Skip to content

CAP-PFM-OPS-001Complete background work with a durable record

Markdown

CAP-PFM-OPS-001

Complete background work with a durable record

Markdown
  • DocumentDraft
  • Product intentConfirmed
  • ImplementationObserved

KindCapabilityProduct areaPlatformModuleOperational RecordsRevision1

Read atservices-platform ad3f6a65macroservice-libraries 54536a44

The Formal Contract

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

Outcomes
Repeated intentions resolve to the existing job rather than another submission.Operators can inspect completed work, interruptions and failure explanations.Failure handling includes the owning record’s declared recovery consequence.
Surfaces
job
Preconditions
The owning module registers the job kind, step catalog, execution workflow, recovery declarations and failure consequence.
Postconditions
Submission preserves the steps and event history and the job eventually records one final status.
Constraints
Cloud workflows own sequencing, retry and timeouts; the engine maintains the observable record.
Intent sources
services-platform:docs/hq/rhythm-hq-plan.md#K8 (plan approved 2026-10-11)services-platform:docs/hq/rhythm-hq-plan.md#L. Verification plan (durable job persistence, retry lineage and idempotent submission)

Controls

41 controls apply, from the corpus control catalogue.

TC-AVL-001 TC-AVL-004 TC-AVL-005 TC-AZ-001 TC-AZ-002 TC-AZ-003 TC-AZ-004 TC-CRY-001 TC-CRY-002 TC-CRY-003 TC-CRY-004 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-DAT-004 TC-IAM-001 TC-IAM-002 TC-IAM-004 TC-IAM-005 TC-IAM-006 TC-LOG-002 TC-LOG-003 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-SEC-001 TC-SEC-002 TC-SEC-003 TC-SEC-004 TC-TEN-001 TC-TEN-002 TC-TEN-003 TC-VEN-001 TC-VEN-002 TC-VEN-003

Business Rules

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

IdRuleKindEnforced atProvenance
01must prove
Confirmed
Repeated intentions identify one job; a concurrent uniqueness conflict resolves to the existing job outside a caller transaction but aborts an open caller transaction for the caller to retry.
✓ A repeated workspace-provisioning submission returns the existing job.✗ A unique submission key prevents two job records for the same intention.
origin: services-platform:docs/hq/rhythm-hq-plan.md#L. Verification plan (approved K8, 2026-10-11)
invariantservice, databaseobserved
02must prove
Confirmed
Creating a job records its queued steps and submission event; starting its execution inside the submitting transaction is refused.
lifecycleservicetest
macroservice-libraries:packages/jobs/src/engine/job-engine.spec.ts#refuses submitJob inside a transaction: the execution starts after the commit
03must prove
Confirmed
When execution cannot start after submission commits, the API-facing start helper leaves the job pending for reconciliation and preserves the successful submission response.
✓ A repeated workspace-provisioning submission returns the existing job.✗ A unique submission key prevents two job records for the same intention.
policyserviceobserved
04must prove
Confirmed
A final job or step cannot transition to another status; late reports for settled jobs are discarded and logged, and another settlement is refused.
invariantservicetest
05must prove
Confirmed
Job progress cannot decrease, and settlement timestamps are present only on final jobs.
invariantservice, databasetest
06must prove
Confirmed
A permanent task refusal ends the job with its safe explanation; transient failures are retried without copying their details into the job or execution history.
policyservicetest
macroservice-libraries:packages/jobs/src/workflow/job-workflow.spec.ts#lets no detail of the transient error reach the job or the execution state
07
Confirmed
Asynchronous job inputs contain identifying references and request context, with secrets and customer content retained outside the execution payload.
policyservicedocumented
services-platform:docs/jobs.md#What may cross the asynchronous boundary
08
Confirmed
The monitor obtains the job’s step catalog from its published history, preserving the definition used for that execution rather than substituting the current declaration.
policyservicetest
services-platform:modules/jobs/tests/integration/services/job-snapshot/job-snapshot.integration.spec.js#takes that catalog from the published event rather than the declaration, which the event itself carries
09must prove
Confirmed
Each registered job kind must declare its business failure consequence or explicitly declare that failure changes nothing outside the job.
policyservicetest
services-platform:modules/jobs/tests/unit/job-failure-consequences.spec.js#declares a failure consequence, or states there is none, for every registered kind
10must prove
Confirmed
Workspace deletion removes its job records, steps, events and notices while preserving the deletion’s own scheduled and executing jobs.
lifecycleservice, databaseobserved
11must prove
Confirmed
Default progress rounds the fraction of settled steps to a percentage capped at one hundred; declared progress weights instead use the highest settled-step weight.
no proof recorded yet
calculationserviceobserved
12must prove
Confirmed
Execution continuation records the successor handle and continuation history together, accepts replay of the same move and refuses a source execution that does not match the job.
invariantserviceobserved

Scenarios

IdGivenWhenThenProvenance
01A provisioning request already has a recorded submission identity.The caller repeats the request using that identity.The existing job is returned without another job record.inferred
macroservice-libraries:packages/jobs/src/engine/job-engine.spec.ts#answers the job the identity already names when the submission is repeated
02An unexpected database fault interrupts a running task.The task exhausts its workflow retries.The recorded failure remains generic and the technical error is confined to logs.inferred
macroservice-libraries:packages/jobs/src/workflow/job-workflow.spec.ts#lets no detail of the transient error reach the job or the execution state

Edge Cases

IdGivenWhenThenProvenance
03A job has already completed successfully.A delayed report marks one of its steps running.The engine ignores and logs the report without adding history or raising a regression alert.inferred
macroservice-libraries:packages/jobs/src/engine/job-engine.spec.ts#raises no terminal-regression alert for a late running report against a succeeded job

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.