Skip to content

CAP-BIL-BIL-003Create and estimate a dated billing run

Markdown

CAP-BIL-BIL-003

Create and estimate a dated billing run

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationObserved

KindCapabilityProduct areaBillingModuleBillingRevision1

Read atservices-accounting f47cb263react-console baf6dae3

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
A run snapshots template instructions for a reference date.Estimation previews a population count, with a recorded cross-unit installment discrepancy.Filters make saved runs discoverable by their operational attributes.
Surfaces
consoleapi
Preconditions
A usable template exists; manual runs also accept an inactive template.
Postconditions
Creation returns a draft or a preparing run when immediate preparation is requested.
Constraints
Declared run-update and bulk keys have no operation that checks them.
Intent sources
services-accounting:docs/milestones/plans/ACCT-M4-plan.md#4a (rule 44)services-accounting:docs/billing/architecture.md#15. Porting rule (Andrew, 2026-10-15)

Controls

29 controls apply, from the corpus control catalogue.

TC-AVL-004 TC-AZ-001 TC-AZ-002 TC-AZ-003 TC-AZ-004 TC-AZ-006 TC-CRY-001 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-IAM-001 TC-IAM-002 TC-IAM-004 TC-IAM-005 TC-LOG-004 TC-LOG-005 TC-MON-001 TC-MON-002 TC-PI-001 TC-PI-002 TC-PI-003 TC-PI-004 TC-PI-005 TC-PRV-001 TC-PRV-002 TC-TEN-001 TC-TEN-002 TC-TEN-003 TC-TEN-004

Permissions

KeyChecked atScope
accounting.billing-runs.readapitenant
accounting.billing-runs.createapitenant
accounting.billing-runs.readconsoletenant
accounting.billing-runs.createconsoletenant

Business Rules

12 rules, 11 to be proved before approval. A rule's product intent is derived from its origin: 0 confirmed by a product decision, the rest inheriting this capability's proposed.

IdRuleKindEnforced atProvenance
01must prove
Proposed
Creating a run requires a workspace template and a valid calendar reference date, with missing templates and malformed dates refused before any run is written.
validationapi, servicetest
02must prove
Proposed
A run retains the template's identity, version and copied action options, preserving its work when the template changes or becomes inactive.
origin: services-accounting:docs/billing/architecture.md#15. Porting rule (Andrew, 2026-10-15)
invariantservicetest
services-accounting:modules/billing/tests/integration/services/billing-runs/request-billing-run.integration.spec.js#records the version that template then had, so a later edit does not change this run
03must prove
Proposed
Run creation resolves nested relative dates against the reference day, including the legacy relative-date form, and retains absolute dates in the resulting options.
origin: services-accounting:docs/billing/architecture.md#15. Porting rule (Andrew, 2026-10-15)
calculationservicetest
services-accounting:modules/billing/tests/integration/services/billing-run-execution/installment-actions.integration.spec.js#resolves the template’s relative days against the reference date in the run’s options
04
Proposed
Default run names combine the reference date and template name; a supplied nonblank name is trimmed, and the business unit remains the template's.
policyserviceobserved
05must prove
Proposed
Manual runs use their requester's identity for population reads and do not accept a different execution identity in the request.
permissionservicetest
06must prove
Proposed
A template containing an unavailable action cannot create a run, even if it predates that action's withdrawal.
origin: services-accounting:docs/billing/architecture.md#1. What is being built, and the first slice
validationservicetest
services-accounting:modules/billing/tests/integration/services/billing-runs/request-billing-run.integration.spec.js#refuses a template holding an action the service cannot run yet, as the template itself is refused
07must prove
Proposed
Manual creation accepts inactive templates although recurring occurrences refuse them.
policyservicetest
08must prove
Proposed
Saved-query estimates use the requester's access, return per-action counts capped at ten thousand with a cap indicator, and create no run, item or job.
calculationservicetest
09must prove
Proposed
Estimation preserves Platform's explanation for query refusals and returns a referenced unavailability message for an invalid Platform response.
no proof recorded yet
policyservicetest
services-accounting:modules/billing/tests/integration/services/billing-runs/request-billing-run.integration.spec.js#answers a worded 503 saved_query_unavailable with the reference when Platform’s answer is not the contract’s (DEF-ACT-0802)
10must prove
Proposed
Run lists use newest-first cursor paging, default to twenty-five and cap at one hundred, support status, template, recurrence, creator, date and name filters, and reject unknown statuses without shifting already-read pages.
no proof recorded yet
policyapi, servicetest
services-accounting:modules/billing/tests/e2e/billing-runs.e2e.spec.js#refuses a status filter the vocabulary does not hold, naming what it may be
11must prove
Proposed
Run reads require read permission, creation and estimates require create permission, and another workspace's run is not found.
permissionapitest
services-accounting:modules/billing/tests/e2e/billing-runs-security.e2e.spec.js#is refused the estimate, which is what a person asks before making one
12must prove
Proposed
Installment estimation omits business-unit filtering because no saved run exists; the prepared population applies its run’s business unit.
no proof recorded yet
calculationserviceobserved

Scenarios

IdGivenWhenThenProvenance
01A reminder template is configured.The controller creates today's run and postpones preparation.The resulting draft records its date, template name and version and the requesting controller.test
services-accounting:modules/billing/tests/e2e/billing-runs.e2e.spec.js#answers a draft named for its date and its template
02A query selects twelve thousand contacts.The controller estimates a run using that query.The count is capped at ten thousand and marked capped without creating a run.test

Edge Cases

IdGivenWhenThenProvenance
03A controller uses the new-run form west of UTC.They open it near the end of their local day.The default date follows UTC and can fall on the next local calendar day.documented

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.