Repository navigation
fix(runtime): an un-walled boot seed's person references resolve to the first admin once that admin exists - #34516
Conversation
… the person exists The inline boot seed runs before the first admin's sys_user row exists, so a person reference naming that admin lands NULL after pass 2. The seed loader now holds such references (on the rows it landed on) and AppPlugin retries them after each sys_user insert, writing each one that resolves only while the column is still NULL. Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
…in it names Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
…ed's own NULL columns (ADR-0138 D1) Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
…walled-seed-person-refs
📓 Docs Drift CheckThis PR changes 2 package(s): 52 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 11 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 35 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 fb02f7a29115e6eda2dfc28e5305fedf395a9c37 && git checkout fb02f7a29115e6eda2dfc28e5305fedf395a9c37
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0c7869c03c9c6ff3a38bd6b09206edeee0184769 0916d339e426a32f029081870c5764bc546b81ce && git checkout -B drift-repro 0c7869c03c9c6ff3a38bd6b09206edeee0184769 && git merge --no-ff 0916d339e426a32f029081870c5764bc546b81ce
node scripts/docs-audit/affected-docs.mjs --json 0c7869c03c9c6ff3a38bd6b09206edeee0184769
|
|
repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz Final head for review: |
|
repo:objectstack#2 · os-steve · session_01ADHkmPZf3MhxKeGaxV4P3W 席位核对L1 first review · ACCEPT · head Checklist (read on GitHub at this head, not from the report)
Out of scope, for the area to place (one line each:
|
|
repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz Landing
Body: attribution header added; the two Acceptance notes now read "Filed: #34542" (held references in process memory) and "Dropped" (the pass-2 log text, still literally true). State: ready, auto-merge armed. |
Requested by Steve · project thread
Fixes #34458
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
On an un-walled (single-tenant) first boot the inline boot seed loads before the first admin's
sys_userrow exists, so aField.user()/Field.lookup('sys_user')value naming that admin landed NULL. The first-admin handoff (claimSeedOwnership) writesowner_idonly, and a later boot's replay of a create-only dataset leaves an existing row as it is, soassignee/reviewerstyle columns stayed NULL for good.packages/metadata-protocol/src/seed-loader.ts: pass 2 now holds each person reference it left NULL (targetsys_user, row id known) as aHeldPersonReference. NewSeedLoaderService#resolveHeldPersonReferences()retries them with the loader's ownresolveReferenceItem(same organization), and writes a resolved value with a compare-and-set update by row id andFIELD = null. So a row the seed did not write is never reached (ADR-0138 D1), and a value set since is kept. Retries are serialized. A reference that still misses stays held.heldPersonReferenceCount()reports how many are held. The held list resets perload.packages/runtime/src/app-plugin.ts: after the inline boot seed,AppPluginkeeps the loader while it holds references. A new ObjectQL middleware (registerSeedPersonReferenceHandoff) runs the retry after everysys_usercreate/insert and releases the loader once it holds none. Failure is best-effort and logged atwarn, like the tenancy handoff beside it. The user insert always stands.packages/spec/src/**; no contract change. The new loader methods are on the concreteSeedLoaderServiceclass and are not part ofISeedLoaderService..changeset/34458-unwalled-seed-person-refs.md:patchon@objectstack/metadata-protocoland@objectstack/runtime.Tests
packages/plugins/organizations/src/default-organization-seed-owner.wall.test.ts. This is the forced test change the card names:control: the same seed on an un-walled boot reads as it did before the fixand assertedassignee: null, reviewer: null, owner_id: adminId. It is now titledthe same seed on an un-walled boot resolves the first admin once that admin existsand assertsassignee,reviewerandowner_idall equal the admin id.un-walled: a held seed person reference fills only the seed's own rows, and only while still NULL. Its PREMISE leg shows the reference is NULL before the named person signs up, and that the admin's insert did not fill it. Its main leg covers three rows. The seed's row resolves to the late person once they exist. A seeded row assigned by hand in the meantime keeps that assignment. A guest-written row with a NULL person stays NULL (the ADR-0138 D1 negative leg).Ablation (one-shot, not kept). The handoff's loader read in
app-plugin.tswas replaced with an always-undefined read throughscripts/ablation-replace.mjs. The marker was proved inpackages/runtime/distwithablation-dist-preflight.mjs(exit 0) after a rebuild. The organizations suite then went red on exactly the two new/flipped legs:Tests 2 failed | 3 passed (5). Restore leg: blob hash equal to HEAD, rebuild, preflight--absentexit 0, thenTests 5 passed (5).Suite readings (locked runs, on e2ab3fd; the later merge of origin/main 6c7d730 touches none of these packages)
pnpm --filter @objectstack/metadata-protocol test: exit 0,Test Files 346 passed | 9 skipped (355),Tests 22968 passed | 45 skipped (23013)pnpm --filter @objectstack/organizations test: exit 0,Test Files 20 passed (20),Tests 264 passed (264)pnpm --filter @objectstack/runtime test: exit 0,Test Files 609 passed (609),Tests 11271 passed | 19 skipped (11290)pnpm --filter @objectstack/metadata-protocol --filter @objectstack/runtime --filter @objectstack/organizations typecheck: VERDICT command-exit 0, all threeDoneTests 5 passed (5); seed-loader suitesTests 58 passed (58)Ablation readings
pnpm --filter @objectstack/runtime buildexit 0,ablation-dist-preflight.mjs @objectstack/runtime '__ABLATION_34458__'exit 0. Wall test:× the wall is down, the seed landed once before the admin existed, and every person reference naming the admin resolves to the admin,× the seed's NULL reference resolves to the person once they exist; the guest row and the hand assignment stand,Tests 2 failed | 3 passed (5).--absent: marker absent from all 12 built files, thenTest Files 1 passed (1),Tests 5 passed (5).Acceptance notes
sys_userrow is inserted by the same process that ran the boot seed. A restart before sign-up was not measured. A durable retry would need the seed-settlement contract to carry the held references, which is a spec change this card does not take. Filed: seed: person references deferred until the first admin exists live only in process memory; a restart before that leaves the columns NULL for good #34542.sys_userinsert only while the loader still holds references; once none are held, the middleware returns at its first check.UNRESOLVEDerror text still says "No further seed pass retries this". That remains literally true, since the held retry is not a seed pass, and its SCOPE clause already says a later boot step can still write the column. Dropped: the sentence is still literally true, because the held retry is a write after the seed, not a seed pass.packages/metadata-protocol/src/seed-loader.tsoverlaps open PR fix(cloud-connection): install-local keeps and honours the landed-key record, so a seed row a tenant deleted stays deleted #34429:git merge-tree --write-tree HEAD refs/pull/34429/headat 2a00228 exits 0 (tree 0e6916848), with no conflict.Verification
Gate sweep:
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 72 families for this diff. Each was run with stdin closed and its exit code captured before any pipe. Reconciliation with--ranreports72 derived, 72 run, 0 NOT-MEASURED, 0 UNRUN. Two families first answered exit 3 (PREREQUISITE NOT MET) and were re-run once the prerequisite was met.check-plugin-teardown-shape --self-testneeded its pinned fixture commit fetched, then exited 0 with 48 cases.check:dual-build-cjs-loadsneeded every package built, then exited 0 with 124 entry points across 72 packages.Head and gate provenance
check:type-check-debt: exit 0, 0 ledger entries re-measured, 0 raw tsc errors.