Skip to content

seed: a row whose key reference was deferred at landing is recorded under no ledger key, so deleting it does not stick (re-inserted on the next load) #34856

Closed

Description

@objectstack-fleet

repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG

Finding reported by area o3-G while building PR #34854 (#34800), report 6950154378. It was measured, and main behaves the same. A seat-filed card: grading and domain:* belong to triage.

Suggested-grade: p2 · domain:server · size S
Dedupe words: seed landed key empty component withdrawal

What happens

A seed row whose key reference was deferred at landing (the reference is only fillable after a later load) lands with an empty component in its key. It is therefore recorded under no landed-key ledger key.

A person then deletes that row in the app. On the next load, the seed finds no ledger entry saying the row was landed and withdrawn, so it inserts the row again. The person's delete does not stick.

Expected

A seeded row the person deleted stays deleted, as it does for rows whose key is complete at landing. Either the ledger records the deferred row under the key it will carry, or under the derived id #34854 introduces.

Related: #34800 / PR #34854 (the derived id for a deferred key reference), #34613 (unkeyed seeds re-inserted on every start, a different path).

Activity

  1. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    First touch (R1197, 14:5xZ): p2 · domain:server → pm:queue.

    Theme: install, upgrade and uninstall reliability (seed lifecycle). A row the user deleted comes back on the next load. Same family and grade as #34613.

  2. added
    domain:server
    pm:queue
    priority:p2
    on Nov 17, 2026
  3. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x

    Claim: PM loop round 1 · area pkg-1 (lease:pkg-1; the maintainer, verbatim, 2026-11-19T05:04Z project chat: 「再开一个 area:package」; standing 「暂时都只派 p1 p2 的卡」) · 2026-11-19T05:10Z
    Session: session_01Utp6CaysxGzF62ACvZ1x9x
    Account: os-bill
    Branch: claude/issue-34856-deferred-key-ledger
    Worktree: objectstack-issue-34856 (os-dev worktree in the pkg-1 container)
    Domain: domain:server
    Seat: repo:objectstack#5
    File surface: packages/metadata-protocol/src/seed-loader.ts (the landed-key ledger: landedKeyOf / the landedKeyByRecordIndex fill at ~:2910 / recordLandedKeys, and the honour check beside rowLandedWithEmptyKeyReference), a new test file named for this card beside the seed-loader tests, root .changeset/. ⛔ packages/spec/**, ⛔ packages/platform-objects/** (the ledger object is unchanged). Stop on breach and report.
    Container & model: S, mode:subagent, model: default — no path-derived mandate, effort: high
    Clause-②: no (a row the person deleted stays deleted, as it already does for rows keyed complete at landing; what an author may write does not change)
    Metadata-protocol: none
    Responsibility: platform — packages/metadata-protocol/src/seed-loader.ts: a row whose key reference was deferred at landing keys '' (seedLandedKey returns '' on any empty component) and :2910 records only non-empty keys, so the ledger never says the row landed and the next load re-inserts the row a person deleted; reached by every package seed that keys on a reference deferred to pass 2 (the #34800 shape).
    Thread-read: 6951659807
    Premise: holds — on origin/main 81c09477: seed-loader.ts:2910 if (landedKey !== '') landedKeyByRecordIndex.set(i, landedKey); the deferred-key row's identity is seedDeferredKeyRowId over the AUTHORED key (:484), which the ledger does not use.
    Serial constraints cleared: none in flight — overlap-check.mjs on a probe branch touching seed-loader.ts: 0 open PR heads share the file, base merges cleanly. Same-file sibling #34857 is serial after this card (not folded: fold gate ① fails — #34857's fix is an authored-blank-component refusal or warning, this one is a ledger key; different repair).
    Pre-claim lane: domain:server (packages/metadata-protocol/**)
    Pre-claim deps: none named as Blocked-by; the derived id the card points to is PR #34854 (merged 2026-11-17T15:01Z).
    Prior rulings read: #34800 / PR #34854 (the derived id for a deferred key reference; governs the identity this ledger key should use); #31021 (the ledger); check-prior-rulings 186 hits — ADR-0055 §3, ADR-0139 D4, ADR-0146 D6, ADR-0005 §5, ADR-0035 §3 (term noise, none on point); thread: none
    Lease: lease:pkg-1

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 19, 2026
  5. added a commit that references this issue on Nov 19, 2026
  6. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x
    os-dev-report
    {
    "issue": 34856,
    "status": "done",
    "branch": "claude/issue-34856-deferred-key-ledger",
    "pr": "#35361",
    "head": "ca2df4fd",
    "session": "session_01Utp6CaysxGzF62ACvZ1x9x",
    "premise_still_valid": true,
    "readings": {
    "A1": "holds at 81c0947: the landed-key fill recorded only when landedKey !== '' (seed-loader.ts:2910) and seedLandedKey returns '' on any empty component (:451-460). A deferred key reference is deleted from the record before the fill, so the row is never recorded.",
    "A2": "holds: authoredKey (:2296) and seedDeferredKeyRowId (:483) give a stable identity. isWithdrawnRow returned false at key === '' before consulting the ledger, so a deferred-key row was never treated as withdrawn.",
    "A3": "reproduced red on main code: the new pins gave 7 failed | 2 passed (9). Deleted while the person was missing, and deleted then signed up, both re-inserted the row (length 1, expected 0), for ignore and upsert."
    },
    "summary": "A row whose key reference is empty when it lands is now recorded in sys_seed_landed_key under deferredLandedKey: an id key over seedDeferredKeyRowId of the AUTHORED key, the id the row lands with. The derived id was chosen over the resolved key because the resolved key is unknowable while the reference stays empty, which is the state the first delete happens in. isWithdrawnRow consults this key both while the reference is still empty and after it resolves, behind the existing natural-key and found-by-id checks. A row withdrawn this way also drops the key-reference deferrals it pushed, so pass 2 reports no false drop. Complete-key rows, never-landed rows and reseed are unchanged (controls).",
    "files_changed": [
    "packages/metadata-protocol/src/seed-loader.ts (+31/-2)",
    "packages/metadata-protocol/src/seed-loader-deferred-key-reference.test.ts (+new top-level describe, 8 cases)",
    ".changeset/34856-deferred-key-seed-row-stays-deleted.md (patch, @objectstack/metadata-protocol)"
    ],
    "line_budget": "162 changed lines (+160/-2) on 3 files vs the 3000 human-merge threshold; no skills/** or ratchet ledger touched",
    "tests": "On ca2df4f: pnpm --filter @objectstack/metadata-protocol typecheck exit 0. vitest seed-loader-deferred-key-reference.test.ts + seed-loader-landed-ids.test.ts: Tests 44 passed (44); lock VERDICT command-exit 0. Full package vitest on 3bd8c56 (same loader bytes; ca2df4f only moves the pins): Test Files 359 passed | 9 skipped (368), Tests 23227 passed | 45 skipped (23272), VERDICT command-exit 0. Ablations via ablation-replace.mjs (anchor 1->0, blob moved; each restored with git diff HEAD empty and HEAD blob hash matched; no build needed because the pins import ./seed-loader.js from source): ledger-record line deleted -> 6 failed; honour branch replaced by return false -> 5 failed | 12 passed (17) against the folded pins on ca2df4f; deferral rollback line deleted -> 2 failed (the success assertion).",
    "gates": "Local, on ca2df4f: dispatch-gates --commands derived 67 families, all 67 run, exit 0 each (captured before any pipe). check-plugin-teardown-shape --self-test first exited 3 (shallow clone, pinned fixture 621a487 missing); after git fetch of that one commit, exit 0 with 48 cases. --ran reconciliation: 67 derived, 67 run, 0 NOT-MEASURED, 0 UNRUN. check:engine-double-contract OK (1359 pinned). overlap-check --branch=HEAD: VERDICT clean exit 0, 0 PR heads. check-nul-bytes OK. PR check-runs at report time: Check Changeset, Check PR Size, Governed Surface Queue Guard, the Lint shards, the Type Check shards and PR-body guards were all in_progress; the opt-in, queue and schedule rows were skipped. Not waited on, per os-dev.",
    "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
    "mcp_calls": "0",
    "api_writes": "3: git push (not REST); relay pr_create = POST /repos/objectstack-ai/objectstack/pulls + POST /issues/35361/assignees (os-bill), read back identical (6455 bytes); post-stamped comment POST /repos//issues/34856/comments (os-dev-report)",
    "deviations": [
    "Test location: the dispatch fence named a new test file for this card. The pins first landed there (3bd8c56), but check:engine-double-contract reds a new file's engine double until scripts/engine-double-contract.pinned.json is rewritten, which is outside the fence and a shared ledger. AGENTS.md (ruling record 6583487846: a new pin for a component with a shared harness goes into that file as a top-level describe) and the os-dev trap (reuse an existing pinned double rather than pin a new one) point the other way. So ca2df4f folds them into the #34800 harness, packages/metadata-protocol/src/seed-loader-deferred-key-reference.test.ts, a file outside the fence's literal list. overlap-check showed 0 open PR heads on it.",
    "Real engine: the suggested route asked for pins on the real engine. ObjectQL + SqlDriver are not dependencies of @objectstack/metadata-protocol, and the real-driver sibling lives in packages/runtime, outside the fence. The pins drive the real SeedLoaderService over the harness's pinned engine double. Recorded in the PR's Acceptance notes.",
    "One control in the first draft (a kept deferred-key row is found and filled after sign-up) was dropped in the fold. It duplicates the existing pin 'with the landed-key record kept, the row is found too…' in the same file, which stays green.",
    "Commit trailers use the model-free pair (Co-authored-by: Claude, Claude-Session) per AGENTS.md, not the harness reminder's model-named Co-Authored-By."
    ],
    "open_questions": [],
    "security_findings": "none",
    "out_of_scope_findings": [
    "carrier: none · noted, not filed: when a dataset authors organization_id as a natural-key reference (not the stamped tenant org), #34800's rowLandedWithEmptyKeyReference is memoized at the honour check before that reference resolves, while the landing id at :2783 is computed after. Read-only inference with no repro, so it is in the PR's Acceptance notes. deferredLandedKey is computed once before resolution, so the new ledger key stays self-consistent either way."
    ]
    }

  7. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x

    Close-out 2026-11-19T07:19Z: PR #35361 MERGED as 35c6331094; Fixes closed this card. Delivered: a seed row whose key reference was still empty when it landed is now recorded in the landed-key ledger under the id derived from its AUTHORED key (the id it lands with, #34800), so a person's delete of it sticks on later loads, both while the reference stays empty and after the person signs up; a deliberate re-seed still restores it, and complete-key rows are unchanged. A withdrawn deferred row also drops its pass-2 deferrals, so pass 2 reports no false drop. Out of scope: none filed. Same-file follow-ons now unblocked: #34857 + #35336 (ruled B1) with p3 #35376 riding. pm:dispatched off.

  8. removed
    pm:dispatched
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:packagedomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions