tidaldb/.sdlc/features/m9-purge-rematerialization/qa-results.md
jordan 6f26d03c77 feat(m9): implement purge re-materialization engine
Adds the M9 purge re-materialization feature: a WAL-replay background
engine that rebuilds community cohort aggregates for a (user, community)
pair after retroactive signal purge, restoring ranking correctness without
modifying the immutable WAL.

Key additions:
- cohort::rematerialization module: PurgeJobQueue, RematerializationEngine,
  WAL replay, atomic CohortSignalLedger swap, BLAKE3 audit log, metrics counters
- TidalDb::{submit_purge_job, purge_job_status, rematerialization_metrics}
  public API (db/rematerialization.rs)
- Engine auto-starts in persistent mode; clean shutdown before WAL teardown
- 6 integration tests in tests/m9_purge_remat.rs covering ephemeral and
  persistent modes, job lifecycle, and multi-job independence
- Split oversized files to comply with 600-line limit: db/mod.rs →
  db/from_parts.rs, entities/revocation.rs → revocation/{mod,tests}.rs,
  schema/validation/builders.rs → builders/{mod,tests}.rs,
  signals/warm.rs → warm/{mod,tests,proptests}.rs
- Fix pre-existing bootstrap errors: export AuditKind from session module,
  add overrides_rejected to SessionSnapshot deserialization
2026-03-03 19:18:16 -07:00

70 lines
2.2 KiB
Markdown

# QA Results: Re-materialization after Purge
## Test Runs
### Lib Tests
```
cargo test --lib --manifest-path tidal/Cargo.toml
test result: ok. 1299 passed; 0 failed; 0 ignored; 0 measured
```
### Integration Tests — m9_purge_remat (new)
```
cargo test --test m9_purge_remat --manifest-path tidal/Cargo.toml
running 6 tests
test submit_purge_job_returns_job_id ... ok
test purge_job_status_pending_after_submit ... ok
test unknown_job_id_returns_none ... ok
test rematerialization_metrics_snapshot_is_valid ... ok
test job_succeeds_in_persistent_mode ... ok
test multiple_jobs_processed_independently ... ok
test result: ok. 6 passed; 0 failed
```
### Integration Tests — m9_retroactive_purge (regression)
```
cargo test --test m9_retroactive_purge --manifest-path tidal/Cargo.toml
running 8 tests
test basic_purge_retracts_score ... ok
test second_purge_is_idempotent ... ok
test purge_does_not_affect_other_users ... ok
test manifest_persisted_and_listable ... ok
test purge_unknown_cohort_is_noop ... ok
test score_never_goes_negative ... ok
test multiple_items_purged_together ... ok
test non_cohort_member_purge_is_noop ... ok
test result: ok. 8 passed; 0 failed
```
### Clippy
```
cargo clippy --manifest-path tidal/Cargo.toml -- -D warnings
Finished `dev` profile [unoptimized + debuginfo] target(s) — clean, no warnings
```
### Formatting
```
cargo fmt --manifest-path tidal/Cargo.toml --check
exit: 0 — clean
```
## Acceptance Criteria Check
| Criterion | Result |
|-----------|--------|
| 1299 lib tests pass | PASS |
| 6 m9_purge_remat integration tests pass | PASS |
| 8 m9_retroactive_purge regression tests pass | PASS |
| `cargo clippy -- -D warnings` clean | PASS |
| `cargo fmt --check` clean | PASS |
| `submit_purge_job` returns JobId without blocking | PASS (test 1) |
| `purge_job_status` returns Pending after submit | PASS (test 2) |
| Unknown job id returns None | PASS (test 3) |
| Fresh db metrics show zero counts | PASS (test 4) |
| Jobs transition to Succeeded in persistent mode | PASS (test 5, < 10s) |
| Multiple jobs processed independently | PASS (test 6, < 15s) |
| Scores never go negative after purge | PASS (existing test) |
| Second purge is idempotent | PASS (existing test) |
## Status: PASSED