Skip to content

Review remediation: floor Short ID allocation + doctor detection #9

Description

@andreiRS

From the three-lens deep review (review-remediation). Theme: floor Short ID allocation. Conforms to ADR-0006.

Problem

ADR-0006 says Short IDs are "monotonically increasing... never reused." createTask (src/store.ts:88-102) reads next_id from meta.yaml verbatim with no floor against the real max. Any drift (bad merge, partial restore, manual edit) yields a duplicate-id file; findTask returns the first match, so show/mv/set/rm/link silently operate on the wrong task. doctor detects none of it.

Slices

6. Short ID allocation floored against the real maximum (finding #4 — allocation)

Allocate next_id = max(metaNextId, maxExistingId(live ∪ archived) + 1) with a pre-write uniqueness check.

  • With meta.yaml's next_id seeded below the real max, tasks new never creates a duplicate Short ID.
  • A normal sequence of tasks new still yields monotonic, never-reused ids.
  • A new that would collide picks the floored id instead.

7. doctor reports duplicate Short IDs (finding #4 — detection)

Teach tasks doctor to detect and report tasks sharing a Short ID.

  • With two files sharing a Short ID, doctor flags the duplication and names the colliding id(s).
  • A healthy store reports no duplicates.

Open question

Flooring next_id scans live ∪ archived on every create — confirm the cost is negligible at expected human/agent task volumes.

Method

TDD outside-in at the CLI boundary. One commit per green. Both slices can start immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreview-remediationConformance fixes from the three-lens deep review

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions