Skip to content

fix: harden backlog refine prompt scaffold and mixed-format parsing#228

Merged
djm81 merged 2 commits intodevfrom
bugfix/backlog-refine-prompt-parser-hardening
Feb 12, 2026
Merged

fix: harden backlog refine prompt scaffold and mixed-format parsing#228
djm81 merged 2 commits intodevfrom
bugfix/backlog-refine-prompt-parser-hardening

Conversation

@djm81
Copy link
Copy Markdown
Collaborator

@djm81 djm81 commented Feb 12, 2026

Description

This PR hardens specfact backlog refine --write against real-world Copilot output drift and parser edge cases reported after 0.30.3 rollout.

Key fixes:

  • Preserve mixed-format description narrative when inline label-style markers (e.g. **Notes**:) appear before later heading sections.
  • Stop label-block capture at markdown heading boundaries to avoid swallowing subsequent sections.
  • Keep description fallback only for pure label-style outputs; do not drop valid ## Description heading content.
  • Strengthen interactive and export Copilot instructions with an explicit ordered scaffold.
  • Explicitly require omission of unknown metadata fields (no placeholders like (unspecified) / no info provided / provide area path).
  • Update OpenSpec source tracking to support multiple linked issues for this change (#225, #227).

Fixes #227

New Features #N/A

Contract References: No new/changed @icontract API contracts in this patch.

Type of Change

Please check all that apply:

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔒 Contract enforcement (adding/updating @icontract decorators)
  • 🧪 Test enhancement (scenario tests, property-based tests)
  • 🔧 Refactoring (code improvement without functionality change)

Contract-First Testing Evidence

Required for all changes affecting CLI commands or public APIs:

Contract Validation

  • Runtime contracts added/updated (@icontract decorators on public APIs)
  • Type checking enforced (@beartype decorators applied)
  • CrossHair exploration completed: hatch run contract-test-exploration
  • Contract violations reviewed and addressed

Test Execution

  • Contract validation: hatch run contract-test-contracts
  • Contract exploration: hatch run contract-test-exploration
  • Scenario tests: hatch run contract-test-scenarios
  • Full test suite: hatch run contract-test-full

Test Quality

  • CLI commands tested with typer test client
  • Edge cases covered with Hypothesis property tests
  • Error handling tested with invalid inputs
  • Rich console output verified manually or with snapshots

How Has This Been Tested?

Contract-First Approach: Added parser/prompt regression tests from user-reported failures, captured failing pre-implementation evidence in OpenSpec TDD log, then implemented fixes and re-ran targeted command/backlog/adapter tests.

Manual Testing

  • Tested CLI commands manually
  • Verified rich console output
  • Tested with different input scenarios
  • Checked error messages for clarity

Automated Testing

  • Contract validation passes
  • Property-based tests cover edge cases
  • Scenario tests cover user workflows
  • All existing tests still pass

Test Environment

  • Python version: 3.11
  • OS: Linux

Checklist

  • My code follows the style guidelines (PEP 8, ruff format, isort)
  • I have performed a self-review of my code
  • I have added/updated contracts (@icontract, @beartype)
  • I have added/updated docstrings (Google style)
  • I have made corresponding changes to documentation
  • My changes generate no new warnings (basedpyright, ruff, pylint)
  • All tests pass locally
  • I have added tests that prove my fix/feature works
  • Any dependent changes have been merged

Quality Gates Status

  • Type checking ✅ (hatch run type-check)
  • Linting ✅ (hatch run lint)
  • Contract validation ✅ (hatch run contract-test-contracts)
  • Contract exploration ✅ (hatch run contract-test-exploration)
  • Scenario tests ✅ (hatch run contract-test-scenarios)

Screenshots/Recordings (if applicable)

N/A

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working devops-backlog DevOps Agile Backlog integrations

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Follow-up] Harden backlog refine prompt scaffold and mixed-format parsing

1 participant