Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← Week 20: Reliability Engineering

Week 20 / Lesson 2

Gating releases and proving rollback

Release a coherent version only after required regressions and security checks pass.

Section 2.1 1 of 7

Overview

Focus

Release a coherent version only after required regressions and security checks pass.

Your route through the lesson

  • 2.2 Versioned model, prompt, index, code, and policy
  • 2.3 Regression suites and release gates
  • 2.4 Compatible rollback and recovery state
  • 2.5 Put it into practice
  • 2.6 Guided comparison
  • 2.7 A rollback with an incompatible index

All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.

Section 2.2 2 of 7

Versioned model, prompt, index, code, and policy

Focus

Treat a release as a compatible set of model, prompt, index, code, policy, and schema versions.

A release is the set of components that jointly determine behavior. A model identifier alone is insufficient: prompts change tool choices, indexes change available evidence, application code changes execution, policy changes permissions, and database schema changes the meaning of stored state. A manifest names exact versions and compatibility assumptions for all of them.

For example, release R1 contains code c1, prompt p1, model m1, index i1, policy acl1, and schema one. If a new index uses different document identifiers, an old prompt or citation validator may no longer work with it. Reverting only the model can leave a broken mixed release. Pin immutable identifiers or content hashes where available instead of mutable labels such as latest.

Version management also records the evaluation set and configuration used to approve the release. Keep a known-good manifest and a reproducible restoration procedure. A manifest describes intended configuration; runtime evidence must confirm which versions actually loaded. Compare startup diagnostics with the manifest and fail clearly on mismatch instead of silently substituting another component. Compatibility is a checked contract, not an assumption that all previous files still fit together.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A rollback restores model m1 but leaves an incompatible index i2. What is wrong?
2. Which identifier is best for reproducible release evidence?
3. A manifest says i1 while startup reports i2. What should happen?

Section 2.3 3 of 7

Regression suites and release gates

Focus

Use mandatory regression and security gates rather than a single favorable aggregate.

A regression suite runs known cases to detect behavior that became worse. A release gate converts required evidence into a promotion decision. The suite produces observations; the gate decides whether those observations satisfy declared conditions. Freeze the gate before viewing candidate results so it cannot be adjusted merely to admit a favored release.

Suppose a candidate answers nine routine questions correctly but reads one unauthorized document. An average score of ninety percent cannot override a rule requiring zero unauthorized reads. Separate hard invariants, quality targets, latency bounds, and unmeasured requirements. A missing test is unknown, not a pass.

Include ordinary success, absent evidence, forbidden operations, malformed arguments, duplicate operations, and recovery after interruption. Keep the cases tied to actual release risks. A gate can reject a bad retrieval index before activation by checking a known fact and a required citation. Store the result with the candidate manifest. If the harness itself uses fixtures, label the verified boundary: fixture checks validate contract behavior while actual model quality still requires real inference on representative reserved cases.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A candidate passes nine routine cases and fails a zero-tolerance access check. What is the gate result?
2. A recovery requirement has no executed test. How should its status appear?
3. When should promotion thresholds be declared?

Section 2.4 4 of 7

Compatible rollback and recovery state

Focus

Recover a compatible version while reconciling durable state and irreversible effects.

Rollback restores a previously approved application configuration. Recovery also addresses data and effects that occurred while the faulty version was active. Restoring code does not erase tickets, messages, or database migrations. Before rollback, identify which state the old release can read and which effects need reconciliation.

A backward-compatible migration might add a nullable column that old code ignores. A destructive migration that renames or removes required fields can make old code fail. A safe rollout often expands the schema first, deploys compatible readers and writers, and delays removal until old releases no longer need it. Keep backups and a tested restore path for changes that cannot be reversed safely.

After restoration, run a known-good success case, an unauthorized case, and an operation-replay case against the actual active service. Verify manifest identity and durable state. Replaying the same operation identifier should recover its result rather than repeat its effect. Record which state was retained, restored, or manually reconciled. A rollback announcement without those checks is a claim about intent, not proof of recovered behavior.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Old code requires a deleted database column. Is reverting code alone sufficient?
2. A faulty release created a ticket. What does rollback do to that ticket automatically?
3. Which post-rollback check addresses duplicate-effect risk?

Section 2.5 5 of 7

Put it into practice

Focus

Reject a bad index and rehearse restoration with a deterministic manifest lab.

Save week20.py and run python week20.py --lesson 2. The standard-library copy module creates an independent copy of the good manifest. A shallow dictionary construction, dict(GOOD, index="i-bad"), replaces the index field while retaining the other simple values. The checks function returns separate answer, authorization, and schema results.

The first candidate fails its answer check because its index is deliberately marked bad. The active manifest remains unchanged after this gate rejection. The script then explicitly simulates accidental activation and restores a copied good manifest. Expected invariants are a rejected candidate, all checks true after restoration, and exact equality between the restored manifest and GOOD.

A separate schema-two manifest fails compatibility with the schema-one fixture. These checks are simulated release mechanics, not a deployment to production or an evaluation of a real retrieval engine. Extend this same manifest harness with a prompt-version compatibility rule and a failing unauthorized-read fixture. Preserve the predeclared gate and inspect individual failures before the overall result. No permanent service or external account is required.

Download this week’s Python lab ↓

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. The lab rejects i-bad before promotion. What should remain active?
2. GOOD is a known-good release-manifest dictionary. A simulated rollback restores an identical dictionary without contacting production or retrieval services. What does that prove?
3. A schema-two candidate meets a schema-one contract. Which check must fail?

Section 2.6 6 of 7

Guided comparison

Focus

Explain rejection, accidental activation, restoration, and verification as distinct transitions.

The worked sequence has four meaningful states. The good manifest is initially active. A bad-index candidate is evaluated and rejected while the good manifest remains active. The drill deliberately activates the candidate to create a recovery situation. Finally, the known-good manifest is restored and its checks rerun. Keep these states separate when reading the output.

Preventing a release and recovering from one are different competencies. A gate can work perfectly while an operator bypass or configuration mistake still activates a bad version. A recovery test therefore cannot be replaced by saying the gate would have stopped it. Likewise, a successful rollback does not justify weakening the gate: every incident still risks effects, user disruption, and uncertain state.

The lab's check implementation is intentionally small and deterministic so the transition logic is visible. In an integrated service, the same structure would call actual interfaces, inspect loaded component versions, and verify persisted operations after restart. Report what ran at each boundary. A release manifest plus simulated checks is useful preparation, but it should never be described as proof that a real model, index, and external tool recovered together.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A gate works but a manual override activates a bad release. Which drill remains necessary?
2. A rollback succeeds in a fixture harness. What claim is justified?
3. Why rerun checks after restoring a known-good manifest?

Section 2.7 7 of 7

A rollback with an incompatible index

Focus

Reason about rollback when evidence identifiers change across indexes.

A knowledge assistant uses index i1, whose documents have identifiers A1 and A2. Release R2 moves to index i2 with identifiers B1 and B2 and changes the citation validator accordingly. During an incident, an operator restores the old validator but leaves i2 active. Retrieval returns B1, which the old validator rejects. The model may still produce fluent text, but the release cannot deliver a valid supported answer.

The compatible rollback restores the old code, prompt, validator configuration, and index i1 together, then reruns a known citation case. If i1 is unavailable, the system should remain degraded rather than silently disabling citation checks. The restoration plan must also preserve permission filters: a fallback index containing the right fact can still be unsafe if its access metadata differs.

This case teaches why compatibility checks need semantic evidence, not only matching filenames. A manifest can name i1 while a stale runtime cache still serves i2. Include an observable index version in trace metadata and query a known document identifier. The final verification connects the declared release to actual retrieved evidence and authorization behavior.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Old citation validation accepts A1; active retrieval returns B1. What failed?
2. The compatible old index is unavailable. Which recovery is justified?
3. A manifest names i1 but a cache serves i2. Which evidence helps?

Your personal notes

Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.

References and further reading
Ask your own AI assistant

Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.

Next lesson: Responding to an incident and recording recovery →