Repository navigation
docs(admin-ui): four stale component references, and no guard that would catch them - #867
Conversation
…e rule
`RulesEditor` is named three times and exists nowhere: `find src -iname
'*rule*'` returns nothing, and the only hits for the name in the tree are
these three lines. Two of them sit in the file's highest-traffic paragraphs
for anyone building a field component, surrounded by real names, so they read
as verified.
- The wrapper-pattern list loses it for **RangeSlider**, whose own `min`/`max`
defaults differ from a number field's — the default-value pitfall the
paragraph above it teaches. **SelectDescription** leaves the same list: it is
one 49-line `FieldDescriptionClientComponent` calling `useField` itself, with
no PayloadCMS-free half, so it cannot show the split. Every name left is a
folder holding `<Name>.tsx` beside `<Name>Field.tsx`, and the sentence now
says so.
- The `admin.custom` key list loses `ruleDefinitions` for `columns`, which
`LogTable` reads. `size` is `'default' | 'large'`, not `'small' | 'large'`.
- The `toWords` example is `LogTable`'s `column.label ?? toWords(column.key)`.
It also states the caveat `src/fields/translationsField.ts` carries:
`toWords('a11y')` is "A11y", so the helper is not unconditional.
Two paths were wrong because the component grew a folder and a barrel while
the doc kept the flat spelling. `RelationshipCountCell.tsx` is now
`RelationshipCountCell/RelationshipCountCell.tsx`. The component tree's
"standalone, single file" example was `ProjectSelector.tsx`, a folder of three
files — the one rule that tree teaches, demonstrated with a counterexample.
`SelectDescription.tsx` really is one file, and the paragraph above freed it.
`docs/code-style.md`'s discriminated-union example cited `ViewerItem` in
`src/endpoints/lecturesForViewer.ts`. Neither exists. `AtlasRouteTarget`
(`src/endpoints/atlas/seo/atlasRoute.ts`) is a real one, discriminating on
`kind`.
Refs #862
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0186yFx1JPGhLZP5Nzu7gn3y
The list said "a folder holding `<Name>.tsx` beside `<Name>Field.tsx`", which reads as a folder named `<Name>`. Two of the four are `ToggleGroupField/` and `TableOfContentsField/`, so a reader looking for `src/components/admin/ToggleGroup/` finds nothing — a fresh stale path in the commit that removes them. The RangeSlider gloss also claimed its own `min`/`max` defaults differ from a number field's, cited under the default-value pitfall. It is the reverse: `RangeSlider.tsx` requires both props and defaults neither, while `RangeSliderField.tsx` supplies `?? 0` and `?? 10`. Payload's number field has no min/max default to align with, so the example illustrated the opposite of the rule above it. Refs #862 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0186yFx1JPGhLZP5Nzu7gn3y
|
🚅 Deployed to the SahajCloud-pr-867 environment in sahajcloud
1 service not affected by this PR
|
|
Phase 2 stays held. It unblocks when #866 merges. Re-measured on this branch against So phase 2 is one session's work once #866 lands. Writing it now lands a red spec, and the only way to get it green early is allowlisting Two scanner details the measurement turned up, for whoever writes it:
Phase 1 is green and merges cleanly on 6ad5fdd. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Phase 2 of 2 did not advance in the last session, so I have stopped continuing this PR. Comment here and I will pick it up again. 🤖 sydevs dispatcher |
|
@sydevs-bot continue this PR |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
|
Phase 2 stays held. #866 unblocks it, it is green and mergeable, and it waits on your merge. I re-measured against current So writing the guard today lands a red spec. #862's "Ordering" rules out the one early fix: allowlisting Phase 1 still holds on current Merge #866, then comment here again. The next session writes phase 2 in one pass. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…nothing #862's phase 1 corrected four stale references by hand. This is the scanner that would have caught them, with the fixture proving it is not vacuous. Three scope rules, each measured against this repo rather than chosen. A fenced block writes a path as a sample argument or a code comment, and a `://` run makes the path the tail of an upstream URL — both cite somebody else's tree. Symlinks are dropped by git mode, because every `CLAUDE.md` is a symlink to the `AGENTS.md` beside it and reading both reports every finding twice. The citation pattern is `\.tsx?`. Written `\.(ts|tsx)` the alternation stops at `ts`, which both truncates the row and reports live `.tsx` components as missing — the fixture pins a case that fails either way round. The assertion over the live tree is phase 2b, not an omission. It reports one row today, `docs/rules/storage.md:169` citing the pipeline #88 deleted, which is #864 and is fixed by the open #866. Landing the assertion now lands a red spec, and the only early alternative is allowlisting `storage.md` — the one outcome that would make the guard worthless. Refs #862 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DZJmVZdzC4UJtcZvxzbJMS
The paragraph teaches separating a "stateless, PayloadCMS-free pure UI component" from a field wrapper, then offered `ToggleGroupField/` as one of four examples. `ToggleGroup.tsx:3` imports `Button` from `@payloadcms/ui`, so it is the one name in the list that cannot show the split it illustrates — the same defect as the stale names this branch removes, one commit later. The three that remain import nothing from Payload. `TranslationsRow/` is not a replacement for the same reason. Refs #862 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DZJmVZdzC4UJtcZvxzbJMS
…oups #866 landed the `docs/rules/storage.md` rewrite, so the one citation that did not resolve is gone and the guard can assert over the real tree rather than the fixture alone. It reports nothing today, and the ticket's own check — appending a `RulesEditor.tsx` citation to `docs/rules/admin-ui.md` — turns it red on that line. Parentheses join the citation class, for Next.js route groups. Without them `src/app/(payload)/api/openapi.json/route.ts` and the Cloudflare Stream webhook handler matched nothing at all, so a whole route tree was cited and never checked. A glob keeps its `*` out of the class and so still matches nothing, which is what we want of a pattern rather than a path. One `git ls-files` per scan instead of two: `inScopeDocs` now takes the map its caller already holds, which also rules out two disagreeing snapshots of one index. Refs #862 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DZJmVZdzC4UJtcZvxzbJMS
|
Phase 2 is done. #866 merged at 13:45Z, so the guard asserts over the live tree and reports nothing. The review pass found three defects in this branch's own work, all fixed:
Every rule is mutation-tested. The ticket's own check — citing Three follow-ups I did not fix, each past the ticket's scope. Tell me to file them:
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff matches #862 phase for phase and carries nothing the ticket did not ask for. Every newly cited path resolves on the branch, the three named wrapper folders import nothing from Payload, and LogTable.tsx:123 with TagSelector.tsx:21,80,86 back the rewritten admin.custom list.
Shape question: the guard is anchored on src/, so docs/rules/admin-ui.md:291 — the file this PR repairs — keeps a citation to a test that does not exist.
Findings
- should-fix —
doc-citations.spec.ts:25: the anchor leaves four broken citations unseen, one in this PR's own file. - consider —
doc-citations.spec.ts:78: the://skip changes no row, measured.
What was checked. #862, the PR body, git diff origin/main...37a5b02, both docs and the spec read whole. git cat-file -e on the newly cited paths, and the imports of the three wrapper folders. I re-ran the spec's own logic over the 36 in-scope docs twice: anchor widened to src|tests|scripts|seeds (four rows), then with the :// skip also removed (same four).
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`tests/int/frameFiltering.int.spec.ts` was named at :291 and resolves to nothing. `tests/int/frames-by-narrator.int.spec.ts` is the live spec, and it covers the auth gate, gender-matched results and sort order — not the category and pagination the old parenthetical claimed. No test in the repo covers those. The guard added here is anchored on `src/`, so it cannot see this line. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UFkxXyqxNzbXKbxi8wraj5
|
Both critic threads answered. One commit: Adopted — the anchor thread, in part. Rebutted — the anchor stays Rebutted — the Both threads stay open for you. Lean gate green: lint, both typechecks, 2245 unit tests. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
All seven smoke specs 401 on `POST /api/managers/login`. The two sides of the preview credential read different addresses: `seedPreviewAdmin` provisions `PREVIEW_ADMIN_EMAIL ?? [email protected]` from the Railway environment, while the smoke step was given only `PREVIEW_ADMIN_PASSWORD`, so the specs always tried the default. #861 set `PREVIEW_ADMIN_EMAIL` on the environments previews fork from, ahead of its own merge, so every preview forked since provisions an address the lane cannot name. #867 stays green because its environment forked earlier. Not caused by this PR's diff, but fixed here because CI cannot go green otherwise, and every new PR hits it. The `??` in the spec helper had to go with it: an unset repository secret reaches the step as an empty string, which is not nullish, so the obvious half of this fix would have swapped a wrong address for an empty one. With `||`, an unset secret leaves today's behaviour exactly as it is. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B81CgCRVa81rHRDgTZdsbC
Summary
docs/rules/admin-ui.mdnamedRulesEditorthree times. It exists nowhere in the repo.src/…path that resolves to no tracked file.Phases
docs/rules/admin-ui.mdanddocs/code-style.mdsrc/…pathPhase 2 was held for two sessions because
docs/rules/storage.mdcited the deleted pipeline that is #864. #866 merged at 13:45Z today, so the guard now asserts over the live tree and reports nothing.Changes
docs/rules/admin-ui.md— seven sites: the tree's standalone example, the join-field cell reference, the wrapper-pattern list, theadmin.customkey list, thetoWordsexample,ToggleGroupField/leaving the list (below), and the frame-spec citation at:291.docs/code-style.md—ViewerItem→AtlasRouteTarget.tests/unit/doc-citations.spec.ts— the guard, its fixture, and the live-tree assertion.Preview
Documentation and one spec — the diff touches no runtime surface, so there is nothing in the PR preview to open.
Test results
.claude/skills/pr-prep/check.sh— lint, typecheck (src), typecheck (tests), 2245 unit tests in 167 filestests/unit/doc-citations.spec.ts— 3 passedManual verification
git grep -nE 'RulesEditor|RuleDefinition|ruleDefinitions'prints nothing.git grep -n ViewerItemprints nothing.See src/components/admin/RulesEditor.tsx.todocs/rules/admin-ui.md, runpnpm test:unit, watch it go red on that line, then revert.Notes for reviewer
Three defects the review pass found in this branch's own work, all fixed here. Each is the failure class the PR exists to correct:
ToggleGroupField/was not a valid example. The paragraph teaches separating a "stateless, PayloadCMS-free pure UI component", andToggleGroup.tsx:3importsButtonfrom@payloadcms/ui. It leaves the list in79e4fe4; the three that remain import nothing from Payload.TranslationsRow/is not a substitute, for the same reason.()in its character class,src/app/(payload)/api/openapi.json/route.tsand the Cloudflare Stream webhook handler matched nothing, so a whole route tree was cited and unchecked. A glob still matches nothing, since its*stays out of the class.git ls-filesran twice per scan.inScopeDocsnow takes the map its caller holds, which also rules out two disagreeing snapshots of one index.Three follow-ups I tripped over and did not fix here, because each widens the PR past the ticket's stated scope. Happy to file them — say the word:
tests/…citations indocs/rules/are still broken (api-clients.md:352,354,openapi.md:149).admin-ui.md:291is fixed here, since it sits in the file this PR repairs. The ticket scopes the guard tosrc/…paths, so it sees none of them. Widening the anchor is not free:openapi.md:149namestests/int/api-explorer.int.spec.tsprecisely to record that the chore(tests): audit suite — redundancy, gaps, and hook/CI tier alignment #434 audit deleted it, so a widened guard goes red on a correct line, and suppressing that row needs the allowlist the ticket forbids.api-clients.md:354has no e2e spec to repoint to either — that bullet wants deleting, not correcting.src/…citations insrc/types/AGENTS.md:185,188,204are broken and sit inside fenced blocks, which the ticket classified as out of scope. They are// <path>header comments presenting this repo's own convention, so the classification is arguably wrong — but dropping the fence rule turns the guard red on three lines this PR would then have to rewrite..claude/hooks/unit-test.mjsgates the Tier-1 lane onsrc/**andtests/unit/**, so editing a.md— the only act that can break a citation — fires nothing. Adding.mdto that matcher closes the loop at ~1.5s cost.Detail
Every rule in the guard was mutation-tested, since a green new assertion proves nothing. Each of these turns the spec red, and the first is the ticket's own verification step:
RulesEditor.tsxinadmin-ui.md\.(ts|tsx)instead of\.tsx?.tsxrow truncatedCLAUDE.mdsrc/types/AGENTS.md:185,188,204://skipThe
://exclusion is prophylactic, not measured. The ticket measured it across all tracked markdown, where the offending URL sat in a vendored file. Inside the final scope there are zero live instances, and zero again with the anchor widened tosrc|tests|scripts|seeds. It is kept becausedocs/rules/code-comments.md:18blesses a permalink as a breadcrumb, so the zero is a property of today's corpus rather than of the rule. Only the fixture exercises it, and the docblock no longer claims otherwise.admin-ui.md:291citedtests/int/frameFiltering.int.spec.ts, which resolves to nothing. The live spec istests/int/frames-by-narrator.int.spec.ts, and it covers theframesByNarratorauth gate, gender-matched results and sort order. The old parenthetical also claimed category and pagination coverage; no spec in the repo has either.Scope, re-measured on this branch against
mainat 53e4569. 36 files in scope, 82 distinctsrc/…citations, none unresolvable. Phase 1 fixed two of the three that main carried; #866 fixed the third.tests/unit/conflict-markers.spec.tsis the template — the only other spec that reads repo markdown, shelling out to git and self-testing against a real temp-dir repo rather than live content.Dismissed: extracting
trackedFiles()intotests/utils/.conflict-markers.spec.tsusesgit grep, notgit ls-files, so there is no second caller — extraction would create a helper rather than reuse one.No security review.
securityReview.triggerPatternfrom.claude/workflow.jsonmatches no file in the diff.comment-lint.mjs --base origin/mainis clean.Closes #862
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_01UFkxXyqxNzbXKbxi8wraj5