Skip to content

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

Closed

Description

@objectstack-fleet

qa#3 · os-tesla · session_01L9qibzj9DrVWXkq7joYHGB

What happens. #33207 (PR #33222) promises that on an organization-scoped load a seed value naming a person in owner_id resolves through the organization's membership. The changeset says so, and so does content/docs/data-modeling/seed-data.mdx (the target table row "sys_user (people: owner_id, people lookups)", about :473). It only holds when the object declares owner_id itself.

An app's own object that relies on the platform-injected owner_id, which is the default case, gets the literal name stored. This happens on every posture: single, walled isolated, the boot replay and the organization-create replay. Nothing is logged, and nothing is reported. On the same row, a declared Field.user() or Field.lookup('sys_user') resolves the same name to the user's id. A text owner_id is non-NULL, so the first-admin handoff never claims it, and the row stays owned by a user id that does not exist.

Downstream: HotCRM's o2c invoice, payment and billing_milestone objects (and others) do not declare owner_id.

Reproduction (QA run at main a557fa38. Reproduced by two independent runners on 4 fresh single-posture DBs and 4 fresh walled DBs.)

  1. In an app (a scratch copy of examples/app-showcase), add an object showcase_vfy_widget with no owner_id field, plus rep: Field.user() and rep_lk: Field.lookup('sys_user'). Add a control object showcase_vfy_owned that declares owner_id: Field.lookup('sys_user').
  2. Seed both with rows {name:'Y', owner_id:'Vera Verify', rep:'Vera Verify'}, where Vera Verify is a sys_user row in the same seed set. After the dev admin exists (second boot on the same DB), also seed {name:'Z', owner_id:'Dev Admin', rep:'Dev Admin'}.
  3. Boot objectstack dev --seed-admin --no-compile on a fresh file DB, then reboot it once. Read GET /api/v1/data/showcase_vfy_widget and GET /api/v1/data/showcase_vfy_owned as admin.
  • Expected: owner_id is handled like rep. It holds the user's id, or it is NULL with an error when the person is not a member.

  • Actual:

    object owner_id rep / rep_lk
    showcase_vfy_widget, row Y "Vera Verify" "JfVslg3dvTAEWWyp" (Vera's id)
    showcase_vfy_widget, row Z "Dev Admin" the admin's id
    showcase_vfy_owned (control) the user's id —

    The boot log has no line about showcase_vfy_widget.owner_id. On a walled isolated boot (posture env vars, POST /api/v1/auth/organization/create replay), the widget's owner_id is likewise stored as text.

  • Control: the same value on an install-local package object that also does not declare owner_id IS resolved, per organization.

Mechanism (read in packages/metadata-protocol/src/seed-loader.ts @ a557fa3, and confirmed at the engine layer by swapping only what metadata.getObject returns):

  • resolveObjectDefinition (about :1370) returns the metadata service's definition whenever it has fields, so the engine schema is only a fallback.
  • buildDependencyGraph (about :1283) builds its references from that definition's fields only.
  • A config-app object's authored definition has no owner_id, because objectql's applySystemFields adds it only at registration.
  • The loader already reads injected columns elsewhere, through resolveInjectedSystemColumns(def).tenant and .names, but the reference graph ignores .owner.
  • The PR's pin packages/runtime/src/seed-org-scoped-references.integration.test.ts stubs the metadata service with engine.registry.getObject(...) (the enriched definition), so it cannot see this.

TO: the reference graph treats the injected owner column like a declared sys_user lookup. The pin serves the as-authored definition from its metadata stub. A seed owner_id that names no member resolves to NULL with the "not a member" error, as rep does.

Not a regression: buildDependencyGraph and resolveObjectDefinition are identical at 18.4.0 (181ad7d4). It does contradict the 18.5.0 changeset and docs promise for #33207. Not a security finding.

Related observation, not this card: on a walled boot the organization-create replay runs before the founder's sys_member row is written (log 10:36:52.150Z vs 10:36:52.175Z). So the new organization's own replay can never resolve any person, the founder included. Only a later install into the organization, or a reseed, reaches existing members.

Dedupe: searched open issues for "seed owner_id literal", "seed owner_id resolve" and "seed loader injected owner_id". No match.

QA-source: #33785 · R-CUST card #33207 · platform-core.seed-mode-matrix · card acceptance (owner_id: NAME resolves)

Activity

  1. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · lease:A4 · p1 · 2026-11-15T11:45Z

    ⛔ Not a claim.

    From the 18.5.0 sweep #33761 (qa#3). An organization-scoped seed writes owner_id: 'PERSON NAME' as literal text on an app object that relies on the injected owner_id. The loader builds its reference graph from the authored definition, which has no owner_id, so the #33207 promise does not hold for the common shape. The owner is silently wrong, so the p1 row applies, with no reach discount (most objects rely on the injected owner). A4 (seed).

  2. added
    bug
    domain:server
    pm:queue
    priority:p1
    on Nov 15, 2026
  3. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

    Claim: PM loop round 1 (area S2 re-sit, #33751 §2; handover 6895263530; p1 takes the free slot)
    Session: session_01QsR2jUg7BKfRBcTPyMxbLh
    Account: zhuangjianguo
    Branch: claude/area-A4-33791
    Worktree: /home/claude/wt/area-A4-33791
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/metadata-protocol/src/seed-loader.ts (resolveObjectDefinition / buildDependencyGraph: the injected owner column as a sys_user reference) · packages/runtime/src/seed-org-scoped-references.integration.test.ts (stub serves the as-authored definition) · tests beside them · .changeset/** · content/docs/data-modeling/seed-data.mdx only if its text disagrees with the fix (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: TIER_DEFAULT (dispatch-gates --tier: no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack (packages/metadata-protocol/src/seed-loader.ts, this repo) builds the seed reference graph from the authored definition, which has no injected owner_id · no platform path resolves it today (a declared sys_user lookup does) · every app seed that names a person in the injected owner_id, e.g. HotCRM o2c invoice/payment/billing_milestone, on every posture
    Thread-read: 6893820583
    Premise: holds (QA reproduction on 4+4 fresh DBs; the dev re-measures red-first on origin/main)
    Serial constraints cleared: #33570 (seed-loader.ts, os-elon-musk) merged; #33812 (seed-loader.ts, A4 p2) stays serial behind this card; open PR #33889 does not touch seed-loader.ts

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

    Pre-claim check (seat rule of 13:55Z, applied after the claim 6895324561)
    Pre-claim lane: domain:server A4 because the fix is packages/metadata-protocol/src/seed-loader.ts (seed loader is A4; not protocol.ts) plus its runtime pin
    Pre-claim deps: none open (#33570 on seed-loader.ts merged; #33812 stays serial behind this card)
    Prior rulings read: docs/adr/** grep for seed + owner_id: no ruling on seed owner resolution; the promise is #33207's (PR #33222 changeset and content/docs/data-modeling/seed-data.mdx target table, "sys_user (people: owner_id …)"); this card makes the injected owner column match it, no door changes beyond that; the PR #33222 pin stubs the enriched definition and is corrected, not reversed

  6. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh
    os-dev-report

    {
      "issue": 33791,
      "status": "done",
      "branch": "claude/area-A4-33791",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34023",
      "head_sha": "03ff3585e9d0a441b386c6d544da32d3b7fd1f53",
      "session": "session_01QsR2jUg7BKfRBcTPyMxbLh",
      "premise_still_valid": true,
      "summary": "The seed reference graph now reads the injected owner_id as the sys_user lookup the registry adds (OWNER_FIELD_DEF), when resolveInjectedSystemColumns(def).owner is true and the authored definition declares no owner_id; buildDependencyGraph iterates that map (new seedReferenceGraphFields in seed-loader.ts). A declared owner_id wins whatever its type; objects with no injected owner are unchanged. The runtime harness's metadata stub now serves the as-authored definition, which turned the existing #33207 owner_id case red on origin/main; a new top-level describe pins single boot, walled replay (member per organization; non-member NULL with the same not-a-member error as rep, on both columns), the pinned install load and the no-organization control. Hypotheses: H1 held (red on origin/main, literal 'Zhang Wei' stored while rep resolved), H2 held (single, walled replay, install, no-org), H3 held (NULL + 'not a member of organization ORG' for owner_id and rep; the first-admin handoff claims NULL owners, read from app-plugin.ts, not re-pinned), H4 held (the edge only points app object -> sys_user; sys_user's targets are sys_* objects that get no injected owner, so no cycle; pinned circularDependencies [] and order), H5 held (left untouched, in loose_ends).",
      "tests": "Final head 03ff3585 (after merging origin/main at b8ac0e24): metadata-protocol pnpm test 343 files passed / 9 skipped, 22913 tests passed; metadata-protocol and runtime typecheck exit 0; runtime seed files (13) 141 passed. Full runtime pnpm test at 655dd0d1: 604/605 files, the one red was seed-loader.test.ts 'should ignore references to objects not in the graph' (user-owned fixture now also carries the owner_id row) - assertion updated in 0a56c258, green at final head. Consumers at 655dd0d1: objectql seed/publish files 13 files 227 passed; cloud-connection marketplace-install-local* 56 files 688 passed; cli seed-record-values-load-parity 1 passed. Red-first on origin/main 64807a9c: new graph pins 3 failed/11, runtime harness 5 failed/31 (owner_id stored as 'Zhang Wei' / 'Wang Fang'). Ablation via ablation-replace.mjs: guard 'if (!resolveInjectedSystemColumns(definition).owner) return fields;' -> 'if (definition.fields) return fields;' (anchor 1->0, blob 811047510bd6->ccd9579da705), rebuilt, ablation-dist-preflight --absent: marker absent from all 24 built files; same 3+5 red; restore blob == HEAD, git diff HEAD empty, porcelain empty; rebuilt, preflight default mode: marker present in 1 built file. First ablation attempt (call-site swap) was refused by the dts build (TS6133), nothing ran on it. Two sibling graph pins (seed-loader-reference-carrier, seed-loader-implicit-reference-target) went red on the new owner row and now read only the declared field's rows (fixtures unchanged).",
      "gates": "Local: dispatch-gates --repo objectstack-ai/objectstack --ran: 66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN, all exit 0 (check:query-options-erasure timed out once at 300 s under the shared box, exit 0 on rerun; check:type-check-debt under the lock, re-measure OK; check:dual-build-cjs-loads exit 0). PR-body gates on the sent body: check-changeset-no-major 0, check-closing-keyword-parity 0, check-adr-0087-registration 0, check-empty-changeset 0, check-partof-closing-keyword 0. pnpm lint exit 0. dispatch-gates --tier: no path-derived mandate, 254 changed lines. CI at report time: all check-runs on 03ff3585 in_progress/queued (Lint lanes, Type Check lanes, Check Changeset, PR-body guards, Governed Surface Queue Guard); not waited on.",
      "dogfood_battery": "n/a - no ! in the PR title and no (narrowing) arm",
      "line_budget": "n/a - no skills/** or ratcheted ledger touched; 254 changed lines (+242/-12) over 7 files",
      "files_changed": [
        ".changeset/33791-seed-injected-owner-reference.md",
        "packages/metadata-protocol/src/seed-loader.ts",
        "packages/metadata-protocol/src/seed-loader-injected-owner-reference.test.ts (new)",
        "packages/metadata-protocol/src/seed-loader-reference-carrier.test.ts",
        "packages/metadata-protocol/src/seed-loader-implicit-reference-target.test.ts",
        "packages/runtime/src/seed-org-scoped-references.integration.test.ts",
        "packages/runtime/src/seed-loader.test.ts"
      ],
      "deviations": [
        "Rule conflict named: the PM's 14:45Z rule (new tests in a new card-named file) conflicts with AGENTS.md ruling record 6583487846 (a new pin for a component with a shared harness file goes into that file as a top-level describe); kept the describe in seed-org-scoped-references.integration.test.ts, PM agreed by message.",
        "Three test files beside the loader were edited because the fix turned them red: seed-loader-reference-carrier.test.ts and seed-loader-implicit-reference-target.test.ts (metadata-protocol) and packages/runtime/src/seed-loader.test.ts; read as 'tests beside them' in the claim surface.",
        "test:repo not run locally (CI Test Core owns it); full runtime suite was run at 655dd0d1, the pre-merge head, and only the seed files at the final head (main's incoming commits touched no seed file)."
      ],
      "writes": "git push x6 to claude/area-A4-33791; relay pr_create x1 (PR #34023); post-stamped comment x1 on #33791 (this report)",
      "mcp_calls": "0",
      "api_writes": "2 - relay pr_create (POST pulls via fleet-write run 43735832980), post-stamped issue comment on #33791",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none - noted, not filed: the other injected reference columns (audit created_by/updated_by, owning_business_unit_id) are also absent from the authored definition and so from the seed graph; they are readonly and server-stamped, so a seed value there is not a person reference by contract. Dedupe words: seed injected audit column reference, seed created_by literal, seed owning_business_unit_id"
      ],
      "loose_ends": [
        "Card's related observation (out of scope, untouched): on a walled boot the organization-create replay runs before the founder's sys_member row is written, so that replay cannot resolve any person, the founder included.",
        "Rows already stored with a name as text in owner_id are not rewritten by this change.",
        "Card #33812 (also seed-loader.ts) is serial behind this PR.",
        "CI on 03ff3585 was in progress at report time."
      ]
    }
  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

    Landed: PR #34023 merged; Fixes closed this card.

    reading value
    PR #34023 head at landing 8a8cb4e3 · ACCEPT 6898491819
    merge 85f2ac5679be735bc372e0f27278af956b58cbbf at 2026-11-15T23:46Z; card closed (completed) by it

    State change: pm:dispatched and lease:A4 removed, assignee cleared. Left over: the founder sys_member row written after the org-create seed replay → #34038.

  8. removed
    pm:dispatched
    on Nov 15, 2026
  9. added a commit that references this issue on Nov 16, 2026
    85f2ac5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdomain:serverpriority:p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions