---
id: TST-PFM-DJE-025
title: Shared job processing lifecycle
kind: integration
product_area: platform
module: data-job-engine
revision: 1
status: draft
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
  macroservice-libraries: 54536a441935c6e09fdb7f96f0bec71c52ba4e03
  services-crm: a8d1364f1dd44b723bb5f9acba12f983e9ec8d69
  services-membership: 5994c270e8a37a30f848e99ba5b5ee6b87c08893
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
repository: macroservice-libraries
files:
  - packages/data-jobs/src/tests/integration/data-job-engine.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: >-
  Suite-owned fixture records, job identifiers and workspace contexts; teardown removes the fixture
  data.
evidence:
  - >-
    macroservice-libraries:packages/data-jobs/src/tests/integration/data-job-engine.integration.spec.ts
assertion_inventory:
  - the data job engine against Postgres
  - submission (T1)
  - 'writes the job, its items, its batches and one queue row per batch, in the caller''s transaction'
  - 'answers the job that exists when the same key submits the same request, and writes nothing twice'
  - 'refuses the same key used for a different request, which is a conflict and not a new job'
  - running a batch
  - 'applies every item once, completes its receipts and finishes the job'
  - applies each item exactly once when two deliveries of the batch run at the same time (T2)
  - 'skips every item of a batch that already committed, when the batch is delivered again (T3)'
  - 'does no work for a batch that has already finished, and says so'
  - 'rejects a record the submitter may no longer reach as not_found, and applies the rest'
  - failures inside a batch
  - commits the valid items and rejects each failure with its own code (T4)
  - >-
    isolates the one object that cannot commit by halving the unit, and commits every other item
    (T5)
  - 'the finished-batch counter, which is how a client says ''batch 7 of 20'''
  - counts one more batch as each of a four-batch job finishes
  - 'counts a batch once however often it is delivered, because the guard is the batch row itself'
  - 'counts a batch that failed for good as finished, so a failed job is not left waiting on it'
  - 'validate, then apply'
  - >-
    writes nothing when it validates, reports the impact, and writes the same frozen items when it
    is applied
  - 'refuses to apply a validated job whose validation has expired, and expires the job'
  - 'pause, resume and cancel (T7)'
  - 'stops at the batch boundary when the job is paused, and runs again when it is resumed'
  - 'never attempts the remaining batches of a cancelled job, and says what had committed'
  - 'lists the items a cancelled job never reached under not_attempted, and under no other outcome'
  - settles a job cancelled while a batch was running as cancelled when that batch finishes
  - a transient failure that runs out of attempts
  - >-
    pauses the job failed_transient when a runner nobody redelivers to gives up, and a retry
    finishes it
  - 'runs the batch again itself when nobody redelivers to it, and applies it once the failure passes'
  - >-
    pauses the job on a queue worker's last delivery, still rethrowing, and a resume takes the batch
    up again
  - >-
    keeps the job paused when a batch still in flight finishes after another gave up, so a retry can
    finish it
  - settles a cancelling job cancelled when the batch it waited for gives up
  - the rejection-rate guard
  - 'pauses a job whose items are mostly being refused, and takes it up again on a retry'
  - the queue dispatcher
  - 'claims the job''s queue rows, publishes one message per batch and deletes what the queue accepted'
  - 'claims nothing a run has already claimed, so two dispatchers never publish one row twice'
registration_note: Registration describes existing source; the suite is not executed by this documentation job.
---

# Shared job processing lifecycle

## Verification Boundary

The suite checks the production service or shared engine against its database fixture. The structured assertion inventory records the checks present at the pinned revision.

## What This Suite Proves

The existing checks exercise shared job processing lifecycle. The specification bindings identify the narrower outcomes supported by those assertions.

## What It Does Not Prove

Local execution does not establish deployed queue, storage or service behavior. Independent test cases do not establish a complete cross-feature process.

## Real Dependencies and Test Doubles

The shared engine uses real Postgres with a test domain operation and repository. File suites use a fake object store; transport publication uses test ports.

## Must Not Be Doubled

The database effects, security context and production operation under examination remain real. Their outcomes cannot be replaced with canned success responses.
