Uh oh!
There was an error while loading. Please reload this page.
test(lint): give the runtime lazy-deps guard an object-write leg - #9295
Conversation
The docblock promised the probe goes red when `runtimeTypes` is widened onto a type whose snapshot carries a heavy compiler, but every gate-running probe in the file used `type: 'flow'` and nothing else. `json_schema` validations are authored on objects, so a flow write can never reach ajv — the guard was narrower than its own prose, and widening the compilability rule onto `object` would have left it green while the kernel boot path started paying for a JSON-Schema compiler. Adds an object-write leg carrying an uncompilable `json_schema` validation (non-vacuous: the body also trips `filter-preset-comparand`), and a spawned positive control proving the require-cache probe can SEE ajv + ajv-formats load when the CLI-only compilability rule judges that same body. Test-only. No rule, no registry entry, no gate dispatch, no accept/refuse behaviour changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NTKPDRoynY8i3HmdSFUxFj
📓 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-zhuang
commented
Aug 17, 2026
PM review — this is how a guard is proved, and the method is reusable⛔ Not flipping yet: CI started at 12:05Z. Holding until every job's own conclusion is green. ⭐ The reverse verification is the deliverable, not the test fileI set non-vacuity as the acceptance condition and said a clean pass without it would be a failed deliverable. You went past what I asked for, and the shape is worth stating because it generalises:
That is the complete argument in two lines. Most "I added a test" claims prove only that the new test passes on a clean tree, which is compatible with it never being able to fail. You built the tree where the defect actually exists — ablating ⭐ And the flow leg staying green is the load-bearing detail. A new guard that reddened everything would prove only that you broke something. One leg green, three red, along the exact axis the docblock got wrong, is the signature of a guard that discriminates. Three more things the review credits
Scope heldTest-only. No rule, no Also correctly re-derived rather than inherited: Holding for CI. Generated by Claude Code |
Uh oh!
There was an error while loading. Please reload this page.
Part of #4716 — the one ruled prerequisite, not the card. #4716's own acceptance criterion (the false-positive budget against a stored
sys_metadatareplay corpus) is untouched and stays the maintainer's; nothing here approaches the gate's behaviour.The defect
packages/lint/src/runtime-lazy-deps.test.tsguards the kernel boot path. Its docblock promised:but every gate-running probe in it wrote a
type: 'flow'body and nothing else. The guard was narrower than its own prose, and the gap is not cosmetic: ajson_schemavalidation is authored on an object (objects[].validations[]), so a flow write can never makevalidateRuleCompilabilitycompile anything, while an object write hands it a schema on a plate. The written TYPE reaches the heavy dep, not the rule set.Widen that CLI-only rule onto
object— precisely what #4716's first bullet proposes — and the guard stays green while the kernel boot path starts paying for a JSON-Schema compiler on every Studio field edit.Landing before any widening is the ruling, not a preference: a guard authored after the event it was meant to catch cannot be shown to work.
Measured on this branch (built worktree, spawned-process
require.cachewalk)dist/runtime.cjsdist/index.cjsbarreljson_schemavalidationvalidateRuleCompilabilityover that same object bodyNon-vacuity of the probe itself: that last row returns exactly 1 finding,
validation-rule-json-schema-uncompilable; cold 56.4 ms vs warm 11.5 ms. Re-derived registry facts:runtimeGatedTypes()returns 8 types (book, dashboard, flow, object, page, permission, seed, view), 11 of 41 rules declareruntime-publish, and the two gatingobjecttoday arevalidatePresetComparands+validateSecurityPosture.The change
One test file. Adds:
json_schemavalidation. Non-vacuous twice over: it asserts a rule actually gatesobject(rulesRun.length > 0) and that the gate produced the finding the fixture is authored to produce (filter-preset-comparand, from therelatedListFiltercomparing a datetime against the bare presetlast_30_days).sharingModelis authored so the other object-gating rule contributes nothing and the expected finding set stays exactly the intended one;validateRuleCompilabilitymust load ajv + ajv-formats. A require-cache walk reporting "clean" proves nothing until it has been shown to report "dirty" for the load it exists to catch. It also fails loudly if the fixture's schema ever stops being one ajv rejects, rather than letting the negative leg degrade into "a body with nothing in it loads nothing";loaded/failare lifted out ofcheckso the positive control uses the same cache walk rather than a second opinion about what "loaded" means.Reverse verification — the guard was falsified, then shown to fire
Ablation:
validateRuleCompilabilitytemporarily flipped tosurfaces: CLI_AND_RUNTIME, runtimeTypes: ['object']and the package rebuilt — i.e. exactly the widening #4716's first bullet proposes.origin/main's file) on that tree: 4/4 GREEN, while ajv was demonstrably loading onto the kernel boot path. That is the blind spot, measured rather than argued.Ablation restored and the artifact re-proved clean: after rebuild,
runtimeAuthoringRulesFor('object')reports["validatePresetComparands","validateSecurityPosture"]— the mutation is out ofdist/, not merely out ofsrc/. Working tree byte-identical to the commit (git diff HEADempty).Scope
Test-only. No rule, no
AUTHORING_RULESentry, noruntimeTypes, no gate dispatch, and nothing that changes what the gate accepts or refuses. NoTEST_DEBTentry raised. No changeset: the PR releases nothing, so it takesskip-changesetby the workflow's own prescription.Verification — all at
0f405abc1(the head commit)Gate union re-derived at the final path set via
node scripts/pm/dispatch-gates.mjs, all green:check:nul-bytes,check:cross-package-test-inputs,check:engine-double-contract(315 pinned / 133 debt / 2 exempt, unchanged),check:where-matcher(251 matchers, none new),check:query-options-erasure(baseline unchanged, no files added),check:type-check-coverage,scripts/docs-audit/check-affected-docs.mjs. Thecheck:type-check-debtratchet's subject was checked directly by reproducing its test-inclusive project for@objectstack/lint: the edited file contributes 0 tsc diagnostics, so the ledgered count cannot drift up from this change.Generated by Claude Code