Skip to content

degradation.ts: Fix service degradation not reverting after recovery window expires #670

Description

@Kingsman-99

Description

src/degradation.ts puts a service into degraded mode after repeated failures, but the recovery window timer does not start until the first success after the failure threshold. It should start immediately when the threshold is crossed, so recovery is bounded in time.

Acceptance Criteria

  • The recovery window timer starts as soon as the failure threshold is crossed
  • After the window expires, the service state reverts to healthy regardless of subsequent calls
  • A test confirms the revert happens at the correct wall-clock time
  • Unit tests pass

Context

  • Target file: src/degradation.ts
  • Use src/timeMachine.ts in tests to control time without setTimeout delays

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions