Description
The migration safety subsystem under src/db/migrations/safety/ (executor.ts, rollback.ts, validation.ts, accessControl.ts) has a single migrationSafety.test.ts, but the rollback and access-control branches need dedicated coverage to ensure a failed migration cleanly reverts and is auditable. Add focused tests for the executor's failure/rollback path.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/db/migrations/safety/executor.ts, src/db/migrations/safety/rollback.ts, src/db/migrations/safety/audit.ts
- A failed step must trigger rollback and emit an audit record
Suggested execution
- Fork the repo and create a branch
git checkout -b test/migration-rollback-coverage
- Implement changes
- Simulate a mid-migration failure and assert
rollback is invoked
- Assert the audit log records the failure and revert
- Assert access control rejects unauthorized migration execution
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Rollback itself fails, partial step applied, concurrent migration attempt blocked
- Include test output and notes
Example commit message
test: cover migration executor rollback and access control
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
The migration safety subsystem under
src/db/migrations/safety/(executor.ts,rollback.ts,validation.ts,accessControl.ts) has a singlemigrationSafety.test.ts, but the rollback and access-control branches need dedicated coverage to ensure a failed migration cleanly reverts and is auditable. Add focused tests for the executor's failure/rollback path.Requirements and context
src/db/migrations/safety/executor.ts,src/db/migrations/safety/rollback.ts,src/db/migrations/safety/audit.tsSuggested execution
git checkout -b test/migration-rollback-coveragerollbackis invokedTest and commit
npm testExample commit message
test: cover migration executor rollback and access controlGuidelines