---
name: "Persist test results to story files"
---

# Story 171: Persist test results to story files

## User Story

As a project owner, I want test results written to the story markdown file when record_tests is called, so that there's a durable paper trail that survives server restarts.

## Acceptance Criteria

- [ ] record_tests appends or updates a Test Results section in the story markdown file
- [ ] Test results section shows test name, status (pass/fail), and details for each recorded test
- [ ] Results persist across server restarts by being read back from the file on load
- [ ] ensure_acceptance reads from the persisted file data, not just in-memory state
- [ ] When a coder agent starts on a story, snapshot the current overall test coverage (from cargo llvm-cov) and write it as front matter (e.g. `coverage_baseline: 42.3%`) so coverage delta can be computed later

## Out of Scope

- TBD

## Test Results

<!-- huskies-test-results: {"unit":[{"name":"test_write_persists","status":"pass","details":null}],"integration":[{"name":"test_roundtrip","status":"pass","details":null}]} -->

### Unit Tests (1 passed, 0 failed)

- ✅ test_write_persists

### Integration Tests (1 passed, 0 failed)

- ✅ test_roundtrip
