Repository navigation
docs(claude): link tests/AGENTS.md, and correct what pnpm test covers - #699
Conversation
`AGENTS.md`'s Project Structure listed `tests/{int,e2e,utils}/`. The real
set is `tests/{unit,int,e2e,files,setup,utils}/`. The omission that mattered
is `tests/unit/`: it is the Tier-1 lane the same file recommends at line 49
and `docs/rules/testing-reqs.md` puts first, holding 120 of the repo's specs.
A reader following the layout sentence would not know where a unit spec goes.
The command list also called `pnpm test` "the full suite". It is
`test:unit && test:int` and never runs the smoke lane, which the next line
lists separately and CI runs as its own step. "Full" invited the reading
that `pnpm test` covers everything.
Ticket #683 also reported `pnpm test:e2e` in the command list. The prose
reset in #696 removed it before this change, so nothing here does. The
remaining contradiction with `tests/AGENTS.md:425` is gone with it, and
every `pnpm` command AGENTS.md names now resolves in `package.json`.
Closes #683
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TeQ6RP2Bop3arGF1jWAfTP
`README.md` carried the same stale `tests/{int,e2e,utils}/` list. Left
alone it would contradict the sentence this branch just corrected, which
is the state the ticket was filed about.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TeQ6RP2Bop3arGF1jWAfTP
|
🚅 Deployed to the SahajCloud-pr-699 environment in sahajcloud
1 service not affected by this PR
|
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Three lines, every claim re-derived and true. ls -d tests/*/ returns exactly the six directories now listed; pnpm test is test:unit && test:int; docs/rules/testing-reqs.md:67 already called it "Tier 3 first half", so the corrected line ends a contradiction rather than opening one. Fixing README.md in the same push is right — identical stale sentence. #683's headline defect really was already gone at the base commit (#696), as the body says.
One shape question, not a correctness one: tests/AGENTS.md owns this layout and the root guide has never linked it. #683 happened because the root guide kept its own copy and drifted; this PR corrects the copy and adds a per-directory gloss on top. See the AGENTS.md:119 thread.
Findings
should-fix—AGENTS.md:119sends the reader tosrc/AGENTS.mdfor atests/layout it does not document, while the guide that does is unlinked.consider—README.md:76makes the enumeration a third copy.
What was checked — ls -d tests/*/ plus the contents of all six; package.json scripts; every pnpm <token> in AGENTS.md set-differenced against them (only the generate: / seed: / test: glob shorthand missing, as the body claims); tests/AGENTS.md 24–26 and 372–425; docs/rules/testing-reqs.md 21–69; README.md 55–78; git log -S test:e2e -- AGENTS.md; ls -l CLAUDE.md (symlink intact). All four of #683's verification checks pass on this branch.
Adjacent, outside this diff: docs/rules/testing-reqs.md:69 calls the smoke target a "CF PR preview" — it is Railway here. Same class of stale doc, for whatever files it next.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The review thread on `AGENTS.md:119` is right about the root cause. #683 happened because the root guide kept its own copy of the tests layout and drifted from it. Correcting the copy and glossing each directory leaves the same drift surface, one entry wider. The sentence also sent the reader to `src/AGENTS.md` "for the layout" while naming the tests tree, and that guide documents `src/` only. Both guides are now named for what each actually covers. `README.md` carried the same list, so it gets the same treatment. This changes how #683's third verification check reads: the documented directory set no longer exists to compare against `ls -d tests/*/`. That is the point — not stating the set is the durable form of not misstating it. Flagged in the PR body for the reviewer. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01A6p13bPyPaiysoorzsPDcK
pnpm test coverspnpm test covers
|
Both review threads adopted and resolved, pushed as The root guide no longer enumerates the tests tree. It links One decision needs your eye. #683 asked that the documented directory set match Lean gate green. CI re-runs on this push. Still needs your approving review to merge. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Review of #703 found the `reads === 0` exit too blunt. It fired on any cause, including a transient statuses-API incident that outlasted the 12-minute deadline — turning every open PR red, clearable only by a full re-run — and it spent the whole budget before saying so. #661 resolved that the fail-open is correct for a PR with genuinely no preview, and scoped exactly one new hard failure. `fetchStatuses` collapsed every non-ok response into one opaque Error, so the loop could not tell a permanent 401/403 from a retryable 502. It now throws StatusFetchError carrying `res.status`, and discovery returns a `forbidden` outcome on the first 401/403 — terminal, like `unpublished`, because GitHub will not relent inside one run. That keeps the property worth keeping (never having looked is not evidence of absence) and drops both the transient trigger and the 12-minute cost. A budget spent entirely on transient errors now warns and skips instead of failing. The remaining causes are the ones that clear on their own. Also from review: the OTHER fixture used `mailpit - Mailpit`, a context Railway never posts. Railway's shape is `<project> - <service>`, so a sibling service is `sahajcloud - Mailpit`. The old fixture asserted against an impossible string; the new one covers the case that can occur, and records that the discrimination rests on `includes` being case-sensitive. And the `unpublished`-is-terminal docstring now records its evidence: settled-state only (#699, #700), bounded by discovery starting about six minutes into the job, so the status it reads is already minutes old. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012noYdvt78W3aLKqJpDpEQY
…#703) * fix(ci): fail closed when a Railway deploy publishes no preview URL Railway can report `success` on a PR deploy while the service has no domain, so the commit-status description reads a bare `Success` with no host after it. Discovery treated that as "not ready yet": neither the success break nor the failure return fired, so it re-read the identical immutable status every 15s for the full 12-minute budget, then exported an empty `preview_url` and exited 0. `ci.yml` gates the smoke step on that value, so the step skipped and the job stayed green. The cost was silent and large. `Lint, Test & Smoke: pass` has meant "unit + integration passed" on every PR for weeks, and three specs — `cors-preflight`, `error-disclosure`, `images` — have never run in CI at all. **A deploy that succeeds without a host is broken configuration, not an absent preview.** PR services inherit a domain only from a base-environment service that has one, so this is terminal on the first poll and re-running changes nothing. Discovery now exits 1 with an `::error` naming the cause and the fix. The genuine skips are untouched and still exit 0: no status within the timeout, a failed or cancelled deploy, or missing env. Returning on the first terminal status also ends the 12-minute wait. A healthy PR now resolves in one poll. `scripts/railway-preview-status.ts` splits the decision out as a pure module — `classifyStatuses` plus `discoverPreview` over injected clock, sleep and fetch — so the unit lane can cover it without network or a direct-run guard on the CI entrypoint. The runner keeps env parsing, the GitHub fetch, the health check and the exit codes. Fixture note: the specs assume Railway posts context `sahajcloud - SahajCloud` with either `Success - <host>.up.railway.app` or a bare `Success`. Verified against the live statuses on #700 (host present) and #699 (bare), not inferred. The new specs were confirmed to fail before they passed: classifying success-with-no-host as `pending` again — the original behaviour, at the line that caused it — turns three of them red. Every exit path was also exercised end to end through `main()` with a stubbed fetch, since a passing unit spec is not evidence that its caller reaches the branch: unpublished exits 1 in ~1s, ready exits 0 with the URL exported, a failed deploy and missing env both exit 0 empty. Docs corrected in the same pass. `playwright.config.ts` and `tests/AGENTS.md` said the URL is "discovered via the Railway API"; it comes from the GitHub commit-status API. `RAILWAY_RUNBOOK.md` claimed PR previews need "no manual per-PR configuration" — the false premise behind this outage — and now states the coupling to production's domain, with the three quiet symptoms. `scripts/AGENTS.md` had no row for either script. Infra step 1 of the ticket was already applied on 2026-09-05: production's `SahajCloud` service has `sahajcloud-production.up.railway.app` on port 8080 beside the custom domain. Closes #661 Claude-Session: https://claude.ai/code/session_01QkaVUYxFsjHJd1aN8hYhVP Co-Authored-By: Claude Opus 5 <[email protected]> * refactor(ci): apply the simplify and review passes to preview discovery Quality pass over the branch, plus two review findings worth fixing. - Never sleep past the deadline. The sleep after the last useful poll gated nothing, and an unclamped one overran the advertised budget by up to a full interval — 15s of dead CI clock on every timing-out run. The new assertion fails without the clamp: a 40s budget reported 45s. - Log the classification (`unpublished`, `pending`) rather than GitHub's raw state. Telling `unpublished` from `success` is the whole point of the change, so the log should say which. Drops the `statusState` helper and its type subtraction, and `state` off `unpublished`, where it is always `success` and so derivable from `kind`. - Make `last` and `elapsedMs` load-bearing instead of test-only: the timeout message now says whether a status ever appeared, or which state it never left. That was the diagnostic the docstring already promised and never delivered. - Trim the duplicated remediation from the `::error` string and its comment. RAILWAY_RUNBOOK.md owns the fix; a copy in a string literal is the one that goes stale while the runbook gets corrected. **A run where every statuses read failed now exits 1 too.** Review found the same silent green as #661 through another door: a revoked `statuses: read` scope makes every poll throw, `last` stays `absent`, and after 12 minutes the run reports "no preview" and exits 0 — indistinguishable from a PR that genuinely has none. `reads`/`errors` on the timeout outcome separate the two, and never having looked is not evidence of absence. A genuinely absent, failed, or still-building preview is untouched and still exits 0. Verified through `main()` with a stubbed fetch and a virtual clock, not just through the unit lane — a passing spec is no evidence that its caller reaches the branch. All reads failing: 48 requests over the full 720s budget, then exit 1. **Not taken.** Review argued that acting on the first `unpublished` is unsound, since a context can post a later status. The premise is right and the docstring overclaimed, so the rationale is corrected in place — but immediate failure is a resolved decision on #661, which named one grace re-poll as the alternative and chose immediate. Also left alone: sharing a `pollUntil` between this loop and `waitHealthy` (pre-existing, unchanged here), and shortening the budget for a never-seen status (#661 keeps the genuine skip paths as they are). Claude-Session: https://claude.ai/code/session_01QkaVUYxFsjHJd1aN8hYhVP Co-Authored-By: Claude Opus 5 <[email protected]> * docs(ci): correct what the preview-discovery step can do to a CI run The workflow comment is the first contract description a CI reader sees, and it still said the step "skips gracefully" with no mention that it can now fail the job — so someone debugging a red `Discover Railway preview URL` would read an adjacent comment telling them that step does not fail. `RAILWAY_RUNBOOK.md`'s CI section asserted the superseded rule five lines above the new section correcting it. Folded the correction into the paragraph it supersedes, rather than leaving a reader to hit the old contract first and the amendment second. The skip warning claimed "This PR has no preview environment", which is only one of the three cases that reach it — a failed deploy and one still building at the deadline also skip. It now points at the discovery step's own log instead of guessing. `scripts/AGENTS.md` records both non-zero exits. Claude-Session: https://claude.ai/code/session_01QkaVUYxFsjHJd1aN8hYhVP Co-Authored-By: Claude Opus 5 <[email protected]> * fix(ci): fail fast on a refused statuses read, not on every failed one Review of #703 found the `reads === 0` exit too blunt. It fired on any cause, including a transient statuses-API incident that outlasted the 12-minute deadline — turning every open PR red, clearable only by a full re-run — and it spent the whole budget before saying so. #661 resolved that the fail-open is correct for a PR with genuinely no preview, and scoped exactly one new hard failure. `fetchStatuses` collapsed every non-ok response into one opaque Error, so the loop could not tell a permanent 401/403 from a retryable 502. It now throws StatusFetchError carrying `res.status`, and discovery returns a `forbidden` outcome on the first 401/403 — terminal, like `unpublished`, because GitHub will not relent inside one run. That keeps the property worth keeping (never having looked is not evidence of absence) and drops both the transient trigger and the 12-minute cost. A budget spent entirely on transient errors now warns and skips instead of failing. The remaining causes are the ones that clear on their own. Also from review: the OTHER fixture used `mailpit - Mailpit`, a context Railway never posts. Railway's shape is `<project> - <service>`, so a sibling service is `sahajcloud - Mailpit`. The old fixture asserted against an impossible string; the new one covers the case that can occur, and records that the discrimination rests on `includes` being case-sensitive. And the `unpublished`-is-terminal docstring now records its evidence: settled-state only (#699, #700), bounded by discovery starting about six minutes into the job, so the status it reads is already minutes old. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012noYdvt78W3aLKqJpDpEQY * docs(ci): correct what discovery does when a statuses read fails The scripts guide still described the blanket `reads === 0` failure. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012noYdvt78W3aLKqJpDpEQY --------- Co-authored-by: Claude <[email protected]>
Railway can report `success` on a PR deploy while the service has no domain, so the commit-status description reads a bare `Success` with no host after it. Discovery treated that as "not ready yet": neither the success break nor the failure return fired, so it re-read the identical immutable status every 15s for the full 12-minute budget, then exported an empty `preview_url` and exited 0. `ci.yml` gates the smoke step on that value, so the step skipped and the job stayed green. The cost was silent and large. `Lint, Test & Smoke: pass` has meant "unit + integration passed" on every PR for weeks, and three specs — `cors-preflight`, `error-disclosure`, `images` — have never run in CI at all. **A deploy that succeeds without a host is broken configuration, not an absent preview.** PR services inherit a domain only from a base-environment service that has one, so this is terminal on the first poll and re-running changes nothing. Discovery now exits 1 with an `::error` naming the cause and the fix. The genuine skips are untouched and still exit 0: no status within the timeout, a failed or cancelled deploy, or missing env. Returning on the first terminal status also ends the 12-minute wait. A healthy PR now resolves in one poll. `scripts/railway-preview-status.ts` splits the decision out as a pure module — `classifyStatuses` plus `discoverPreview` over injected clock, sleep and fetch — so the unit lane can cover it without network or a direct-run guard on the CI entrypoint. The runner keeps env parsing, the GitHub fetch, the health check and the exit codes. Fixture note: the specs assume Railway posts context `sahajcloud - SahajCloud` with either `Success - <host>.up.railway.app` or a bare `Success`. Verified against the live statuses on #700 (host present) and #699 (bare), not inferred. The new specs were confirmed to fail before they passed: classifying success-with-no-host as `pending` again — the original behaviour, at the line that caused it — turns three of them red. Every exit path was also exercised end to end through `main()` with a stubbed fetch, since a passing unit spec is not evidence that its caller reaches the branch: unpublished exits 1 in ~1s, ready exits 0 with the URL exported, a failed deploy and missing env both exit 0 empty. Docs corrected in the same pass. `playwright.config.ts` and `tests/AGENTS.md` said the URL is "discovered via the Railway API"; it comes from the GitHub commit-status API. `RAILWAY_RUNBOOK.md` claimed PR previews need "no manual per-PR configuration" — the false premise behind this outage — and now states the coupling to production's domain, with the three quiet symptoms. `scripts/AGENTS.md` had no row for either script. Infra step 1 of the ticket was already applied on 2026-09-05: production's `SahajCloud` service has `sahajcloud-production.up.railway.app` on port 8080 beside the custom domain. Closes #661 Claude-Session: https://claude.ai/code/session_01QkaVUYxFsjHJd1aN8hYhVP Co-Authored-By: Claude Opus 5 <[email protected]>
Review of #703 found the `reads === 0` exit too blunt. It fired on any cause, including a transient statuses-API incident that outlasted the 12-minute deadline — turning every open PR red, clearable only by a full re-run — and it spent the whole budget before saying so. #661 resolved that the fail-open is correct for a PR with genuinely no preview, and scoped exactly one new hard failure. `fetchStatuses` collapsed every non-ok response into one opaque Error, so the loop could not tell a permanent 401/403 from a retryable 502. It now throws StatusFetchError carrying `res.status`, and discovery returns a `forbidden` outcome on the first 401/403 — terminal, like `unpublished`, because GitHub will not relent inside one run. That keeps the property worth keeping (never having looked is not evidence of absence) and drops both the transient trigger and the 12-minute cost. A budget spent entirely on transient errors now warns and skips instead of failing. The remaining causes are the ones that clear on their own. Also from review: the OTHER fixture used `mailpit - Mailpit`, a context Railway never posts. Railway's shape is `<project> - <service>`, so a sibling service is `sahajcloud - Mailpit`. The old fixture asserted against an impossible string; the new one covers the case that can occur, and records that the discrimination rests on `includes` being case-sensitive. And the `unpublished`-is-terminal docstring now records its evidence: settled-state only (#699, #700), bounded by discovery starting about six minutes into the job, so the status it reads is already minutes old. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012noYdvt78W3aLKqJpDpEQY
Summary
AGENTS.mdlisted the test tree astests/{int,e2e,utils}/. It istests/{unit,int,e2e,files,setup,utils}/, andtests/unit/— the Tier-1 lane, 120 of the repo's 190 spec files — was the omission that mattered.tests/AGENTS.mdowns that tree, and the root guide links it. A copy that cannot drift beats a copy corrected once.pnpm testwas called "the full suite". It istest:unit && test:intand never runs smoke.README.mdcarried the same stale list, so it gets the same treatment in the same push.Changes
AGENTS.md— the Project Structure paragraph, and thepnpm testcommand lineREADME.md— the same Project Structure paragraphPreview
Railway builds it after each push. Not constructing the host by hand.
Test results
pnpm lint,pnpm typecheck,pnpm typecheck:tests,pnpm test:unit(120 files, 1564 tests)83bb02a,Lint, Test & Smoke, 14:28Z). The review push re-runs it.Manual verification
None. The claims are checkable from the diff plus
ls -d tests/*/.Notes for reviewer
ls -d tests/*/". After the review revision there is no documented set left to compare. That is deliberate: docs(claude): AGENTS.md names a pnpm test:e2e that does not exist #683 exists because the root guide kept its own copy of the tests layout and drifted from it, so correcting the copy leaves the same failure available. Say so if you want the enumeration back, and it comes back.974e0c5, whereAGENTS.md:73named apnpm test:e2ethat does not exist. The prose reset in docs: prose reset — STE register, legacy debris removed #696 removed that line. So this PR closes docs(claude): AGENTS.md names a pnpm test:e2e that does not exist #683 on its remaining criteria, and the title has shifted to match what actually changed.pnpm generate:,pnpm seed:andpnpm test:are prose shorthand, not missing scripts. They come frompnpm seed:<script>andtimeout 300 pnpm test:*, and the check below treats them as such rather than reporting three false misses.Detail
Why "the full suite" was worth changing, not just the directory list.
package.jsondefinestestaspnpm run test:unit && pnpm run test:int.docs/rules/testing-reqs.mdputs Tier 3 atlint && typecheck && typecheck:tests && test && test:smoke— two commands, not one. So a reader who ranpnpm testbelieving it was "full" would skip the smoke lane, which is the lane most likely to catch what the other two cannot. The next line already liststest:smokeseparately; "full" contradicted it two lines apart.The review revision (
c3d106d). Two threads, both adopted. The root guide's sentence sent the reader tosrc/AGENTS.md"for the layout" while naming the tests tree, and that guide documentssrc/only — so each guide is now named for what it actually covers, and neither tree is enumerated outside its own guide.README.md:58's command table is untouched: it names commands, not a tree, which is why it never drifted.What was checked, and how. Directory set from
ls -d tests/*/, file counts fromfind:unit120,int70,e2e8 (plus_helpers/),files11 fixtures,setup1 (globalSetup.ts),utils7 helpers. Thepnpmtoken check parsespackage.json'sscriptskeys and set-differences them against everypnpm <token>inAGENTS.md, excluding pnpm built-ins (exec,tsx) and the glob/placeholder forms named above. It reports PASS on this branch.grep test:e2e AGENTS.mdis empty andCLAUDE.mdis still a symlink, so #683's other two checks hold.The contradiction the ticket opened with is gone.
tests/AGENTS.md:425still says "There is nopnpm test:e2escript or local-boot E2E config", andAGENTS.mdno longer disagrees.Pipeline notes.
/simplifyand/pr-review-toolkit:review-pr allwere not run: the toolkit plugin is not installed in this environment, and both passes analyse code quality over a diff that is two prose sentences. The security review was gated off bysecurityReview.triggerPatternin.claude/workflow.json, which the changed paths (AGENTS.md,README.md) do not match. Flagged so the substitutions are visible rather than assumed.Closes #683
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_01A6p13bPyPaiysoorzsPDcK