Files
github-spec-kit/tests
github-actions[bot] 19b7974253 Fix preset-constitution-not-installed: resolver-aware seeding + reseed hook
Apply the remediation from the bug assessment on issue #3272.

Three-part fix:

1. Make ensure_constitution_from_template resolver-aware (init.py): replace
   the hardcoded shutil.copy2 from the core template path with a call to
   PresetResolver(project_path).resolve('constitution-template', 'template').
   The resolver walks the full preset priority stack so a preset-provided
   constitution-template is picked up automatically. Falls back to the core
   template when no preset overrides it, preserving existing behaviour for
   projects without presets.

2. Reorder the init flow (init.py): move the call to
   ensure_constitution_from_template from before the preset installation block
   to after it. For 'specify init --preset', the memory file is now seeded
   from the already-resolved template stack instead of from the generic core
   template that existed before the preset arrived.

3. Add guarded re-seed hook in install_from_directory (presets/__init__.py):
   _maybe_reseed_constitution is called at the end of install_from_directory
   and re-seeds .specify/memory/constitution.md from the preset's resolved
   constitution-template, but only when (a) the manifest provides a
   constitution-template entry AND (b) the current memory file still contains
   generic placeholder tokens ([PROJECT_NAME] or [PRINCIPLE_1_NAME]).
   Legitimately authored constitutions (no placeholder tokens) are never
   overwritten.

Also adds a _CONSTITUTION_PLACEHOLDER_TOKENS module-level constant and seven
regression tests covering:
- ensure_constitution_from_template picks up a preset override via resolver
- falls back to core template when no preset is installed
- skips existing memory files
- install_from_directory re-seeds a generic memory constitution
- install_from_directory does not overwrite an authored constitution
- install_from_directory skips re-seed for presets without constitution-template
- self-test preset re-seeds a generic memory constitution on install

Refs #3272

Assisted-by: GitHub Copilot (model: claude-sonnet-4.6, autonomous)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 18:31:35 +00:00
..