docs: add CSS, component-extraction and testability guidance for agents - #88
Merged
Merged
Conversation
moodyjmz
marked this pull request as draft
July 23, 2026 14:40
Adds four rules covering what came up while redoing #79/#83 this session: reuse existing design tokens over hardcoded values, extract components only for genuine multi-site duplication (as its own commit unless the component is new to the feature), prefer @nextcloud/vue over hand-rolled markup, and structure code for testability without extracting solely to reach a test. Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Restructures the previous commit's four new sections plus the existing ones into a tighter set, replacing the "extract only for 2+ call sites" rule with a naming-based test — validateFilename in this repo is a legitimate single-call-site extraction that the old call-site-count rule would have wrongly discouraged. Also fixes a real gap found in review: the pre-PR checklist was missing npm run stylelint, a separate CI gate from npm run lint. Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Consolidates the reuse and extraction sections down to their essential positive rules (name the responsibility; use the design token or don't invent one) and drops persuasion aimed at a reader who isn't there. Corrects the var() fallback claim to match the actual CSS spec behaviour (guaranteed-invalid -> inherited/initial, not cascade fallback), restores that the bot commits assets (not just compiles them) and notes /compile needs a human to type it, and adds the "name needs an 'and'" check as a mechanical extraction test. Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
The stale-base warning claimed DCO failures that base staleness cannot cause, and implied "Check build changes" fails only on stale bases when it fails on any uncompiled src change by design — replace it with the actual mechanism (CI builds the merge ref, so a moved main makes compiled assets drift again). State the conventional-commit headline format CI enforces on every commit, restore the reviewability rationale for atomic commits, rename the commit section to a single concern, note /compile requires a maintainer, and add the composer gates (lint, cs:check, psalm, openapi) that the JS-only pre-PR checklist omitted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
The app's roadmap is token-authenticated document serving, where a widened TTL or a casually added #[NoCSRFRequired] is an authentication change, not a fix. Require reviewable justification for loosening any check, ban secrets and file paths from logs, and close the baseline escape hatch for psalm findings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Enterprise deployments audit accessibility, so regressions block releases rather than queueing as polish. State the floor: accessible names on interactive elements, no colour-only state, keyboard reachability with visible focus — and note that @nextcloud/vue components ship these semantics already, reinforcing reuse. The current eslint config carries no accessibility rules, so the section says plainly that the check is manual rather than pointing at a gate that does not exist. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Anything that grows with a user's file count gets capped or paginated, component-registered listeners and timers are released in onUnmounted (TemplateSection.vue is the in-repo shape), file contents stream rather than load whole since office documents have no upper size, and new dependencies justify their bundle cost. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
The repo pairs every unit in src/utils/ and src/components/ with a .spec.ts sibling, but the guidance only asked for testable structure, not tests. State the requirement as a completion criterion under commit discipline — inside the separation-of-concerns section it would read as a tax on the extraction that section argues for. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
A rule an agent can satisfy by articulating a plausible reason is a rule an agent will self-certify past — the security-attribute and bundle-cost judgements are exactly where that happens, not just the extraction seams. Name those triggers and generalize to any call a reviewer could reasonably contest. Unattended, the fallback is the narrower, easier-to-reverse option rather than "leave it", which an agent would treat as inapplicable when the contested change blocks the feature; the PR-description flag applies either way, since an agent cannot reliably tell whether it is unattended. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
The spec-sibling rule above only covers new units. It doesn't say anything about changing what an existing tested function returns or accepts, which is a different failure mode: the specs already exist, they just go stale silently until someone runs test:unit. That gap is what let #100 change getAllOfficeFiles's return shape while leaving two existing spec files asserting the old one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Neither of the two testing rules just added stops the failure mode where a red test gets skipped, deleted, or de-fanged (a dulled matcher, a dropped case) instead of the underlying code getting fixed — the PR still goes green, the bug just loses its test coverage along the way. State it as its own rule so a genuine behavior-change update to an expectation isn't confused with silencing one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
The JS checklist runs test:unit; the PHP one didn't, despite composer.json defining the same script. A branch about tightening test discipline shouldn't skip reminding PHP changes to run their own tests before opening a PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
The two existing testing rules cover a new unit and a changed signature, but not the most common shape a bug fix takes: same signature, corrected behavior. That gap is exactly what PR #85's own regression test closed (newest-first cap) and what the DAV orderby/limit fix in #100 needed independent of its return-shape change — the doc's rules shouldn't cover the shapes that made this branch's own examples but miss the shape most bug fixes actually are. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
The red-test rule only recognized two causes: the code is wrong, or behavior changed on purpose. That left no legitimate path for a test that was simply wrong to begin with (asserting on a mock, flaky), which would either force fixing code that isn't broken or invite a dishonest "behavior changed" justification to stay compliant. Add the third case, gated the same way as the others — justify it in the commit — and route it through the existing contestable-call rule rather than leaving it as a unilateral judgment call. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
moodyjmz
force-pushed
the
docs/agents-component-css-testing-guidance
branch
from
August 10, 2026 08:17
d6d271e to
d95e231
Compare
moodyjmz
marked this pull request as ready for review
August 10, 2026 08:18
Aiiaiiio
approved these changes
Aug 10, 2026
Aiiaiiio
left a comment
There was a problem hiding this comment.
Very detailed. I believe a lot of this came from experience :) Starting to be useful for humans as well.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #84. Adds four rules to
AGENTS.mdcovering what came up while redoing #79 and #83 this session:src/usage before hardcoding, and never invent avar()that isn't defined anywhere.@nextcloud/vue/componentsbefore writing raw HTML/CSS.This draft went through an internal adversarial review pass before being finalized — it caught and fixed a contradiction with the atomic-commits rule, a too-loose "two call sites" abstraction threshold, a missing test-induced-extraction caveat, and a fragile/unguarded CSS-token-lookup instruction. All four are addressed in the wording above.
Test plan