Repository navigation
fix(metadata-protocol): a seed owner_id naming a person resolves on objects that rely on the injected owner column - #34023
Conversation
…harness's metadata stub Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
…_id as a sys_user lookup Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
…pins to the declared field Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
… declared lookup Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
📓 Docs Drift CheckThis PR changes 1 package(s): 7 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 — 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 f31488e4142bd64d136e9516ebb385991ad4e8c8 && git checkout f31488e4142bd64d136e9516ebb385991ad4e8c8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b4eea885058321e56776ab2b690e4f35e29b7a0c 8a8cb4e33173f263bab510cbd84d6b7a59227baf && git checkout -B drift-repro b4eea885058321e56776ab2b690e4f35e29b7a0c && git merge --no-ff 8a8cb4e33173f263bab510cbd84d6b7a59227baf
node scripts/docs-audit/affected-docs.mjs --json b4eea885058321e56776ab2b690e4f35e29b7a0c
|
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Request: review · PR #34023 · area S2 (A4) · Fixes #33791 · head
|
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review claim · head 03ff358 · 2026-11-15T17:02Z review (review-b, areas S2+S4): ordinary ACCEPT read per review-checklist.md; the verdict follows on this PR. |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review — PASSHead-sha:
A clean |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh 席位核对Head-sha:
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43741987434 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Re-arm (one discriminating re-queue) at head
A timeout is load-sensitive, so one re-queue of the unchanged head discriminates. If the same case times out again, I'll stop and measure the file locally on main versus this head before any further queue attempt, and report the reading here. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43743119181 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Holding the re-queue. The second queue build, 43743119181, hit the same signature ( Why this is not this PR's failure (read from code, not run):
Re-queue waits on #34081's fix, so another full queue round isn't burned. |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Re-arm at head
|
Requested by Steedos · project thread
Fixes #33791
Clause-②: no
Metadata-protocol: none
维护者速读
owner_id(自己没声明),种子里写的人名现在会像Field.user()一样解析成该用户的 id;该人不是本组织成员时留空并报「not a member」错误。owner_id的对象和不注入 owner 的对象不受影响;已存的文本值不会被本改动改写。回滚即撤回本 PR。packages/metadata-protocol/src/seed-loader.ts(seedReferenceGraphFields与buildDependencyGraph中的一行调用)、packages/runtime/src/seed-org-scoped-references.integration.test.ts(桩改为返回作者原始定义 + 新的 seed:owner_id: 'PERSON NAME'is written as literal text on an app object that relies on the injected owner_id — the seed loader builds its reference graph from the authored definition, which has no owner_id #33791 用例组)。pnpm --filter @objectstack/runtime exec vitest run src/seed-org-scoped-references.integration.test.ts,预期 31 个用例全部通过,其中 seed:owner_id: 'PERSON NAME'is written as literal text on an app object that relies on the injected owner_id — the seed loader builds its reference graph from the authored definition, which has no owner_id #33791 组 5 个。What changes
The seed loader builds its reference graph from the definition the metadata service serves, which is the one the author wrote. An object that relies on the platform's
owner_iddoes not declare it: objectql's system-field pass adds it at registration.buildDependencyGraphread the declared fields only, so a seedowner_id: 'PERSON NAME'on such an object was stored as the name itself, while a declaredField.user()/Field.lookup('sys_user')on the same row resolved.seed-loader.ts: a newseedReferenceGraphFields(definition)returns the declared fields plusowner_idasOWNER_FIELD_DEF(thesys_userlookup the registry injects) whenresolveInjectedSystemColumns(definition).owneris true and the object does not declareowner_id.buildDependencyGraphiterates that map. A declaredowner_idwins whatever its type; objects with no injected owner (ownership: 'org' | 'none' | 'business_unit',managedBy, asys_*name,systemFields: false) are unchanged. The injected owner then takes the same resolution path as a declared person lookup: unscoped on a load with no organization, membership-scoped on an organization's own load, NULL plus the "not a member of organization" error for a non-member.seed-org-scoped-references.integration.test.ts: the metadata stub now serves the as-authored definition (it servedengine.registry.getObject(...), the enriched one, which hid this defect). The existing seed: on an organization-scoped load a reference to sys_user (owner_id: NAME) never resolves — the reference probe adds organization_id to a tenant-less object and swallows the refusal #33207 case that seedsowner_id: 'Zhang Wei'oncrm_dealturned red onorigin/mainonce the stub was corrected, and is green with the fix. A new top-level describe pins single boot, walled replay (member, same-name per organization, non-member NULL + error on bothowner_idandrep), the pinned install load, and the no-organization control.seed-loader-injected-owner-reference.test.ts(new): graph-level pins on authored definitions: the injected row, its equality with a declaredsys_userlookup namedowner_id, a declaredowner_idwinning, a declared non-referenceowner_id, the six no-owner boundary objects, andsys_userordering with no cycle.seed-loader-reference-carrier.test.ts,seed-loader-implicit-reference-target.test.ts: their fixtures (book,crm_task) are user-owned objects, so the graph now also carries anowner_idrow for them. Their assertions judge the declared carrier field, so they now read the declared field's rows only (fixture triage: the fixtures are unchanged; the new row is correct for them).@objectstack/metadata-protocolpatch.Tests
All readings below are on head
03ff3585(after mergingorigin/mainatb8ac0e24) unless named otherwise.@objectstack/metadata-protocolpnpm test: Test Files 343 passed, 9 skipped (352); Tests 22913 passed, 43 skipped.typecheck: exit 0.@objectstack/runtimetypecheck: exit 0. Seed files of the runtime suite (13 files, includingseed-loader.test.tsandseed-org-scoped-references.integration.test.ts): Tests 141 passed.@objectstack/runtimepnpm testat655dd0d1(before the merge): 604 of 605 files passed; the one failure wasseed-loader.test.ts"should ignore references to objects not in the graph", whose fixturecontactis user-owned and now also carries theowner_idrow. Its assertion was updated to name both rows (account_idtoaccount,owner_idtosys_user) in0a56c258, and the file is green at the final head.SeedLoaderServiceoutside these packages, at655dd0d1: objectql seed and publish files (13 files, 227 tests),@objectstack/cloud-connectionmarketplace-install-local*(56 files, 688 tests),@objectstack/cliseed-record-values-load-parity(1 test): all passed.Acceptance notes
sys_userlookup; the pin serves the as-authored definition; a non-member resolves to NULL with the "not a member" error, asrepdoes.claimSeedOwnership) claims rows whoseowner_idis NULL; a non-member's row is now NULL, so it is claimable. Not re-pinned here (outside this file surface); read frompackages/runtime/src/app-plugin.ts.content/docs/data-modeling/seed-data.mdxalready promises this (the target table row forsys_user, "people:owner_id, people lookups"); its text agrees with the fix, so it is not edited.owner_idis added. The audit*_bycolumns andowning_business_unit_idare also injected lookups but are readonly and server-stamped; they are not part of this card's ruling and are left as they were.sys_memberrow is written) is out of scope and untouched.Clause-②: noandMetadata-protocol: nonehold. No schema key, accepted value or metadata type moves; a seed that loaded still loads. A non-member name now lands as NULL with a reported error instead of as text, which is the behaviour the 18.5.0 changeset and docs already promised for person references.Verification
Red first on origin/main (the card's hypothesis H1)
The new pins and the corrected stub, run against the unchanged
origin/mainloader (64807a9c) after a closure build:seed-loader-injected-owner-reference.test.ts: 3 failed, 8 passed.expected [] to deeply equal [ { field: 'owner_id', ... } ];dependsOn['crm_account']instead of['crm_account', 'sys_user'].seed-org-scoped-references.integration.test.ts: 5 failed, 26 passed. Single boot:"owner_id": "Zhang Wei"stored whererepis"usr_zhang". Walled replay:"owner_id": "Wang Fang"and"Zhang Wei"stored as text. The existing seed: on an organization-scoped load a reference to sys_user (owner_id: NAME) never resolves — the reference probe adds organization_id to a tenant-less object and swallows the refusal #33207 case that seedsowner_idalso went red once the stub served the authored definition.With the fix (
seed-loader.tsbuilt intodist/): 11 of 11 and 31 of 31.Ablation (each leg rebuilt; runtime reads metadata-protocol from dist/)
Mutation through
scripts/ablation-replace.mjs: the guardif (!resolveInjectedSystemColumns(definition).owner) return fields;replaced byif (definition.fields) return fields;(anchor 1 to 0, blob811047510bd6toccd9579da705), thenpnpm --filter @objectstack/metadata-protocol buildandablation-dist-preflight.mjs @objectstack/metadata-protocol 'resolveInjectedSystemColumns(definition).owner' --absent: marker absent from all 24 built files. Result: the graph pins 3 failed of 11 and the runtime pins 5 failed of 31, the same cases as onorigin/main. Restore: blob back to811047510bd6= HEAD,git diff HEADempty,git status --porcelainempty; rebuilt, and the preflight in default mode reads the marker present in 1 built file. A first attempt that replaced the call site was refused by the dts build (TS6133unused function), so nothing ran on it.Gates
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran: 66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN; every recorded exit code is 0.check:query-options-erasurehit a 300 s local timeout under a shared box once and passed on rerun;check:type-check-debtran under the verify lock (re-measure OK, 0 errors above the record).check-changeset-no-majorexit 0,check-closing-keyword-parityexit 0,check-adr-0087-registrationexit 0,check-empty-changesetexit 0.dispatch-gates --tier: no path-derived mandate; 254 changed lines.git merge-tree --write-treeagainstorigin/main: clean. No open PR touchesseed-loader.tsor the runtime harness file (59 open PRs read through REST).!in the title, no(narrowing)arm).Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh