Repository navigation
fix(paths): reject stale feature.json pointers in all three helpers - #5571
Open
adityajai119 wants to merge 1 commit into
Open
adityajai119 wants to merge 1 commit into
adityajai119 wants to merge 1 commit into
Conversation
A persisted feature_directory whose folder no longer exists was still treated as the active feature by the Bash, PowerShell, and Python resolvers. Treat it as absent and emit the same 'Feature directory not found' error used when the pointer is missing. Fixes github#5566 Assisted-by: OpenCode (model: Gemini 4 Neon, autonomous)
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change rejecting stale persisted feature-directory pointers.
No open issues 🎉
What changed in this PR
Fixes #5566 by rejecting persisted .specify/feature.json pointers to missing directories across all three feature-path resolvers. Explicit SPECIFY_FEATURE_DIRECTORY overrides remain unchanged.
Changes:
- Add directory-existence checks in Bash, PowerShell, and Python, reporting
Feature directory not foundfor stale pointers. - Add subprocess regression tests covering stale-pointer rejection and existing-pointer acceptance on each surface.
The PR reports before-and-after regression results; these were not independently rerun.
| File | Description |
|---|---|
tests/test_stale_feature_pointer.py |
Adds positive and negative regression coverage for all three script surfaces. |
scripts/python/common.py |
Rejects persisted pointers that do not resolve to a directory. |
scripts/powershell/common.ps1 |
Rejects stale pointers while preserving null-return error handling. |
scripts/bash/common.sh |
Returns an error when the persisted feature directory is missing. |
Review effort: Balanced (adaptive)
Collaborator
|
Please fix CI/CD errors |
This branch has not been deployed
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.
Fixes #5566
What
All three feature-path resolvers now reject a
.specify/feature.jsonpointer whosefeature_directoryfolder no longer exists:scripts/bash/common.sh(get_feature_paths)scripts/powershell/common.ps1(Get-FeaturePathsEnv)scripts/python/common.py(get_feature_paths)An explicit
SPECIFY_FEATURE_DIRECTORYoverride is unchanged; only the persisted pointer is validated.Why
The pointer is per-checkout state that is overwritten by
/speckit.specifyand gitignored. When its directory is deleted, the old resolvers still returned aFEATURE_DIRfor a path that did not exist, so downstream commands silently operated on a phantom feature. The fix treats the stale pointer as absent and emits the establishedFeature directory not founderror, matching the missing-file path.Tests
tests/test_stale_feature_pointer.pydrives real subprocesses of the installed Bash, Windows PowerShell 5.1, and Pythoncheck-prerequisitesscripts. Each surface is covered for both a stale pointer (negative) and an existing pointer (positive).main: 3 failed (one per surface), 3 passed. Green after fix: 6 passed.powershell.exe5.1.26100.9836.uvx ruff@0.15.0 check src tests: all checks passed.specify --help: exit 0.git diff --check: clean; all changed files pure LF.Disclosure
This PR, its commit, and its tests were authored by an AI agent (OpenCode, model: Gemini 4 Neon, autonomous) acting for adityajai119. The contributor did not line-by-line review the change; automation produced the verification evidence above. The filer explicitly authorized opening this fourth PR while three PRs are already open.