Repository navigation
refactor: consolidate audit migration test fixtures - #118277
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 7:24 PM ET / 23:24 UTC. ClawSweeper reviewWhat this changesThe PR replaces duplicated temporary-state, audit-record, recovery-journal, and controlled file-operation setup in two legacy audit-migration Vitest suites with a shared test-only fixture. Merge readinessThis is a coherent, test-only consolidation that keeps the audit migration’s distinct import and recovery scenarios explicit while moving duplicated setup into one private fixture. The checked PR head is not present on current Priority: P3 Review scores
Verification
How this fits togetherThe legacy audit migration reads retired audit JSONL files and recovery journals, imports their records into SQLite-backed audit stores, and preserves crash-recovery ordering. The changed fixture builds those legacy on-disk states and injects filesystem failures so the two suites can exercise the production migration owner consistently. flowchart LR
A[Audit migration test cases] --> B[Shared test fixture]
B --> C[Legacy audit files and journals]
C --> D[Audit migration owner]
D --> E[SQLite audit stores]
E --> F[Recovery assertions]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +230, Tests -688. Total -458 across 3 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the private Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors regression-test setup rather than fixing a reported user-visible defect. The behavioral path is nonetheless covered by the existing audit import and recovery suites described in the PR evidence. Is this the best way to solve the issue? Yes. A private audit-specific fixture is the narrowest maintainable owner boundary: it centralizes repeated setup and failure injection without generalizing unrelated test infrastructure or changing the production migration owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5aae66f4e368. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
ClawSweeper before-merge items addressed on exact head
Best-fix judgment from both reviews: the private audit-specific test-support module is the narrowest coherent owner boundary; genericizing it or combining the suites would obscure the distinct import/recovery invariants. |
|
Merged via squash.
|
What Problem This Solves
The audit-log import and crash-recovery suites repeated their temporary state layout, audit event construction, journal bytes, migration invocation, and file-handle fault injection across 1,604 lines. That duplication made the same migration lifecycle harder to review and update consistently.
Why This Change Was Made
This introduces one test-only fixture owned by the legacy audit migration lifecycle and rewrites the two existing suites around it. Distinct checkpoint, generation, downgrade, restore, durability, lock, symlink, and old-writer scenarios remain explicit in their test bodies.
src/infra/User Impact
No user-visible or production behavior change. Maintainers get a smaller, more coherent audit migration regression surface.
Evidence
tbx_01kz29pbcd3ej9g5y73tm2wm8j:pnpm check:changedpassed, including formatting, ratchets, dead-export scan, core-test typecheck, and lint.git diff --check: passed.