Skip to content

fix(paths): reject stale feature.json pointers in all three helpers - #5571

Open
adityajai119 wants to merge 1 commit into
github:mainfrom
adityajai119:fix/5566-stale-feature-json-pointer
Open

adityajai119 wants to merge 1 commit into
github:mainfrom
adityajai119:fix/5566-stale-feature-json-pointer

Conversation

@adityajai119

Copy link
Copy Markdown
Contributor

Fixes #5566

What

All three feature-path resolvers now reject a .specify/feature.json pointer whose feature_directory folder 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_DIRECTORY override is unchanged; only the persisted pointer is validated.

Why

The pointer is per-checkout state that is overwritten by /speckit.specify and gitignored. When its directory is deleted, the old resolvers still returned a FEATURE_DIR for 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 established Feature directory not found error, matching the missing-file path.

Tests

  • New tests/test_stale_feature_pointer.py drives real subprocesses of the installed Bash, Windows PowerShell 5.1, and Python check-prerequisites scripts. Each surface is covered for both a stale pointer (negative) and an existing pointer (positive).
  • Red on main: 3 failed (one per surface), 3 passed. Green after fix: 6 passed.
  • Adjacent parity suites: 153 passed, 182 skipped.
  • Windows PowerShell 5.1: parser reports 0 errors, and the PowerShell test cases execute under powershell.exe 5.1.26100.9836.
  • uvx ruff@0.15.0 check src tests: all checks passed.
  • Both repository guard scripts: pass. 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.

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)
@adityajai119
adityajai119 requested a review from mnriem as a code owner November 25, 2026 16:42
Copilot AI adaptive review requested due to automatic review settings November 25, 2026 16:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 found for 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)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the stale feature-pointer validation changes.

No open issues 🎉

Review effort: Balanced

@mnriem

mnriem commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Please fix CI/CD errors

This branch has not been deployed

No deployments
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.

[Bug]: feature.json pointing at a missing directory is still used as the active feature

3 participants