Skip to content

Add automatic rollback trigger on post-switch error-rate threshold in deploy.ts #264

@mikewheeleer

Description

@mikewheeleer

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

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions