Repository navigation
fix(service-automation): a package-bound flow's run records the checksum its history row is keyed by - #39431
fix(service-automation): a package-bound flow's run records the checksum its history row is keyed by#39431objectstack-fleet[bot] wants to merge 1 commit into
Conversation
…d provenance stamps A flow bound to a package reaches registerFlow stamped with _packageId by the read, while the write door strips _packageId, _packageVersion and _provenance before it stores and hashes the body. flowContentChecksum now drops those three, so a run's flow_checksum equals the checksum its sys_metadata_history row is keyed by. The _lock family is stored and stays hashed. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czHUJLmdQAqm4fdDs9
📓 Docs Drift Check3 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 11 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 081aa7c2313be8e31c383e24bb7129a1ec36a25b && git checkout 081aa7c2313be8e31c383e24bb7129a1ec36a25b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 5c00c57263d07f060ab09674de1b1cb2ff9933e3 1cf80b3430138d45199ab5dfa70ed1315f3d58b3 && git checkout -B drift-repro 5c00c57263d07f060ab09674de1b1cb2ff9933e3 && git merge --no-ff 1cf80b3430138d45199ab5dfa70ed1315f3d58b3
node scripts/docs-audit/affected-docs.mjs --json 5c00c57263d07f060ab09674de1b1cb2ff9933e3 |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9 Final green head · 2026-12-04T00:11Z · |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czzaKz49WLAvKtdyiY 席位核对L1 verdict (L1-b): ACCEPT at head Face: The one red check is stale, not a defect. Diff (3 files, +193/−5), read in full:
Dev's open question (export the write door's list instead of a second spelling): not a REWORK. It is outside the claim's file surface, and the docblock names the authority. It is cheap, though: service-automation already imports from Card half: the PR body says the card's resume-after-restart half rides #39386's suite. Generated by Claude Code |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9 Landing · 2026-12-04T00:16Z · head
|
Requested by Elon · project thread
Fixes #39388
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czHUJLmdQAqm4fdDs9
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
flowContentChecksum(service-automationflow-identity.ts) is the identity a run records (flow_checksum) and a resume looks its body up by insys_metadata_history(getByHash). It hashed the body handed toregisterFlow. For a flow bound to a package, that body is a served body: the read stamps_packageIdon it. The metadata write door strips_packageId,_packageVersionand_provenance(DERIVED_PROVENANCE_KEYS/stripDerivedProvenance,metadata-protocolprotocol-package-bindings.ts) before it stores the body and hashes it intosys_metadata.checksumand the history row. So the run's checksum named no history row.The checksum now drops exactly those three derived provenance stamps before
hashSpec(body, 'flow'):registerFlowreceives carries_packageIdand nothing else beyond the stored history body (a one-off spy onregisterFlowin this suite's package-bound case; diagnostic removed)._lock*family. A lock is author-declarable and the write door persists it, so it is part of the stored body and of its checksum. Dropping it would break the match in the other direction.METADATA_READ_DECORATIONS. The flow schema is closed, so a body carrying_diagnosticsand the rest is refused byregisterFlowbefore any checksum is taken.@objectstack/metadata-protocoland the claim's file surface isflow-identity.ts. The three keys are spelled once more there, and the docblock names the write door's list as the authority (see Acceptance notes).Every reader of the identity goes through this one function (
registerFlow→flowChecksums), or stores the history checksum as given (recoverStoredFlow). The approvals run-body witness compares the engine against itself. A loose (package-less) flow carries no stamp, so its checksum is unchanged. Per the maintainer rule, runs recorded with the old checksum are not migrated.Read first
packages/services/service-automation/src/flow-identity.ts: the whole change. The risk is the key set. Compare it withDERIVED_PROVENANCE_KEYSinpackages/metadata-protocol/src/protocol-package-bindings.tsand the strip atprotocol-save.ts(request.item = stripDerivedProvenance(request.item)).packages/services/service-automation/src/flow-checksum-served-stamps-39388.integration.test.ts: the pin. It compares the run row'sflow_checksumwith the history row the real save wrote, never with a hash the test computes.Two-minute verification
pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/flow-checksum-served-stamps-39388.integration.test.tsshould show 2 passed. ChangehashSpec(withoutServedStamps(definition), 'flow')back tohashSpec(definition, 'flow')and the package-bound case goes red, with two differentsha256:values.Tests
flow-version-pinning.integration.test.tsis held by open PR 39386, so the claim excludes it): one kernel over sqlite, the real metadata protocol save, the real engine.flow_checksumequals its v1 history row's checksum.f32b7d6d(before the fix): package-bound case failed,expected 'sha256:19e1044b…' to be 'sha256:061e7f8c…'; loose case passed.1cf80b34(scripts/ablation-replace.mjs, anchor hit 1 → 0, blob8d9cc8da→d54ffdf1): package-bound red with the same two hashes, loose green; restored blob == HEAD,git diff HEADempty.pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2at1cf80b34: 307 files, 4560 tests passed.pnpm --filter @objectstack/service-automation typecheckat1cf80b34: exit 0 (tsc andcheck:test-typecheckOK).pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/flow-route.integration.test.tsagainst a rebuilt service-automationdist: 58 passed.Acceptance notes
flow-identity.tsand in metadata-protocol's module-privateDERIVED_PROVENANCE_KEYS. If the write door ever strips a fourth served key, this list must follow it. Exporting the write door's list from@objectstack/metadata-protocoland importing it here would remove the second spelling. That change is outside this claim's file surface.hashSpec(body, 'flow')":run-body-witness.ts(plugin-approvals),run-flow-checksum.ts,engine-resume.ts,sys-automation-run.object.ts. They are still true of the stored body and out of surface, so they are not edited here.Verification
Local gates: the families
node scripts/pm/dispatch-gates.mjs --commandsderived for this diff at1cf80b34. Readings are in the report comment on the card. CI runs every family on the PR.Generated by Claude Code