Skip to content

id(references): resolve ignores the cleared flag — a tombstoned target still resolves, auto-picks via insert_unambiguous, and makes its live namesake contested #4455

Closed

Description

@dezren39

Summary

LocalIndex::resolve in pkgs/id/src/references.rs (landed by PR #2756 for #2259) never looks at IndexedObject.cleared. A tombstoned target is offered as an ordinary candidate, is auto-picked by Resolution::single(), and can be committed by insert_unambiguous — a fresh reference that render immediately reports as RenderState::Cleared. A cleared object also still counts in claimants, so a tombstone sharing a title with a live object makes the live object read as contested and blocks its unambiguous insert. The Candidate type carries no cleared marker, so nothing downstream can tell a dead candidate from a live one.

Relevant code (main 466cf98, references.rs):

  • resolve (:383-407) iterates all objects of the sigil and calls best_match — no cleared filter.
  • best_match (:410-475) never reads object.cleared either; the petname tier (:430-444) likewise.
  • claimants (:368-380) counts cleared objects as claimants for contested determination.
  • render (:543-578) is the only place cleared is honored — after the reference already exists.

Evidence (verified this run, laptop probe)

Probe: ~/git/fleet/probe-2026-11-02-laneA-references/ — verbatim references.rs (md5 b939a8c3b71faa4fef2958834888ce1c) plus the two minimal compile fixes described in #4454 (the module does not compile as landed; the fixes touch only the StoreId Default impl and an owned String in from_markdown, neither of which affects resolution). The module's 12 own tests pass in the probe; two added probe tests (tests/cleared.rs, log patched-output.txt) demonstrate:

cleared_target_still_resolves_and_auto_inserts ... ok
  — index holding ONLY a cleared "Roadmap": resolve("roadmap") returns 1 candidate
    for the tombstone, single() returns it, insert_unambiguous succeeds, and the
    fresh reference immediately renders as RenderState::Cleared.
cleared_duplicate_makes_live_target_contested ... ok
  — one live "Minutes" + one cleared "Minutes": resolve returns 2 candidates,
    is_contested() is true, insert_unambiguous("minutes") fails Ambiguous(2)
    even though only one live target exists.

Why it matters

The design record (doc/2026-10-30T13-25-00Z_design_friendly_name_references.md §4) defines the cleared state for rendering stored references — a citation degrades to its label. It never sanctions minting new references to tombstones, and the contested rule it adopts ("two or more claims for the same surface") is about live claims an author must choose between. As written, deletion of a document silently (a) keeps it insertable by anyone resolving its name, and (b) poisons the name for the live document that replaced it — the exact ambiguity the contested rule exists to surface only when a real choice exists.

Acceptance criteria

  • resolve does not return candidates for cleared objects (all tiers, including petname matches), or candidates for cleared objects are explicitly marked as cleared in Candidate and excluded from single() / insert_unambiguous — one stated rule, documented in the module docs.
  • claimants does not count cleared objects: a live target whose only same-surface namesake is cleared resolves uncontested and insert_unambiguous succeeds.
  • Existing behavior for stored references is unchanged: render still reports RenderState::Cleared for a reference whose target was cleared after insertion (existing test a_cleared_target_degrades_to_its_label still passes).
  • New tests cover: cleared-only phrase resolves to no auto-insertable candidate; live+cleared duplicate inserts unambiguously; the module's existing 12 tests still pass (after the id(lib): references.rs does not compile — LocalIndex derives Default over a StoreId with no Default impl, and from_markdown breaks with a borrow of a loop-local String (PR #2756) #4454 compile fix).

Distinct from: #4454 (the same module's compile errors — this issue is the resolution semantics, visible only once the module compiles), #2259 (the PoC tracker this module implements), #4298 (notes.rs cyclic revise parents — different module).

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: filed

  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  4. 100 remaining items

  5. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 3, 2026
  6. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: parked
    task: 6366 (repo-health-code-pilot; worker repo-worker-code; OpenChamber scheduled lane 262eb403-3347-4a7c-ba6b-e7bc263ca853)
    state: parked until 2026-11-03T09:37:43Z.
    blocker: Canonical PR #4537 remains OPEN on queue/6366-4455-cleared-object-resolve at d831908, authored by dezren39 (Drew); fresh checks: basic guard SUCCESS, CodeRabbit NEUTRAL. Dependency #4454 is CLOSED. This lane did not touch or merge the Drew-owned PR and created no competing PR.
    resume: After explicit ownership handoff or PR closure/merge, revalidate #4455, PR #4537, checks, diff, and targeted tests.
    labels: queue/parked + status/parked; work/assigned retained.
    bookkeeping: openchamber scheduled lane — sandbox bookkeeping deferred to fleet reconciliation.

  7. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 6366 (small_fix, queued, priority 40) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

  8. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: parked (resume brief — verify then merge an existing PR)
    queue: repo-health-code-pilot
    task: 6366
    by: openchamber-scheduled-lane
    at: 2026-11-03T14:04Z

    The work already exists: PR #4537, open, awaiting verification

    Claiming this task found origin/queue/6366-4455-cleared-object-resolve with one commit (d831908bf, "fix(id): exclude cleared objects from resolve candidates and claimants (#4455)") and PR #4537 open against main. The change is exactly the fix the issue describes, and it is small:

    • claimants() gains .filter(|object| !object.cleared) — a tombstone no longer contests its live namesake.
    • resolve() filters !object.cleared while collecting candidates — a tombstoned target is no longer offered, so Resolution::single()/insert_unambiguous cannot auto-pick it.
    • Two tests: a_cleared_only_target_does_not_resolve_or_insert and a_cleared_duplicate_does_not_contest_a_live_target.
    • A doc bullet on the module stating the rule.

    Why it is parked rather than merged

    1. It is 507 commits behind main, and its diff no longer applies to main's references.rs (git apply --check fails at :384) — main moved under it. git merge-tree --write-tree reports no conflicts, so a plain merge of main into the branch should be mechanical.
    2. CI never ran on the PR head. For d831908b the only run is opencode-config-guard (pass); no id-workflow basic job exists for that commit, so the merge gate has not actually been exercised for the Rust change. That is a coverage gap worth noting when this PR is next touched.
    3. The local suite cannot currently prove it anyway. Prior lanes recorded that a full cargo test of references hits unrelated pre-existing compile errors (ChainExt.link, id: build: local topic links and backlink projection #3816) and that the references.rs compile breakage is id(lib): references.rs does not compile — LocalIndex derives Default over a StoreId with no Default impl, and from_markdown breaks with a borrow of a loop-local String (PR #2756) #4454. The honest verification for this fix is: merge main in (picking up whatever id(lib): references.rs does not compile — LocalIndex derives Default over a StoreId with no Default impl, and from_markdown breaks with a borrow of a loop-local String (PR #2756) #4454/id: build: local topic links and backlink projection #3816 state main is in), run the two named tests, and only then enqueue the merge.

    Resume instruction (20 minutes from 2026-11-03T14:03Z)

    git fetch origin
    # worktree from the existing branch — do not recreate it
    git merge origin/main            # no conflicts per merge-tree
    cd pkgs/id && cargo test --lib references::
    gh pr merge 4537 --repo developing-today/code   # enqueues into the merge queue
    

    If main still fails to compile references for the #4454/#3816 reasons, that is a pre-existing main break: record it on #4454 rather than treating it as this PR's failure.

  9. added a commit that references this issue on Nov 3, 2026
  10. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 3, 2026
  11. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: done
    task: 6366 (repo-health-code-pilot, small_fix) — lane 8ac61616-3815-4e7b-b33d-840a3829154a
    pr: #4537 (merged)
    merge_sha: 0467ae0

    Cleared objects are now excluded from LocalIndex::resolve candidates and claimants counts, per the rule documented in the references.rs module docs. A cleared-only index yields no candidate (insert_unambiguous → NoMatch); live + cleared duplicate title is uncontested and inserts; render of references stored before clearing still reports Cleared.

    Verification: branch was 583 commits behind main (including a later claimants petname change), so I merged origin/main into the branch and ran cargo test --lib references on the merged result — 21 passed, 0 failed (includes the petname contested/uncontested cases). PR checks green on the merge commit 2e5ffc28b; merged as 0467ae0f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions