Skip to content

Fix sync skipping directory spec_paths#2

Open
coherent-cache wants to merge 1 commit intodbreunig:mainfrom
coherent-cache:fix/sync-directory-spec-paths
Open

Fix sync skipping directory spec_paths#2
coherent-cache wants to merge 1 commit intodbreunig:mainfrom
coherent-cache:fix/sync-directory-spec-paths

Conversation

@coherent-cache
Copy link
Copy Markdown

@coherent-cache coherent-cache commented Mar 10, 2026

Context

I'm using plumb alongside spec-kit for a spec-driven development workflow. spec-kit generates feature specs under a specs/ directory (e.g., specs/001-feature/spec.md, specs/002-feature/spec.md), so the natural plumb config is:

{ "spec_paths": ["specs/"] }

This triggers the directory resolution bug described below. See also issue #3 for a second related bug (DuckDB version compatibility).

Problem

When spec_paths in .plumb/config.json contains a directory (e.g., "specs/"), sync_decisions() silently skips all spec files because spec_path.is_file() returns False for directories. The same bug exists in _run_modify() in cli.py.

This means plumb sync reports "No unsynced decisions found" or syncs 0 spec sections even when there are approved decisions waiting — the decisions get marked as synced but spec files are never updated.

parse_spec_files() in the same file already handles directories correctly by expanding them via rglob("*.md"). The inconsistency is between these two functions in sync.py:

# parse_spec_files — WORKS (resolves directories) for spec_path_str in config.spec_paths: spec_path = repo_root / spec_path_str if spec_path.is_dir(): md_files = list(spec_path.rglob("*.md")) elif spec_path.is_file(): md_files = [spec_path] # sync_decisions — BROKEN (skips directories) for spec_path_str in config.spec_paths: spec_path = repo_root / spec_path_str if not spec_path.is_file(): # ← False for directories, skips everything continue

Fix

Apply the same directory resolution pattern from parse_spec_files to:

  • sync_decisions() in sync.py
  • _run_modify() in cli.py

Tests

  • Added initialized_repo_dir_specs fixture with spec_paths: ["specs/"]
  • test_syncs_when_spec_path_is_directory — verifies sync_decisions calls the updater for each .md file found in the directory
  • test_parses_spec_files_from_directory — verifies parse_spec_files finds files inside directory spec_paths

All 19 sync tests pass.

When spec_paths contains a directory (e.g., "specs/"), sync_decisions silently skips it because `spec_path.is_file()` returns False for directories. This means approved decisions are never synced to spec files. The same bug exists in _run_modify in cli.py. parse_spec_files already handles directories correctly by expanding them via rglob("*.md"). This commit applies the same resolution pattern to sync_decisions and _run_modify. Adds test fixture for directory-based spec_paths and two tests confirming sync and parse both work with directory spec_paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant