Milestone 6 of 8

Execute an ordered transformation plan

Validate every named operation and argument before execution, then retain source and stage identity, shapes, pixel checks, and output digests.

Several correct operations can still produce an unclear result if their order is hidden. Treat the transformation plan as data and validate it before executing any stage.

Goal

Validate and execute an ordered, non-empty plan while retaining source and intermediate identities, configured arguments, shapes, pixel checks, and digests.

Plan contract

plans/transform_plan.json contains a unique safe plan name, a source image_id, and an ordered list of operation records. Each operation names one required operation and its arguments. Validate the complete plan, including operation names and argument types, before executing the first stage.

An invalid later stage must not leave behind a plausible completed plan. Every stage receives an independent array and returns an independent uint8 array under the toolkit contract.

Deliverables

Implement plan validation and execution in src/config.py and src/pipeline.py. Save one stage record per operation containing stage index, operation, configured arguments, input/output shape and dtype, selected pixel checks, and output digest. Keep the source image ID and plan name in every record.

Checks

Use a plan containing crop, flip, channel, brightness, mask, and mean stages where valid. Predict one intermediate shape and pixel before running. Check that stage order is preserved and that the same plan run twice produces the same records and arrays.

Reject empty plans, unsafe names, unknown operations, malformed arguments, invalid later stages, wrong source IDs, and extra fields that change the contract. Confirm a failed plan reports its stage and does not claim a completed output. Check source and intermediate arrays remain unchanged after later stages.

Workspace

Keep plan schema and validation in src/config.py and execution in src/pipeline.py. Numerical summaries and PNG serialization belong to later milestones.

Hints

HintValidate first
If stage 4 is invalid, the output from stages 1 through 3 is not a completed plan. Validate the whole list before writing final stage records.
HintRecord the boundary
A shape and digest tell you what came out; the input stage identity tells you what went in. Save both.

Review

Choose two plans with the same operations in different orders. Which stage record first shows the difference? Why is a partial output dangerous to label as a successful transformation?

How to check your work

Checks compare operation order, arguments, stage shapes, selected pixels, digests, and controlled failure with the supplied plans. The plan records a sequence; it does not claim that one sequence is visually best.

LLM PrimerExecute an ordered transformation planhttps://llmprimer.com/python/projects/build-an-image-transformation-toolkit/execute-an-ordered-transformation-plan© 2026 LLM Primer