Repository navigation
fix(cli): os validate refuses the engines.protocol range the boot refuses - #39090
Conversation
On a protocol-19 toolchain a manifest declaring engines.protocol '^18' passed os validate with a drift warning while os dev refused to boot it. Validate now runs the boot's handshake (assertProtocolCompat, answered through protocolIncompatibleAnswer) ahead of every content check and exits 1 with OS_PROTOCOL_INCOMPATIBLE, the boot's words, its migrate meta --from step and the registered semantic entry that command lists. Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
…add changeset Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
…range pin Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 41 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f4e67bec30f35f787cf6b5b2a774a6240208d57e && git checkout f4e67bec30f35f787cf6b5b2a774a6240208d57e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6354509427fab0ca2052b2b05be787f8593422ca 0274f51c1f262d64f71b24c9100ec2892ee0f336 && git checkout -B drift-repro 6354509427fab0ca2052b2b05be787f8593422ca && git merge --no-ff 0274f51c1f262d64f71b24c9100ec2892ee0f336
node scripts/docs-audit/affected-docs.mjs --json 6354509427fab0ca2052b2b05be787f8593422ca
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYoSKoNUygbCoMBTbGc Final green head for review · 2026-12-02T08:33Z |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #39090 (#38928) · head 席位核对 · ACCEPTACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYoSKoNUygbCoMBTbGc Landing · 2026-12-02T08:37Z · head
|
Fixes #38928
Clause-②: no
Metadata-protocol: none
Ruling-ref: 7337736429 — maintainer 「38928 选 A」
(narrowing) note, for review routing:
os validate's accept set narrows to match the boot. A manifest range the boot refuses ('^18'on protocol 19) used to pass validate at exit 0 and now exits 1. No project that boots changes behaviour. The kind staysnonebecause the boot already refuses this range, as the claim records. One contract-review-tier L2 is owed before the queue; the seat routes it.维护者速读
What changes
os validateruns the boot's protocol handshake as the first check of the stack's content, right after the config loads. Where the boot refuses the declaredengines.protocolrange, validate exits 1 whatever--strictsays. The text face prints the boot's code (OS_PROTOCOL_INCOMPATIBLE), the boot's message with itsRun: objectstack migrate meta --from 18, and the registered semantic entry that command lists (protocol-18-range-refused).--jsoncarries the refusal as oneerrors[]row, the same row family as the view-container-name refusal:path,code,httpStatus,message,details(the boot answer's closed shape:requiredRange,rangeSource,protocolVersion,targetMajor,migrateCommandwhen present) andmigrationEntries.findProtocolRangeRefusal(new,packages/cli/src/utils/protocol-version-gap.ts) calls the boot's ownassertProtocolCompatwith a silenced warn hook, over the sliceAppPluginreads (bundle.manifest || bundle, the same readingplanProtocolRangeuses). It answers throughprotocolIncompatibleAnswer. Nothing in the CLI parses a range or decides a major. The entry ids come from the installed chain (MIGRATIONS_BY_MAJOR): entries whosesurfaceis the handshake's range key, on the steps the prescribed--from Nreplays. The registry entry is imported lazily, only on a refusal.PROTOCOL_VERSIONof the metadata-core this CLI loads. That is the protocolos dev/os serveboot under, since they import@objectstack/runtimefrom the CLI's own dependencies. The non-blocking drift advisory (checkProtocolVersionGap) is unchanged: it still reads the app's installed spec, andos buildandos doctorstill print it.packages/cli/test/validate-build-gate-parity.test.ts'sVALIDATE_ONLY_GATES. That test's closed call-site roster requires every callvalidate.tsmakes to be classified. The new gate is validate-only by the ruling, which namesos validatealone. The row states the build-side gap.Read first (by risk)
packages/cli/src/utils/protocol-version-gap.ts,findProtocolRangeRefusalandrangeMigrationEntries: the slice choice and the entry selection.packages/cli/src/commands/validate.ts, step1b': its position (after the producer-refusal and conversion fold, ahead of the schema parse) and both exits.packages/cli/src/commands/validate-protocol-range-refusal.test.ts: the boot-parity battery.Two-minute check: in any
defineStackproject on this branch, setengines: { protocol: '^18' }and runnode packages/cli/bin/run-dev.js validate --jsonfrom it. Expected: exit 1,errors[0].codeisOS_PROTOCOL_INCOMPATIBLE,errors[0].details.migrateCommandisobjectstack migrate meta --from 18, anderrors[0].migrationEntriesis["protocol-18-range-refused"].Tests
New
packages/cli/src/commands/validate-protocol-range-refusal.test.ts(integration tier, because it spawns the CLI; 16 tests; file wall 4.7 s locally):'^18'with--jsonexits 1, and the row'scode,httpStatus,messageanddetailsequal whatassertProtocolCompat+protocolIncompatibleAnswerreturn for the same manifest, withprotocol-18-range-refusedinmigrationEntries.'^18'in text exits 1 and prints the code, the boot's message and the entry id. Control:'^19'with--jsonexits 0,valid: true.'^18','^19', a range from 18 up to but excluding 20,'^18 || ^19','>=18','^20','^15','18.x','not-a-range'and no range,findProtocolRangeRefusalreturnsnullexactly when the boot's handshake admits. Otherwise it returns the boot's code, words and details, and no entry where the boot prescribes no command. No range carries a hard-coded verdict. A vacuity pin asserts that the battery holds both verdicts.Test runs (HEAD 0274f51 unless noted)
origin/main7814822), in adefineStackproject with'^18':os validateexited 0 (✓ Validation passedplus the⚠ Installed @objectstack/spec is v19.0.0-next.3 but this app declares engines.protocol '^18'advisory).--jsonexited 0 withvalid: true, and the range appeared only underprotocolVersionGap.errors[0]={ path: 'manifest.engines.protocol', code: 'OS_PROTOCOL_INCOMPATIBLE', httpStatus: 422, details.migrateCommand: 'objectstack migrate meta --from 18', migrationEntries: ['protocol-18-range-refused'] }.pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 src/commands/validate-protocol-range-refusal.test.ts src/utils/protocol-version-gap.test.ts test/validate-build-gate-parity.test.tsat 8b5aebf: 3 files, 71 tests passed. The new file alone at 0274f51: 16/16 passed;src/utils/protocol-version-gap.test.ts+test/validate-build-gate-parity.test.tsat 0274f51: 2 files, 55 tests passed.pnpm --filter @objectstack/cli typecheck(tsc --noEmitandcheck:test-typecheck) at 0274f51: exit 0.scripts/ablation-replace.mjs, anchorif (protocolRefusal) {→if (protocolRefusal && process.env.OS_TEST_NEVER === "x") {, landed 1→0, blob 246bd982→bf8ca296): THE PIN (--json) and the text-face pin failed, 2 of 16. The control and the parity battery stayed green, as expected. Restored: blob == HEAD,git diff HEADempty.Acceptance notes
os buildon the same'^18'project still exits 0 and prints only the drift advisory (measured on this branch). The ruling namedos validateonly, so the build-side gap is recorded in the parity test'sVALIDATE_ONLY_GATESrow and not closed here.AppPluginjudges. Apackages[]body's own manifest range is judged by the package doors at install, not by this check. Not measured here.VALIDATE_ONLY_GATES's header sentence "It holds two today" was already stale before this row (it held three). Left as found.Verification
Gates
The local gate list is
dispatch-gates --commands: 72 commands, run at 0398b62.--ranreconciliation: 72 derived, 68 run, 4 NOT-MEASURED, 0 UNRUN.check:test-source-aliaswas red at 0398b62: the new test reached the lazily imported registry inside a clocked case. 0274f51 adds the collection-time import the gate prescribes, and the gate is green there. The families a test-file edit can move were re-run at 0274f51, all exit 0: test-source-alias, cross-package-test-inputs, type-check-debt, type-check-coverage, tier-file-adoption, nul-bytes, cli-test-child-env, issue-citations and doc-authoring. The per-gate readings are in the dev report on #38928.check:dual-build-cjs-loads,check:i18n,check:i18n-coverageandcheck:i18n-walk-parityexited 3 (PREREQUISITE NOT MET: the built CLI and the example closures, which this worktree did not build). Those four are NOT MEASURED locally and are left to CI'sLint & Repo Gates. Repo-wide scans, the type-check lanes and Test Core are CI's.Generated by Claude Code