Skip to content

fix(cli): os validate refuses the engines.protocol range the boot refuses - #39090

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-38928-validate-protocol-range
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-38928-validate-protocol-range

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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 stays none because the boot already refuses this range, as the claim records. One contract-review-tier L2 is owed before the queue; the seat routes it.

维护者速读

  • 用户能看到什么变化:在 19 版工具链上,项目清单仍声明只兼容 18 版协议时,校验命令现在直接报错退出,给出与启动时相同的错误码和迁移命令;以前它只提示一行警告并显示通过。
  • 为什么做:属于 18 升 19 的升级主线。用户先跑校验、看到通过,启动时才被拒,这次让两处在同一个问题上给出同一个答案。
  • 出错会怎样:受影响的只有本来就启动不了的项目,它们现在在校验阶段就失败;能启动的项目不受影响。改动只在命令行工具里,可以直接撤回。
  • 要你做什么:无

What changes

  • os validate runs the boot's protocol handshake as the first check of the stack's content, right after the config loads. Where the boot refuses the declared engines.protocol range, validate exits 1 whatever --strict says. The text face prints the boot's code (OS_PROTOCOL_INCOMPATIBLE), the boot's message with its Run: objectstack migrate meta --from 18, and the registered semantic entry that command lists (protocol-18-range-refused).
  • --json carries the refusal as one errors[] 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, migrateCommand when present) and migrationEntries.
  • One judge, not a second rule. findProtocolRangeRefusal (new, packages/cli/src/utils/protocol-version-gap.ts) calls the boot's own assertProtocolCompat with a silenced warn hook, over the slice AppPlugin reads (bundle.manifest || bundle, the same reading planProtocolRange uses). It answers through protocolIncompatibleAnswer. Nothing in the CLI parses a range or decides a major. The entry ids come from the installed chain (MIGRATIONS_BY_MAJOR): entries whose surface is the handshake's range key, on the steps the prescribed --from N replays. The registry entry is imported lazily, only on a refusal.
  • It judges against PROTOCOL_VERSION of the metadata-core this CLI loads. That is the protocol os dev / os serve boot under, since they import @objectstack/runtime from the CLI's own dependencies. The non-blocking drift advisory (checkProtocolVersionGap) is unchanged: it still reads the app's installed spec, and os build and os doctor still print it.
  • Landing outside the claimed file surface: one row in packages/cli/test/validate-build-gate-parity.test.ts's VALIDATE_ONLY_GATES. That test's closed call-site roster requires every call validate.ts makes to be classified. The new gate is validate-only by the ruling, which names os validate alone. The row states the build-side gap.

Read first (by risk)

  1. packages/cli/src/utils/protocol-version-gap.ts, findProtocolRangeRefusal and rangeMigrationEntries: the slice choice and the entry selection.
  2. packages/cli/src/commands/validate.ts, step 1b': its position (after the producer-refusal and conversion fold, ahead of the schema parse) and both exits.
  3. packages/cli/src/commands/validate-protocol-range-refusal.test.ts: the boot-parity battery.

Two-minute check: in any defineStack project on this branch, set engines: { protocol: '^18' } and run node packages/cli/bin/run-dev.js validate --json from it. Expected: exit 1, errors[0].code is OS_PROTOCOL_INCOMPATIBLE, errors[0].details.migrateCommand is objectstack migrate meta --from 18, and errors[0].migrationEntries is ["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):

  • CLI pins, from three spawns started together. '^18' with --json exits 1, and the row's code, httpStatus, message and details equal what assertProtocolCompat + protocolIncompatibleAnswer return for the same manifest, with protocol-18-range-refused in migrationEntries. '^18' in text exits 1 and prints the code, the boot's message and the entry id. Control: '^19' with --json exits 0, valid: true.
  • Boot-parity battery: for '^18', '^19', a range from 18 up to but excluding 20, '^18 || ^19', '>=18', '^20', '^15', '18.x', 'not-a-range' and no range, findProtocolRangeRefusal returns null exactly 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)
  • Before the fix (origin/main 7814822), in a defineStack project with '^18': os validate exited 0 (✓ Validation passed plus the ⚠ Installed @objectstack/spec is v19.0.0-next.3 but this app declares engines.protocol '^18' advisory). --json exited 0 with valid: true, and the range appeared only under protocolVersionGap.
  • After the fix: the same project exits 1 on both faces, with 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.ts at 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.ts at 0274f51: 2 files, 55 tests passed.
  • pnpm --filter @objectstack/cli typecheck (tsc --noEmit and check:test-typecheck) at 0274f51: exit 0.
  • Ablation (scripts/ablation-replace.mjs, anchor if (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 HEAD empty.

Acceptance notes

  • os build on the same '^18' project still exits 0 and prints only the drift advisory (measured on this branch). The ruling named os validate only, so the build-side gap is recorded in the parity test's VALIDATE_ONLY_GATES row and not closed here.
  • Only the root manifest's range is judged, the slice AppPlugin judges. A packages[] 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. --ran reconciliation: 72 derived, 68 run, 4 NOT-MEASURED, 0 UNRUN. check:test-source-alias was 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-coverage and check:i18n-walk-parity exited 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's Lint & Repo Gates. Repo-wide scans, the type-check lanes and Test Core are CI's.


Generated by Claude Code

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>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cli, touching 10 documentable anchor(s).

12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/api/error-catalog.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/api/error-handling-client.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/api/error-handling-server.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/api/index.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/api/wire-format.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/automation/flows.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/deployment/app-dependencies.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/deployment/cli.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/plugins/development.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/protocol/kernel/error-handling.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/protocol/kernel/http-protocol.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/releases/v17/17-3.mdx (via httpStatus (symbol, a field of interface ProtocolRangeRefusalRow))
  • content/docs/releases/v18/18-0.mdx (via manifest.engines.protocol (literal, a string literal in RANGE_ENTRY_SURFACE))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: os validate (command, 102 pages)
  • 2 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 254 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 41 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 6354509427fab0ca2052b2b05be787f8593422ca → packageMentionDocs.

Which tree this was computed on

This run read content/docs from f4e67bec30f35f787cf6b5b2a774a6240208d57e — the merge of head 0274f51c1f262d64f71b24c9100ec2892ee0f336 into base 6354509427fab0ca2052b2b05be787f8593422ca, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 6354509427fab0ca2052b2b05be787f8593422ca → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYoSKoNUygbCoMBTbGc

Final green head for review · 2026-12-02T08:33Z
Head-sha: 0274f51c1f
Check-runs at this head: 39 success · 18 skipped · 0 failure · 0 pending.
Owed: L1 (seat session), then one contract-review-tier L2 ((narrowing) arm of os validate). Landing: seat.
Card #38928 · claim 7337788608 · amendment on the card · dev report 7338954379.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

L1 ACCEPT · PR #39090 (#38928) · head 0274f51c1f262d64f71b24c9100ec2892ee0f336 · read 2026-12-02T08:35Z

席位核对 · ACCEPT

ACCEPT · repo:objectstack@os-justin · head 0274f51c1f262d64f71b24c9100ec2892ee0f336

  1. Shape. Draft, base main, Fixes #38928 on the first line. The ruling (7337736429, A) names os validate alone, and this PR delivers exactly that, so Fixes is right. No closing keyword binds another card. l1-face --pr 39090: CLEAN, 13 items.
  2. Ruling delivered. The seat read the diff (+437/−6, 5 files). Step 1b' in validate.ts calls findProtocolRangeRefusal, which runs the boot's own assertProtocolCompat and answers through protocolIncompatibleAnswer, so there is one judge and no second rule. It exits 1 on both faces regardless of --strict. The JSON row carries OS_PROTOCOL_INCOMPATIBLE, the migrate meta --from 18 step and protocol-18-range-refused. The parity battery (ten ranges, including absent and unrecognised) asserts null exactly where the boot admits, and a vacuity pin holds both verdicts. The ablation of the if (protocolRefusal) gate reds the two CLI pins and leaves the control and the battery green. Before and after are measured on a real project.
  3. Declarations. Clause-②: no and Metadata-protocol: none stand. The platform's accept set does not change: the boot already refuses '^18' on 19, and only the point of failure moves earlier. So the PR declares no (narrowing) arm, and no L2 face is hit (no non-test packages/spec/src/** path, no governed rule text, no Clause-②: yes). L2: none owed. This answers the zone's routing note and the body's "(narrowing) note" paragraph, which is prose for routing only and is not a declaration. The seat's reading stands in its place.
  4. Changeset, read sentence by sentence. Every sentence matches the diff, with one nit. "ahead of every other check of the stack" is wider than the code: step 1a (refuseUnbuiltStack) and a load-time defineStack refusal run first. The code's own comment says "ahead of every check of the stack's content", which is exact. This is a nit and not owed. "migrate meta --from 18 --write, which rewrites the range of a root defineStack manifest" is true as qualified; the stock exportsOf wiring is cli: os migrate meta --write writes 0 edits on the stock create-objectstack wiring (exportsOf(…)) and on helper-built stacks (HotCRM 0 of 144), while both outputs say "Applied N mechanical change(s)" #38879's (PR fix(cli): migrate meta --write writes through the scaffold's exportsOf(…) wiring; no run says "Applied" before it writes #39096).
  5. Gates (check-runs at this head). 39 success, 18 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check: success. The dogfood battery is not owed (no !, no (narrowing) arm). Four gates were NOT MEASURED locally (exit 3, prerequisite) and are covered by CI's Lint & Repo Gates, which is green.
  6. Accepted deviations. One row in validate-build-gate-parity.test.ts lies outside the claimed surface. The test's closed roster requires it, and the claim amendment is posted.
  7. Out of scope. os build still exits 0 on '^18'; it is filed as cli: on 19, os build exits 0 on a manifest whose engines.protocol admits 18 and not 19, while the boot refuses it #39098. The stale "It holds two today" header of VALIDATE_ONLY_GATES is left as found.
  8. Landing. Not governed (check-governed-merges --pr 39090: 0 of 5 paths, +437/−6), and there is no narrowing. git merge-tree against current main is clean. The build zone lands it per landing-operations.md.

Clause-②: no · Metadata-protocol: none

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYoSKoNUygbCoMBTbGc

Landing · 2026-12-02T08:37Z · head 0274f51c1f

  • L1 ACCEPT 7339676350 at this head (seat session); no L2 owed per that ACCEPT (Clause-②: no, Metadata-protocol: none stand).
  • check-governed-merges.mjs --pr 39090: NOT governed, 0 of 5 paths; +437/−6 ≤ 3000.
  • Check-runs at this head: 39 success · 18 skipped · 0 failure (comment 7339621275).
  • landing-k.mjs --pr 39090: K = 2 < 15, OK.
  • Action: pr_ready + automerge_enable (zone build lands a non-governed PR per area-lease).

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

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: on 19, os validate passes a manifest still declaring engines.protocol: '^18' with a warning, while os dev with the same config refuses to start

2 participants