fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0 - #14593

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4
Sep 2, 2026
Merged

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0#14593
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#10667

Sitting 4, the final sitting of the KNOWN_IMPORT_UNSAFE burn-down. The ledger held exactly the two files the changesets-v3 epic #9465 had fenced; that epic has since completed, releasing them.

Ledger: 2 to 0. Sittings 1-4 across the whole card: 35 to 10 to 5 to 2 to 0.

File surface — four files, the fourth authorized

Three files are the card's own surface. The fourth, scripts/pm/dispatch-gates.mjs, carries a one-pin fix that emptying the ledger makes unavoidable. It was escalated rather than taken, and authorized by the PM decision on the card — comment 5511119817, which widens the surface "for exactly that one pin". See "The pin the empty ledger broke" below.

git diff --stat origin/main...HEAD:

 scripts/check-changeset-no-major.mjs | 24 +++++++++++++++++++++++-
scripts/check-empty-changeset.mjs | 23 ++++++++++++++++++++++-
scripts/check-entry-guard.mjs | 5 +----
scripts/pm/dispatch-gates.mjs | 28 +++++++++++++++++++++-------
4 files changed, 67 insertions(+), 13 deletions(-)

Both gate scripts had one offending top-level statement each — a trailing --self-test / --list / main dispatch chain — so both took the inverted 4-line insert. Zero re-indentation: the only line touched in each chain is its head, which becomes } else if (...) {.

scripts/check-entry-guard.mjs is touched only to delete the two ledger lines; the set becomes new Set([]). Its SHRINK-ONLY doc comment is untouched by design — the sentence "a file this rule newly reaches is a failure with one remedy, never a line in here" is exactly what keeps an empty set empty, and the :800 self-test assertions over the roster hold on an empty set (verified: 54 cases green).

The inversion check (sitting 3's ts-parse.mjs lesson), applied

Before guarding anything, the question sitting 3 raised: does any top-level statement here have to run for an importer?

No — nothing in the repo imports either file. Every reference is a spawn or prose:

  • spawns: .github/workflows/pr-automation.yml (:766-767, :942), cut-rc.yml (:482-483, :492-493), and package.json (check:empty-changeset, check:changeset-gate-self-tests) — all node scripts/..., a child process, unaffected by an import guard.
  • prose only: check-adr-0087-registration.mjs, objectui-changeset-digest.mjs, check-required-contexts.mjs, objectui-range.mjs, pm/dispatch-gates.mjs, check-entry-guard.mjs.
  • a repo-wide grep for an import/import() of either module returns nothing.

So the only statement moved behind isEntrypoint is CLI dispatch, and neither guard silences a census. This is the check that would have caught ts-parse.mjs; here it clears.

What the guards actually fixed — measured, both directions

Import probe: node -e "import('./scripts/NAME.mjs').then(m => console.log('SENTINEL exports:', Object.keys(m).join(',')))".

filebeforeafter
check-changeset-no-major.mjsran the whole gate inside the importer, then main()'s trailing process.exit(exitCode)ended the importer mid-import carrying status 0 — SENTINEL never printed, probe exit 0silent; SENTINEL exports: judge,majorPackagesIn,mergeBase,readChangesets,readPre,render,resolveCommit,scan; exit 0
check-empty-changeset.mjsran the gate and wrote its verdict to the importer's stdout, then returnedsilent; SENTINEL exports: declaredBumpsIn,mergeBase,scan; exit 0

The first is the worst shape in this class, and the one sitting 2 flagged as most dangerous: a silent success is indistinguishable from a clean import to any caller reading the exit status alone.

Zero behaviour change when invoked directly

Re-proven on the final commit d11a00a29 as a same-tree ablation: capture guarded output, revert both scripts to origin/main (pre-guard — isEntrypoint count 0/0 confirmed on disk), capture again, restore with git checkout HEAD --, prove the restore (both blob hashes match HEAD, git diff HEAD empty, guard count back to 3/3), then cmp.

modecheck-changeset-no-majorcheck-empty-changeset
defaultexit 0, byte-identicalexit 0, byte-identical
--self-testexit 0, byte-identical (116 assertions)exit 0, byte-identical (118 assertions)
--listexit 0, byte-identicalexit 0, byte-identical

check:entry-guard after

✓ check:entry-guard: 199 scripts/ file(s) — every entry guard goes through invoked-as.mjs;
150 export bindings, 150 of them inert on import (0 known-unsafe, ⛔ SHRINK-ONLY).

Before this PR that read 148 of them inert on import (2 known-unsafe). The two ledger lines were deleted only after the gate named them STALE — never in the same breath as the guard:

❌ check:entry-guard — 2 stale KNOWN_IMPORT_UNSAFE entry/entries:
scripts/check-changeset-no-major.mjs — no longer runs on import
scripts/check-empty-changeset.mjs — no longer runs on import

The pin the empty ledger broke

Emptying the ledger turned one case in scripts/pm/dispatch-gates.mjs red — the #10784 ablation, which strips check:entry-guard's declared subtree hint and asserts the brand-new-file verdict falls back:

✗ …and it is the subtree declaration doing it: strip it and check:entry-guard goes back to silent

Measured through the tool's own exported discoverFamilies / classifyEntry:

hints NOW: ["scripts/**"]
verdict NOW (full): matched <- the pin above this one still passes
hints after strip: []
verdict after strip: undetermined <- the pin demanded exactly: silent
PRE-CHANGE hints after strip: ["scripts/check-changeset-no-major.mjs",
"scripts/check-empty-changeset.mjs"]
PRE-CHANGE verdict after strip: silent

The ablation was passing only because the ledger still contributed two path literals as hints. That ledger is SHRINK-ONLY and reaching zero is its goal, so the sitting that empties it leaves the stripped hint set bare, the residual becomes undetermined, and the case reds over a gate that had not changed at all. The pin was calibrated against a debt ledger designed to disappear. Unreachable in sittings 1-3 — only the sitting that empties the set can hit it.

The fix pins the claim, not the spelling. The ablation exists to prove the subtree declaration is the load-bearing half — i.e. that without it the file is not matched. Both silent and undetermined are not-matched, so both are accepted, spelled as the explicit pair ['silent', 'undetermined'].includes(residual) rather than !== 'matched' so a new verdict value cannot slip through as a pass. The vacuity guard undeclared.hints.length < entry.hints.length is untouched. The case label now says NOT MATCHED instead of silent, and the residual verdict is carried into the failure detail so a future red names what it actually got.

The pin still discriminates — shown, not asserted

Two one-off mutations on the final commit, each proven on disk before running, each restored with git checkout HEAD -- and the restore proven by blob hash plus an empty git diff HEAD:

mutationeffectthis case
A — the strip is a no-op (filter(() => true), subtree hint not stripped)vacuity guard trips✗ RED for check:entry-guardandcheck:parse-guard
B — residual forced to 'matched'the accepted pair rejects it✗ RED for both gates
CONTROL — unmutated✓ GREEN for both gates

So the widened pin still fails when the subtree declaration is not what is doing the work, and still fails on a matched residual. It was not loosened into a tautology.

Gates

Union re-derived at the final commit d11a00a29 (clean working tree) with node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands — provenance names objectstack-ai/objectstack at d11a00a29. The fourth file grew the union from 18 to 20 families: node scripts/check-self-test-wired.mjs and pnpm check:declared-population-live are new, and neither was in the first derivation — re-deriving after the surface widened is what caught them. Exit codes captured by redirect before any pipe.

19 RAN-PASS (exit 0):check:agent-test-spelling · check:bash32-floor · check:changeset-gate-self-tests · check:cli-command-ids · check:cross-package-test-inputs · check:declared-population-live ("158 of 202 famil(ies) declare a path population, and every one of them reaches this tree's 7985 tracked file(s)") · check:entry-guard · check:parse-guard · check:pnpm-filter-targets · check:ratchet-remedy-authority · check:watch-hint-literal · check:pm-dispatch-gates ("✓ dispatch-gates self-test: 1240 cases pass", gate exit 0 — run detached through scripts/pm/os-verify-lock.sh, held 439s, waited 320s) · check-changeset-no-major.mjs · check-ci-filter-parity.mjs · check-cross-package-test-inputs.mjs · check-empty-changeset.mjs · check-self-test-wired.mjs · check-shard-attestation.mjs · pm/bare-root-worklist.mjs --self-test ("none stale, none missing, none contradicted").

1 NOT MEASURED:check-test-completeness.mjs, exit 3 — its own PREREQUISITE NOT MET branch (it grades a saved turbo test log and the family names it with no argument). Its text is explicit that this is not a red, and CI, which tees the log and passes the path, never reaches that branch.

Changeset: none — scripts/** only, no package publishes, so the PR carries skip-changeset.


Generated by Claude Code


Generated by Claude Code

`check-changeset-no-major.mjs` and `check-empty-changeset.mjs` were the final
two entries in the SHRINK-ONLY `KNOWN_IMPORT_UNSAFE` ledger, held back until
the changesets-v3 epic released their file territory.
Both take the inverted 4-line insert, so every existing dispatch branch keeps
its indentation. Measured on this tree before the guards:
- importing `check-changeset-no-major.mjs` for its exports ran the whole
gate inside the importer and then `main()`'s trailing
`process.exit(exitCode)` ended that process mid-import carrying status 0.
The probe never reached the statement after its own `import()`, so a
caller reading the status alone cannot tell it from a clean import.
- importing `check-empty-changeset.mjs` ran the gate and wrote its verdict
to the importer's stdout before returning the exports.
After: both probes return their exports silently, exit 0, no foreign output.
All three CLI modes (default, `--self-test`, `--list`) are byte-identical
before and after on the same tree.
Nothing in the repo imports either file -- every reference in `.github/**`,
`package.json` and `scripts/**` spawns them as `node scripts/...` -- so
neither guard silences a census. That is the sitting-3 `ts-parse.mjs`
inversion check, applied and cleared.
The ledger entries were deleted only after `check:entry-guard` named both
STALE. The set is now empty and its SHRINK-ONLY doc comment is untouched:
that comment is what keeps an empty set empty.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 2, 2026
The ablation strips check:entry-guard's declared subtree hint and asserts the
brand-new-file verdict falls back. Its claim is that the subtree declaration is
the load-bearing half -- i.e. that without it the file is NOT MATCHED -- but it
spelled that as exactly `'silent'`.
`'silent'` was only ever the residual because check-entry-guard.mjs's
KNOWN_IMPORT_UNSAFE roster still contributed two path literals as hints. That
ledger is SHRINK-ONLY and reaching zero is its GOAL, so the sitting that
emptied it left the stripped hint set bare, the residual became
`'undetermined'`, and this case went red over a gate that had not changed at
all. The pin was calibrated against a debt ledger designed to disappear.
Both verdicts are not-matched and either one proves the subtree hint is
load-bearing, so both are accepted -- spelled as an explicit pair rather than
`!== 'matched'`, so a NEW verdict value added later cannot slip through as a
pass. The vacuity guard (`undeclared.hints.length < entry.hints.length`) is
untouched, the case label now says NOT MATCHED rather than 'silent', and the
residual verdict is carried into the failure detail so a future red names what
it actually got.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@baozhoutao
baozhoutao marked this pull request as ready for review September 2, 2026 14:59
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 33655524730 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Test Core (1/6) — 失败步骤: Run this shard's tests

    @objectstack/cli:test: FAIL integration test/run-dev-unbuilt-workspace.e2e.test.ts > the mirror direction: a reader that is never coming back > gives up and exits instead of waiting forever
    ↳ 失败原因: @objectstack/cli:test: AssertionError: expected 'SIGKILL' to be null
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 7 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit a120885Sep 2, 2026
33 of 35 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-10667-entry-guard-ledger-sitting-4 branch September 2, 2026 17:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burn down the 35 scripts/ modules that run on import — the KNOWN_IMPORT_UNSAFE ledger from PR #10665

2 participants

@baozhoutao@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0 - #14593

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4
Sep 2, 2026
Merged

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0#14593
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#10667

Sitting 4, the final sitting of the KNOWN_IMPORT_UNSAFE burn-down. The ledger held exactly the two files the changesets-v3 epic #9465 had fenced; that epic has since completed, releasing them.

Ledger: 2 to 0. Sittings 1-4 across the whole card: 35 to 10 to 5 to 2 to 0.

File surface — four files, the fourth authorized

Three files are the card's own surface. The fourth, scripts/pm/dispatch-gates.mjs, carries a one-pin fix that emptying the ledger makes unavoidable. It was escalated rather than taken, and authorized by the PM decision on the card — comment 5511119817, which widens the surface "for exactly that one pin". See "The pin the empty ledger broke" below.

git diff --stat origin/main...HEAD:

 scripts/check-changeset-no-major.mjs | 24 +++++++++++++++++++++++-
scripts/check-empty-changeset.mjs | 23 ++++++++++++++++++++++-
scripts/check-entry-guard.mjs | 5 +----
scripts/pm/dispatch-gates.mjs | 28 +++++++++++++++++++++-------
4 files changed, 67 insertions(+), 13 deletions(-)

Both gate scripts had one offending top-level statement each — a trailing --self-test / --list / main dispatch chain — so both took the inverted 4-line insert. Zero re-indentation: the only line touched in each chain is its head, which becomes } else if (...) {.

scripts/check-entry-guard.mjs is touched only to delete the two ledger lines; the set becomes new Set([]). Its SHRINK-ONLY doc comment is untouched by design — the sentence "a file this rule newly reaches is a failure with one remedy, never a line in here" is exactly what keeps an empty set empty, and the :800 self-test assertions over the roster hold on an empty set (verified: 54 cases green).

The inversion check (sitting 3's ts-parse.mjs lesson), applied

Before guarding anything, the question sitting 3 raised: does any top-level statement here have to run for an importer?

No — nothing in the repo imports either file. Every reference is a spawn or prose:

  • spawns: .github/workflows/pr-automation.yml (:766-767, :942), cut-rc.yml (:482-483, :492-493), and package.json (check:empty-changeset, check:changeset-gate-self-tests) — all node scripts/..., a child process, unaffected by an import guard.
  • prose only: check-adr-0087-registration.mjs, objectui-changeset-digest.mjs, check-required-contexts.mjs, objectui-range.mjs, pm/dispatch-gates.mjs, check-entry-guard.mjs.
  • a repo-wide grep for an import/import() of either module returns nothing.

So the only statement moved behind isEntrypoint is CLI dispatch, and neither guard silences a census. This is the check that would have caught ts-parse.mjs; here it clears.

What the guards actually fixed — measured, both directions

Import probe: node -e "import('./scripts/NAME.mjs').then(m => console.log('SENTINEL exports:', Object.keys(m).join(',')))".

filebeforeafter
check-changeset-no-major.mjsran the whole gate inside the importer, then main()'s trailing process.exit(exitCode)ended the importer mid-import carrying status 0 — SENTINEL never printed, probe exit 0silent; SENTINEL exports: judge,majorPackagesIn,mergeBase,readChangesets,readPre,render,resolveCommit,scan; exit 0
check-empty-changeset.mjsran the gate and wrote its verdict to the importer's stdout, then returnedsilent; SENTINEL exports: declaredBumpsIn,mergeBase,scan; exit 0

The first is the worst shape in this class, and the one sitting 2 flagged as most dangerous: a silent success is indistinguishable from a clean import to any caller reading the exit status alone.

Zero behaviour change when invoked directly

Re-proven on the final commit d11a00a29 as a same-tree ablation: capture guarded output, revert both scripts to origin/main (pre-guard — isEntrypoint count 0/0 confirmed on disk), capture again, restore with git checkout HEAD --, prove the restore (both blob hashes match HEAD, git diff HEAD empty, guard count back to 3/3), then cmp.

modecheck-changeset-no-majorcheck-empty-changeset
defaultexit 0, byte-identicalexit 0, byte-identical
--self-testexit 0, byte-identical (116 assertions)exit 0, byte-identical (118 assertions)
--listexit 0, byte-identicalexit 0, byte-identical

check:entry-guard after

✓ check:entry-guard: 199 scripts/ file(s) — every entry guard goes through invoked-as.mjs;
150 export bindings, 150 of them inert on import (0 known-unsafe, ⛔ SHRINK-ONLY).

Before this PR that read 148 of them inert on import (2 known-unsafe). The two ledger lines were deleted only after the gate named them STALE — never in the same breath as the guard:

❌ check:entry-guard — 2 stale KNOWN_IMPORT_UNSAFE entry/entries:
scripts/check-changeset-no-major.mjs — no longer runs on import
scripts/check-empty-changeset.mjs — no longer runs on import

The pin the empty ledger broke

Emptying the ledger turned one case in scripts/pm/dispatch-gates.mjs red — the #10784 ablation, which strips check:entry-guard's declared subtree hint and asserts the brand-new-file verdict falls back:

✗ …and it is the subtree declaration doing it: strip it and check:entry-guard goes back to silent

Measured through the tool's own exported discoverFamilies / classifyEntry:

hints NOW: ["scripts/**"]
verdict NOW (full): matched <- the pin above this one still passes
hints after strip: []
verdict after strip: undetermined <- the pin demanded exactly: silent
PRE-CHANGE hints after strip: ["scripts/check-changeset-no-major.mjs",
"scripts/check-empty-changeset.mjs"]
PRE-CHANGE verdict after strip: silent

The ablation was passing only because the ledger still contributed two path literals as hints. That ledger is SHRINK-ONLY and reaching zero is its goal, so the sitting that empties it leaves the stripped hint set bare, the residual becomes undetermined, and the case reds over a gate that had not changed at all. The pin was calibrated against a debt ledger designed to disappear. Unreachable in sittings 1-3 — only the sitting that empties the set can hit it.

The fix pins the claim, not the spelling. The ablation exists to prove the subtree declaration is the load-bearing half — i.e. that without it the file is not matched. Both silent and undetermined are not-matched, so both are accepted, spelled as the explicit pair ['silent', 'undetermined'].includes(residual) rather than !== 'matched' so a new verdict value cannot slip through as a pass. The vacuity guard undeclared.hints.length < entry.hints.length is untouched. The case label now says NOT MATCHED instead of silent, and the residual verdict is carried into the failure detail so a future red names what it actually got.

The pin still discriminates — shown, not asserted

Two one-off mutations on the final commit, each proven on disk before running, each restored with git checkout HEAD -- and the restore proven by blob hash plus an empty git diff HEAD:

mutationeffectthis case
A — the strip is a no-op (filter(() => true), subtree hint not stripped)vacuity guard trips✗ RED for check:entry-guardandcheck:parse-guard
B — residual forced to 'matched'the accepted pair rejects it✗ RED for both gates
CONTROL — unmutated✓ GREEN for both gates

So the widened pin still fails when the subtree declaration is not what is doing the work, and still fails on a matched residual. It was not loosened into a tautology.

Gates

Union re-derived at the final commit d11a00a29 (clean working tree) with node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands — provenance names objectstack-ai/objectstack at d11a00a29. The fourth file grew the union from 18 to 20 families: node scripts/check-self-test-wired.mjs and pnpm check:declared-population-live are new, and neither was in the first derivation — re-deriving after the surface widened is what caught them. Exit codes captured by redirect before any pipe.

19 RAN-PASS (exit 0):check:agent-test-spelling · check:bash32-floor · check:changeset-gate-self-tests · check:cli-command-ids · check:cross-package-test-inputs · check:declared-population-live ("158 of 202 famil(ies) declare a path population, and every one of them reaches this tree's 7985 tracked file(s)") · check:entry-guard · check:parse-guard · check:pnpm-filter-targets · check:ratchet-remedy-authority · check:watch-hint-literal · check:pm-dispatch-gates ("✓ dispatch-gates self-test: 1240 cases pass", gate exit 0 — run detached through scripts/pm/os-verify-lock.sh, held 439s, waited 320s) · check-changeset-no-major.mjs · check-ci-filter-parity.mjs · check-cross-package-test-inputs.mjs · check-empty-changeset.mjs · check-self-test-wired.mjs · check-shard-attestation.mjs · pm/bare-root-worklist.mjs --self-test ("none stale, none missing, none contradicted").

1 NOT MEASURED:check-test-completeness.mjs, exit 3 — its own PREREQUISITE NOT MET branch (it grades a saved turbo test log and the family names it with no argument). Its text is explicit that this is not a red, and CI, which tees the log and passes the path, never reaches that branch.

Changeset: none — scripts/** only, no package publishes, so the PR carries skip-changeset.


Generated by Claude Code


Generated by Claude Code

`check-changeset-no-major.mjs` and `check-empty-changeset.mjs` were the final
two entries in the SHRINK-ONLY `KNOWN_IMPORT_UNSAFE` ledger, held back until
the changesets-v3 epic released their file territory.
Both take the inverted 4-line insert, so every existing dispatch branch keeps
its indentation. Measured on this tree before the guards:
- importing `check-changeset-no-major.mjs` for its exports ran the whole
gate inside the importer and then `main()`'s trailing
`process.exit(exitCode)` ended that process mid-import carrying status 0.
The probe never reached the statement after its own `import()`, so a
caller reading the status alone cannot tell it from a clean import.
- importing `check-empty-changeset.mjs` ran the gate and wrote its verdict
to the importer's stdout before returning the exports.
After: both probes return their exports silently, exit 0, no foreign output.
All three CLI modes (default, `--self-test`, `--list`) are byte-identical
before and after on the same tree.
Nothing in the repo imports either file -- every reference in `.github/**`,
`package.json` and `scripts/**` spawns them as `node scripts/...` -- so
neither guard silences a census. That is the sitting-3 `ts-parse.mjs`
inversion check, applied and cleared.
The ledger entries were deleted only after `check:entry-guard` named both
STALE. The set is now empty and its SHRINK-ONLY doc comment is untouched:
that comment is what keeps an empty set empty.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 2, 2026
The ablation strips check:entry-guard's declared subtree hint and asserts the
brand-new-file verdict falls back. Its claim is that the subtree declaration is
the load-bearing half -- i.e. that without it the file is NOT MATCHED -- but it
spelled that as exactly `'silent'`.
`'silent'` was only ever the residual because check-entry-guard.mjs's
KNOWN_IMPORT_UNSAFE roster still contributed two path literals as hints. That
ledger is SHRINK-ONLY and reaching zero is its GOAL, so the sitting that
emptied it left the stripped hint set bare, the residual became
`'undetermined'`, and this case went red over a gate that had not changed at
all. The pin was calibrated against a debt ledger designed to disappear.
Both verdicts are not-matched and either one proves the subtree hint is
load-bearing, so both are accepted -- spelled as an explicit pair rather than
`!== 'matched'`, so a NEW verdict value added later cannot slip through as a
pass. The vacuity guard (`undeclared.hints.length < entry.hints.length`) is
untouched, the case label now says NOT MATCHED rather than 'silent', and the
residual verdict is carried into the failure detail so a future red names what
it actually got.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@baozhoutao
baozhoutao marked this pull request as ready for review September 2, 2026 14:59
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 33655524730 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Test Core (1/6) — 失败步骤: Run this shard's tests

    @objectstack/cli:test: FAIL integration test/run-dev-unbuilt-workspace.e2e.test.ts > the mirror direction: a reader that is never coming back > gives up and exits instead of waiting forever
    ↳ 失败原因: @objectstack/cli:test: AssertionError: expected 'SIGKILL' to be null
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 7 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit a120885Sep 2, 2026
33 of 35 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-10667-entry-guard-ledger-sitting-4 branch September 2, 2026 17:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burn down the 35 scripts/ modules that run on import — the KNOWN_IMPORT_UNSAFE ledger from PR #10665

2 participants

@baozhoutao@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0 - #14593

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4
Sep 2, 2026
Merged

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0#14593
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#10667

Sitting 4, the final sitting of the KNOWN_IMPORT_UNSAFE burn-down. The ledger held exactly the two files the changesets-v3 epic #9465 had fenced; that epic has since completed, releasing them.

Ledger: 2 to 0. Sittings 1-4 across the whole card: 35 to 10 to 5 to 2 to 0.

File surface — four files, the fourth authorized

Three files are the card's own surface. The fourth, scripts/pm/dispatch-gates.mjs, carries a one-pin fix that emptying the ledger makes unavoidable. It was escalated rather than taken, and authorized by the PM decision on the card — comment 5511119817, which widens the surface "for exactly that one pin". See "The pin the empty ledger broke" below.

git diff --stat origin/main...HEAD:

 scripts/check-changeset-no-major.mjs | 24 +++++++++++++++++++++++-
scripts/check-empty-changeset.mjs | 23 ++++++++++++++++++++++-
scripts/check-entry-guard.mjs | 5 +----
scripts/pm/dispatch-gates.mjs | 28 +++++++++++++++++++++-------
4 files changed, 67 insertions(+), 13 deletions(-)

Both gate scripts had one offending top-level statement each — a trailing --self-test / --list / main dispatch chain — so both took the inverted 4-line insert. Zero re-indentation: the only line touched in each chain is its head, which becomes } else if (...) {.

scripts/check-entry-guard.mjs is touched only to delete the two ledger lines; the set becomes new Set([]). Its SHRINK-ONLY doc comment is untouched by design — the sentence "a file this rule newly reaches is a failure with one remedy, never a line in here" is exactly what keeps an empty set empty, and the :800 self-test assertions over the roster hold on an empty set (verified: 54 cases green).

The inversion check (sitting 3's ts-parse.mjs lesson), applied

Before guarding anything, the question sitting 3 raised: does any top-level statement here have to run for an importer?

No — nothing in the repo imports either file. Every reference is a spawn or prose:

  • spawns: .github/workflows/pr-automation.yml (:766-767, :942), cut-rc.yml (:482-483, :492-493), and package.json (check:empty-changeset, check:changeset-gate-self-tests) — all node scripts/..., a child process, unaffected by an import guard.
  • prose only: check-adr-0087-registration.mjs, objectui-changeset-digest.mjs, check-required-contexts.mjs, objectui-range.mjs, pm/dispatch-gates.mjs, check-entry-guard.mjs.
  • a repo-wide grep for an import/import() of either module returns nothing.

So the only statement moved behind isEntrypoint is CLI dispatch, and neither guard silences a census. This is the check that would have caught ts-parse.mjs; here it clears.

What the guards actually fixed — measured, both directions

Import probe: node -e "import('./scripts/NAME.mjs').then(m => console.log('SENTINEL exports:', Object.keys(m).join(',')))".

filebeforeafter
check-changeset-no-major.mjsran the whole gate inside the importer, then main()'s trailing process.exit(exitCode)ended the importer mid-import carrying status 0 — SENTINEL never printed, probe exit 0silent; SENTINEL exports: judge,majorPackagesIn,mergeBase,readChangesets,readPre,render,resolveCommit,scan; exit 0
check-empty-changeset.mjsran the gate and wrote its verdict to the importer's stdout, then returnedsilent; SENTINEL exports: declaredBumpsIn,mergeBase,scan; exit 0

The first is the worst shape in this class, and the one sitting 2 flagged as most dangerous: a silent success is indistinguishable from a clean import to any caller reading the exit status alone.

Zero behaviour change when invoked directly

Re-proven on the final commit d11a00a29 as a same-tree ablation: capture guarded output, revert both scripts to origin/main (pre-guard — isEntrypoint count 0/0 confirmed on disk), capture again, restore with git checkout HEAD --, prove the restore (both blob hashes match HEAD, git diff HEAD empty, guard count back to 3/3), then cmp.

modecheck-changeset-no-majorcheck-empty-changeset
defaultexit 0, byte-identicalexit 0, byte-identical
--self-testexit 0, byte-identical (116 assertions)exit 0, byte-identical (118 assertions)
--listexit 0, byte-identicalexit 0, byte-identical

check:entry-guard after

✓ check:entry-guard: 199 scripts/ file(s) — every entry guard goes through invoked-as.mjs;
150 export bindings, 150 of them inert on import (0 known-unsafe, ⛔ SHRINK-ONLY).

Before this PR that read 148 of them inert on import (2 known-unsafe). The two ledger lines were deleted only after the gate named them STALE — never in the same breath as the guard:

❌ check:entry-guard — 2 stale KNOWN_IMPORT_UNSAFE entry/entries:
scripts/check-changeset-no-major.mjs — no longer runs on import
scripts/check-empty-changeset.mjs — no longer runs on import

The pin the empty ledger broke

Emptying the ledger turned one case in scripts/pm/dispatch-gates.mjs red — the #10784 ablation, which strips check:entry-guard's declared subtree hint and asserts the brand-new-file verdict falls back:

✗ …and it is the subtree declaration doing it: strip it and check:entry-guard goes back to silent

Measured through the tool's own exported discoverFamilies / classifyEntry:

hints NOW: ["scripts/**"]
verdict NOW (full): matched <- the pin above this one still passes
hints after strip: []
verdict after strip: undetermined <- the pin demanded exactly: silent
PRE-CHANGE hints after strip: ["scripts/check-changeset-no-major.mjs",
"scripts/check-empty-changeset.mjs"]
PRE-CHANGE verdict after strip: silent

The ablation was passing only because the ledger still contributed two path literals as hints. That ledger is SHRINK-ONLY and reaching zero is its goal, so the sitting that empties it leaves the stripped hint set bare, the residual becomes undetermined, and the case reds over a gate that had not changed at all. The pin was calibrated against a debt ledger designed to disappear. Unreachable in sittings 1-3 — only the sitting that empties the set can hit it.

The fix pins the claim, not the spelling. The ablation exists to prove the subtree declaration is the load-bearing half — i.e. that without it the file is not matched. Both silent and undetermined are not-matched, so both are accepted, spelled as the explicit pair ['silent', 'undetermined'].includes(residual) rather than !== 'matched' so a new verdict value cannot slip through as a pass. The vacuity guard undeclared.hints.length < entry.hints.length is untouched. The case label now says NOT MATCHED instead of silent, and the residual verdict is carried into the failure detail so a future red names what it actually got.

The pin still discriminates — shown, not asserted

Two one-off mutations on the final commit, each proven on disk before running, each restored with git checkout HEAD -- and the restore proven by blob hash plus an empty git diff HEAD:

mutationeffectthis case
A — the strip is a no-op (filter(() => true), subtree hint not stripped)vacuity guard trips✗ RED for check:entry-guardandcheck:parse-guard
B — residual forced to 'matched'the accepted pair rejects it✗ RED for both gates
CONTROL — unmutated✓ GREEN for both gates

So the widened pin still fails when the subtree declaration is not what is doing the work, and still fails on a matched residual. It was not loosened into a tautology.

Gates

Union re-derived at the final commit d11a00a29 (clean working tree) with node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands — provenance names objectstack-ai/objectstack at d11a00a29. The fourth file grew the union from 18 to 20 families: node scripts/check-self-test-wired.mjs and pnpm check:declared-population-live are new, and neither was in the first derivation — re-deriving after the surface widened is what caught them. Exit codes captured by redirect before any pipe.

19 RAN-PASS (exit 0):check:agent-test-spelling · check:bash32-floor · check:changeset-gate-self-tests · check:cli-command-ids · check:cross-package-test-inputs · check:declared-population-live ("158 of 202 famil(ies) declare a path population, and every one of them reaches this tree's 7985 tracked file(s)") · check:entry-guard · check:parse-guard · check:pnpm-filter-targets · check:ratchet-remedy-authority · check:watch-hint-literal · check:pm-dispatch-gates ("✓ dispatch-gates self-test: 1240 cases pass", gate exit 0 — run detached through scripts/pm/os-verify-lock.sh, held 439s, waited 320s) · check-changeset-no-major.mjs · check-ci-filter-parity.mjs · check-cross-package-test-inputs.mjs · check-empty-changeset.mjs · check-self-test-wired.mjs · check-shard-attestation.mjs · pm/bare-root-worklist.mjs --self-test ("none stale, none missing, none contradicted").

1 NOT MEASURED:check-test-completeness.mjs, exit 3 — its own PREREQUISITE NOT MET branch (it grades a saved turbo test log and the family names it with no argument). Its text is explicit that this is not a red, and CI, which tees the log and passes the path, never reaches that branch.

Changeset: none — scripts/** only, no package publishes, so the PR carries skip-changeset.


Generated by Claude Code


Generated by Claude Code

`check-changeset-no-major.mjs` and `check-empty-changeset.mjs` were the final
two entries in the SHRINK-ONLY `KNOWN_IMPORT_UNSAFE` ledger, held back until
the changesets-v3 epic released their file territory.
Both take the inverted 4-line insert, so every existing dispatch branch keeps
its indentation. Measured on this tree before the guards:
- importing `check-changeset-no-major.mjs` for its exports ran the whole
gate inside the importer and then `main()`'s trailing
`process.exit(exitCode)` ended that process mid-import carrying status 0.
The probe never reached the statement after its own `import()`, so a
caller reading the status alone cannot tell it from a clean import.
- importing `check-empty-changeset.mjs` ran the gate and wrote its verdict
to the importer's stdout before returning the exports.
After: both probes return their exports silently, exit 0, no foreign output.
All three CLI modes (default, `--self-test`, `--list`) are byte-identical
before and after on the same tree.
Nothing in the repo imports either file -- every reference in `.github/**`,
`package.json` and `scripts/**` spawns them as `node scripts/...` -- so
neither guard silences a census. That is the sitting-3 `ts-parse.mjs`
inversion check, applied and cleared.
The ledger entries were deleted only after `check:entry-guard` named both
STALE. The set is now empty and its SHRINK-ONLY doc comment is untouched:
that comment is what keeps an empty set empty.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 2, 2026
The ablation strips check:entry-guard's declared subtree hint and asserts the
brand-new-file verdict falls back. Its claim is that the subtree declaration is
the load-bearing half -- i.e. that without it the file is NOT MATCHED -- but it
spelled that as exactly `'silent'`.
`'silent'` was only ever the residual because check-entry-guard.mjs's
KNOWN_IMPORT_UNSAFE roster still contributed two path literals as hints. That
ledger is SHRINK-ONLY and reaching zero is its GOAL, so the sitting that
emptied it left the stripped hint set bare, the residual became
`'undetermined'`, and this case went red over a gate that had not changed at
all. The pin was calibrated against a debt ledger designed to disappear.
Both verdicts are not-matched and either one proves the subtree hint is
load-bearing, so both are accepted -- spelled as an explicit pair rather than
`!== 'matched'`, so a NEW verdict value added later cannot slip through as a
pass. The vacuity guard (`undeclared.hints.length < entry.hints.length`) is
untouched, the case label now says NOT MATCHED rather than 'silent', and the
residual verdict is carried into the failure detail so a future red names what
it actually got.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@baozhoutao
baozhoutao marked this pull request as ready for review September 2, 2026 14:59
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 33655524730 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Test Core (1/6) — 失败步骤: Run this shard's tests

    @objectstack/cli:test: FAIL integration test/run-dev-unbuilt-workspace.e2e.test.ts > the mirror direction: a reader that is never coming back > gives up and exits instead of waiting forever
    ↳ 失败原因: @objectstack/cli:test: AssertionError: expected 'SIGKILL' to be null
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 7 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit a120885Sep 2, 2026
33 of 35 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-10667-entry-guard-ledger-sitting-4 branch September 2, 2026 17:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burn down the 35 scripts/ modules that run on import — the KNOWN_IMPORT_UNSAFE ledger from PR #10665

2 participants

@baozhoutao@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0 - #14593

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4
Sep 2, 2026
Merged

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0#14593
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#10667

Sitting 4, the final sitting of the KNOWN_IMPORT_UNSAFE burn-down. The ledger held exactly the two files the changesets-v3 epic #9465 had fenced; that epic has since completed, releasing them.

Ledger: 2 to 0. Sittings 1-4 across the whole card: 35 to 10 to 5 to 2 to 0.

File surface — four files, the fourth authorized

Three files are the card's own surface. The fourth, scripts/pm/dispatch-gates.mjs, carries a one-pin fix that emptying the ledger makes unavoidable. It was escalated rather than taken, and authorized by the PM decision on the card — comment 5511119817, which widens the surface "for exactly that one pin". See "The pin the empty ledger broke" below.

git diff --stat origin/main...HEAD:

 scripts/check-changeset-no-major.mjs | 24 +++++++++++++++++++++++-
scripts/check-empty-changeset.mjs | 23 ++++++++++++++++++++++-
scripts/check-entry-guard.mjs | 5 +----
scripts/pm/dispatch-gates.mjs | 28 +++++++++++++++++++++-------
4 files changed, 67 insertions(+), 13 deletions(-)

Both gate scripts had one offending top-level statement each — a trailing --self-test / --list / main dispatch chain — so both took the inverted 4-line insert. Zero re-indentation: the only line touched in each chain is its head, which becomes } else if (...) {.

scripts/check-entry-guard.mjs is touched only to delete the two ledger lines; the set becomes new Set([]). Its SHRINK-ONLY doc comment is untouched by design — the sentence "a file this rule newly reaches is a failure with one remedy, never a line in here" is exactly what keeps an empty set empty, and the :800 self-test assertions over the roster hold on an empty set (verified: 54 cases green).

The inversion check (sitting 3's ts-parse.mjs lesson), applied

Before guarding anything, the question sitting 3 raised: does any top-level statement here have to run for an importer?

No — nothing in the repo imports either file. Every reference is a spawn or prose:

  • spawns: .github/workflows/pr-automation.yml (:766-767, :942), cut-rc.yml (:482-483, :492-493), and package.json (check:empty-changeset, check:changeset-gate-self-tests) — all node scripts/..., a child process, unaffected by an import guard.
  • prose only: check-adr-0087-registration.mjs, objectui-changeset-digest.mjs, check-required-contexts.mjs, objectui-range.mjs, pm/dispatch-gates.mjs, check-entry-guard.mjs.
  • a repo-wide grep for an import/import() of either module returns nothing.

So the only statement moved behind isEntrypoint is CLI dispatch, and neither guard silences a census. This is the check that would have caught ts-parse.mjs; here it clears.

What the guards actually fixed — measured, both directions

Import probe: node -e "import('./scripts/NAME.mjs').then(m => console.log('SENTINEL exports:', Object.keys(m).join(',')))".

filebeforeafter
check-changeset-no-major.mjsran the whole gate inside the importer, then main()'s trailing process.exit(exitCode)ended the importer mid-import carrying status 0 — SENTINEL never printed, probe exit 0silent; SENTINEL exports: judge,majorPackagesIn,mergeBase,readChangesets,readPre,render,resolveCommit,scan; exit 0
check-empty-changeset.mjsran the gate and wrote its verdict to the importer's stdout, then returnedsilent; SENTINEL exports: declaredBumpsIn,mergeBase,scan; exit 0

The first is the worst shape in this class, and the one sitting 2 flagged as most dangerous: a silent success is indistinguishable from a clean import to any caller reading the exit status alone.

Zero behaviour change when invoked directly

Re-proven on the final commit d11a00a29 as a same-tree ablation: capture guarded output, revert both scripts to origin/main (pre-guard — isEntrypoint count 0/0 confirmed on disk), capture again, restore with git checkout HEAD --, prove the restore (both blob hashes match HEAD, git diff HEAD empty, guard count back to 3/3), then cmp.

modecheck-changeset-no-majorcheck-empty-changeset
defaultexit 0, byte-identicalexit 0, byte-identical
--self-testexit 0, byte-identical (116 assertions)exit 0, byte-identical (118 assertions)
--listexit 0, byte-identicalexit 0, byte-identical

check:entry-guard after

✓ check:entry-guard: 199 scripts/ file(s) — every entry guard goes through invoked-as.mjs;
150 export bindings, 150 of them inert on import (0 known-unsafe, ⛔ SHRINK-ONLY).

Before this PR that read 148 of them inert on import (2 known-unsafe). The two ledger lines were deleted only after the gate named them STALE — never in the same breath as the guard:

❌ check:entry-guard — 2 stale KNOWN_IMPORT_UNSAFE entry/entries:
scripts/check-changeset-no-major.mjs — no longer runs on import
scripts/check-empty-changeset.mjs — no longer runs on import

The pin the empty ledger broke

Emptying the ledger turned one case in scripts/pm/dispatch-gates.mjs red — the #10784 ablation, which strips check:entry-guard's declared subtree hint and asserts the brand-new-file verdict falls back:

✗ …and it is the subtree declaration doing it: strip it and check:entry-guard goes back to silent

Measured through the tool's own exported discoverFamilies / classifyEntry:

hints NOW: ["scripts/**"]
verdict NOW (full): matched <- the pin above this one still passes
hints after strip: []
verdict after strip: undetermined <- the pin demanded exactly: silent
PRE-CHANGE hints after strip: ["scripts/check-changeset-no-major.mjs",
"scripts/check-empty-changeset.mjs"]
PRE-CHANGE verdict after strip: silent

The ablation was passing only because the ledger still contributed two path literals as hints. That ledger is SHRINK-ONLY and reaching zero is its goal, so the sitting that empties it leaves the stripped hint set bare, the residual becomes undetermined, and the case reds over a gate that had not changed at all. The pin was calibrated against a debt ledger designed to disappear. Unreachable in sittings 1-3 — only the sitting that empties the set can hit it.

The fix pins the claim, not the spelling. The ablation exists to prove the subtree declaration is the load-bearing half — i.e. that without it the file is not matched. Both silent and undetermined are not-matched, so both are accepted, spelled as the explicit pair ['silent', 'undetermined'].includes(residual) rather than !== 'matched' so a new verdict value cannot slip through as a pass. The vacuity guard undeclared.hints.length < entry.hints.length is untouched. The case label now says NOT MATCHED instead of silent, and the residual verdict is carried into the failure detail so a future red names what it actually got.

The pin still discriminates — shown, not asserted

Two one-off mutations on the final commit, each proven on disk before running, each restored with git checkout HEAD -- and the restore proven by blob hash plus an empty git diff HEAD:

mutationeffectthis case
A — the strip is a no-op (filter(() => true), subtree hint not stripped)vacuity guard trips✗ RED for check:entry-guardandcheck:parse-guard
B — residual forced to 'matched'the accepted pair rejects it✗ RED for both gates
CONTROL — unmutated✓ GREEN for both gates

So the widened pin still fails when the subtree declaration is not what is doing the work, and still fails on a matched residual. It was not loosened into a tautology.

Gates

Union re-derived at the final commit d11a00a29 (clean working tree) with node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands — provenance names objectstack-ai/objectstack at d11a00a29. The fourth file grew the union from 18 to 20 families: node scripts/check-self-test-wired.mjs and pnpm check:declared-population-live are new, and neither was in the first derivation — re-deriving after the surface widened is what caught them. Exit codes captured by redirect before any pipe.

19 RAN-PASS (exit 0):check:agent-test-spelling · check:bash32-floor · check:changeset-gate-self-tests · check:cli-command-ids · check:cross-package-test-inputs · check:declared-population-live ("158 of 202 famil(ies) declare a path population, and every one of them reaches this tree's 7985 tracked file(s)") · check:entry-guard · check:parse-guard · check:pnpm-filter-targets · check:ratchet-remedy-authority · check:watch-hint-literal · check:pm-dispatch-gates ("✓ dispatch-gates self-test: 1240 cases pass", gate exit 0 — run detached through scripts/pm/os-verify-lock.sh, held 439s, waited 320s) · check-changeset-no-major.mjs · check-ci-filter-parity.mjs · check-cross-package-test-inputs.mjs · check-empty-changeset.mjs · check-self-test-wired.mjs · check-shard-attestation.mjs · pm/bare-root-worklist.mjs --self-test ("none stale, none missing, none contradicted").

1 NOT MEASURED:check-test-completeness.mjs, exit 3 — its own PREREQUISITE NOT MET branch (it grades a saved turbo test log and the family names it with no argument). Its text is explicit that this is not a red, and CI, which tees the log and passes the path, never reaches that branch.

Changeset: none — scripts/** only, no package publishes, so the PR carries skip-changeset.


Generated by Claude Code


Generated by Claude Code

`check-changeset-no-major.mjs` and `check-empty-changeset.mjs` were the final
two entries in the SHRINK-ONLY `KNOWN_IMPORT_UNSAFE` ledger, held back until
the changesets-v3 epic released their file territory.
Both take the inverted 4-line insert, so every existing dispatch branch keeps
its indentation. Measured on this tree before the guards:
- importing `check-changeset-no-major.mjs` for its exports ran the whole
gate inside the importer and then `main()`'s trailing
`process.exit(exitCode)` ended that process mid-import carrying status 0.
The probe never reached the statement after its own `import()`, so a
caller reading the status alone cannot tell it from a clean import.
- importing `check-empty-changeset.mjs` ran the gate and wrote its verdict
to the importer's stdout before returning the exports.
After: both probes return their exports silently, exit 0, no foreign output.
All three CLI modes (default, `--self-test`, `--list`) are byte-identical
before and after on the same tree.
Nothing in the repo imports either file -- every reference in `.github/**`,
`package.json` and `scripts/**` spawns them as `node scripts/...` -- so
neither guard silences a census. That is the sitting-3 `ts-parse.mjs`
inversion check, applied and cleared.
The ledger entries were deleted only after `check:entry-guard` named both
STALE. The set is now empty and its SHRINK-ONLY doc comment is untouched:
that comment is what keeps an empty set empty.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 2, 2026
The ablation strips check:entry-guard's declared subtree hint and asserts the
brand-new-file verdict falls back. Its claim is that the subtree declaration is
the load-bearing half -- i.e. that without it the file is NOT MATCHED -- but it
spelled that as exactly `'silent'`.
`'silent'` was only ever the residual because check-entry-guard.mjs's
KNOWN_IMPORT_UNSAFE roster still contributed two path literals as hints. That
ledger is SHRINK-ONLY and reaching zero is its GOAL, so the sitting that
emptied it left the stripped hint set bare, the residual became
`'undetermined'`, and this case went red over a gate that had not changed at
all. The pin was calibrated against a debt ledger designed to disappear.
Both verdicts are not-matched and either one proves the subtree hint is
load-bearing, so both are accepted -- spelled as an explicit pair rather than
`!== 'matched'`, so a NEW verdict value added later cannot slip through as a
pass. The vacuity guard (`undeclared.hints.length < entry.hints.length`) is
untouched, the case label now says NOT MATCHED rather than 'silent', and the
residual verdict is carried into the failure detail so a future red names what
it actually got.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@baozhoutao
baozhoutao marked this pull request as ready for review September 2, 2026 14:59
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 33655524730 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Test Core (1/6) — 失败步骤: Run this shard's tests

    @objectstack/cli:test: FAIL integration test/run-dev-unbuilt-workspace.e2e.test.ts > the mirror direction: a reader that is never coming back > gives up and exits instead of waiting forever
    ↳ 失败原因: @objectstack/cli:test: AssertionError: expected 'SIGKILL' to be null
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 7 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit a120885Sep 2, 2026
33 of 35 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-10667-entry-guard-ledger-sitting-4 branch September 2, 2026 17:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burn down the 35 scripts/ modules that run on import — the KNOWN_IMPORT_UNSAFE ledger from PR #10665

2 participants

@baozhoutao@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0 - #14593

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4
Sep 2, 2026
Merged

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0#14593
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#10667

Sitting 4, the final sitting of the KNOWN_IMPORT_UNSAFE burn-down. The ledger held exactly the two files the changesets-v3 epic #9465 had fenced; that epic has since completed, releasing them.

Ledger: 2 to 0. Sittings 1-4 across the whole card: 35 to 10 to 5 to 2 to 0.

File surface — four files, the fourth authorized

Three files are the card's own surface. The fourth, scripts/pm/dispatch-gates.mjs, carries a one-pin fix that emptying the ledger makes unavoidable. It was escalated rather than taken, and authorized by the PM decision on the card — comment 5511119817, which widens the surface "for exactly that one pin". See "The pin the empty ledger broke" below.

git diff --stat origin/main...HEAD:

 scripts/check-changeset-no-major.mjs | 24 +++++++++++++++++++++++-
scripts/check-empty-changeset.mjs | 23 ++++++++++++++++++++++-
scripts/check-entry-guard.mjs | 5 +----
scripts/pm/dispatch-gates.mjs | 28 +++++++++++++++++++++-------
4 files changed, 67 insertions(+), 13 deletions(-)

Both gate scripts had one offending top-level statement each — a trailing --self-test / --list / main dispatch chain — so both took the inverted 4-line insert. Zero re-indentation: the only line touched in each chain is its head, which becomes } else if (...) {.

scripts/check-entry-guard.mjs is touched only to delete the two ledger lines; the set becomes new Set([]). Its SHRINK-ONLY doc comment is untouched by design — the sentence "a file this rule newly reaches is a failure with one remedy, never a line in here" is exactly what keeps an empty set empty, and the :800 self-test assertions over the roster hold on an empty set (verified: 54 cases green).

The inversion check (sitting 3's ts-parse.mjs lesson), applied

Before guarding anything, the question sitting 3 raised: does any top-level statement here have to run for an importer?

No — nothing in the repo imports either file. Every reference is a spawn or prose:

  • spawns: .github/workflows/pr-automation.yml (:766-767, :942), cut-rc.yml (:482-483, :492-493), and package.json (check:empty-changeset, check:changeset-gate-self-tests) — all node scripts/..., a child process, unaffected by an import guard.
  • prose only: check-adr-0087-registration.mjs, objectui-changeset-digest.mjs, check-required-contexts.mjs, objectui-range.mjs, pm/dispatch-gates.mjs, check-entry-guard.mjs.
  • a repo-wide grep for an import/import() of either module returns nothing.

So the only statement moved behind isEntrypoint is CLI dispatch, and neither guard silences a census. This is the check that would have caught ts-parse.mjs; here it clears.

What the guards actually fixed — measured, both directions

Import probe: node -e "import('./scripts/NAME.mjs').then(m => console.log('SENTINEL exports:', Object.keys(m).join(',')))".

filebeforeafter
check-changeset-no-major.mjsran the whole gate inside the importer, then main()'s trailing process.exit(exitCode)ended the importer mid-import carrying status 0 — SENTINEL never printed, probe exit 0silent; SENTINEL exports: judge,majorPackagesIn,mergeBase,readChangesets,readPre,render,resolveCommit,scan; exit 0
check-empty-changeset.mjsran the gate and wrote its verdict to the importer's stdout, then returnedsilent; SENTINEL exports: declaredBumpsIn,mergeBase,scan; exit 0

The first is the worst shape in this class, and the one sitting 2 flagged as most dangerous: a silent success is indistinguishable from a clean import to any caller reading the exit status alone.

Zero behaviour change when invoked directly

Re-proven on the final commit d11a00a29 as a same-tree ablation: capture guarded output, revert both scripts to origin/main (pre-guard — isEntrypoint count 0/0 confirmed on disk), capture again, restore with git checkout HEAD --, prove the restore (both blob hashes match HEAD, git diff HEAD empty, guard count back to 3/3), then cmp.

modecheck-changeset-no-majorcheck-empty-changeset
defaultexit 0, byte-identicalexit 0, byte-identical
--self-testexit 0, byte-identical (116 assertions)exit 0, byte-identical (118 assertions)
--listexit 0, byte-identicalexit 0, byte-identical

check:entry-guard after

✓ check:entry-guard: 199 scripts/ file(s) — every entry guard goes through invoked-as.mjs;
150 export bindings, 150 of them inert on import (0 known-unsafe, ⛔ SHRINK-ONLY).

Before this PR that read 148 of them inert on import (2 known-unsafe). The two ledger lines were deleted only after the gate named them STALE — never in the same breath as the guard:

❌ check:entry-guard — 2 stale KNOWN_IMPORT_UNSAFE entry/entries:
scripts/check-changeset-no-major.mjs — no longer runs on import
scripts/check-empty-changeset.mjs — no longer runs on import

The pin the empty ledger broke

Emptying the ledger turned one case in scripts/pm/dispatch-gates.mjs red — the #10784 ablation, which strips check:entry-guard's declared subtree hint and asserts the brand-new-file verdict falls back:

✗ …and it is the subtree declaration doing it: strip it and check:entry-guard goes back to silent

Measured through the tool's own exported discoverFamilies / classifyEntry:

hints NOW: ["scripts/**"]
verdict NOW (full): matched <- the pin above this one still passes
hints after strip: []
verdict after strip: undetermined <- the pin demanded exactly: silent
PRE-CHANGE hints after strip: ["scripts/check-changeset-no-major.mjs",
"scripts/check-empty-changeset.mjs"]
PRE-CHANGE verdict after strip: silent

The ablation was passing only because the ledger still contributed two path literals as hints. That ledger is SHRINK-ONLY and reaching zero is its goal, so the sitting that empties it leaves the stripped hint set bare, the residual becomes undetermined, and the case reds over a gate that had not changed at all. The pin was calibrated against a debt ledger designed to disappear. Unreachable in sittings 1-3 — only the sitting that empties the set can hit it.

The fix pins the claim, not the spelling. The ablation exists to prove the subtree declaration is the load-bearing half — i.e. that without it the file is not matched. Both silent and undetermined are not-matched, so both are accepted, spelled as the explicit pair ['silent', 'undetermined'].includes(residual) rather than !== 'matched' so a new verdict value cannot slip through as a pass. The vacuity guard undeclared.hints.length < entry.hints.length is untouched. The case label now says NOT MATCHED instead of silent, and the residual verdict is carried into the failure detail so a future red names what it actually got.

The pin still discriminates — shown, not asserted

Two one-off mutations on the final commit, each proven on disk before running, each restored with git checkout HEAD -- and the restore proven by blob hash plus an empty git diff HEAD:

mutationeffectthis case
A — the strip is a no-op (filter(() => true), subtree hint not stripped)vacuity guard trips✗ RED for check:entry-guardandcheck:parse-guard
B — residual forced to 'matched'the accepted pair rejects it✗ RED for both gates
CONTROL — unmutated✓ GREEN for both gates

So the widened pin still fails when the subtree declaration is not what is doing the work, and still fails on a matched residual. It was not loosened into a tautology.

Gates

Union re-derived at the final commit d11a00a29 (clean working tree) with node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands — provenance names objectstack-ai/objectstack at d11a00a29. The fourth file grew the union from 18 to 20 families: node scripts/check-self-test-wired.mjs and pnpm check:declared-population-live are new, and neither was in the first derivation — re-deriving after the surface widened is what caught them. Exit codes captured by redirect before any pipe.

19 RAN-PASS (exit 0):check:agent-test-spelling · check:bash32-floor · check:changeset-gate-self-tests · check:cli-command-ids · check:cross-package-test-inputs · check:declared-population-live ("158 of 202 famil(ies) declare a path population, and every one of them reaches this tree's 7985 tracked file(s)") · check:entry-guard · check:parse-guard · check:pnpm-filter-targets · check:ratchet-remedy-authority · check:watch-hint-literal · check:pm-dispatch-gates ("✓ dispatch-gates self-test: 1240 cases pass", gate exit 0 — run detached through scripts/pm/os-verify-lock.sh, held 439s, waited 320s) · check-changeset-no-major.mjs · check-ci-filter-parity.mjs · check-cross-package-test-inputs.mjs · check-empty-changeset.mjs · check-self-test-wired.mjs · check-shard-attestation.mjs · pm/bare-root-worklist.mjs --self-test ("none stale, none missing, none contradicted").

1 NOT MEASURED:check-test-completeness.mjs, exit 3 — its own PREREQUISITE NOT MET branch (it grades a saved turbo test log and the family names it with no argument). Its text is explicit that this is not a red, and CI, which tees the log and passes the path, never reaches that branch.

Changeset: none — scripts/** only, no package publishes, so the PR carries skip-changeset.


Generated by Claude Code


Generated by Claude Code

`check-changeset-no-major.mjs` and `check-empty-changeset.mjs` were the final
two entries in the SHRINK-ONLY `KNOWN_IMPORT_UNSAFE` ledger, held back until
the changesets-v3 epic released their file territory.
Both take the inverted 4-line insert, so every existing dispatch branch keeps
its indentation. Measured on this tree before the guards:
- importing `check-changeset-no-major.mjs` for its exports ran the whole
gate inside the importer and then `main()`'s trailing
`process.exit(exitCode)` ended that process mid-import carrying status 0.
The probe never reached the statement after its own `import()`, so a
caller reading the status alone cannot tell it from a clean import.
- importing `check-empty-changeset.mjs` ran the gate and wrote its verdict
to the importer's stdout before returning the exports.
After: both probes return their exports silently, exit 0, no foreign output.
All three CLI modes (default, `--self-test`, `--list`) are byte-identical
before and after on the same tree.
Nothing in the repo imports either file -- every reference in `.github/**`,
`package.json` and `scripts/**` spawns them as `node scripts/...` -- so
neither guard silences a census. That is the sitting-3 `ts-parse.mjs`
inversion check, applied and cleared.
The ledger entries were deleted only after `check:entry-guard` named both
STALE. The set is now empty and its SHRINK-ONLY doc comment is untouched:
that comment is what keeps an empty set empty.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 2, 2026
The ablation strips check:entry-guard's declared subtree hint and asserts the
brand-new-file verdict falls back. Its claim is that the subtree declaration is
the load-bearing half -- i.e. that without it the file is NOT MATCHED -- but it
spelled that as exactly `'silent'`.
`'silent'` was only ever the residual because check-entry-guard.mjs's
KNOWN_IMPORT_UNSAFE roster still contributed two path literals as hints. That
ledger is SHRINK-ONLY and reaching zero is its GOAL, so the sitting that
emptied it left the stripped hint set bare, the residual became
`'undetermined'`, and this case went red over a gate that had not changed at
all. The pin was calibrated against a debt ledger designed to disappear.
Both verdicts are not-matched and either one proves the subtree hint is
load-bearing, so both are accepted -- spelled as an explicit pair rather than
`!== 'matched'`, so a NEW verdict value added later cannot slip through as a
pass. The vacuity guard (`undeclared.hints.length < entry.hints.length`) is
untouched, the case label now says NOT MATCHED rather than 'silent', and the
residual verdict is carried into the failure detail so a future red names what
it actually got.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@baozhoutao
baozhoutao marked this pull request as ready for review September 2, 2026 14:59
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 33655524730 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Test Core (1/6) — 失败步骤: Run this shard's tests

    @objectstack/cli:test: FAIL integration test/run-dev-unbuilt-workspace.e2e.test.ts > the mirror direction: a reader that is never coming back > gives up and exits instead of waiting forever
    ↳ 失败原因: @objectstack/cli:test: AssertionError: expected 'SIGKILL' to be null
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 7 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit a120885Sep 2, 2026
33 of 35 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-10667-entry-guard-ledger-sitting-4 branch September 2, 2026 17:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burn down the 35 scripts/ modules that run on import — the KNOWN_IMPORT_UNSAFE ledger from PR #10665

2 participants

@baozhoutao@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0 - #14593

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4
Sep 2, 2026
Merged

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0#14593
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#10667

Sitting 4, the final sitting of the KNOWN_IMPORT_UNSAFE burn-down. The ledger held exactly the two files the changesets-v3 epic #9465 had fenced; that epic has since completed, releasing them.

Ledger: 2 to 0. Sittings 1-4 across the whole card: 35 to 10 to 5 to 2 to 0.

File surface — four files, the fourth authorized

Three files are the card's own surface. The fourth, scripts/pm/dispatch-gates.mjs, carries a one-pin fix that emptying the ledger makes unavoidable. It was escalated rather than taken, and authorized by the PM decision on the card — comment 5511119817, which widens the surface "for exactly that one pin". See "The pin the empty ledger broke" below.

git diff --stat origin/main...HEAD:

 scripts/check-changeset-no-major.mjs | 24 +++++++++++++++++++++++-
scripts/check-empty-changeset.mjs | 23 ++++++++++++++++++++++-
scripts/check-entry-guard.mjs | 5 +----
scripts/pm/dispatch-gates.mjs | 28 +++++++++++++++++++++-------
4 files changed, 67 insertions(+), 13 deletions(-)

Both gate scripts had one offending top-level statement each — a trailing --self-test / --list / main dispatch chain — so both took the inverted 4-line insert. Zero re-indentation: the only line touched in each chain is its head, which becomes } else if (...) {.

scripts/check-entry-guard.mjs is touched only to delete the two ledger lines; the set becomes new Set([]). Its SHRINK-ONLY doc comment is untouched by design — the sentence "a file this rule newly reaches is a failure with one remedy, never a line in here" is exactly what keeps an empty set empty, and the :800 self-test assertions over the roster hold on an empty set (verified: 54 cases green).

The inversion check (sitting 3's ts-parse.mjs lesson), applied

Before guarding anything, the question sitting 3 raised: does any top-level statement here have to run for an importer?

No — nothing in the repo imports either file. Every reference is a spawn or prose:

  • spawns: .github/workflows/pr-automation.yml (:766-767, :942), cut-rc.yml (:482-483, :492-493), and package.json (check:empty-changeset, check:changeset-gate-self-tests) — all node scripts/..., a child process, unaffected by an import guard.
  • prose only: check-adr-0087-registration.mjs, objectui-changeset-digest.mjs, check-required-contexts.mjs, objectui-range.mjs, pm/dispatch-gates.mjs, check-entry-guard.mjs.
  • a repo-wide grep for an import/import() of either module returns nothing.

So the only statement moved behind isEntrypoint is CLI dispatch, and neither guard silences a census. This is the check that would have caught ts-parse.mjs; here it clears.

What the guards actually fixed — measured, both directions

Import probe: node -e "import('./scripts/NAME.mjs').then(m => console.log('SENTINEL exports:', Object.keys(m).join(',')))".

filebeforeafter
check-changeset-no-major.mjsran the whole gate inside the importer, then main()'s trailing process.exit(exitCode)ended the importer mid-import carrying status 0 — SENTINEL never printed, probe exit 0silent; SENTINEL exports: judge,majorPackagesIn,mergeBase,readChangesets,readPre,render,resolveCommit,scan; exit 0
check-empty-changeset.mjsran the gate and wrote its verdict to the importer's stdout, then returnedsilent; SENTINEL exports: declaredBumpsIn,mergeBase,scan; exit 0

The first is the worst shape in this class, and the one sitting 2 flagged as most dangerous: a silent success is indistinguishable from a clean import to any caller reading the exit status alone.

Zero behaviour change when invoked directly

Re-proven on the final commit d11a00a29 as a same-tree ablation: capture guarded output, revert both scripts to origin/main (pre-guard — isEntrypoint count 0/0 confirmed on disk), capture again, restore with git checkout HEAD --, prove the restore (both blob hashes match HEAD, git diff HEAD empty, guard count back to 3/3), then cmp.

modecheck-changeset-no-majorcheck-empty-changeset
defaultexit 0, byte-identicalexit 0, byte-identical
--self-testexit 0, byte-identical (116 assertions)exit 0, byte-identical (118 assertions)
--listexit 0, byte-identicalexit 0, byte-identical

check:entry-guard after

✓ check:entry-guard: 199 scripts/ file(s) — every entry guard goes through invoked-as.mjs;
150 export bindings, 150 of them inert on import (0 known-unsafe, ⛔ SHRINK-ONLY).

Before this PR that read 148 of them inert on import (2 known-unsafe). The two ledger lines were deleted only after the gate named them STALE — never in the same breath as the guard:

❌ check:entry-guard — 2 stale KNOWN_IMPORT_UNSAFE entry/entries:
scripts/check-changeset-no-major.mjs — no longer runs on import
scripts/check-empty-changeset.mjs — no longer runs on import

The pin the empty ledger broke

Emptying the ledger turned one case in scripts/pm/dispatch-gates.mjs red — the #10784 ablation, which strips check:entry-guard's declared subtree hint and asserts the brand-new-file verdict falls back:

✗ …and it is the subtree declaration doing it: strip it and check:entry-guard goes back to silent

Measured through the tool's own exported discoverFamilies / classifyEntry:

hints NOW: ["scripts/**"]
verdict NOW (full): matched <- the pin above this one still passes
hints after strip: []
verdict after strip: undetermined <- the pin demanded exactly: silent
PRE-CHANGE hints after strip: ["scripts/check-changeset-no-major.mjs",
"scripts/check-empty-changeset.mjs"]
PRE-CHANGE verdict after strip: silent

The ablation was passing only because the ledger still contributed two path literals as hints. That ledger is SHRINK-ONLY and reaching zero is its goal, so the sitting that empties it leaves the stripped hint set bare, the residual becomes undetermined, and the case reds over a gate that had not changed at all. The pin was calibrated against a debt ledger designed to disappear. Unreachable in sittings 1-3 — only the sitting that empties the set can hit it.

The fix pins the claim, not the spelling. The ablation exists to prove the subtree declaration is the load-bearing half — i.e. that without it the file is not matched. Both silent and undetermined are not-matched, so both are accepted, spelled as the explicit pair ['silent', 'undetermined'].includes(residual) rather than !== 'matched' so a new verdict value cannot slip through as a pass. The vacuity guard undeclared.hints.length < entry.hints.length is untouched. The case label now says NOT MATCHED instead of silent, and the residual verdict is carried into the failure detail so a future red names what it actually got.

The pin still discriminates — shown, not asserted

Two one-off mutations on the final commit, each proven on disk before running, each restored with git checkout HEAD -- and the restore proven by blob hash plus an empty git diff HEAD:

mutationeffectthis case
A — the strip is a no-op (filter(() => true), subtree hint not stripped)vacuity guard trips✗ RED for check:entry-guardandcheck:parse-guard
B — residual forced to 'matched'the accepted pair rejects it✗ RED for both gates
CONTROL — unmutated✓ GREEN for both gates

So the widened pin still fails when the subtree declaration is not what is doing the work, and still fails on a matched residual. It was not loosened into a tautology.

Gates

Union re-derived at the final commit d11a00a29 (clean working tree) with node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands — provenance names objectstack-ai/objectstack at d11a00a29. The fourth file grew the union from 18 to 20 families: node scripts/check-self-test-wired.mjs and pnpm check:declared-population-live are new, and neither was in the first derivation — re-deriving after the surface widened is what caught them. Exit codes captured by redirect before any pipe.

19 RAN-PASS (exit 0):check:agent-test-spelling · check:bash32-floor · check:changeset-gate-self-tests · check:cli-command-ids · check:cross-package-test-inputs · check:declared-population-live ("158 of 202 famil(ies) declare a path population, and every one of them reaches this tree's 7985 tracked file(s)") · check:entry-guard · check:parse-guard · check:pnpm-filter-targets · check:ratchet-remedy-authority · check:watch-hint-literal · check:pm-dispatch-gates ("✓ dispatch-gates self-test: 1240 cases pass", gate exit 0 — run detached through scripts/pm/os-verify-lock.sh, held 439s, waited 320s) · check-changeset-no-major.mjs · check-ci-filter-parity.mjs · check-cross-package-test-inputs.mjs · check-empty-changeset.mjs · check-self-test-wired.mjs · check-shard-attestation.mjs · pm/bare-root-worklist.mjs --self-test ("none stale, none missing, none contradicted").

1 NOT MEASURED:check-test-completeness.mjs, exit 3 — its own PREREQUISITE NOT MET branch (it grades a saved turbo test log and the family names it with no argument). Its text is explicit that this is not a red, and CI, which tees the log and passes the path, never reaches that branch.

Changeset: none — scripts/** only, no package publishes, so the PR carries skip-changeset.


Generated by Claude Code


Generated by Claude Code

`check-changeset-no-major.mjs` and `check-empty-changeset.mjs` were the final
two entries in the SHRINK-ONLY `KNOWN_IMPORT_UNSAFE` ledger, held back until
the changesets-v3 epic released their file territory.
Both take the inverted 4-line insert, so every existing dispatch branch keeps
its indentation. Measured on this tree before the guards:
- importing `check-changeset-no-major.mjs` for its exports ran the whole
gate inside the importer and then `main()`'s trailing
`process.exit(exitCode)` ended that process mid-import carrying status 0.
The probe never reached the statement after its own `import()`, so a
caller reading the status alone cannot tell it from a clean import.
- importing `check-empty-changeset.mjs` ran the gate and wrote its verdict
to the importer's stdout before returning the exports.
After: both probes return their exports silently, exit 0, no foreign output.
All three CLI modes (default, `--self-test`, `--list`) are byte-identical
before and after on the same tree.
Nothing in the repo imports either file -- every reference in `.github/**`,
`package.json` and `scripts/**` spawns them as `node scripts/...` -- so
neither guard silences a census. That is the sitting-3 `ts-parse.mjs`
inversion check, applied and cleared.
The ledger entries were deleted only after `check:entry-guard` named both
STALE. The set is now empty and its SHRINK-ONLY doc comment is untouched:
that comment is what keeps an empty set empty.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 2, 2026
The ablation strips check:entry-guard's declared subtree hint and asserts the
brand-new-file verdict falls back. Its claim is that the subtree declaration is
the load-bearing half -- i.e. that without it the file is NOT MATCHED -- but it
spelled that as exactly `'silent'`.
`'silent'` was only ever the residual because check-entry-guard.mjs's
KNOWN_IMPORT_UNSAFE roster still contributed two path literals as hints. That
ledger is SHRINK-ONLY and reaching zero is its GOAL, so the sitting that
emptied it left the stripped hint set bare, the residual became
`'undetermined'`, and this case went red over a gate that had not changed at
all. The pin was calibrated against a debt ledger designed to disappear.
Both verdicts are not-matched and either one proves the subtree hint is
load-bearing, so both are accepted -- spelled as an explicit pair rather than
`!== 'matched'`, so a NEW verdict value added later cannot slip through as a
pass. The vacuity guard (`undeclared.hints.length < entry.hints.length`) is
untouched, the case label now says NOT MATCHED rather than 'silent', and the
residual verdict is carried into the failure detail so a future red names what
it actually got.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@baozhoutao
baozhoutao marked this pull request as ready for review September 2, 2026 14:59
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 33655524730 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Test Core (1/6) — 失败步骤: Run this shard's tests

    @objectstack/cli:test: FAIL integration test/run-dev-unbuilt-workspace.e2e.test.ts > the mirror direction: a reader that is never coming back > gives up and exits instead of waiting forever
    ↳ 失败原因: @objectstack/cli:test: AssertionError: expected 'SIGKILL' to be null
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 7 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit a120885Sep 2, 2026
33 of 35 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-10667-entry-guard-ledger-sitting-4 branch September 2, 2026 17:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burn down the 35 scripts/ modules that run on import — the KNOWN_IMPORT_UNSAFE ledger from PR #10665

2 participants

@baozhoutao@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0 - #14593

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4
Sep 2, 2026
Merged

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0#14593
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#10667

Sitting 4, the final sitting of the KNOWN_IMPORT_UNSAFE burn-down. The ledger held exactly the two files the changesets-v3 epic #9465 had fenced; that epic has since completed, releasing them.

Ledger: 2 to 0. Sittings 1-4 across the whole card: 35 to 10 to 5 to 2 to 0.

File surface — four files, the fourth authorized

Three files are the card's own surface. The fourth, scripts/pm/dispatch-gates.mjs, carries a one-pin fix that emptying the ledger makes unavoidable. It was escalated rather than taken, and authorized by the PM decision on the card — comment 5511119817, which widens the surface "for exactly that one pin". See "The pin the empty ledger broke" below.

git diff --stat origin/main...HEAD:

 scripts/check-changeset-no-major.mjs | 24 +++++++++++++++++++++++-
scripts/check-empty-changeset.mjs | 23 ++++++++++++++++++++++-
scripts/check-entry-guard.mjs | 5 +----
scripts/pm/dispatch-gates.mjs | 28 +++++++++++++++++++++-------
4 files changed, 67 insertions(+), 13 deletions(-)

Both gate scripts had one offending top-level statement each — a trailing --self-test / --list / main dispatch chain — so both took the inverted 4-line insert. Zero re-indentation: the only line touched in each chain is its head, which becomes } else if (...) {.

scripts/check-entry-guard.mjs is touched only to delete the two ledger lines; the set becomes new Set([]). Its SHRINK-ONLY doc comment is untouched by design — the sentence "a file this rule newly reaches is a failure with one remedy, never a line in here" is exactly what keeps an empty set empty, and the :800 self-test assertions over the roster hold on an empty set (verified: 54 cases green).

The inversion check (sitting 3's ts-parse.mjs lesson), applied

Before guarding anything, the question sitting 3 raised: does any top-level statement here have to run for an importer?

No — nothing in the repo imports either file. Every reference is a spawn or prose:

  • spawns: .github/workflows/pr-automation.yml (:766-767, :942), cut-rc.yml (:482-483, :492-493), and package.json (check:empty-changeset, check:changeset-gate-self-tests) — all node scripts/..., a child process, unaffected by an import guard.
  • prose only: check-adr-0087-registration.mjs, objectui-changeset-digest.mjs, check-required-contexts.mjs, objectui-range.mjs, pm/dispatch-gates.mjs, check-entry-guard.mjs.
  • a repo-wide grep for an import/import() of either module returns nothing.

So the only statement moved behind isEntrypoint is CLI dispatch, and neither guard silences a census. This is the check that would have caught ts-parse.mjs; here it clears.

What the guards actually fixed — measured, both directions

Import probe: node -e "import('./scripts/NAME.mjs').then(m => console.log('SENTINEL exports:', Object.keys(m).join(',')))".

filebeforeafter
check-changeset-no-major.mjsran the whole gate inside the importer, then main()'s trailing process.exit(exitCode)ended the importer mid-import carrying status 0 — SENTINEL never printed, probe exit 0silent; SENTINEL exports: judge,majorPackagesIn,mergeBase,readChangesets,readPre,render,resolveCommit,scan; exit 0
check-empty-changeset.mjsran the gate and wrote its verdict to the importer's stdout, then returnedsilent; SENTINEL exports: declaredBumpsIn,mergeBase,scan; exit 0

The first is the worst shape in this class, and the one sitting 2 flagged as most dangerous: a silent success is indistinguishable from a clean import to any caller reading the exit status alone.

Zero behaviour change when invoked directly

Re-proven on the final commit d11a00a29 as a same-tree ablation: capture guarded output, revert both scripts to origin/main (pre-guard — isEntrypoint count 0/0 confirmed on disk), capture again, restore with git checkout HEAD --, prove the restore (both blob hashes match HEAD, git diff HEAD empty, guard count back to 3/3), then cmp.

modecheck-changeset-no-majorcheck-empty-changeset
defaultexit 0, byte-identicalexit 0, byte-identical
--self-testexit 0, byte-identical (116 assertions)exit 0, byte-identical (118 assertions)
--listexit 0, byte-identicalexit 0, byte-identical

check:entry-guard after

✓ check:entry-guard: 199 scripts/ file(s) — every entry guard goes through invoked-as.mjs;
150 export bindings, 150 of them inert on import (0 known-unsafe, ⛔ SHRINK-ONLY).

Before this PR that read 148 of them inert on import (2 known-unsafe). The two ledger lines were deleted only after the gate named them STALE — never in the same breath as the guard:

❌ check:entry-guard — 2 stale KNOWN_IMPORT_UNSAFE entry/entries:
scripts/check-changeset-no-major.mjs — no longer runs on import
scripts/check-empty-changeset.mjs — no longer runs on import

The pin the empty ledger broke

Emptying the ledger turned one case in scripts/pm/dispatch-gates.mjs red — the #10784 ablation, which strips check:entry-guard's declared subtree hint and asserts the brand-new-file verdict falls back:

✗ …and it is the subtree declaration doing it: strip it and check:entry-guard goes back to silent

Measured through the tool's own exported discoverFamilies / classifyEntry:

hints NOW: ["scripts/**"]
verdict NOW (full): matched <- the pin above this one still passes
hints after strip: []
verdict after strip: undetermined <- the pin demanded exactly: silent
PRE-CHANGE hints after strip: ["scripts/check-changeset-no-major.mjs",
"scripts/check-empty-changeset.mjs"]
PRE-CHANGE verdict after strip: silent

The ablation was passing only because the ledger still contributed two path literals as hints. That ledger is SHRINK-ONLY and reaching zero is its goal, so the sitting that empties it leaves the stripped hint set bare, the residual becomes undetermined, and the case reds over a gate that had not changed at all. The pin was calibrated against a debt ledger designed to disappear. Unreachable in sittings 1-3 — only the sitting that empties the set can hit it.

The fix pins the claim, not the spelling. The ablation exists to prove the subtree declaration is the load-bearing half — i.e. that without it the file is not matched. Both silent and undetermined are not-matched, so both are accepted, spelled as the explicit pair ['silent', 'undetermined'].includes(residual) rather than !== 'matched' so a new verdict value cannot slip through as a pass. The vacuity guard undeclared.hints.length < entry.hints.length is untouched. The case label now says NOT MATCHED instead of silent, and the residual verdict is carried into the failure detail so a future red names what it actually got.

The pin still discriminates — shown, not asserted

Two one-off mutations on the final commit, each proven on disk before running, each restored with git checkout HEAD -- and the restore proven by blob hash plus an empty git diff HEAD:

mutationeffectthis case
A — the strip is a no-op (filter(() => true), subtree hint not stripped)vacuity guard trips✗ RED for check:entry-guardandcheck:parse-guard
B — residual forced to 'matched'the accepted pair rejects it✗ RED for both gates
CONTROL — unmutated✓ GREEN for both gates

So the widened pin still fails when the subtree declaration is not what is doing the work, and still fails on a matched residual. It was not loosened into a tautology.

Gates

Union re-derived at the final commit d11a00a29 (clean working tree) with node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands — provenance names objectstack-ai/objectstack at d11a00a29. The fourth file grew the union from 18 to 20 families: node scripts/check-self-test-wired.mjs and pnpm check:declared-population-live are new, and neither was in the first derivation — re-deriving after the surface widened is what caught them. Exit codes captured by redirect before any pipe.

19 RAN-PASS (exit 0):check:agent-test-spelling · check:bash32-floor · check:changeset-gate-self-tests · check:cli-command-ids · check:cross-package-test-inputs · check:declared-population-live ("158 of 202 famil(ies) declare a path population, and every one of them reaches this tree's 7985 tracked file(s)") · check:entry-guard · check:parse-guard · check:pnpm-filter-targets · check:ratchet-remedy-authority · check:watch-hint-literal · check:pm-dispatch-gates ("✓ dispatch-gates self-test: 1240 cases pass", gate exit 0 — run detached through scripts/pm/os-verify-lock.sh, held 439s, waited 320s) · check-changeset-no-major.mjs · check-ci-filter-parity.mjs · check-cross-package-test-inputs.mjs · check-empty-changeset.mjs · check-self-test-wired.mjs · check-shard-attestation.mjs · pm/bare-root-worklist.mjs --self-test ("none stale, none missing, none contradicted").

1 NOT MEASURED:check-test-completeness.mjs, exit 3 — its own PREREQUISITE NOT MET branch (it grades a saved turbo test log and the family names it with no argument). Its text is explicit that this is not a red, and CI, which tees the log and passes the path, never reaches that branch.

Changeset: none — scripts/** only, no package publishes, so the PR carries skip-changeset.


Generated by Claude Code


Generated by Claude Code

`check-changeset-no-major.mjs` and `check-empty-changeset.mjs` were the final
two entries in the SHRINK-ONLY `KNOWN_IMPORT_UNSAFE` ledger, held back until
the changesets-v3 epic released their file territory.
Both take the inverted 4-line insert, so every existing dispatch branch keeps
its indentation. Measured on this tree before the guards:
- importing `check-changeset-no-major.mjs` for its exports ran the whole
gate inside the importer and then `main()`'s trailing
`process.exit(exitCode)` ended that process mid-import carrying status 0.
The probe never reached the statement after its own `import()`, so a
caller reading the status alone cannot tell it from a clean import.
- importing `check-empty-changeset.mjs` ran the gate and wrote its verdict
to the importer's stdout before returning the exports.
After: both probes return their exports silently, exit 0, no foreign output.
All three CLI modes (default, `--self-test`, `--list`) are byte-identical
before and after on the same tree.
Nothing in the repo imports either file -- every reference in `.github/**`,
`package.json` and `scripts/**` spawns them as `node scripts/...` -- so
neither guard silences a census. That is the sitting-3 `ts-parse.mjs`
inversion check, applied and cleared.
The ledger entries were deleted only after `check:entry-guard` named both
STALE. The set is now empty and its SHRINK-ONLY doc comment is untouched:
that comment is what keeps an empty set empty.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 2, 2026
The ablation strips check:entry-guard's declared subtree hint and asserts the
brand-new-file verdict falls back. Its claim is that the subtree declaration is
the load-bearing half -- i.e. that without it the file is NOT MATCHED -- but it
spelled that as exactly `'silent'`.
`'silent'` was only ever the residual because check-entry-guard.mjs's
KNOWN_IMPORT_UNSAFE roster still contributed two path literals as hints. That
ledger is SHRINK-ONLY and reaching zero is its GOAL, so the sitting that
emptied it left the stripped hint set bare, the residual became
`'undetermined'`, and this case went red over a gate that had not changed at
all. The pin was calibrated against a debt ledger designed to disappear.
Both verdicts are not-matched and either one proves the subtree hint is
load-bearing, so both are accepted -- spelled as an explicit pair rather than
`!== 'matched'`, so a NEW verdict value added later cannot slip through as a
pass. The vacuity guard (`undeclared.hints.length < entry.hints.length`) is
untouched, the case label now says NOT MATCHED rather than 'silent', and the
residual verdict is carried into the failure detail so a future red names what
it actually got.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@baozhoutao
baozhoutao marked this pull request as ready for review September 2, 2026 14:59
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 33655524730 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Test Core (1/6) — 失败步骤: Run this shard's tests

    @objectstack/cli:test: FAIL integration test/run-dev-unbuilt-workspace.e2e.test.ts > the mirror direction: a reader that is never coming back > gives up and exits instead of waiting forever
    ↳ 失败原因: @objectstack/cli:test: AssertionError: expected 'SIGKILL' to be null
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 7 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit a120885Sep 2, 2026
33 of 35 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-10667-entry-guard-ledger-sitting-4 branch September 2, 2026 17:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burn down the 35 scripts/ modules that run on import — the KNOWN_IMPORT_UNSAFE ledger from PR #10665

2 participants

@baozhoutao@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0 - #14593

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4
Sep 2, 2026
Merged

fix(devx): guard the last two run-on-import gate scripts — KNOWN_IMPORT_UNSAFE 2 to 0#14593
baozhoutao merged 3 commits into
mainfrom
claude/issue-10667-entry-guard-ledger-sitting-4

Conversation

@claude

@claudeclaudeBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes#10667

Sitting 4, the final sitting of the KNOWN_IMPORT_UNSAFE burn-down. The ledger held exactly the two files the changesets-v3 epic #9465 had fenced; that epic has since completed, releasing them.

Ledger: 2 to 0. Sittings 1-4 across the whole card: 35 to 10 to 5 to 2 to 0.

File surface — four files, the fourth authorized

Three files are the card's own surface. The fourth, scripts/pm/dispatch-gates.mjs, carries a one-pin fix that emptying the ledger makes unavoidable. It was escalated rather than taken, and authorized by the PM decision on the card — comment 5511119817, which widens the surface "for exactly that one pin". See "The pin the empty ledger broke" below.

git diff --stat origin/main...HEAD:

 scripts/check-changeset-no-major.mjs | 24 +++++++++++++++++++++++-
scripts/check-empty-changeset.mjs | 23 ++++++++++++++++++++++-
scripts/check-entry-guard.mjs | 5 +----
scripts/pm/dispatch-gates.mjs | 28 +++++++++++++++++++++-------
4 files changed, 67 insertions(+), 13 deletions(-)

Both gate scripts had one offending top-level statement each — a trailing --self-test / --list / main dispatch chain — so both took the inverted 4-line insert. Zero re-indentation: the only line touched in each chain is its head, which becomes } else if (...) {.

scripts/check-entry-guard.mjs is touched only to delete the two ledger lines; the set becomes new Set([]). Its SHRINK-ONLY doc comment is untouched by design — the sentence "a file this rule newly reaches is a failure with one remedy, never a line in here" is exactly what keeps an empty set empty, and the :800 self-test assertions over the roster hold on an empty set (verified: 54 cases green).

The inversion check (sitting 3's ts-parse.mjs lesson), applied

Before guarding anything, the question sitting 3 raised: does any top-level statement here have to run for an importer?

No — nothing in the repo imports either file. Every reference is a spawn or prose:

  • spawns: .github/workflows/pr-automation.yml (:766-767, :942), cut-rc.yml (:482-483, :492-493), and package.json (check:empty-changeset, check:changeset-gate-self-tests) — all node scripts/..., a child process, unaffected by an import guard.
  • prose only: check-adr-0087-registration.mjs, objectui-changeset-digest.mjs, check-required-contexts.mjs, objectui-range.mjs, pm/dispatch-gates.mjs, check-entry-guard.mjs.
  • a repo-wide grep for an import/import() of either module returns nothing.

So the only statement moved behind isEntrypoint is CLI dispatch, and neither guard silences a census. This is the check that would have caught ts-parse.mjs; here it clears.

What the guards actually fixed — measured, both directions

Import probe: node -e "import('./scripts/NAME.mjs').then(m => console.log('SENTINEL exports:', Object.keys(m).join(',')))".

filebeforeafter
check-changeset-no-major.mjsran the whole gate inside the importer, then main()'s trailing process.exit(exitCode)ended the importer mid-import carrying status 0 — SENTINEL never printed, probe exit 0silent; SENTINEL exports: judge,majorPackagesIn,mergeBase,readChangesets,readPre,render,resolveCommit,scan; exit 0
check-empty-changeset.mjsran the gate and wrote its verdict to the importer's stdout, then returnedsilent; SENTINEL exports: declaredBumpsIn,mergeBase,scan; exit 0

The first is the worst shape in this class, and the one sitting 2 flagged as most dangerous: a silent success is indistinguishable from a clean import to any caller reading the exit status alone.

Zero behaviour change when invoked directly

Re-proven on the final commit d11a00a29 as a same-tree ablation: capture guarded output, revert both scripts to origin/main (pre-guard — isEntrypoint count 0/0 confirmed on disk), capture again, restore with git checkout HEAD --, prove the restore (both blob hashes match HEAD, git diff HEAD empty, guard count back to 3/3), then cmp.

modecheck-changeset-no-majorcheck-empty-changeset
defaultexit 0, byte-identicalexit 0, byte-identical
--self-testexit 0, byte-identical (116 assertions)exit 0, byte-identical (118 assertions)
--listexit 0, byte-identicalexit 0, byte-identical

check:entry-guard after

✓ check:entry-guard: 199 scripts/ file(s) — every entry guard goes through invoked-as.mjs;
150 export bindings, 150 of them inert on import (0 known-unsafe, ⛔ SHRINK-ONLY).

Before this PR that read 148 of them inert on import (2 known-unsafe). The two ledger lines were deleted only after the gate named them STALE — never in the same breath as the guard:

❌ check:entry-guard — 2 stale KNOWN_IMPORT_UNSAFE entry/entries:
scripts/check-changeset-no-major.mjs — no longer runs on import
scripts/check-empty-changeset.mjs — no longer runs on import

The pin the empty ledger broke

Emptying the ledger turned one case in scripts/pm/dispatch-gates.mjs red — the #10784 ablation, which strips check:entry-guard's declared subtree hint and asserts the brand-new-file verdict falls back:

✗ …and it is the subtree declaration doing it: strip it and check:entry-guard goes back to silent

Measured through the tool's own exported discoverFamilies / classifyEntry:

hints NOW: ["scripts/**"]
verdict NOW (full): matched <- the pin above this one still passes
hints after strip: []
verdict after strip: undetermined <- the pin demanded exactly: silent
PRE-CHANGE hints after strip: ["scripts/check-changeset-no-major.mjs",
"scripts/check-empty-changeset.mjs"]
PRE-CHANGE verdict after strip: silent

The ablation was passing only because the ledger still contributed two path literals as hints. That ledger is SHRINK-ONLY and reaching zero is its goal, so the sitting that empties it leaves the stripped hint set bare, the residual becomes undetermined, and the case reds over a gate that had not changed at all. The pin was calibrated against a debt ledger designed to disappear. Unreachable in sittings 1-3 — only the sitting that empties the set can hit it.

The fix pins the claim, not the spelling. The ablation exists to prove the subtree declaration is the load-bearing half — i.e. that without it the file is not matched. Both silent and undetermined are not-matched, so both are accepted, spelled as the explicit pair ['silent', 'undetermined'].includes(residual) rather than !== 'matched' so a new verdict value cannot slip through as a pass. The vacuity guard undeclared.hints.length < entry.hints.length is untouched. The case label now says NOT MATCHED instead of silent, and the residual verdict is carried into the failure detail so a future red names what it actually got.

The pin still discriminates — shown, not asserted

Two one-off mutations on the final commit, each proven on disk before running, each restored with git checkout HEAD -- and the restore proven by blob hash plus an empty git diff HEAD:

mutationeffectthis case
A — the strip is a no-op (filter(() => true), subtree hint not stripped)vacuity guard trips✗ RED for check:entry-guardandcheck:parse-guard
B — residual forced to 'matched'the accepted pair rejects it✗ RED for both gates
CONTROL — unmutated✓ GREEN for both gates

So the widened pin still fails when the subtree declaration is not what is doing the work, and still fails on a matched residual. It was not loosened into a tautology.

Gates

Union re-derived at the final commit d11a00a29 (clean working tree) with node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands — provenance names objectstack-ai/objectstack at d11a00a29. The fourth file grew the union from 18 to 20 families: node scripts/check-self-test-wired.mjs and pnpm check:declared-population-live are new, and neither was in the first derivation — re-deriving after the surface widened is what caught them. Exit codes captured by redirect before any pipe.

19 RAN-PASS (exit 0):check:agent-test-spelling · check:bash32-floor · check:changeset-gate-self-tests · check:cli-command-ids · check:cross-package-test-inputs · check:declared-population-live ("158 of 202 famil(ies) declare a path population, and every one of them reaches this tree's 7985 tracked file(s)") · check:entry-guard · check:parse-guard · check:pnpm-filter-targets · check:ratchet-remedy-authority · check:watch-hint-literal · check:pm-dispatch-gates ("✓ dispatch-gates self-test: 1240 cases pass", gate exit 0 — run detached through scripts/pm/os-verify-lock.sh, held 439s, waited 320s) · check-changeset-no-major.mjs · check-ci-filter-parity.mjs · check-cross-package-test-inputs.mjs · check-empty-changeset.mjs · check-self-test-wired.mjs · check-shard-attestation.mjs · pm/bare-root-worklist.mjs --self-test ("none stale, none missing, none contradicted").

1 NOT MEASURED:check-test-completeness.mjs, exit 3 — its own PREREQUISITE NOT MET branch (it grades a saved turbo test log and the family names it with no argument). Its text is explicit that this is not a red, and CI, which tees the log and passes the path, never reaches that branch.

Changeset: none — scripts/** only, no package publishes, so the PR carries skip-changeset.


Generated by Claude Code


Generated by Claude Code

`check-changeset-no-major.mjs` and `check-empty-changeset.mjs` were the final
two entries in the SHRINK-ONLY `KNOWN_IMPORT_UNSAFE` ledger, held back until
the changesets-v3 epic released their file territory.
Both take the inverted 4-line insert, so every existing dispatch branch keeps
its indentation. Measured on this tree before the guards:
- importing `check-changeset-no-major.mjs` for its exports ran the whole
gate inside the importer and then `main()`'s trailing
`process.exit(exitCode)` ended that process mid-import carrying status 0.
The probe never reached the statement after its own `import()`, so a
caller reading the status alone cannot tell it from a clean import.
- importing `check-empty-changeset.mjs` ran the gate and wrote its verdict
to the importer's stdout before returning the exports.
After: both probes return their exports silently, exit 0, no foreign output.
All three CLI modes (default, `--self-test`, `--list`) are byte-identical
before and after on the same tree.
Nothing in the repo imports either file -- every reference in `.github/**`,
`package.json` and `scripts/**` spawns them as `node scripts/...` -- so
neither guard silences a census. That is the sitting-3 `ts-parse.mjs`
inversion check, applied and cleared.
The ledger entries were deleted only after `check:entry-guard` named both
STALE. The set is now empty and its SHRINK-ONLY doc comment is untouched:
that comment is what keeps an empty set empty.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Sep 2, 2026
The ablation strips check:entry-guard's declared subtree hint and asserts the
brand-new-file verdict falls back. Its claim is that the subtree declaration is
the load-bearing half -- i.e. that without it the file is NOT MATCHED -- but it
spelled that as exactly `'silent'`.
`'silent'` was only ever the residual because check-entry-guard.mjs's
KNOWN_IMPORT_UNSAFE roster still contributed two path literals as hints. That
ledger is SHRINK-ONLY and reaching zero is its GOAL, so the sitting that
emptied it left the stripped hint set bare, the residual became
`'undetermined'`, and this case went red over a gate that had not changed at
all. The pin was calibrated against a debt ledger designed to disappear.
Both verdicts are not-matched and either one proves the subtree hint is
load-bearing, so both are accepted -- spelled as an explicit pair rather than
`!== 'matched'`, so a NEW verdict value added later cannot slip through as a
pass. The vacuity guard (`undeclared.hints.length < entry.hints.length`) is
untouched, the case label now says NOT MATCHED rather than 'silent', and the
residual verdict is carried into the failure detail so a future red names what
it actually got.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
@baozhoutao
baozhoutao marked this pull request as ready for review September 2, 2026 14:59
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@baozhoutao
baozhoutao added this pull request to the merge queueSep 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 33655524730 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Test Core (1/6) — 失败步骤: Run this shard's tests

    @objectstack/cli:test: FAIL integration test/run-dev-unbuilt-workspace.e2e.test.ts > the mirror direction: a reader that is never coming back > gives up and exits instead of waiting forever
    ↳ 失败原因: @objectstack/cli:test: AssertionError: expected 'SIGKILL' to be null
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 7 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit a120885Sep 2, 2026
33 of 35 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-10667-entry-guard-ledger-sitting-4 branch September 2, 2026 17:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burn down the 35 scripts/ modules that run on import — the KNOWN_IMPORT_UNSAFE ledger from PR #10665

2 participants

@baozhoutao@claude