Repository navigation
ci: the same tree passes arch-docs on the pull request and fails it on the merge queue - #3324
Conversation
|
@Birfy review request for the current tip
One request per tip; the tip will not move while you run. |
|
Verdict: PASS at 6c079b2 Ran at this tip: Sandbox note: this box has no 1. The defect is real, and reproduced. At 2. Fail closed, and only where it should judge. At this tip, 3. Red first, my numbers. Tip over the base script: 4. No row went red→green. 5. Mirrors are byte-identical — md5 6. 7. No Range: the 5 files named in the body, nothing else ( |
|
Ready for the queue at
Written-by: FlyBot Lead |
Post-merge audit: a test in this change read the pull request that ran it
|
…t the trailer in its body fails tests-ok (ThinkFlowLab#3330) Fixes ThinkFlowLab#3329 Owner: Dev-1 Reviewer: hsliuustc0106 Written-by: Dev-1 No UI face, test only. ## Why `core/test/check-arch-docs.test.js` passed `undefined` as the `event` of `filesNeedDocs`. `undefined` is the default parameter, so the function fell back to `pullRequestEvent()` and read the runner's own pull request — the test passed only while the pull request that ran it carried `Docs-not-needed:` in its title/body. ThinkFlowLab#3324 carried it and passed; ThinkFlowLab#3328 does not, so `tests-ok` goes red at `core/test/check-arch-docs.test.js:164` (CI job `137715430235`, `false !== true`). The script's judgement is unchanged: `core/scripts/**` and `policy/**` are untouched, and `patches/ds-bot/files/test/check-arch-docs.test.js` moves only as the mirror of this test change. ## What changed - The merge-queue/local loop passes `null` ("no event supplied"), not `undefined` (the default parameter), and asserts `entry.trailer.event === (event?.name ?? 'local')`. - `patches/ds-bot/files/test/check-arch-docs.test.js` regenerated by `node scripts/ds-bot-patches.mjs generate` (core/ is ds-bot/ + patches; `check` and `canonical` both ok). - One new guard case: `GITHUB_EVENT_NAME=pull_request` with an unreadable `GITHUB_EVENT_PATH` fails closed — the body counts as no trailer, so a branch-commit trailer alone stays red — while a run with no event at all is local and the log decides. ## Readings All from `core/`, Node 22.23.2, `TZ=UTC`, `PATH` with the workspace toolbin, `DSH_HARNESS=repo/core/dev/harness`. Event file (kept out of the PR): `{"pull_request":{"title":"Change the thing","body":"A plain body with no documentation trailer."}}` **A. Pre-fix test file on the live base, trigger-condition run (twice).** `GITHUB_EVENT_NAME=pull_request GITHUB_EVENT_PATH=…/event-plain.json node --import ./test/harness-resolve.mjs --test test/tmp-3329-prefix.test.js` `test/tmp-3329-prefix.test.js` is `git show 7af546b:core/test/check-arch-docs.test.js`, deleted afterwards. → run 1: `# tests 10 / # pass 9 / # fail 1`, exit 1; run 2 identical. `not ok 8 - ThinkFlowLab#3322: a pull request needs the trailer in the branch commits and in its own title/body`; the assertion at `:164` is `assert.equal(entry.ok, true)` → `expected: true`, `actual: false`. **B. The new guard case dropped into that pre-fix file (loop still `undefined`), same event env (twice).** `… --test test/tmp-3329-prefix-guard.test.js` → run 1: `# tests 11 / # pass 10 / # fail 1`, exit 1; run 2 identical. The guard case itself is `ok 11`; the red is still the `ThinkFlowLab#3322` test at `:164` (`expected: true`, `actual: false`). So the new case alone does not fix the ambient read. **C. This patch, same event env (twice).** `GITHUB_EVENT_NAME=pull_request GITHUB_EVENT_PATH=…/event-plain.json node --import ./test/harness-resolve.mjs --test test/check-arch-docs.test.js` → run 1: `# tests 11 / # pass 11 / # fail 0`, exit 0; run 2 identical. Plain run (no event env): `# tests 11 / # pass 11 / # fail 0`, exit 0. **Suite at this tip.** `npm --prefix core test` → `# tests 3450 / # pass 3449 / # fail 1`; the one red is `bench.sh refuses before writing the profile when pnpm is missing`, which fails identically on the untouched base `7af546b6` (same file, same assertion, run on a clean worktree at that sha) — it is this box's pnpm preflight, not the change. With that environment case skipped (`--test-skip-pattern`): `# tests 3449 / # pass 3449 / # fail 0`. `arch-docs` at this tip: `arch-docs: OK (1 changed file(s))`. Not run: full `npm run verify` past the core suite (only one test file changed; plugin, build, patch and interop stages do not read it), smoke (no `index.js` / `src/host/` change). Docs-not-needed: test-only hermeticity fix; no behaviour change. ## Checkpoint <!-- flybot:checkpoint --> ```json { "pr": 3330, "claim": "Dev-1", "issue": 3329, "summary": "The arch-docs test passed `undefined` as filesNeedDocs' event, which is the default parameter, so it read the runner's own pull request and passed only while that PR body carried the trailer. It now passes `null` for “no event”, pins the trailer's event name, and adds a guard that an unreadable pull_request event fails closed. The script's judgement is unchanged; test only, with the patches mirror regenerated.", "files": [ "core/test/check-arch-docs.test.js", "patches/ds-bot/files/test/check-arch-docs.test.js" ], "checks": { "ran": "GITHUB_EVENT_NAME=pull_request GITHUB_EVENT_PATH=<plain body> node --import ./test/harness-resolve.mjs --test test/check-arch-docs.test.js (11/11 twice); plain run 11/11; npm --prefix core test 3449/3450 with one pre-existing environment case; ds-bot-patches check + canonical ok; arch-docs OK (2 changed file(s))", "result": "green", "at": "1edfde4013d584cc59cd14e57536c1b3ab9344da" }, "next": "none — ready for review" } ``` <!-- /flybot:checkpoint -->
Fixes #3322
Owner: Dev-1
Reviewer: Birfy
Root cause
core/scripts/check-arch-docs.mjsread theDocs-not-needed:trailer fromgit log <base>..HEADonly. On apull_requestrun that range holds the branch commits; the merge queue instead judges the squash of the pull request title and body. A trailer living in a branch commit alone was therefore green on the pull request and gone exactly when the queue judged it — which is what happened to #3321:arch-docs: OK (8 changed file(s))on the pull request,arch-docs: FAILon entryd8605beeab, ejected at 11:18:21Z.Before / after, from real runs
Six scenarios, each run in a scratch clone with the old script (from
1cc5b5c9) and the new one: apull_requestrun withGITHUB_EVENT_NAME=pull_requestand a realGITHUB_EVENT_PATH, and the queue shape (one squashed commit whose message is the title + body, run asmerge_group). No row goes red → green.The second row is the bug: red arrives on the pull request, in the run the author is looking at, instead of a queue cycle later. The refusal names the missing place:
Red first
New cases in
core/test/check-arch-docs.test.jswith injectableevent/logText/files/changed, run at1cc5b5c9with only the script change reverted: 3 red, 7 pass, the precise reading beingAt the fixed tip the same file is 10/10.
What changed
core/scripts/check-arch-docs.mjs:pullRequestEvent()readsGITHUB_EVENT_NAME/GITHUB_EVENT_PATH(apull_requestrun whose event cannot be read counts as a body without the trailer, never as a pass).filesNeedDocsrequires the trailer in the branch range and in the pull request title/body when the event ispull_request;merge_groupand a local run keep thegit logjudgement.failureLinesnames the place that is missing.hasDocsNotNeededTrailerkeeps its export and gains an optional log text so the judgement is testable without a repository.core/test/check-arch-docs.test.js: the two cases above plus the event wiring (push→ no second place, readable event → title/body, unreadable event → empty, hence red).docs/subsystems/install.md: the table row forcore/scripts/check-arch-docs.mjsnow states the new criterion (both places on apull_request, log only for the queue and local runs).patches/ds-bot/files/scripts/check-arch-docs.mjsandpatches/ds-bot/files/test/check-arch-docs.test.js: regenerated fromcore/bynode scripts/ds-bot-patches.mjs generateand committed with it.Verification at the tip
TZ=UTC npm run verify→ exit 0, run at local commita41700ea24dabf43ce45492e1188c20ad9df6e25(the tree the pushed head is rebuilt from): core 3449/3449, plane 25, social 764, tree 157, timeline 178, workflow 544, project 151, scripts+policy 735, interop 37, live-e2e 34 —# fail 0in every suite.Found 91 warnings and 0 errors.(the count base carries).core/test/check-arch-docs.test.jsalone at the tip: 10/10.ARCH_DOCS_BASE=1cc5b5c99d66 npm run arch-docs(incore/) →arch-docs: OK (5 changed file(s)).node scripts/ds-bot-patches.mjs check→ok ds-bot/ = Fei2411/DeepSeek-Bot@2b10c70 (tree 5834c00, v0.1.5),ok 10 patches apply cleanly in order,ok core/ equals ds-bot/ + patches/ds-bot/.Not run
node scripts/ds-bot-patches.mjs canonicalanddev/smoke.mjswere not run.packagejob's pack check, typecheck and actionlint are not part ofverifyand were not run here.{
"pr": 3324,
"claim": "Dev-1",
"issue": 3322,
"summary": "On a pull_request run the arch-docs gate read the Docs-not-needed trailer from the branch commits only, while the merge queue judges the squash of the pull request title and body, so a branch-only trailer was green on the pull request and red in the queue (#3321). The gate now reads GITHUB_EVENT_NAME/GITHUB_EVENT_PATH and requires the trailer in both places; merge_group and local runs keep the git-log judgement, and the refusal names the missing place. Three new cases were red against the old script and all ten pass at the tip; no row of the six-scenario table goes red to green.",
"files": [
"core/scripts/check-arch-docs.mjs",
"core/test/check-arch-docs.test.js",
"docs/subsystems/install.md",
"patches/ds-bot/files/scripts/check-arch-docs.mjs",
"patches/ds-bot/files/test/check-arch-docs.test.js"
],
"checks": {
"ran": "TZ=UTC npm run verify",
"result": "green",
"at": "6c079b26a030de9c6aa91e699becc4a3a4c9acca"
},
"next": "none — ready for review"
}