---
id: TST-PFM-DJE-008
title: Chunk plan
kind: unit
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/chunk-plan.spec.ts
implements:
  - ATS-PFM-DJE-014-03
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 1
isolation: In-memory fixtures and restored dependency doubles.
evidence:
  - 'macroservice-libraries:packages/data-jobs/src/chunk-plan.spec.ts'
assertion_inventory:
  - where a chunk file ends
  - closes the chunk when one more item would pass the item limit
  - 'closes it when one more item would pass the byte limit, however few items it holds'
  - >-
    never closes an empty chunk, so an item larger than the whole limit is written alone rather than
    nowhere
  - >-
    keeps a group whole, even past both limits, because a group divided could never commit as one
    unit
  - 'holds a group it has seen anywhere in the chunk, not only on its last line'
  - 'cuts a thousand items of no group into ten chunks of a hundred, which is the default'
  - 'cuts by bytes when the records are wide, so a chunk is always a size a worker can read whole'
  - when a source is unreadable rather than a line being bad
  - says nothing until enough lines have been read to have an opinion
  - bears the few bad lines a producer always has
  - gives up once more than the allowed share of the file cannot be read
  - how many batches admission hands to the queue
  - admits the job its own ceiling when nothing else is in flight
  - 'admits only what is waiting, and nothing when nothing is'
  - counts the job's own batches in flight against its ceiling
  - >-
    lets the tenant's other jobs hold the tenant's share, so one job of a tenant does not take it
    all
  - >-
    stops at the cluster ceiling the service reads from its own capacity, so the interactive lane
    keeps its room
  - >-
    admits nothing when a ceiling was lowered under what is already in flight, rather than asking
    for batches back
registration_note: Registration describes existing source; the suite is not executed by this documentation job.
---

# Chunk plan

## Verification Boundary

The suite checks an isolated production calculation, declaration or adapter. The structured assertion inventory records the checks present at the pinned revision.

## What This Suite Proves

The existing checks exercise chunk plan. The specification bindings identify the narrower outcomes supported by those assertions.

## What It Does Not Prove

An isolated check does not establish a deployed workflow, database enforcement or complete feature acceptance.

## Real Dependencies and Test Doubles

The production function or declaration is exercised with in-memory inputs and dependency doubles. This boundary does not require a live database.

## Must Not Be Doubled

The production function under examination and its returned decisions remain real; replacing their answers defeats the check.
