---
id: TST-PFM-INT-008
title: sweep
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/sweep.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/sweep.integration.spec.ts'
test_cases:
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#claims
      nothing before a timer is due, and fires it once it is: the run written, the timer fired with it
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#a
      host action a guard refuses blocks the timer with the problem and attention, writes no run, and
      fires on retry
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#a
      timer whose condition reads a fact the host did not declare is blocked with the problem and
      attention, not raised
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#leaves
      a timer of a host kind it does not serve alone
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#sweeps
      only the tenants it is given, when it is given some
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#deletes
      terminal timers thirty days after they ended, and keeps younger ones
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#keeps
      each host’s terminal timers for its own terminal_timer_retention, the others for thirty days
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#never
      deletes or writes an action run, however old: runs are the host’s history
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#a
      firing that throws is rolled back and counted failed; its claim lapses for the next sweep
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#without
      per_tenant_limit, one pass of claim_limit per tenant, oldest due tenant first
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#with
      per_tenant_limit, passes rotate the tenants so a backlog never holds another tenant back, up to
      claim_limit each
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#refuses
      a per_tenant_limit above claim_limit, and an enqueue host without its callback
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#the
      sweep claims and hands the timers over; the worker fires each once, under the lock, exactly as
      inline
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#the
      worker runs the atomic check: an instance that closed meanwhile supersedes the timer
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#a
      guard refusal blocks the timer from the worker as from the sweep
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#supersedes
      a timer whose claim lapsed before the worker reached it
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#a
      message whose claim a later sweep retook is not_claimed; the later message fires the timer
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#an
      enqueue callback that throws counts the timers failed and leaves their claims to lapse for the next
      sweep
    provenance: test
  - source: >-
      macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts#refuses
      a context acting in another tenant than the timer’s
    provenance: test
dependency_evidence:
  provenance: test
  source: 'macroservice-libraries:packages/workflow-actions/src/tests/integration/sweep.integration.spec.ts'
  reviewed:
    - Suite introduction
    - Fixture setup
    - Client substitutions
    - Assertions and cleanup
---
# sweep

## Verification Boundary

This database and service suite exercises sweep. 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.
