fix(spec-refiner): broaden _section regex to accept parenthesized headers #28
Reference in New Issue
Block a user
Delete Branch "fix/spec-refiner-parenthesized-suffix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
The spec-refiner prompt lists section headers with parenthesized descriptions (
## Acceptance Criteria (numbered),## TDD Plan (list the failing tests), etc.). The LLM faithfully copies them. The post-check regex^##\\s+<name>\\s*\\nrejects parenthesized suffixes — every spec wentspec_wrongon first attempt (2026-06-26).Fix
Broaden
_section()regex to\\s*(\\([^)]*\\))?\\s*\\n. Accepts both bare and parenthesized headers. The prompt's parentheticals are intentional hints to the LLM about what belongs in each section's body — kept.Coverage
tests/unit/test_phases_section.py— 10 unit tests pinning regex behavior.tests/contract/test_contracts_match_source.py::test_refine_spec_prompt_section_names_match_post_check— pins both prompt AND regex.Companion gap analysis
The structural fix (replace text parsing with Pydantic-in / JSONB-out) lives at
wiki/queries/damascus-orchestrator/spec-refiner-text-parsing-2026-06-26.md(tracked separately).Verification
pytest tests/test_conftest_safety.py tests/unit/ tests/contract/→ 90 passed, 0 failed.