Skip to content

API Reference parrot.sdd.scripts.check_id_collisions

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.sdd.scripts.check_id_collisions

View source

check_id_collisions.py — defense-in-depth SDD ID collision scanner.

Independent, read-only backstop for the git-native compare-and-swap allocator (reserve_ids.py, FEAT-387): scans the repo's current SDD state for any TASK-<NNN> number associated with more than one distinct feature slug. This is the check that would have caught the six real collisions found during FEAT-380's closeout (TASK-1939/1940/1941/1942/1944/1946, each shared with an unrelated feature) had it existed at the time.

TASK-<NNN> collisions across different slugs are treated as failures. FEAT-<NNN> reuse across specs is an accepted, pre-existing pattern (migrate_index.py's own documented convention — see FEAT-380 itself, split across three specs sharing one FEAT-ID by design) and is reported informationally only, never as a failure.

Class CollisionReport

One colliding numeric ID and every distinct slug/source using it.

Fields:

Field Type Default Description
id str
kind str
slugs list[str]
sources list[str]

Function find_collisions

Scan SDD state for TASK-ID collisions and FEAT-ID reuse.

Scans index_dir/*.json (task id fields + their owning feature/feature_id), active_dir/*.md, and completed_dir/*.md (filenames, matched by TASK-<NNN>- prefix) for any TASK-<NNN> number used by more than one distinct feature slug. Separately tallies FEAT-<NNN> -> spec slug from specs_dir/*.md headers for an informational (never-failing) report.

find_collisions(index_dir: Path = Path('sdd/tasks/index'), active_dir: Path = Path('sdd/tasks/active'), completed_dir: Path = Path('sdd/tasks/completed'), specs_dir: Path = Path('sdd/specs')) -> list[CollisionReport]

Parameter Type Default Description
index_dir Path Path('sdd/tasks/index') Directory containing per-spec index JSON files.
active_dir Path Path('sdd/tasks/active') Directory containing in-progress task markdown files.
completed_dir Path Path('sdd/tasks/completed') Directory containing completed task markdown files.
specs_dir Path Path('sdd/specs') Directory containing spec markdown files.

Returns: list[CollisionReport] — One CollisionReport per colliding TASK-<NNN> number (kind "task") PLUS one per shared FEAT-<NNN> number (kind "feature", informational only — callers must not treat these as failures). Empty list overall = a fully clean tree.

Function main

CLI entry point.

Exits 1 and prints a human-readable report naming every offending file/slug if any NEW (non-baselined) TASK-<NNN> collision is found; exits 0 otherwise. FEAT-<NNN> reuse is always printed informationally and never affects the exit code. Baselined collisions (--baseline) are still printed, but marked as non-fatal and excluded from the exit-code decision.

main(argv: list[str] | None = None) -> int

Parameter Type Default Description
argv list[str] | None None

Returns: int

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally