Skip to content

Key each plan by its path below the plans folder - #66

Open
bfs2021 wants to merge 1 commit into
mj-hahn:mainfrom
bfs2021:fix/plan-id-from-path
Open

bfs2021 wants to merge 1 commit into
mj-hahn:mainfrom
bfs2021:fix/plan-id-from-path

Conversation

@bfs2021

@bfs2021 bfs2021 commented Nov 12, 2026

Copy link
Copy Markdown

Problem

A plan's id is built from its file name alone (core/extractors/plans.py:140), so docs/specs/auth/design.md and docs/specs/billing/design.md both become plan:design and one hides the other — a status set on one applies to both. Fixes #59

Root cause

extract() derives the id with path.rsplit("/", 1)[-1].removesuffix(".md"), dropping every directory component. Plan nodes are keyed by id in the system map, so two same-named plans from different folders collapse into a single node.

Fix

New plan_id(path) helper: when the path sits below one of the PLAN_DIRS roots, the id is the path below that root (plan:auth/design); top-level plan files and repo-root briefs keep their old id (plan:mail, plan:brief), so no existing consumer or stored status key changes.

Testing

  • Added test_same_name_plans_in_different_folders_stay_apart in tests/test_system.py: red before the fix ({'plan:billing', 'plan:design', 'plan:mail'} — both design files collapsed into plan:design), green after (plan:auth/design and plan:billing/design both present).
  • tests/test_system.py full suite: 43 tests OK (1 pre-existing skip).
  • tests/test_mcp.py, tests/test_sweep.py, tests/test_backend.py: OK. tests/test_worktrees.py has 4 pre-existing Windows path-separator assertion failures that fail identically with the change stashed, so they are unrelated to this fix.

A plan's id came from its file name alone, so docs/specs/auth/design.md
and docs/specs/billing/design.md were both plan:design and one hid the
other. Strip the plan directory instead: top-level names keep their old
id, and nested files become plan:auth/design. Adds a test with two
same-named plans.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plans in different folders with the same file name share one id

1 participant