runbook-tutorials/workplans/RBT-WP-0003-engine-core-run-state-and-evidence.md
tegwick 1c89c85862
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s
Work Records / validate (push) Has been cancelled
Add run records, step state machine, verification and exercise-status diff (RBT-WP-0003)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: sonnet
Assistant-Process: 295952@bnt-lap001
Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477
2026-09-29 00:43:38 +02:00

79 lines
2.1 KiB
Markdown

---
id: RBT-WP-0003
type: workplan
title: "Engine core: run state and evidence"
domain: infotech
repo: runbook-tutorials
status: finished
flavor: implementation
owner: claude
topic_slug: stack
created: "2026-09-29"
updated: "2026-09-29"
depends_on: [RBT-WP-0002]
state_hub_workstream_id: "b7f2568a-96a2-5e92-8d04-4e7ac7b6da9b"
---
## Goal
Give the engine memory: a run of a pack keeps non-secret parameter values,
per-step state and evidence, and is the only thing allowed to change a pack's
exercise status.
## Design the run record
```task
id: RBT-WP-0003-T01
status: done
priority: high
state_hub_task_id: "e61fbba9-d69f-59d4-ad86-c1fab69e8171"
```
Specified in `docs/run-spec.md`: `runbook-run/v0.1`: pack id and revision, operator label, parameter
values, per-step state (`todo|running|done|failed|skipped`), timestamps,
evidence facts, verification results. Non-secret only, with the same secret-marker
rejection as packs. Stored under `.local/runbook-runs/` in the repo being operated.
## Implement the run store and step state machine
```task
id: RBT-WP-0003-T02
status: done
priority: high
state_hub_task_id: "fb10ebd1-d122-5b5f-9fd5-83d08539f8c1"
```
Create, resume and list runs. Enforce order, block a step until the previous
one verified, record failures without losing state. Tests for restart and
resume.
## Implement verification
```task
id: RBT-WP-0003-T03
status: done
priority: medium
state_hub_task_id: "870980df-c1e8-51e5-9a00-643f63404783"
```
`manual`, `exit-0` and `output-contains` checks. Commands are shown to the
operator; the engine runs a verify command only when the operator confirms
it, with a timeout and captured output size only (no output stored).
## Exercise-status writer
```task
id: RBT-WP-0003-T04
status: done
priority: medium
state_hub_task_id: "bad99b81-2b64-520f-b92f-1b8c6457659b"
```
When every step of a run has verified, offer to write
`exercise_status: exercised <date> by <operator>` into `pack.yaml` via a
reviewable diff. Never edit automatically.
## Acceptance Criteria
- A run survives restart and records outcomes without secrets.
- A pack becomes `exercised` only through a completed, verified run.