---
id: TST-BIL-BIL-032
title: Dated run lifecycle and population review
kind: integration
product_area: billing
module: billing
revision: 1
status: draft
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
repository: services-accounting
files:
- modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js
implements: []
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
isolation: Suite-owned test workspaces and fixture records in the prepared local PostgreSQL database;
  fixtures are removed by the suite teardown.
evidence:
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  the run with a generated record id of ten readable characters, not a configuration id
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  every column as it was given, in the tenant of the context
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#starts
  the run as a draft, which is a run nothing has been done in the name of
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  the run’s resolved actions, which a later change of the template never alters
- 'services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#stores
  the notification address canonical: trimmed and in lower case'
- 'services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#has
  nothing of a run that has run: no stamps, no statistics and no error (the mapping omits a null)'
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#stamps
  the system properties of a new record at the context’s instant and actor
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#reads
  back as it was written
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a business unit the tenant does not have, naming the field
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a billing template the tenant does not have, naming the field
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a template only another tenant has, the key being (tenant_id, id)
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a second run for one occurrence of a recurring billing run (§6.4)
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#allows
  the same recurring billing run a run for another occurrence, even on the same reference date
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#moves
  the run to preparing
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#records
  the job that will do the work, which is how a task finds the run it is for
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#moves
  the version on and stamps the modification, the identity staying what it was
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#claims
  a scheduled run too, which is a run waiting for the preparation it was promised
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  the second claim of the same run, naming the status it is in and the ones a preparation wants
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#leaves
  the run claimed by the first job after refusing the second
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a preparation of a ready run, which is a refresh rather than a preparation
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#claims
  a ready run for a refresh, which is the one status a refresh may be asked from
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a refresh of a draft run, which has no review set to refresh
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#clears
  the error of a run that failed before, the claim being a fresh attempt
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  404 for a run the tenant does not have
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  404 for another tenant’s run, which reads as absent
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#moves
  the run to ready, which is the run a person reviews
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#stamps
  when the preparation finished, from the context’s clock
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#stamps
  the selection the items were seen under, which is 1.0’s last_refresh_date
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#writes
  the statistics the counts added up to, whole
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to settle the same run twice, so a task delivered twice settles it once
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#leaves
  the first statistics after refusing the second, the counts not being read-modify-written
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to make a draft run ready, nothing having selected anything for it
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#moves
  the run to failed
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#says
  why, in the words an operator reads
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#stamps
  when the run came to rest
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#leaves
  the first reason when the failure is applied twice, the job and the reconciler both applying it
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#writes
  nothing at all against a run that is not preparing, and refuses nothing either
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#cancels
  a draft run, which nobody has started
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#cancels
  a scheduled run, so the preparation it was promised never happens
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#cancels
  a ready run, whose review set is then nobody’s to start
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to cancel a running run, which the execution must stop rather than this write
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to cancel a run that is already cancelled
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to cancel a completed run, there being nothing left to stop
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  404 for another tenant’s run
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#deletes
  a draft run, answering its id
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#leaves
  nothing behind, the run being gone from the tenant
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#deletes
  a cancelled run, which is a run nothing was done in the name of
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to delete a running run, as 1.0 did
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to delete a completed run, as 1.0 did
- 'services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to delete a failed run, which 1.0 allowed: it is the record of what was attempted (§5.4)'
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to delete a ready run, whose review set a person has worked on
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#leaves
  the run after refusing its deletion
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  404 for a run the tenant does not have
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  404 for another tenant’s run, which reads as absent
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  to delete a locked run, whatever its status
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#moves
  a ready run to starting, as the person who starts it, its version one higher
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a version the run no longer has, as stale, naming the version it is at
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a run that is no longer ready, with the status it has
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#answers
  404 for another tenant’s run
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#marks
  a starting run running, with the instant it started
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#gives
  a start that failed its run back, ready, with the reason
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#moves
  a running run to cancelling, and refuses a ready one
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#takes
  a run that finished with errors up again for a retry, its finish cleared
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#refuses
  a retry of a completed run
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#settles
  a running run once, with its statistics, its finish and its reason
- services-accounting:modules/billing/tests/integration/services/persistence/billing-runs.integration.spec.js#writes
  a running run’s statistics, and leaves a settled run’s alone
---
# Dated run lifecycle and population review

## Verification Boundary

The suite checks production database or service behavior against the local test database.

## What This Suite Proves

The assertions examine dated run lifecycle and population review. No complete specification scenario is bound to this file yet; its implementation exists, but coverage mapping remains unverified.

## What It Does Not Prove

It does not establish deployed IAM grants, actual queue and object-store delivery, mailbox outcomes or Commerce checkout. Local port replacements limit any workflow claim to the tested process.

## Real Dependencies and Test Doubles

PostgreSQL and the production persistence or service statements are real. The file declares its own fixtures and connection context; no deployed browser or message transport is inferred.

## Must Not Be Doubled

The database transaction, constraints, row locks, workspace isolation and production statements exercised by this suite must remain real. For handler suites, keep request validation and permission enforcement in the call path.
