Skip to content

Commit ec066d5

Browse files
mnriemCopilot
andcommitted
test(presets): parse frontmatter as YAML in constitution-sync wrapper test
Address review feedback on #3873: assert `strategy: wrap` structurally by parsing the Markdown frontmatter as YAML (instead of a substring match that could false-positive on body text), and assert {CORE_TEMPLATE} in the body section only. Assisted-by: GitHub Copilot (model: Claude Opus 4.8, supervised) Co-authored-by: Copilot App <[email protected]> Copilot-Session: afa7c1d2-147b-4f62-a6fc-a2cc824cfa3e
1 parent 19be9bb commit ec066d5

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

‎tests/test_presets.py‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12520,14 +12520,23 @@ def test_manifest_provides_wrap_of_constitution(self):
1252012520

1252112521
def test_wrapper_uses_core_template_and_propagates(self):
1252212522
text = (self.PRESET_DIR / "commands" / "speckit.constitution.md").read_text()
12523-
assert "strategy: wrap" in text
12524-
assert "{CORE_TEMPLATE}" in text
12523+
12524+
# Parse the Markdown frontmatter as YAML rather than substring-matching,
12525+
# so `strategy: wrap` is asserted structurally (not as text that could
12526+
# appear in the body) and {CORE_TEMPLATE} is asserted in the body only.
12527+
assert text.startswith("---\n")
12528+
_, frontmatter_block, body = text.split("---", 2)
12529+
frontmatter = yaml.safe_load(frontmatter_block)
12530+
assert frontmatter["strategy"] == "wrap"
12531+
12532+
assert "{CORE_TEMPLATE}" in body
12533+
assert "strategy: wrap" not in body # only in frontmatter
1252512534
# The three governed scaffolds the old checklist propagated into.
12526-
assert "plan-template.md" in text
12527-
assert "spec-template.md" in text
12528-
assert "tasks-template.md" in text
12535+
assert "plan-template.md" in body
12536+
assert "spec-template.md" in body
12537+
assert "tasks-template.md" in body
1252912538
# Must not mutate versioned preset/extension artifacts.
12530-
assert "Do not edit versioned preset- or extension-provided template files" in text
12539+
assert "Do not edit versioned preset- or extension-provided template files" in body
1253112540

1253212541
def test_catalog_lists_bundled_preset(self):
1253312542
manifest = yaml.safe_load((self.PRESET_DIR / "preset.yml").read_text())

0 commit comments

Comments
 (0)