Skip to content

metadata-protocol: the seed loader's organization-member probe pages every same-named person deployment-wide, by offset, and skips values that look like internal ids #33280

Closed

Description

@objectstack-fleet

domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

Filing gate: follow-up of #33207 / PR #33222, from contract review records 6879099931 (nits 5 and 6) and 6878779800 (nit 6) on that PR. A hosted deployment that deals sample data to every new organization pays this on every replay, and a rare concurrent delete can make the probe answer wrong. ⛔ Not a claim; triage sets the lane and grade.

What happens today

After #33222, an organization's seed load resolves a person reference (sys_user by email or name) only to a member of that organization. probeOrganizationMember in packages/metadata-protocol/src/seed-loader.ts reads the same-named sys_user candidates 50 at a time, ordered by id with a growing offset, asks sys_member per page, and answers "not a member" only after the last page.

  1. Cost grows with the deployment, not the organization. In the hosted case each organization's sample people share the seeded names, so the candidate set is one row per organization deployment-wide, while the organization being replayed usually holds a handful of members. Every replay reads two queries per 50 organizations per reference value, and the full candidate list for every name with no member in the load's organization. The candidate read filters sys_user by a column with no declared index.
  2. Offset paging is not stable under a concurrent delete. If a same-named sys_user below the current offset is deleted between two pages, the next page shifts by one and a candidate is skipped. If the skipped one is the load organization's member, the probe answers the false "not a member" fix(metadata-protocol)!: an organization's seed load resolves people through its membership, reports a refused reference probe, and writes as that organization #33222 exists to prevent. The window is one probe wide.
  3. An authored value that looks like an internal id skips the probe. A value looksLikeInternalId recognises is taken as an id and never judged by the membership rule. This predates fix(metadata-protocol)!: an organization's seed load resolves people through its membership, reports a refused reference probe, and writes as that organization #33222.

What this card would build

Seam

Seam: metadata-protocol:seed-loader.ts (probeOrganizationMember) → sys_member / sys_user reads.

Dedupe words: seed member probe, probeOrganizationMember, keyset paging seed, same-named sys_user, looksLikeInternalId.

Activity

  1. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor
  2. added
    domain:server
    pm:queue
    on Nov 14, 2026
  3. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC

    Claim: area-lease pilot #33059, area thread A4 (data layer) · p3 · unleased domain:server pm:queue card in A4's paths (seed loader). A4's lease list is exhausted, and the unleased p2s are metadata-registry cards outside A4. Dispatched to an os-dev subagent of this area thread.
    Session: session_016WV4cw787kMeaX7oyz7DDC (area thread; subagent of it)
    Account: os-elon-musk
    Branch: claude/area-A4-33280
    Worktree: objectstack-a4-33280
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/metadata-protocol/src/seed-loader.ts (probeOrganizationMember and the internal-id skip only), its tests (packages/metadata-protocol/src/**seed* and packages/runtime/src/seed-org-scoped-references.integration.test.ts), and one changeset. Stop on breach.
    Container & model: M, mode:subagent, model: default, effort: high
    Clause-②: no (expected; re-read after the diff)
    Metadata-protocol: none
    Responsibility: the seed loader's organization-member probe is bounded by the load organization's member set (no deployment-wide offset paging), and an internal-id-looking value's membership answer is decided and pinned
    Thread-read: none
    Premise: re-measured at origin/main before any edit; premise_still_valid: false is a valid result
    Serial constraints: A4's PRs #33550 (merge queue) and #33570 touch other functions of seed-loader.ts (loadExistingRecords / organizationColumnOf). Main is merged in before landing.

  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 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC
    os-dev-report

    {
      "issue": 33280,
      "status": "done",
      "branch": "claude/area-A4-33280",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/33611",
      "session": "session_016WV4cw787kMeaX7oyz7DDC",
      "premise_still_valid": true,
      "summary": "Premise re-measured at origin/main 4bba8b8f02: probeOrganizationMember read same-named sys_user rows 50 at a time by offset (offset += page), asked sys_member per page, and resolveReferenceItem kept any looksLikeInternalId value verbatim before any probe. Now the probe reads the load organization's sys_member rows ordered by user_id with keyset paging (user_id $gt last seen, page 500), and per member page does ONE sys_user read constrained to that page's ids AND the key (orderBy id, limit 1); pages ascend so the first page that answers holds the lowest-id member. On a miss a single limit-1 read words the not-a-member verdict; the id leg reads the one membership row directly. Decision on id-shaped values: CHECK them on an organization-pinned, non-dry-run load for the members-scope target (sys_user) via the new judgesInternalIdByMembership; a member's id still resolves to itself, an outsider's id gets the name's refusal, every other target and unscoped/dry-run loads keep it verbatim. Re-judged declarations: Clause-②: no (narrowing) (a UUID person reference to a non-member on an org load used to land linked and now stays empty with an error), Metadata-protocol: none; changeset is patch with BREAKING note and adr-0087 not-required marker; PR title carries the bang. This departs from the dispatch's expected 'no / none'.",
      "tests": "Head 3a152285a2. New top-level describe in packages/runtime/src/seed-org-scoped-references.integration.test.ts (3 cases: read-count bound with 0 vs 120 same-named strangers + no-offset/constrained-read shape; UUID member resolves and UUID outsider refused both ways; CONTROL no-org load keeps UUID). Integration file: Tests 21 passed (21). pnpm --filter @objectstack/metadata-protocol test: Test Files 340 passed | 9 skipped, Tests 22877 passed | 43 skipped, VERDICT command-exit 0. Ablation (scripts/ablation-replace.mjs, committed first, metadata-protocol rebuilt each leg since runtime resolves it through dist): leg 1 = previous offset probe restored verbatim, marker 'offset += page' present in 2 built files, Tests 1 failed | 20 passed, bound pin red 'expected 6 to be 2'; restore blob == HEAD 7ec7f8be7dbc and git diff HEAD empty, rebuilt, --absent green. The first run of leg 1 was a no-op (mutated build failed dts on an unused constant, no test ran); respelled and re-run. Leg 2 = internal-id skip forced back, marker present in 2 built files, Tests 1 failed | 20 passed, id-shaped case red; restore proven, rebuilt, --absent green.",
      "gates": "Local: dispatch-gates --commands derived 65; 63 exit 0; check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET (needs whole-workspace build) = NOT MEASURED locally; check:type-check-debt first exit 3 (queue-timeout behind my dogfood hold), re-run under the lock: VERDICT command-exit 0, re-measure OK. --ran reconciliation: 65 derived, 63 run, 2 UNRUN (those two, the second since measured). Runtime typecheck (tsc + check:test-typecheck) VERDICT 0. eslint --no-inline-config on both changed files exit 0. PR check-runs on 3a152285a2 all completed: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (8/8 shards), Build Core success, Governed Surface Queue Guard success, Check Changeset success, Test UI success, Live E2E UI success, Dogfood Regression Gate success; UI build/lint/type-check lanes skipped by selector.",
      "dogfood_battery": "3a152285a2 · os-verify-lock: VERDICT command-exit 0 (held 2459s, shared box) · Test Files 467 passed | 3 skipped (470) · Tests 3950 passed | 42 skipped (3992) · no failures",
      "mcp_calls": "0",
      "api_writes": "2 — fleet-write relay pr_create (repository_dispatch to objectstack-ai/objectstack, run 43668667041, PR #33611 draft, assignee os-elon-musk, body read back byte-identical) and this os-dev-report comment via post-stamped.mjs; plus git push of the branch",
      "open_questions": [
        { "question": "Coordinator's mid-task seat rule (run metadata-protocol's direct dependents' suites before arming) vs os-dev.md 'public surface bytes unchanged means only own-package tests'. Followed both where time allowed.", "options": ["A keep the os-dev rule; dependents ride CI Test Core", "B run every direct dependent locally before arming"], "recommendation": "A for this PR: no export or contract byte moved; runtime (the dependent that exercises the seed loader) ran full: Test Files 602 passed, Tests 10784 passed | 19 skipped, VERDICT 0. Not run locally (time box, lock held by the dogfood battery): objectql, rest, cli, client, cloud-connection, plugin-approvals, plugin-security, service-automation, service-messaging, service-package; CI Test Core 8/8 green on the head covers them." }
      ],
      "security_findings": "none",
      "out_of_scope_findings": ["carrier: none · noted, not filed: the membership probe still re-reads the organization's member page once per probe leg (name, then id) of a reference that misses; bounded by the organization, not cached across references on purpose because a load may seed sys_member rows itself", "carrier: none · noted, not filed: PR #33550 not merged at push time, so no main merge was taken; it edits other functions of seed-loader.ts and the new tests are a separate top-level describe"]
    }
  6. added a commit that references this issue on Nov 16, 2026
    b95d915
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverpm:dispatchedpriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions