Repository navigation
feat: collision-resistant ID allocation on new (--id, --base) - #24
Merged
Merged
Conversation
Closes #13 — the prevention leg of the multi-branch ID-collision incident (renumber in 1.3.0 is the cleanup leg): - new --id T-42: create with an explicit ID (normalized like all ID input). Refused if taken (primary or @shadow) or cross-kind; no --force — a forced duplicate ID is corruption, not a feature. - new --base <git-ref>: allocate max(local, ref) + 1 by reading TASKS.md at the ref (git show), so a branch forked from main cannot re-issue IDs main already handed out. Fails closed on any git problem instead of silently falling back to local-only allocation. With --id, the explicit ID must be free at the ref too. - reserve N stays deferred (would add a new concept to the format). Design doc: docs/superpowers/specs/2026-07-15-id-allocation-design.md e2e scenarios 53-54 (13 new assertions, suite now 298). Claude-Session: https://claude.ai/code/session_01UquRBmRrh52iyPFuFQna5q
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13 — the prevention leg of the multi-branch ID-collision incident (
renumberin v1.3.0 is the cleanup leg).What
new … --id T-42— create with an explicit ID (short forms normalized like all ID input). Refused if the ID is already taken (primary or@shadow) or the kind doesn't match. No--force— a forced duplicate ID is file corruption in every case; deviation from the triage sketch recorded in the design doc.new … --base <git-ref>— auto-allocatemax(local, ref) + 1by readingTASKS.mdat the ref (git rev-parse --show-toplevel+git show ref:path, fence-skipping scan same as local). A branch forked frommaincan no longer re-issue IDsmainalready handed out.no repo, bad ref, file absent at ref, tasks file outside the repo) is a hard error — a silent fallback to local-only allocation would quietly reintroduce the collisions the flag exists to prevent. (Contrast:renumber --refsdegrades gracefully because it's a best-effort report, not a safety guarantee.)--id+--basecompose — the explicit ID must be free at the ref too.reserve Nstays deferred (needs persisted reservation state — a new format concept).Compatibility
Both flags are opt-in;
newwithout them is byte-identical behavior. No file-format change (schema.mduntouched).Testing
TDD: e2e scenarios 53 (
--id+ guards) and 54 (--baseincident-shape allocation,--id+--baseref-collision refusal, fail-closed on bad ref and outside git) written first and watched fail (Unknown arg: --id). Suite now 298 assertions, green onmake check.Design doc
docs/superpowers/specs/2026-07-15-id-allocation-design.md(in this PR). LEARNINGS.md entry included.https://claude.ai/code/session_01UquRBmRrh52iyPFuFQna5q