Repository navigation
feat(metadata-core): export the schema upgrade verdict and its finding set token, so a host's install door forwards the platform's own verdict - #31529
Conversation
…g set token, so a host's install door forwards the platform's own verdict The verdict that decides which findings of a package upgrade plan stop a managed upgrade until the installer confirms them, and the token that confirmation echoes, were module-private in the install-local door. They move into @objectstack/metadata-core beside comparePackageVersions (package-upgrade-verdict.ts) and are exported; install-local imports them and keeps only its ledger-specific sentence for an unreadable install record. No behaviour change: the refusal, its findings, sentences and token are unchanged, and a test pins two token values the door's digest minted. The hosted control plane's install door (cloud#3654) applies the same rule and mints the same token from its two stored versions instead of keeping a second reading of it. Fixes #31526 Claude-Session: https://claude.ai/code/session_01QUs3BsJ2E2byCWsBstMjAJ Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 174 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 50a21644e39e2fca90630635c961951df9155920 && git checkout 50a21644e39e2fca90630635c961951df9155920
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 46ec2ec10fafc1d7aa760598c1f1b6fdb80c9b47 44d510c5115afdf824c719840c1f735ca0baf2ad && git checkout -B drift-repro 46ec2ec10fafc1d7aa760598c1f1b6fdb80c9b47 && git merge --no-ff 44d510c5115afdf824c719840c1f735ca0baf2ad
node scripts/docs-audit/affected-docs.mjs --json 46ec2ec10fafc1d7aa760598c1f1b6fdb80c9b47
|
…ON_REQUIRED now that metadata-core defines it; grade the changeset patch The error-code provenance gate attributes a constant to its DEFINING package. The code moved into metadata-core's verdict module (#31526) while its wire emitter stays install-local's door, so the row stays under @objectstack/cloud-connection and a PROVENANCE_WAIVERS entry records the shared-verdict shape (as UPDATE_ID_MISMATCH does). The changeset is regraded patch: Metadata-protocol is none, and the level follows the protocol kind alone. Refs #31526 Claude-Session: https://claude.ai/code/session_01QUs3BsJ2E2byCWsBstMjAJ Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sam · project thread
Fixes #31526
What changes
@objectstack/metadata-coregainssrc/package-upgrade-verdict.ts, exported from the index next topackage-upgrade-plan.ts. It contains:schemaUpgradeVerdict(packageId, plan)→{ findings, findingSet }. These need confirming:needs_confirmordestructivedrift category, including on a declared rename.These are not findings: a declared rename, a removed field or object, a
safetype change, a seed change.installedRecordUnavailableVerdict(packageId, finding): the verdict for a door that has no installed side to compare. It returns one confirmable finding, never "no finding". The finding's sentence stays the door's own.schemaUpgradeFindingSet(packageId, findings): the token. It isschema-upgrade:followed by 32 hex characters of a SHA-256 over the package id and the findings' sorted identities.Constants:
SCHEMA_UPGRADE_CONFIRMATION_REQUIRED,SCHEMA_UPGRADE_CONFIRMATION_STATUS,SCHEMA_UPGRADE_TOPIC,SCHEMA_UPGRADE_CONFIRMED_CATEGORIES.Types:
SchemaUpgradeFinding,SchemaUpgradeUnavailableFinding,SchemaUpgradeVerdict.@objectstack/cloud-connection: the install-local door now imports all of the above, and the moved code is verbatim. The door keeps onlyledgerRecordUnavailableVerdict, its sentence for an install record that is unreadable or missing; that function now calls the exportedinstalledRecordUnavailableVerdict.createHashand three type imports the door no longer uses are dropped.@objectstack/spec: onePROVENANCE_WAIVERSentry, because the provenance gate attributes a constant to the package that defines it.SCHEMA_UPGRADE_CONFIRMATION_REQUIREDis now defined in metadata-core but stays registered under@objectstack/cloud-connection, whose door puts it on the wire. This follows theUPDATE_ID_MISMATCHshape. No ledger row is added or moved.Why
cloud#3654 (epic cloud#3652, ruling Q3 「默认拒绝,需显式映射(推荐)」) has the hosted install door refuse an undeclared rename or a type change "with the framework's code and finding-set token". Its card forbids cloud from re-judging.
Before this PR, the verdict and the token were private to
marketplace-install-local-plugin.ts, so the hosted door could only copy the judgement or refuse nothing. With the export, both doors apply one rule and mint one token: the same pair of versions gets the same findings and the same token, whichever door installs it.The hosted consumer is cloud#3861.
Verification
Run in a worktree at
origin/main4cd48e27plus this branch. The workspace dependencies'dist/were borrowed from a build of objectstack3c380253(27 commits behind main), andmetadata-corewas rebuilt from this branch.packages/metadata-core:vitest run src/package-upgrade-verdict.test.ts src/package-upgrade-plan.test.tsgives 2 files, 27 tests passed. The new test file pins two token values, both computed with the door's original digest before the move, so the test pins byte identity:schema-upgrade:a168d8927e7a5afc25f947ee715fa848: a one-field suspected rename oncom.acme.deals;schema-upgrade:c29494e0b3b3e33a84adf0c2188baa37: the empty set.packages/cloud-connection:vitest runon the three install-local suites that exercise the gate (marketplace-install-local-upgrade-plan,-corrupt-ledger,-declared-rename) gives 3 files, 47 tests passed, unchanged.packages/spec:check:error-code-provenanceOK (11 waivers, all live).src/api/error-code-ledger.test.tsgives 26 tests passed.tsc --noEmitis clean inmetadata-core(both configs) and incloud-connection. eslint is clean on the changed source files.check-changeset-fixed,check-empty-changeset,check-adr-0087-registration,check-changeset-no-majorandcheck-doc-authoringall pass.data-modeling/fields.mdxanddeployment/cli.mdx) describe the install-local refusal andrenamedFrom. Their behaviour is unchanged by a verbatim move, so neither needs an edit.Clause-②: yes (widening)
Metadata-protocol: none
This is widening only:
@objectstack/metadata-coregains the exports listed above. No request, answer, key or error code changes on any door. The changeset is gradedpatch, since the protocol kind is none.Human Minimum
packages/specholds no runtime logic. (packages/specgains one data entry inPROVENANCE_WAIVERS.)pnpm lintpasses. (eslint on the changed files)main, one pull request.packages/spectouched: one ledger waiver entry. No schema, key or export changes.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.pnpm testwas not run in this container; CI carries it.)Generated by Claude Code