Skip to content

docs(admin-ui): four stale component references, and no guard that would catch them - #867

Merged
sydevs-bot merged 7 commits into
mainfrom
claude/docs-862-admin-ui-citations
Oct 1, 2026
Merged

sydevs-bot merged 7 commits into
mainfrom
claude/docs-862-admin-ui-citations

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • docs/rules/admin-ui.md named RulesEditor three times. It exists nowhere in the repo.
  • Two cited paths were the flat spelling of a component that has since grown a folder and a barrel, and the tree's "standalone, single file" example was a folder of three files.
  • A spec now fails when any doc in scope cites an src/… path that resolves to no tracked file.

Phases

  • Phase 1 — correct the citations in docs/rules/admin-ui.md and docs/code-style.md
  • Phase 2 — the spec that fails when a doc in scope cites an unresolvable src/… path

Phase 2 was held for two sessions because docs/rules/storage.md cited 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, the admin.custom key list, the toWords example, 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

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh — lint, typecheck (src), typecheck (tests), 2245 unit tests in 167 files
  • Targeted specs: tests/unit/doc-citations.spec.ts — 3 passed
  • Build: N/A

Manual verification

  1. git grep -nE 'RulesEditor|RuleDefinition|ruleDefinitions' prints nothing.
  2. git grep -n ViewerItem prints nothing.
  3. The guard fails on a real break. Append See src/components/admin/RulesEditor.tsx. to docs/rules/admin-ui.md, run pnpm 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", and ToggleGroup.tsx:3 imports Button from @payloadcms/ui. It leaves the list in 79e4fe4; the three that remain import nothing from Payload. TranslationsRow/ is not a substitute, for the same reason.
  • The citation pattern could not see a Next.js route group. Without () in its character class, src/app/(payload)/api/openapi.json/route.ts and 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-files ran twice per scan. inScopeDocs now 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:

  • Three tests/… citations in docs/rules/ are still broken (api-clients.md:352,354, openapi.md:149). admin-ui.md:291 is fixed here, since it sits in the file this PR repairs. The ticket scopes the guard to src/… paths, so it sees none of them. Widening the anchor is not free: openapi.md:149 names tests/int/api-explorer.int.spec.ts precisely 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:354 has no e2e spec to repoint to either — that bullet wants deleting, not correcting.
  • Three src/… citations in src/types/AGENTS.md:185,188,204 are 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.mjs gates the Tier-1 lane on src/** and tests/unit/**, so editing a .md — the only act that can break a citation — fires nothing. Adding .md to 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:

Mutation What goes red
Cite RulesEditor.tsx in admin-ui.md the live-tree row
\.(ts|tsx) instead of \.tsx? 8 live components reported missing, and every .tsx row truncated
No symlink-by-mode skip every finding reported twice, once per CLAUDE.md
No fenced-block skip src/types/AGENTS.md:185,188,204
No :// skip the upstream URL's tail
No scope filter Payload's own vendored docs

The :// 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 to src|tests|scripts|seeds. It is kept because docs/rules/code-comments.md:18 blesses 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:291 cited tests/int/frameFiltering.int.spec.ts, which resolves to nothing. The live spec is tests/int/frames-by-narrator.int.spec.ts, and it covers the framesByNarrator auth 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 main at 53e4569. 36 files in scope, 82 distinct src/… citations, none unresolvable. Phase 1 fixed two of the three that main carried; #866 fixed the third.

tests/unit/conflict-markers.spec.ts is 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() into tests/utils/. conflict-markers.spec.ts uses git grep, not git ls-files, so there is no second caller — extraction would create a helper rather than reuse one.

No security review. securityReview.triggerPattern from .claude/workflow.json matches no file in the diff. comment-lint.mjs --base origin/main is clean.

Closes #862

🤖 Written by the sydevs autonomous loop — see what this is

🤖 Generated with Claude Code

https://claude.ai/code/session_01UFkxXyqxNzbXKbxi8wraj5

…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
@railway-app

railway-app Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-867 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Sep 29, 2026 at 7:47 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Phase 2 stays held. It unblocks when #866 merges.

Re-measured on this branch against main at 6ad5fdd. In the guard's scope — tracked docs/**/*.md, root *.md, nested AGENTS.md — 85 distinct src/… paths are cited and exactly one does not resolve: docs/rules/storage.md:169. That one is #864's, and #866 fixes it. #866 is ready and awaiting review.

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 storage.md, which the ticket rules out.

Two scanner details the measurement turned up, for whoever writes it:

  • Match \.tsx?, not (ts|tsx). The alternation stops at ts and drops the x. That reported four live components as missing.
  • Skip symlinks by git mode. Every CLAUDE.md is a symlink to its AGENTS.md, so scanning both double-reports every finding.

Phase 1 is green and merges cleanly on 6ad5fdd.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

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

@Ardnived

Copy link
Copy Markdown
Contributor

@sydevs-bot continue this PR

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 29, 2026
@sydevs-bot

sydevs-bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 19:35Z address-review · attempt 1 · session · done
  • 19:35Z address-review · attempt 1 · session
  • 19:33Z adversarial-review · attempt 2 · session · done
  • 19:33Z adversarial-review · attempt 2 · session
  • 14:14Z adversarial-review · attempt 1 · session · timed out

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Phase 2 stays held. #866 unblocks it, it is green and mergeable, and it waits on your merge.

I re-measured against current main (e24889e), not this PR's base. In the guard's scope — tracked docs/**/*.md, root *.md, nested AGENTS.md, fenced blocks skipped, symlinks skipped — 36 files are in scope and exactly one citation does not resolve: docs/rules/storage.md:169 → src/lib/videoThumbnailUtils.ts. That line is #866's.

So writing the guard today lands a red spec. #862's "Ordering" rules out the one early fix: allowlisting storage.md is what makes a new guard worthless.

Phase 1 still holds on current main too. #863 deleted AnalyticsNavLink.tsx, and no doc in scope cites it.

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

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 29, 2026
…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
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

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:

  • ToggleGroupField/ was listed as a "PayloadCMS-free pure UI" example. ToggleGroup.tsx:3 imports Button from @payloadcms/ui.
  • The citation pattern could not see a Next.js route group, so src/app/(payload)/api/** was cited and never checked.
  • git ls-files ran twice per scan.

Every rule is mutation-tested. The ticket's own check — citing RulesEditor.tsx in admin-ui.md — turns it red.

Three follow-ups I did not fix, each past the ticket's scope. Tell me to file them:

  • Four tests/… citations in docs/rules/ are broken. The guard is scoped to src/…, so it cannot see them.
  • Three src/… citations in src/types/AGENTS.md are broken inside fenced blocks, which the ticket excluded.
  • The Tier-1 hook does not fire on a .md edit, the only act that can break a citation.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-867 September 29, 2026 14:09 Destroyed
@sydevs-bot sydevs-bot added awaiting bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 29, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 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

Comment thread tests/unit/doc-citations.spec.ts Resolved
Comment thread tests/unit/doc-citations.spec.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 29, 2026
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 29, 2026
`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
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-867 September 29, 2026 19:41 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Both critic threads answered. One commit: ec5280d.

Adopted — the anchor thread, in part. admin-ui.md:291 cited tests/int/frameFiltering.int.spec.ts, which resolves to nothing. It now cites tests/int/frames-by-narrator.int.spec.ts, and the parenthetical drops the category and pagination coverage no spec has.

Rebutted — the anchor stays src/. Widening it surfaces a fourth row that is no defect: openapi.md:149 names tests/int/api-explorer.int.spec.ts to record that the #434 audit deleted it. Suppressing a correct line needs the allowlist #862 forbids.

Rebutted — the :// thread. Zero live instances, widened or not. But docs/rules/code-comments.md:18 blesses a permalink as a breadcrumb, so the zero describes today's corpus, not the rule.

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

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 29, 2026
sydevs-bot added a commit that referenced this pull request Sep 29, 2026
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
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 29, 2026 19:55
@sydevs-bot
sydevs-bot requested a review from Ardnived September 29, 2026 19:55
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit f720792 Oct 1, 2026
56 of 57 checks passed
@sydevs-bot
sydevs-bot deleted the claude/docs-862-admin-ui-citations branch October 1, 2026 17:02

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-867 — ec5280d9 Deployed Sep 29, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

docs(admin-ui): four stale component references, and no guard that would catch them

3 participants