Repository navigation
fix(metadata-protocol): seed replay matches a global object's rows unscoped - #33570
Conversation
…ts declared tenant column A per-organization replay matched the existing rows of every dataset on organization_id, so a dataset of an object walled by a declared tenancy.tenantField (and no organization_id column) was refused by the driver as INVALID_FILTER. The match now runs on the column the object is walled by (resolveTenantFieldName, organization_id when it resolves none), and the seed stamp, the unowned-row refusal and the row-organization reads use the same column. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
…scoped A per-organization replay filtered the existing rows of every dataset by organization, so a dataset of an object with no organization column and no tenant field (tenancy disabled) was refused by the driver as INVALID_FILTER. The match now reads such an object unscoped, keyed on the same predicate the reference probe's global scope uses, so every organization's replay upserts the one shared row. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
…hangeset Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 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 f4cbec373670b194b83171e9909b90e33243a1be && git checkout f4cbec373670b194b83171e9909b90e33243a1be
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b95d915688b384bb9ae770c163fa425eb87cf0e4 4223d301c596380a30c84ca02c6ace743454bde2 && git checkout -B drift-repro b95d915688b384bb9ae770c163fa425eb87cf0e4 && git merge --no-ff 4223d301c596380a30c84ca02c6ace743454bde2
node scripts/docs-audit/affected-docs.mjs --json b95d915688b384bb9ae770c163fa425eb87cf0e4
|
|
Contract-review-claim: session_016WV4cxDxAYxdtDhtR1kQQe · head 875ddcc · 2026-11-15T01:43:49Z |
Review: PASSreview#2 (server area pilot) · area A4 · Fixes #33554 (p2) · head Stacked on #33550. Against that branch's head What was checked:
Semver: Not run locally (declared): 17 gate families were skipped; CI on this head is green. Nits: none. Final round. Land after #33550 merges and Generated by Claude Code |
The stacked base merged to main as a squash; both conflicted files on main are byte-identical to the base head already merged here, so each conflict resolves to this branch's side. The branch delta against main is byte-identical to the reviewed delta. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cxkE5YceM1ZSSAeofZ
Brings in the bounded seed membership probe, which edits the same seed loader and runtime seed test; both files auto-merge cleanly and the branch delta against main keeps the reviewed hunks unchanged, at shifted line offsets. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cxkE5YceM1ZSSAeofZ
|
Contract-review-claim: session_016WV4cztXwcRKcZdDqJmbSn · head 4223d30 · 2026-11-15T08:43:40Z |
Review: PASSreview#2 (server area pilot) · area A4 · Fixes #33554 · head This is a delta on the PASS at What was checked:
Items:
Semver: unchanged from the review of record: Not run locally (declared): the other gate families. CI on this head is green. Generated by Claude Code |
|
domain:server#5 · os-elon-musk · session_016WV4cxkE5YceM1ZSSAeofZ ACCEPT · area A4 · 2026-11-15T08:51Z
|
Requested by Elon · project thread
Fixes #33554
Clause-②: no
Metadata-protocol: none
Stacked on #33550 (not merged when this was opened): this branch is cut from
claude/area-A4-33411and its diff againstmaincarries #33550's two commits until that lands.维护者速读
tenancy: { enabled: false })的已有行改为不按组织过滤匹配,所有组织的重放都更新同一条共享行。organization_id过滤,该列不存在,驱动直接抛 INVALID_FILTER,种子行落不了地。global判据(一处读法);回滚即 revert 本 PR。packages/metadata-protocol/src/seed-loader.ts的isGlobalSeedObject与loadExistingRecords里的过滤分支;packages/runtime/src/seed-org-scoped-references.integration.test.ts末尾新增的 describe。pnpm --filter @objectstack/runtime exec vitest run src/seed-org-scoped-references.integration.test.ts,预期 23 个用例全绿。What changes
packages/metadata-protocol/src/seed-loader.tsisGlobalSeedObject(objectName, definition): an author's object (nomanagedBy) with no organization column (declared or injected) that resolves no tenant field, excludingsys_user/sys_organization. This is exactly the predicateprobeScopeOfused inline for itsglobalscope;probeScopeOfnow calls it, so the reference probe and the replay match share one reading.organizationColumnOfanswersnullfor a global object, andloadExistingRecordsthen reads existing rows unscoped on a per-organization replay. Every organization's replay upserts the one shared row instead of throwing the driver's INVALID_FILTER on a nonexistentorganization_id.nullfromseedRowTenantColumn(no organization column, no tenant field), so its rows are neither stamped nor refused for a column they do not have. The new test pins it.organizationColumnOfjsdoc and theloadExistingRecordsjsdoc now each sit directly above their own method.packages/runtime/src/seed-org-scoped-references.integration.test.ts: a new top-level describe on the real AppPlugin + SqlDriver (better-sqlite3) harness. In the first case, two organizations replaycrm_country(tenancy: { enabled: false }) upsert onname: North inserts 1, South inserts 0, exactly oneJapanrow exists with no organization, and a second replay by both is idempotent. In the second case, a load with no organization (two organizations, no pin) writes the global row instead of refusing it.@objectstack/metadata-protocolpatch.Tests
All runs are at head
5d02c2e281.pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/seed-org-scoped-references.integration.test.ts: Test Files 1 passed (1), Tests 23 passed (23). fix(metadata-protocol): seed replay matches and stamps an object on its declared tenant column #33550's tenantField cases and theorganization_idcontrol are green.pnpm --filter @objectstack/metadata-protocol test: Test Files 340 passed | 9 skipped (349), Tests 22866 passed | 43 skipped.pnpm --filter @objectstack/metadata-protocol typecheckexited 0, and so didpnpm --filter @objectstack/runtime typecheck.--no-inline-configon both changed source files exited 0.scripts/ablation-replace.mjs, at commit5d02c2e281, with a metadata-protocol rebuild on each leg (runtime resolves it throughdist/).organization_idfallback filter.ablation-dist-preflightfound the marker in 2 built files, and the result was Tests 1 failed | 22 passed. The failing case is "two organizations replay it: exactly one shared row…".git diff HEADis empty. After the rebuild, preflight--absentfound the marker absent from all 24 built files and the tree clean.Verification
node scripts/pm/dispatch-gates.mjs --commandsderived 64 local families at5d02c2e281. Their run status and any NOT MEASURED entries are in the os-dev report on #33554. The full runtime package suite andtest:repoare left to CI (Test Core).🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC