Uh oh!
There was an error while loading. Please reload this page.
test(cli): mask comments before scanning serve.ts in two contract/pin scans - #11002
Merged
Conversation
… scans (#10514) Two `packages/cli` scans read `serve.ts` raw, with no comment/code separator at all, so prose counted as code -- the FABRICATES direction `scripts/js-comment-mask.mjs`'s own header calls the worse one. Neither scan was wrong today, but both were one ordinary comment away from being wrong: - `serve-email-config-parity.contract.test.ts`'s `keysReadFromConfigEmail()` matched `cfgEmail\.\w+` over raw source, so a comment naming an undeclared key would have fabricated a false "undeclared key" red, and -- the worse direction -- a comment naming a declared-but-unread key would have silently restored the exact `DECLARED_BUT_UNREAD` exemption this file's own docblock says was deleted for good after #5447/#5470. - `serve-multi-node-cap-advisory.pin.test.ts`'s four shape assertions matched regexes over raw source, so a reverted call could hide behind a trailing comment quoting the shape it replaced. Both now scan `maskComments(SERVE_SOURCE)` instead. `interfaceFields()`'s own narrower, brace-matched strip is untouched -- out of scope per the issue. Re-verified per the card's release condition: on origin/main at branch point (047ac86), the raw / naive-stripped / masked key sets for subject 1 and the raw / masked match verdicts for subject 2's four assertions are all identical -- no verdict moved by #10453/#10919/#10948/#10956's changes to serve.ts since the card was written. `CROSS_PACKAGE_TEST_INPUTS['@objectstack/cli']` and the turbo.json `@objectstack/cli#test` input already carry `scripts/js-comment-mask.mjs`/`.d.mts` (landed with #10453/PR #10513), so no registration work was needed -- just the two-site routing. Adds vacuity-proof tests demonstrating the FABRICATES shapes on synthetic sources: a comment containing the exact pattern each scan keys on is shown producing the wrong verdict when read raw, and the right one once masked. Fresh answer to the open question #10909's dev never returned: yes, editing comment prose in serve.ts could move both scans' results pre-fix (demonstrated above); post-fix it cannot. Side effect caught by `check:cross-package-test-inputs`: adding the `maskComments` import gave `serve-email-config-parity.contract.test.ts` its first real escaping read, which newly exposed a PRE-EXISTING prose mention of `packages/spec/src/system/email-config.test.ts` (a doc cross-reference, never actually read) to the gate's literal collector. Reworded to name it without a single quoted repo-relative literal, following the precedent already set in this directory's `serve-multi-node-cap-advisory.pin.test.ts` for the identical gate. Fixes#10514
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. |
os-elon
marked this pull request as ready for review
August 22, 2026 04:44
Uh oh!
There was an error while loading. Please reload this page.
Contributor
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 32553849025 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#10514
What changed
Both
packages/cliscans that readserve.tswith no comment/code separator now scanmaskComments(SERVE_SOURCE)(scripts/js-comment-mask.mjs) instead of raw text:serve-email-config-parity.contract.test.ts—keysReadFromConfigEmail()now matchescfgEmail\.\w+over masked source.serve-multi-node-cap-advisory.pin.test.ts— the fourcheckMultiNodeAllowed/MultiNodeGateVerdictshape assertions now match over masked source.interfaceFields()'s own narrower, brace-matched strip (used only for the producer/consumer verdict-shape comparison) is untouched — the issue calls this out explicitly as a different, narrower mechanism and out of scope here.FIRST ACTION — re-verification duty (release condition on this card)
Re-measured on
origin/mainat branch point047ac86ee9(before touching either scan), per the triage comment's explicit condition:cfgEmail.*are identical:["apiKey","appName","defaultFrom","defaultTemplateContext","options","persist","provider","queueDelivery","retries"]in all three.not.toMatchzero-arg,toMatchnon-empty-arg,toMatchreplicas call,toMatchtyped dynamic import) are identical raw vs. masked — allfalse/true/true/truerespectively.No verdict moved, despite
serve.tshaving changed materially since the card was written (#10919 module-scopeimportFromHost, #10948Serve.importConfigPlugin, #10956 capability-loop comment rewrite). This was confirmed two independent ways: a standalone script against the raw file text, and — after landing the fix — the full test suite with the production routing lines reverted back to raw (13/13 tests green, see "Reverse-verification" below).Fresh answer to the open question #10909's dev never returned
Yes — pre-fix, editing comment prose in
serve.tscould move both scans' results.#10956 merging green is not evidence either way (nobody added the adversarial comment); established here directly via the vacuity-proof tests (see below), which demonstrate on synthetic sources shaped exactly like the real resolver/call site that a comment containing the pattern each scan keys on flips the verdict when read raw. Post-fix, it cannot — masking blanks the comment before either scan runs.CROSS_PACKAGE_TEST_INPUTSregistration — already presentConfirmed live:
scripts/js-comment-mask.mjsandscripts/js-comment-mask.d.mtsare already inCROSS_PACKAGE_TEST_INPUTS['@objectstack/cli'](scripts/check-cross-package-test-inputs.mjs) and inturbo.json's@objectstack/cli#testinputs — landed with #10453/PR #10513. No registration work was needed; this PR is the clean two-sitemaskCommentsrouting the issue predicted for that case.Vacuity proof — the hardening actually hardens
Three new tests, each showing the RAW leg produce the wrong verdict (what these scans would have done pre-#10514) next to the MASKED leg producing the right one, on synthetic sources rather than waiting for
serve.tsto regress:serve-email-config-parity.contract.test.ts— a comment naming an undeclared key (cfgEmail.bogusKey) is read as a real key raw, ignored masked ("declares every key" direction).cfgEmail.persist) is read as a real read raw, correctly unread masked — the worse direction the issue calls out: this is the exact spec/cli:EmailServiceConfig.persist声明了但没有载体 ——config.email.persist永远到不了 EmailServicePlugin(#5307 的反向面,ADR-0049) #5447DECLARED_BUT_UNREADshape the file's own docblock says was deleted for good.serve-multi-node-cap-advisory.pin.test.ts— a reverted zero-arg call with a trailing comment quoting the old argued call satisfies the "good shape present" assertion raw (hiding the regression); masked, it correctly does not.Reverse-verification (both legs)
Leg A — revert only the production routing (the
MASKED_SERVE_SOURCE = maskComments(SERVE_SOURCE)default / fourexpect(MASKED_SERVE_SOURCE)call sites back to rawSERVE_SOURCE), full targeted suite: predicted GREEN, confirmed GREEN (13/13) — consistent with the re-measured identity above: today'sserve.tshas no adversarial comment, so raw and masked agree everywhere the real assertions look. Restored, confirmed GREEN again (byte-identical toHEADviagit checkout HEAD -- <path>).Leg B — bypass masking inside the new vacuity-proof tests' "post-fix" leg only (to prove those tests are not vacuous): predicted RED, confirmed RED — all 3 vacuity tests failed exactly as predicted (
expected [ 'bogusKey', 'provider' ] to deeply equal [ 'provider' ],expected [ 'persist', 'provider' ] to not include 'persist',expected '...' not to match /checkMultiNodeAllowed\(\s*[^)\s]/). Restored, confirmed GREEN again (13/13).Collateral gate fix (same PR, caused by this diff)
Adding the
maskCommentsimport gaveserve-email-config-parity.contract.test.tsits first real escaping read, which newly exposed a pre-existing prose mention ofpackages/spec/src/system/email-config.test.ts(a doc cross-reference, never actually read by this file) tocheck:cross-package-test-inputs's literal collector —check:cross-package-test-inputswent red. Reworded the comment to name that file without a single quoted repo-relative literal, following the precedent already set in this same directory (serve-multi-node-cap-advisory.pin.test.ts's own comment about the identical gate). Confirmed green after.Verification
pnpm --filter '@objectstack/cli^...' build— green.pnpm --filter @objectstack/cli typecheck— green (tsc --noEmit, 0 errors).pnpm --filter @objectstack/cli test(full package, both viapnpm test --and directly viavitest runon the two changed files) — 152 test files / 1682 tests green package-wide; 13/13 on the two changed files verbose.ebd9be7da6, vianode scripts/pm/dispatch-gates.mjs, no paths passed — derived from the real diff):pnpm check:cross-package-test-inputs—OK: 13 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.pnpm check:slot-lookup—✓ slot-lookup ratchet holds: 107 unswept site(s) in 25 file(s), none new...pnpm check:test-source-alias—check-test-source-alias OK — 72 packages with tests scanned...pnpm check:type-source-resolution—check-type-source-resolution OK — 76 packages with a tsconfig.json scanned...node scripts/check-ci-filter-parity.mjs—OK: all 82 declared cross-package glob(s) (71 unique) are covered...node scripts/check-plugin-teardown-shape.mjs—✓ check:plugin-teardown-shape: 61 Plugin implementation(s)... 0 known-unreached, SHRINK-ONLY, baseline fully burned down.node scripts/docs-audit/check-affected-docs.mjs— self-test + main run, no FAIL.pnpm check:query-options-erasure—✓ query-options-erasure ratchet holds: 67 unswept non-test site(s)... none new.pnpm check:type-check-coverage—check-type-check-coverage: OK — 64/77 workspace packages type-checked...pnpm check:type-check-debt(fullpnpm exec turbo run build --filter=./packages/* --filter=./packages/*/*closure built first, 70/70 tasks) —check-type-check-coverage --re-measure: OK — 33 ledger entr(ies) re-measured in 203.5s, 1908 raw tsc error(s) total, none above its recorded number.@objectstack/cli's TEST_DEBT entry (146) is unaffected — both new test files sit in the regularly-typecheckedsrctree, not the hiddentest/tree the ledger tracks. (Unrelated pre-existing informational note in this run:@objectstack/plugin-authTEST_DEBT could be lowered by 12 — untouched by this PR, tracked by the gate's own linked issue [finding][devx]check:type-check-debt的 ledger 余量会让新写的 pin 变哑:mongodb 曾有 33 条余量吞掉一次真实回退,另有 5 条目前带 4–19 余量 #6376.)pnpm check:engine-double-contract—OK — 377 pinned, 133 in the DEBT ledger, 2 exempt.pnpm check:where-matcher—✓ where-matcher conformance holds: 276 matcher(s) discovered, 276 answer... correctly or refuse it loudly.$?); every exit code captured before any pipe (cmd > log 2>&1; EXIT=$?).Changeset — noted conflict, resolved per AGENTS.md
The dispatch brief said a changeset is required. This diff touches only two
*.test.tsfiles underpackages/cli/src/commands/— no runtime/user-facing change. Per AGENTS.md's own convention for this repo (a realskip-changesetlabel mechanism, applied by the PR author, not CI), this qualifies as tests-only and takes the label instead of a changeset. Applyingskip-changeseton this PR now and will read the label list back once it settles.Generated by Claude Code