Skip to content

feat: story regression foundation - @pytest.mark.story marker + traceability API (#1699)#1713

Open
prompt-driven-github[bot] wants to merge 1 commit into
mainfrom
change/issue-1699
Open

feat: story regression foundation - @pytest.mark.story marker + traceability API (#1699)#1713
prompt-driven-github[bot] wants to merge 1 commit into
mainfrom
change/issue-1699

Conversation

@prompt-driven-github

Copy link
Copy Markdown
Contributor

Summary

Establishes the story-regression foundation for EPIC #1698: a deterministic, marker-traceable pytest oracle that links user_stories/story__*.md files to runnable regression tests via a @pytest.mark.story marker and a bidirectional story↔test traceability API. No test generation yet (that is sub-issue 2).

Closes #1699

Changes Made

Prompts Modified

  • pdd/prompts/story_regression_python.prompt (NEW) - deterministic, marker-traceable pytest oracle (pdd/story_regression.py). Builds a bidirectional story_id ↔ {nodeid} map via a pytest --collect-only plugin; exposes tests_for_story, story_for_test, and has_regression_test; detects both orphan directions. No LLM, no test execution.
  • pdd/prompts/user_story_tests_python.prompt - promotes the private _slug_from_story_path() slug extractor to a public, documented story_id helper so the marker mechanism and story files share one identity space. Purely additive; LLM-oracle flow unchanged.
  • pdd/prompts/coverage_contracts_python.prompt - adds an orthogonal, story-keyed has_regression_test dimension (true when ≥1 collected test claims the story via the marker), computed by querying story_regression.tests_for_story. Existing rule-keyed (test_R<n>) statuses and priority are untouched.

Direct Edits (no originating prompt)

  • pytest.ini - registers the story(story_id) marker alongside e2e/integration/slow/real/private_prompt so pytest -m story selects exactly the marked tests with no PytestUnknownMarkWarning.

Documentation Updated

  • docs/coverage_contracts.md - new "Story regression coverage" section + Rule-fields note.
  • docs/generating_user_stories.md - new "Story regression tests (@pytest.mark.story)" section + Quick-reference row.
  • README.md - one-clause coverage-matrix pointer.

Other

  • architecture.json - updated to reflect the new story_regression module.

User Stories

  • Policy: warn
  • user_stories/story__coverage_contracts_story_regression_user_story_tests.md — issue-derived story linked to: coverage_contracts_python.prompt, story_regression_python.prompt, user_story_tests_python.prompt
  • user_stories/contracts/coverage_contracts_story_regression_user_story_tests.contract.md — generated machine-checkable contract
  • Validation: ❌ 1 of 1 linked story check(s) failed: user_stories/story__coverage_contracts_story_regression_user_story_tests.md
  • ⚠️ Warning (non-blocking): failing linked story check(s): user_stories/story__coverage_contracts_story_regression_user_story_tests.md

Review Checklist

  • Prompt syntax is valid
  • PDD conventions followed
  • Documentation is up to date

Next Steps After Merge

  1. Regenerate code from modified prompts in dependency order:
    pdd sync coverage_contracts
    pdd sync user_story_tests
    pdd sync story_regression
    
  2. Run tests to verify functionality (pytest -m story should select exactly the story-backed regression tests)
  3. Deploy if applicable

Created by pdd change workflow

…ability API (#1699)

Add the deterministic, marker-traceable pytest story regression foundation:
new story_regression_python.prompt, a public story_id identity helper in
user_story_tests, and an orthogonal per-story has_regression_test dimension
in coverage_contracts.

Co-Authored-By: Claude Opus 4 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Story regression foundation: @pytest.mark.story marker + story→test traceability API

1 participant