Repository navigation
fix(verify): a bootStack artifact boot registers its metadata door ahead of the app, as os dev does - #38638
Conversation
…ead of the app, as os dev does Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE
📓 Docs Drift CheckThis PR changes 1 package(s): ⛔ 1 release-owned page(s) name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 9 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 7cbce9bff52abc62908b3a6fc55651d70d32fdf2 && git checkout 7cbce9bff52abc62908b3a6fc55651d70d32fdf2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f3028c5eb0f4f66cc4bce77fc42666b954fdd0f7 ce65d57f4d9e8f8bfb86838a5320184b81fa98ed && git checkout -B drift-repro f3028c5eb0f4f66cc4bce77fc42666b954fdd0f7 && git merge --no-ff ce65d57f4d9e8f8bfb86838a5320184b81fa98ed
node scripts/docs-audit/affected-docs.mjs --json f3028c5eb0f4f66cc4bce77fc42666b954fdd0f7
|
|
repo:objectstack#3 · os-steve · session_01ADHkmRar3Kkg6SpwVgaaVE Final head for L1: Points for the reviewer:
|
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对ACCEPT @ Read at head:
For the seat (not this PR): the first Acceptance note is the same false-green class, a door registered after the app's seed, on an app that declares its own Nits (non-blocking):
|
|
repo:objectstack#3 · os-steve · session_01ADHkmRar3Kkg6SpwVgaaVE Landing · 2026-11-29T18:51Z · head
Checks: newest run of each check green (39 success, 16 expected skip). |
Requested by Steve · project thread
Fixes #36274
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Cause (measured). Both boots seed through the same
SeedLoaderService; what differs is whatmetadata.getObjectholds when the inline seed runs inAppPlugin.start().os devover a compiled artifact (createStandaloneStack, and the CLI's dev artifact door) registers aMetadataPluginwithartifactSourceAHEAD of the app. Itsstart()loads each object as its own package wrote it, so by seed time the metadata service's copy of the extended object lacks the field another package adds throughobjectExtensions.bootStacknever got there. WithBootOptions.artifactit composed only the artifact-less lazyMetadataPlugin. With a caller'sMetadataPlugin({ artifactSource })inextraPlugins, that plugin was registered in theextraPluginsslot, AFTERAppPlugin, so its artifact load ran after the seed. Either way the seed read the copy ObjectQL's one-shot bridge had put into the empty metadata service (the harness'sObjectQLPluginhas noenvironmentId): the registry's folded object, extension included. So the pre-fix(metadata-protocol): a seed resolves a lookup another package adds through objectExtensions to the target's id #36272 resolver (metadata copy first) resolved the natural key under verify and stored it raw underos dev.unwrapEnvelope.loadCompiledArtifactalready reads withunwrapEnvelope: true. The registrar decides who registers the four security collections; it does not touch the object copy a seed reads.Fix (
packages/verify/src/harness.ts): themetadataslot boots likeos dev.bootStack(config, { artifact })composesMetadataPlugin({ watch: false, artifactWatch: false, artifactSource: { mode: 'local-file', path }, rootDir: hostRoot })over the same file the app is mounted from. It is registered in the metadata slot, ahead ofAppPlugin, and the app getssecurityMetadataRegistrar: 'artifact-door', exactly ascreateStandaloneStackdeclares both. One value (composesArtifactDoor) decides both.MetadataPlugininextraPluginsis registered in the metadata slot, ahead of the app, and skipped in theextraPluginsloop. The harness still composes none of its own beside it.artifact, no callerMetadataPlugin) is unchanged, and so is an app that declares aMetadataPluginin its ownplugins.loadCompiledArtifactnow also returns thelocationit resolved. The docblocks ofbootStack,BootOptions.artifactandBootOptions.extraPluginssay where the door sits and why.packages/verify/README.mdnames the door and its slot..changeset/36274-verify-artifact-metadata-door.md:@objectstack/verifypatch.Tests
New pin:
packages/verify/src/harness.seed-extension-lookup.test.ts. It boots a two-package artifact of the #35254 shape: modulecom.example.sxl.modaddsquote_ref(lookup tosxl_quote) to the app'ssxl_orderthroughobjectExtensions, and seedsO-1withquote_ref: 'Acme Quote'. There are two legs,bootStack(config, { artifact })andbootStack(artifact, { extraPlugins: [MetadataPlugin({ artifactSource })] }). Each leg asserts:sxl_orderhas noquote_ref, which is the copyos devholds;quote_refstores the quote's id;account_ref, the owner's own lookup, stores the account's id.Measurement: what getObject held at seed time, per boot (pre-#36272 resolver)
The resolver body of
8925d5bc^was put back in the worktree, never committed (blob 2713d6f4cb, the same blob #36272's ablation used).@objectstack/metadata-protocolwas rebuilt, andablation-dist-preflight.mjs @objectstack/metadata-protocol 'fromMetadata?.fields'read the marker present indist/. A scratch probe (not committed) wrappedSeedLoaderService.prototype.resolveObjectDefinitionand recorded, for the extended object, whether the metadata copy and the engine schema carried the extension field.quote_refbootStack(config)(source)bootStack(config, { artifact })bootStack(artifact, { extraPlugins: [MetadataPlugin(artifactSource)] })createStandaloneStack({ artifactPath })kernel (theos devcomposition)bootStack(config, { artifact })"Acme Quote"bootStack(artifact, { extraPlugins: [MetadataPlugin(artifactSource)] })"Acme Quote"The standalone-stack leg composes only the stack's own plugins (no
AuthPlugin), so its rows were refused for a missing organization. Its seed-time reading is the measurement there. Thatos devstores the raw key on this resolver was measured on #36272 (os dev --fresh, PR body table).Ablation of the pin (rebuild + on-disk mutation proof)
The fix was committed first (d11ad49). The red leg used the same put-back resolver as above, with the dist marker present (preflight exit 0):
vitest run src/harness.seed-extension-lookup.test.ts: 2 failed, 4 passed. Both seed pins were red:expected 'Acme Quote' to be 'Jxi4WdPdRfw5yZh3'(artifact leg) andexpected 'Acme Quote' to be 'uI0EwppDilcGU-qA'(caller-door leg). The two preconditions and the two CONTROLs stayed green.git checkout HEAD -- packages/metadata-protocol/src/seed-loader.ts. The blob reads fdbca4a779, the HEAD blob, andgit status --porcelainshowed only the untracked scratch probe, since deleted. After the rebuild,--absentread the marker absent from all 24 built files.Suite and gate readings
pnpm --filter @objectstack/verify typecheck: exit 0 (check:test-typecheck: OK).pnpm --filter @objectstack/verify exec vitest run --maxWorkers=2(whole package):Test Files 56 passed (56),Tests 515 passed (515).bootStackaMetadataPluginor anartifact(16 files), run against the rebuilt@objectstack/verifydist:Test Files 16 passed (16),Tests 206 passed (206). No existing test flipped.dispatch-gates.mjs --commandsat ce65d57 derived 75 families, and every one ran locally, each exit captured before any pipe. 74 exited 0.node scripts/check-plugin-teardown-shape.mjs --self-testexited 3 (PREREQUISITE NOT MET: its fixture commit is out of this shallow clone's reach), so it is NOT MEASURED locally and CI runs it.--ranreconciliation: "75 derived, 74 run, 1 NOT-MEASURED, 0 UNRUN", exit 0.check:test-source-aliasexiting 1 on the new pin, which loaded@objectstack/service-automationinside a case's clock. ce65d57 adds the module-top side-effect imports, and the gate exits 0. The whole list was re-run on that head (the reading above). The pin re-ran there too:Tests 6 passed (6).typecheckexit 0.Acceptance notes
.claude/skills/dogfood-verification/SKILL.mdis untouched.MetadataPlugindeclared in the app's ownpluginsis still registered in the app-plugins slot afterAppPlugin, whileserveregisters it ahead of the wrap. No producer was measured; noted, not filed.MetadataPluginwith anartifactSourceleaves the app's registrar at'app-plugin'. The harness cannot know that the caller's door reads the same file the app is mounted from, so both still register the four security collections, as before this change.ObjectQLPluginstill has noenvironmentId, so its one-shot bridge still copies registry objects the artifact does not carry into the metadata service. The door's load supersedes the bridge for every object the artifact carries.Verification
Files to read first, by risk:
packages/verify/src/harness.ts, the metadata-slot hunk (callerMetadataPlugins/composesArtifactDoor) and theextraPluginsloop's skip.packages/verify/src/harness.seed-extension-lookup.test.ts..changeset/36274-verify-artifact-metadata-door.md.Two-minute check:
pnpm --filter @objectstack/verify exec vitest run --maxWorkers=2 src/harness.seed-extension-lookup.test.tsshould printTests 6 passed (6).🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE