Skip to content

fix(canon): the entry guard of the six scripts without a template copy is one text, and org-health-watch asks the ruled shape (28m, queue row UMB4-115 part (a)) - #266

Draft
HetCreep wants to merge 1 commit into
mainfrom
deputy/28m-entry-guard
Draft

HetCreep wants to merge 1 commit into
mainfrom
deputy/28m-entry-guard

Conversation

@HetCreep

Copy link
Copy Markdown
Member

Order 28m, queue row UMB4-115, part (a). A draft for the auditor; it is not merged without main's word.

What changed

  • One guard text for the ruled shape (realpath.native on both sides; if that throws, file identity; last, the plain paths) in the six scripts that carry no template copy: the three deploy-payload.mjs, update-readme.mjs, verify-landing.mjs and org-health-watch.mjs. The block sits between // ENTRY GUARD and // END ENTRY GUARD and is the same by bytes in all six. It is a copy, not a module, because a script that must stay import-free at its top (node/runtime.md section 1) cannot share one; the comment in the block says so. update-readme.mjs and verify-landing.mjs gain the fs and path default imports so the text can be spelled once.
  • org-health-watch.mjs (item 4): moved to the ruled text, not kept as a divergence. Its guard was a pattern on the NAME in argv[1] (/org-health-watch\.mjs$/), a third shape. An import with an argv path that ends in that name and names no file ran the whole watcher against the API. A divergence needs a reason a different job gives, and there is none here; the ruled text also fails closed.
  • No file that has a template copy is edited.

Tests

  • scripts/overlay-entry-guards.test.mjs: the six blocks are equal, and the shape is the ruled one (two realpath.native calls, the file-identity and plain-path fallbacks, no catch that answers "the entry").
  • scripts/org-health-watch.test.mjs: imported with an argv path that ends in the script's name and names no file, the watcher asks no API, writes no report and prints nothing. A fetch stub is preloaded, so a wrong guard meets no network.
  • The other five scripts keep their own import tests from e0eba02 (an argv path that names no file; -e with no argv; realpath refused; no file id).

Red: 2 of 80 fail on 8a5b621 (the watcher ran on import; no guard between the markers). Green: 152 pass, 0 fail, 3 skipped (the overlay file's own pending skips); pre-commit 2082 tests, 0 failures.

Mutation table, 18 of 18 killed: for each of the six scripts, (A) a fail-open catch, (B) the file-identity fallback dropped, (C) the guard never firing. A and B are killed by the equality test and, for A, by that script's own import test too. Each mutant ran under a heap cap and a kill-timeout; the restore was checked byte-equal.

The class table (16 sites)

# File : line Shape Template copy carried by a room?
1 scripts/front-door-links.mjs : 126-141 ruled yes, #2
2 templates/published-code/scripts/front-door-links.mjs : 126-141 ruled this is the copy; eight public rooms carry it
3 scripts/inbox/deploy-payload.mjs : 150-162 ruled, now the one text no
4 scripts/mirror/deploy-payload.mjs : 117-129 ruled, now the one text no
5 scripts/watcher/deploy-payload.mjs : 141-153 ruled, now the one text no
6 scripts/update-readme.mjs : 179-191 ruled, now the one text no
7 scripts/verify-landing.mjs : 182-194 ruled, now the one text no
8 templates/overlay-coal-skill/scripts/build-claude-ai-zips.mjs : 189-207 ruled (isMainModule) this is the copy
9 templates/overlay-coal-skill/scripts/lib/machine-reading.mjs : 208-226 ruled (isMainModule) this is the copy (CoalFace's file, adopted by blob)
10 templates/overlay-coal-skill/scripts/lib/wave-run.mjs : 341-359 ruled (isMainModule) this is the copy
11 templates/overlay-coal-skill/scripts/prune-release-zips.mjs : 83-101 ruled (isMainModule) this is the copy
12 scripts/watcher/cold-read.mjs : 85 catch { return true; } no (part (b))
13 templates/article/scripts/release-notes.mjs : 220 catch { return true; } this is the copy (part (b))
14 templates/overlay-coal-skill/scripts/release-notes.mjs : 220 catch { return true; } this is the copy (part (b))
15 scripts/org-health-watch.mjs : 524-537 (was 524) pattern on the name, moved to the ruled text here no
16 templates/published-code/.github/scripts/lcov-to-cobertura.mjs : 149-153 a fourth shape: realpath once, fails closed, no identity fallback this is the copy (part (c))

Not in the class: benchmarks/CoalTipple/score.mjs:26,192 reads process.argv[1] inside a child-process code string, which is a parameter, not an entry test.

Rows 8 to 11 spell the same logic as isMainModule(url) rather than isEntry(); the overlay already holds those four equal by a test of its own (overlay-entry-guards.test.mjs, "ONE text"). One text across the two spellings is not asked in this part.

Not in this pull request

Parts (b) and (c): the three catch { return true; } sites, the four pins of the copied fallback (i7, i1, i2, i3), the unlinkFolderLink check and the fourth shape in lcov-to-cobertura.mjs.

🤖 Generated with Claude Code

…y is one text, and org-health-watch asks the ruled shape instead of a pattern on its name (28m, queue row UMB4-115 part (a))

- One byte-equal block between `// ENTRY GUARD` and `// END ENTRY GUARD` in the three deploy-payload.mjs, update-readme.mjs, verify-landing.mjs and org-health-watch.mjs: realpath.native on both sides; if that throws, file identity; last, the plain paths. It is a copy, not a module: a script that must stay import-free at its top (node/runtime.md section 1) cannot share one, and the comment says so. update-readme.mjs and verify-landing.mjs gain the `fs` and `path` default imports so the text can be spelled once.
- org-health-watch.mjs (item 4, kept in the class, not as a divergence): its guard was a pattern on the NAME in argv[1] (/org-health-watch\.mjs$/), a third shape. An import with an argv path that ends in that name and names no file ran the whole watcher against the API. It takes the ruled text, because the reason for a divergence (a different job) does not exist here, and the ruled text fails closed.
- A file that has a template copy is not edited (parts (b) and (c) are separate orders).

Tests:
- scripts/overlay-entry-guards.test.mjs holds the six blocks equal and checks the shape (two realpath.native calls, the file-identity and plain-path fallbacks, no catch that answers the entry). The six scripts' own import tests from e0eba02 stay.
- scripts/org-health-watch.test.mjs: imported with an argv path that ends in the script's name and names no file, the watcher asks no API, writes no report and prints nothing. A fetch stub is preloaded, so a wrong guard meets no network.

Red: 2 of 80 fail on 8a5b621 (the watcher ran on import; no guard between the markers). Green: 152 pass, 0 fail, 3 skipped (the overlay file's own pending skips). Mutation table, 18 of 18 killed: for each of the six scripts, a fail-open catch, the file-identity fallback dropped, and the guard never firing. Each mutant ran under a heap cap and a kill-timeout and the restore was checked byte-equal.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant