fix(presets): use _repo_root() for bundled-core source-checkout fallback (#3086)#9
Closed
mnriem wants to merge 1 commit into
Closed
fix(presets): use _repo_root() for bundled-core source-checkout fallback (#3086)#9mnriem wants to merge 1 commit into
mnriem wants to merge 1 commit into
Conversation
The tier-5 fallback in PresetResolver.resolve() and _find_bundled_core() computed the repo root as Path(__file__).parent.parent.parent. After presets.py was moved to presets/__init__.py (github#2826) that chain is one level short, resolving to src/ and looking for src/templates/commands/<cmd>.md, which never exists. As a result, wrap-strategy presets found no core base layer in source/editable installs. Use the shared _repo_root() helper so both fallbacks resolve against the actual repo-root templates/ tree. Wheel installs were unaffected (core_pack path), so this only impacts source/editable checkouts. Refs github#3086 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Owner
Author
|
Reopening against upstream github/spec-kit:main. |
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.
Summary
Assessment and fix for github#3086.
The issue claims
specify initnot copyingtemplates/commands/into.specify/templates/commands/causeswrap-strategy presets to fail. That root cause is incorrect:PresetResolverhas an explicit Priority‑5 fallback (_find_bundled_core, plus the matching tier‑5 branch inresolve()) specifically designed to locate the core base layer when.specify/templates/commands/is absent. The missing copy is a layout/cosmetic gap, not a functional one.However, while verifying, I found a real bug that does break
wrappresets — but only in source/editable installs, and for a different reason:Both fallbacks computed the repo root as
Path(__file__).parent.parent.parent. Afterpresets.pywas moved topresets/__init__.py(github#2826), that chain is one level short — it resolves tosrc/and looks forsrc/templates/commands/<cmd>.md, which never exists. So the base layer was never found.Wheel installs were unaffected because they take the
core_packbranch.Fix
Use the shared
_repo_root()helper (from_assets.py) in bothresolve()and_find_bundled_core()instead of a hand-rolled.parentchain, so the path stays correct regardless of module nesting.Tests
speckit.implementvia bothcollect_all_layers()andresolve()when.specify/templates/commands/has no matching file.Why not the issue's suggested fix
Copying
templates/commands/into.specify/templates/commands/duringspecify inittouches the core SDD install/manifest/upgrade flow to solve a non-problem (the fallback already covers wheel installs). This PR keeps the change isolated to the preset resolver and does not alter the SDD process.Refs github#3086