advanced24 min studyLesson 340 in Engineering

Roll out a contract without hiding rejected or unchecked data

Stage observation, consumer validation, quarantine, enforcement, and rollback while retaining outcome accounting and historical-data scope.

On this page

What you’ll understand

  • Distinguish a published rule from a check on existing and future data.
  • Stage enforcement with consumer evidence and explicit quarantine handling.
  • Account for every input outcome and plan rollback around data already written.

A team adds a stricter rule and suddenly stops a training pipeline because a common legacy value is rejected. Another team adds the rule only to documentation, leaving producers unchanged. A useful contract rollout avoids both unexamined outcomes by separating observation, validation, enforcement, and migration. It also keeps invalid, rejected, quarantined, and unchecked data visible rather than declaring success because the surviving published rows happen to pass the new test.

Specify the gate and its historical scope

A contract should identify its dataset and field scope, semantic version, rule, owner, evaluation stage, and failure action. Decide whether a violation rejects a write, quarantines a record or partition, blocks publication, or raises a nonblocking alert. Different actions protect different consumers and create different operational costs. State how existing data is assessed: a newly checked producer does not retroactively validate an archive. Schema compatibility and content quality also need separate gates. A structurally compatible migration can still change label meaning, while a new quality requirement can reject otherwise decodable historical examples.

Database mechanisms illustrate the distinction between future enforcement and historical validation. For supported PostgreSQL CHECK or foreign-key constraints, NOT VALID can defer checking the pre-existing rows while enforcing the new constraint on new changes; VALIDATE CONSTRAINT later addresses the old population according to that mechanism's contract. This is not a universal behavior of every validator, constraint type, or storage engine. A lakehouse rule documented in a catalog may require a separate scan and a producer or publication gate. Verify the actual enforcement point and keep historical-unverified state explicit until the defined validation completes.

Ninput=Naccepted+Nquarantined+Nrejected+NunknownN_{\mathrm{input}}=N_{\mathrm{accepted}}+N_{\mathrm{quarantined}}+N_{\mathrm{rejected}}+N_{\mathrm{unknown}}
Counts cover a fixed input batch with mutually exclusive processing outcomes under this rollout contract. Unknown means the required check or outcome is not established; it must not silently count as passing.↔ Scroll wide equations horizontally.

Observe and test before expanding rejection

Begin with a shadow assessment when appropriate: evaluate the proposed rule and record would-fail outcomes without pretending the existing publication now enforces it. Review representative failures, including rare slices and intentional legacy cases, and compare downstream training behavior under the proposed exclusion. A rule with many false positives can remove valuable or difficult examples, changing the learning population while improving a superficial pass-rate metric. Ground-truth review has its own scope and uncertainty; one convenient sample does not certify every flagged partition. Record the evidence supporting the threshold and exceptions.

A canary then exercises the real gate, quarantine path, error reporting, and affected consumers on a deliberately limited scope. Test both invalid rejection and valid acceptance. Quarantine requires an owner, retention, access policy, review capacity, and replay procedure; otherwise it can become an untracked second dataset or an ever-growing queue. Version the rule and produced artifact so a consumer can distinguish releases, and retain the admission funnel. Expanding enforcement should be a concrete decision based on observed outcomes, not an automatic reward for seeing no errors among rows that were allowed through.

flag precision⁡=Ntruly invalid and flaggedNflagged\operatorname{flag\ precision}=\frac{N_{\mathrm{truly\ invalid\ and\ flagged}}}{N_{\mathrm{flagged}}}
This fraction requires a defined trusted review population with a nonzero flagged count. It describes the assessed flags, not automatically every future violation or the false-positive rate among all valid records.↔ Scroll wide equations horizontally.

Make rollback and repair respect written history

Rollback must consider the data already produced, not just restore an old code binary. New writers may have emitted schemas an old reader cannot consume; quarantine may contain records needing repair rather than blind replay; a reverted rule can reopen a use boundary it was meant to enforce. Define which versions consumers may read, how corrections are published, and which evidence permits republishing a held artifact. Re-run checks against pinned inputs and current required policy before releasing repairs. Never rewrite a failed record silently while leaving its original dataset identity and provenance unchanged.

The queue lab isolates quarantine review capacity. Compare separate fixed-rate runs at arrival 4/service 2 and arrival 2/service 4, interpreting units as review tasks per second. Before each run, Reset, re-set both rates, predict from four initial tasks, then Play or Step. The second fresh backlog drains in two seconds; changing controls alone does not switch the old backlog's rates in place. This fluid model has no validator, ground truth, or publication gate. It can reveal a capacity imbalance, while the contract's actual correctness still depends on rule semantics, outcome tracking, and verified consumer behavior.

Inspect a canary’s false exclusions

A fully reviewed 1000-row canary has 50 truly invalid rows and 950 valid rows. A proposed gate flags all 50 invalid rows plus 20 valid rows; flagged rows are quarantined and all other rows are published. Assume the review is correct for this fixed canary.

  1. The gate quarantines 70 rows and publishes 930. Input accounting remains 1000=70+930, with no unchecked or rejected rows in this particular exercise.

  2. Flag precision is 50/70≈71.43%. The false-positive rate among valid rows is 20/950≈2.11%; these are different denominators.

  3. The published rows pass this reviewed rule, but 20 valid examples were unnecessarily excluded. Investigate the rule and slice effects before expanding enforcement, and preserve quarantine for controlled correction rather than silently dropping those rows.

The result

The canary reveals both successful invalid exclusion and a real cost to valid examples. A published-only pass rate would conceal that cost.

Explore the model

Interactive lab

Interactive lab · queue

A stricter gate creates review work that needs capacity

Compare separate runs at λ=4,μ=2 and λ=2,μ=4, in hypothetical review tasks per second. Each time: Reset, set both rates, predict from four fresh tasks, then Play or Step. The stable fluid run drains in two seconds; edits retain elapsed time rather than live-switching rates.

A stricter gate creates review work that needs capacityFluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Current readings: Fluid backlog: 4; Net rate · λ − μ: −1 /s; M/M/1 mean residence: 1 s. All parameters are adjustable with the labeled controls below.02.557.51001.534.56Elapsed time · sFluid backlogλ < μ
Fluid backlogCurrent time
Fluid backlog
4
Net rate · λ − μ
−1 /s
M/M/1 mean residence
1 s
t = 0 s

Fluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forThe instrument models aggregate pressure, not rule correctness or ground truth. Quarantine outcomes and safe replay need their own contract; the displayed M/M/1 mean also requires its stated stochastic assumptions.

Check your understanding

A new rule runs only in shadow mode and reports would-fail rows. Which claim would overstate the rollout?

Try it yourself

A2000-row batch records 1900 accepted, 80 quarantined, 10 rejected, and 10 unknown outcomes. Does the outcome accounting balance? Can the 10 unknown rows be included in a passing published dataset without another decision?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Add the disjoint categories, then preserve the meaning of an unestablished check.

Compare with the solution

The categories sum to 2000. Unknown rows are not proven passing and should follow the defined blocked or recovery path rather than be silently published as accepted. Publication and later replay must use the contract’s actual verification and versioning rules.

Take it with you

  • A contract rollout separates rule definition, observation, historical validation, and real enforcement.
  • Quarantine, false positives, and unknown outcomes belong in the reported admission funnel.
  • Rollback and repairs must account for artifacts already written and consumers still reading them.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.