--- id: RBT-WP-0007 type: workplan title: "Engine v0.2: graph, datapoint states and gates" 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: "0ce4d5fd-6eac-5f9a-a170-8231a551f66a" --- ## Goal Make the engine understand the v0.2 model so a renderer can show a questionnaire flow, a dimension view and an overview from the same run data. ## Dependency graph and recommended next action ```task id: RBT-WP-0007-T01 status: done priority: high state_hub_task_id: "55dd86f9-5f89-59a2-8a0a-85fbedd95483" ``` Compute ready items from `requires` and `one_of`; recommended next = first ready in canonical order; explain what a blocked item waits for. ## Datapoint states ```task id: RBT-WP-0007-T02 status: done priority: high state_hub_task_id: "571e8685-6eeb-54ce-bb1a-4616ea951f81" ``` `nil/set/err/ok` per datapoint in the run record, with validation, dimension tags, and how `ok` is reached (check or recorded manual confirmation). ## Gates and waivers ```task id: RBT-WP-0007-T03 status: done priority: high state_hub_task_id: "707cca55-24a1-5355-8722-10740c5a2862" ``` Evaluate gate checks (same confirmation rule as step verify), block dependents and stage exit, record waivers with who, when and why. ## Run record v0.2 ```task id: RBT-WP-0007-T04 status: done priority: medium state_hub_task_id: "73307bb9-2739-563b-92c7-a034a360b444" ``` `runbook-run/v0.2` with datapoints, gates, waivers; v0.1 records still load. ## Confirmation policy ```task id: RBT-WP-0007-T05 status: done priority: medium state_hub_task_id: "0933ff4a-8478-50d9-aa99-991948bc2379" ``` Derive confirm button versus typed phrase from `reversible`; enforce the phrase in the engine so no renderer can skip it. ## Operating modes: manual and auto-confirm ```task id: RBT-WP-0007-T06 status: done priority: high state_hub_task_id: "1656597c-3748-5480-b136-e2872436bab4" ``` A run has a mode (`docs/pack-spec-v0.2.md`). Manual: the operator confirms; every check, gate and precondition is shown with its state. Auto-confirm: the engine confirms when all preconditions are met. `auto_confirm: manual-only` steps and irreversible steps are never auto-confirmed without a recorded pre-authorization. ## Overrides, waivers, push-through and the deviation record ```task id: RBT-WP-0007-T07 status: done priority: high state_hub_task_id: "0ef958ef-88b6-565b-8797-df730cf11ad3" ``` Override in manual mode when preconditions are unmet: name the unmet items and the declared `downstream_risk`, require explicit confirmation and a reason, record a deviation. Waivers only where a gate declares `waivable`. Auto-confirm timeouts (`stop` or `push-through`) record a deviation and, for push-through, move on. A run with any deviation is flagged and can never exercise a pack. ## Delivered 2026-09-29 `rtut/flow.py` and `rtut/run2.py`, documented in `docs/run-spec.md` (run record v0.2) and covered by `tests/test_run2.py` (25 tests: readiness and recommendation, parallel items, alternatives, datapoint states, gates, overrides, waivers, confirmation phrase, auto-confirm confirm / stop / push-through, manual-only and pre-authorization, read-only finished runs). Two spec corrections came out of it: a gate cannot require a datapoint it is itself `confirmed_by` (validator rule), and `run.finalize` also requires gates passed or waived. Not done here: any UI or CLI for v0.2 runs (RBT-WP-0004). ## Acceptance Criteria - The old console's stages, gates and datapoints can be expressed and computed without special cases. - A v0.1 pack behaves exactly as before.