Milestone 2 of 8

Define and validate the configuration

Name the seed, exact checking count, batch size, and remainder rule, then reject impossible values before random work begins.

The movement rule depends on four choices. Give those choices names and reject an impossible configuration before asking a generator for a permutation.

Goal

Create and validate one configuration record containing the seed, checking count, batch size, and remainder policy.

Inputs

Use the record count from the previous milestone. The configuration fields are:

FieldRule
seedThe initial state for one NumPy generator
checking_countAn exact count with 0 < checking_count < record_count
batch_sizeA positive maximum number of records in one batch
keep_remainderWhether to retain a final smaller working batch

Keep the configuration separate from the source arrays. It describes one run; it does not modify the records.

Deliverables

Implement a small immutable or otherwise explicit configuration record and a validation function. Return a validated configuration or a clear failure that names the invalid field. Save the accepted values as part of the later split evidence.

Checks

Check an ordinary configuration, a checking count of one, a checking count of record_count - 1, a batch size larger than the working group, and both remainder choices. Reject zero and negative checking counts, counts equal to or larger than the source count, and zero or negative batch sizes.

Validation must happen before generator creation and before any output is written. Changing one setting must not silently change another setting in the saved record.

Workspace

Implement the record in src/config.py. The caller in src/main.py should pass the validated record to later stages instead of keeping separate hidden constants. Keep the supplied files unchanged.

Hints

HintKeep a count exact
A fraction such as 20 percent can produce different integer counts after rounding. checking_count states the exact number of positions to hold out.
HintValidate before random work
A failed configuration should not consume generator state or leave a partial manifest.

Review

Read the error messages with a reader who has supplied record_count but no other context. They should be able to tell which value is invalid and what boundary is allowed.

How to check your work

The supplied fixture uses one named configuration record and checks every boundary before generating indexes. Compare the accepted values and failure cases, not just the record type.

LLM PrimerDefine and validate the configurationhttps://llmprimer.com/python/projects/build-a-reproducible-split-and-batch-pipeline/define-and-validate-configuration© 2026 LLM Primer