Builtpublic

S5 · Apply

Applies the fix plan and clears four gates. This is the stage where rejection is correct behaviour.

4 gates

Applies the fix plan from the previous stage, repairs group boundaries, and has to clear four gates before moving on. All code.

Rejection is correct behaviour

A fix plan carries a “before” value — what the row currently says. If that doesn’t match, the applier refuses rather than applies.

Rejection isn’t a malfunction. It means the content changed in the meantime, and regenerating the plan beats laying a stale edit over a moved target. A missing anchor, or a collision with another edit, gets refused the same way.

Read as a “success rate,” this makes you want to loosen the gate. The number worth watching isn’t the success rate — it’s how many mismatches the rejections caught.

There is no judgement in the application itself. It executes the prescription written upstream, and if it can’t do what the prescription says, it doesn’t do anything — there is deliberately no path where it improvises something similar.

Four gates, each looking at something different

Gate What it looks at If it trips
Content Abstract phrasing, unfounded deferral Fix and re-run
Duplication Rows whose expected results are identical Merge, or state the differing condition
Traceability Rules left uncovered in the ledger Patch in new rows and re-apply
Grouping Same category split apart Repaired automatically

The duplication gate blocks exact matches only and lets similar ones through, because similarity is the upstream judge’s call. Once code starts cutting on a similarity score, legitimately similar cases die with the rest.

Numbers change; content doesn’t

Uncovered rules get patched by inserting new rows. But the moment a row is inserted, every number below it shifts. The ledger built upstream goes stale on the spot.

Remapping those numbers arithmetically is forbidden. The join is done on content — major category, minor category, verification stage, and expected result, all of them.

Minor category plus expected result isn’t enough. Inside one spec an earlier section routinely restates a later one, so those two alone attach to the wrong row. Matching on a substring of the expected result is banned too — if another row carries the same phrase, it wins.

When in doubt, rebuilding the ledger against the finalised sheet is the safer move. It costs less than forcing a stale ledger to line up.

Passing is recorded as a file

Clear all four and a completion marker file gets written. If that file is absent, this stage runs again.

That’s what makes resuming from the middle possible. An exit code dies with the process; a file doesn’t. In a pipeline running unattended, writing it to disk is the only way to know “this much is done.”