---
id: TST-PFM-INT-009
title: timer correctness
kind: integration
product_area: platform
module: integrations
revision: 1
status: draft
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
  macroservice-libraries: 54536a441935c6e09fdb7f96f0bec71c52ba4e03
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
repository: macroservice-libraries
files:
  - packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts
implements: []
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 5
isolation: >-
  Use the suite-owned database fixtures and its declared cleanup; prepare the test database before
  integration or lifecycle execution.
evidence:
  - >-
    macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts
test_cases:
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#1.
      stale timer: the stage run exits after the sweep claimed its timer; the firing finds it closed,
      supersedes it and sends nothing
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#2.
      re-entered stage: the old run’s timers are cancelled, the new run has fresh ones, and
      preserve_elapsed subtracts the earlier active time
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#3.
      concurrent manual transition, the advance first: the timeout transition waits for the lock, finds
      the run closed and is superseded
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#3.
      concurrent manual transition, the timeout first: the advance waits for the lock, re-reads and is
      refused StaleObject
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#4.
      repeated reminders: every P3D, max 3 fires three times and no more, three runs, three distinct
      idempotency keys
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#5.
      timer retries: the firing throws after the claim; the claim lapses; the next sweep fires it once;
      the run exists once
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#6.
      workflow version change: open runs keep their timers; after migrate they are recomputed from
      version 2 with scheduled_from preserved
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#7.
      pause accounting: two days awaiting the applicant move the internal timer and sla_target_at by two
      days, not the wall-clock timer
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#8.
      business calendar: P2D business from a Friday 16:00 with a Monday holiday fires on Wednesday 16:00,
      across the DST change
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#9.
      duplicate protection on redelivery: the batch delivered twice invokes the executor once; the task
      fixture holds one task
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts#10.
      cancellation: withdrawing cancels every scheduled timer and queued run of the open stage in that
      transaction; nothing fires afterwards
    provenance: test
dependency_evidence:
  provenance: test
  source: >-
    macroservice-libraries:packages/workflow-actions/src/tests/integration/timer-correctness.integration.spec.ts
  reviewed:
    - Suite introduction
    - Fixture setup
    - Client substitutions
    - Assertions and cleanup
---
# timer correctness

## Verification Boundary

This database and service suite exercises timer correctness. Its registration records the executable definition; no run result is asserted.

## What This Suite Proves

The suite contains executable checks, but no detailed scenario binding is verified in this pass.

## What It Does Not Prove

In-process execution does not establish deployed infrastructure or a real provider response. Several bindings can supply different parts of a detailed scenario; no single-file completeness is implied.

## Real Dependencies and Test Doubles

The suite definition identifies its database fixtures and replaced clients, hooks, clocks or executors. Integration runs use the prepared database; lifecycle runs exercise the in-process route or adapter path.

## Must Not Be Doubled

The database constraints, transactions and service behavior claimed by an integration binding must execute. Replaced external seams cannot establish live provider or infrastructure behavior.
