Fix sync skipping directory spec_paths#2
Open
coherent-cache wants to merge 1 commit intodbreunig:mainfrom
Open
Fix sync skipping directory spec_paths#2coherent-cache wants to merge 1 commit intodbreunig:mainfrom
coherent-cache wants to merge 1 commit intodbreunig:mainfrom
Conversation
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.
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.
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_pathsin.plumb/config.jsoncontains a directory (e.g.,"specs/"),sync_decisions()silently skips all spec files becausespec_path.is_file()returnsFalsefor directories. The same bug exists in_run_modify()incli.py.This means
plumb syncreports "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 viarglob("*.md"). The inconsistency is between these two functions insync.py:Fix
Apply the same directory resolution pattern from
parse_spec_filesto:sync_decisions()insync.py_run_modify()incli.pyTests
initialized_repo_dir_specsfixture withspec_paths: ["specs/"]test_syncs_when_spec_path_is_directory— verifiessync_decisionscalls the updater for each.mdfile found in the directorytest_parses_spec_files_from_directory— verifiesparse_spec_filesfinds files inside directory spec_pathsAll 19 sync tests pass.