Description
After switch-green, regressions are only caught manually via deploy:status. Add an automatic rollback that watches error-rate/health metrics for a soak window after the switch and invokes rollback if a threshold is breached.
Requirements and context
- Read error-rate from the metrics registry over a configurable soak window; if breached, invoke
deploy.ts rollback automatically.
- Make thresholds and window env-configurable and validated; emit structured deploy-decision logs.
- Ensure the rollback path is idempotent and reflected by
deploy:status.
- Acceptance:
deploy.test.ts simulates healthy soak (no rollback) and breached soak (auto rollback).
Suggested execution
- Fork the repo and create a branch:
git checkout -b feature/deploy-auto-rollback
- Implement changes:
src/deploy.ts
- Tests:
src/deploy.test.ts
- Docs:
docs/backend
- Include TSDoc/NatSpec-style doc comments
- Validate security assumptions (input validation, auth, signature verification, secret redaction, idempotency)
Test and commit
- Run tests:
npm test (coverage: npm run test:ci)
- Cover edge cases
- Include test output and security notes in the PR
Example commit message
feat(deploy): auto-rollback on post-switch error-rate breach
Guidelines
- Minimum 95% line coverage on new/changed code
- No secrets in repo; use
.env + deployment secrets only
- Clear documentation
- Timeframe: 96 hours from assignment
Description
After
switch-green, regressions are only caught manually viadeploy:status. Add an automatic rollback that watches error-rate/health metrics for a soak window after the switch and invokesrollbackif a threshold is breached.Requirements and context
deploy.ts rollbackautomatically.deploy:status.deploy.test.tssimulates healthy soak (no rollback) and breached soak (auto rollback).Suggested execution
git checkout -b feature/deploy-auto-rollbacksrc/deploy.tssrc/deploy.test.tsdocs/backendTest and commit
npm test(coverage:npm run test:ci)Example commit message
Guidelines
.env+ deployment secrets only