Skip to content
BlogOctober 29, 2026

A Runbook Needs an Exit Contract

Rohi Rikman
A Runbook Needs an Exit Contract
RB-12, the database restore runbook in my homelab, has a line I want printed beside every restore command: "A checksum proves artifact integrity, not a successful restore." A command exiting cleanly is the same mistake one level up. It tells me something about the command. It does not tell me whether the application can read its records, whether the intended route works, or whether the operator preserved the state needed to investigate a failed restore. My runbook lifecycle, RB-00, calls the work after execution the exit contract. It has four gates: runtime evidence, an account of remaining state, an audit trail, and a final report about the change that actually happened. The recovery runbooks are honest about their own status. RB-04 and RB-12 carry the same sentence in their scope sections: "This is procedure source, not evidence of an executed operation." A well-written procedure cannot serve as its own execution receipt, and these two do not pretend to.

Start with what would prove the operation worked

RB-00 says an operational task is never finished merely because the commands exited. Its examples of runtime evidence include container health, HTTP responses from real probes, and network reachability between containers. Those are different observations. A healthy container is not automatically a working application route. A reachable endpoint is not automatically a successful authenticated workflow. The proof should match the thing the operation was meant to recover. RB-12 makes that concrete for database restores. It calls for known records and application behavior, along with encryption-key compatibility, mounts, health, dependencies and authenticated routes. It also forbids masking a failed probe with || true. That list stops an early, convenient observation from being promoted into the final result. If a target cannot be reached from the environment doing the review, RB-00 has the sentence ready: runtime evidence not obtainable in this environment, verified statically via a named command. A missing probe does not become a passed probe because the configuration looks plausible.

Recovery has limits that teardown cannot fix

RB-04 covers emergency service and tier recovery. Its scope is preserving state and repairing forward, and it explicitly does not promise a return to a replaced operating system. That limit should be visible before anybody starts stopping services. The procedure also names what teardown cannot reverse: database migrations, deleted records, in-memory work and a replaced OS. A surviving bind path or external volume does not establish that the application data is usable. In RB-04's words, directory existence is not database integrity. Recreating a container is not a rollback either. RB-04 warns against retagging cached images as a generic recovery plan, because pull_policy: always may fetch different content, and it requires a reviewed image and data recovery plan before a failed update gets another start. Even the time estimate refuses to guess. Both recovery runbooks list it as unmeasured, with an instruction to record the actual duration on the selected target.

Preserve the failed attempt

The restore procedure starts from a selected, verified artifact and an isolated empty target. Existing target state is preserved independently. On mismatch, the procedure says to stop and preserve the source artifact, existing target state and failed restore for diagnosis. It closes the section bluntly: no automatic overwrite or deletion is a recovery step. That beats cleaning up until the next command has a tidy place to run. A failed attempt can contain the evidence needed to explain the failure. Overwriting it may remove that evidence. Deleting it may also turn a recoverable mistake into a different, larger change than the owner approved. RB-00 carries the same idea into close-out. Temporary artifacts and running test containers must be accounted for. Cleanup is limited to approved actions. Unrelated working-tree edits are preserved, and private diagnostics stay outside Git without secrets in the report. The artifact inventory is not permission to remove the artifacts. If removal is necessary, it is another operation with a scope and a reason. It should not arrive disguised as housekeeping at the end of a recovery task.

Make the handoff resumable

A runbook also needs an ending for when the operation cannot finish. RB-00's interruption procedure asks the operator to preserve the partial state, record the last successfully verified step, retain bounded diagnostics and name the single next command needed to resume. It does not ask the operator to force the procedure to completion so the report looks cleaner. That changes what I want from an agent handoff. "The deployment had issues" is not enough. The next operator needs to know which action actually ran, which observation confirmed it and where the evidence stops. An incomplete task with a precise stopping point is worth more to me than a completed label that hides uncertainty about the target. The next command still needs to be appropriate to the selected environment and approval state. Writing it into a handoff does not authorize someone to run it. RB-04 requires approval for the exact lifecycle action and the affected services, and a DNS change has its own gate. An interruption is not a reason to inherit permission from a neighboring step.

Report the change that exists

The final report in RB-00 answers four questions: what was touched, how, why it was authorized, and how much it moved resources. The recovery runbooks add actual downtime and impact. Those questions make omissions visible. A report can name the service but omit a temporary process. It can quote the command but omit the failed verification. It can describe the intended state instead of the state that remains. Keep unavailable measurements explicit. If resource deltas were not collected, say so. If application records were not checked, the restore is not verified at that level. A plausible figure is worse than an honest gap because the next operator may rely on it. The command transcript belongs with the result, but it is not the result. The result is the observed service behavior, the preserved state and a clear account of what remains unresolved. Before the next restore, name the record the application must be able to read afterward.
Share this post: