Skip to main content

Module workspace_data

Module workspace_data 

Source
Expand description

Golden-data hooks (design D-D in docs/scoping/workspace-contract.md, ticket .kranz/tickets/golden-data-hooks.md) — the optional data block’s clone / migrate / reset / skewCheck commands that provision a de-identified golden dataset into the workspace before agents run.

This module owns the hook vocabulary and the outcome shapes; EXECUTION stays with the crate::workspace_provider seam (host shell for local-worktree, compose exec for the container provider — a container workspace never runs data hooks on the host), and the reset-between-rounds drive lives here on MissionEngine because it fires from validation_round, outside the provision/readiness drive.

Lifecycle (all steps skip silently when the contract’s data block does not declare them — repos without a data block are byte-identical):

provision → data clone → data migrate → bootstrap → readiness → data skewCheck
                                                                       │failure
                                             Blocked, owner repo-setup ◀─┘
                                             (the SKEW case: the reason
                                              names the migrate/reset
                                              hook to run, then resume)
validation_round: data reset (when resetBetweenRounds opts in) → validators

Owned outcomes, never flake (D-D): a skewCheck failure is crate::workspace_provider::ReadinessOutcome::DataSkew — a distinct outcome that Blocks with the migrate/reset action named, never a generic readiness failure and never a validator finding. Clone/migrate failures fold into the gate’s established block shape (kind “data clone hook” / “data migrate hook”). A reset failure Blocks with the same owned shape before any validator spawns. All block reasons carry the [crate::workspace_gate::GATE_REASON_PREFIX] so a fixed environment lifts them on resume like any other gate block.

Decision events reuse the orchestrator.decision audit channel with a DATA_SUMMARY_PREFIX summary (no new event kinds): hook name, command, exit, and a scrubbed bounded tail in the detail — mirroring the bootstrap gate’s decision shape. Secret values never appear: the contract carries names only, hooks run with the gate’s env discipline (inherited env plus the handle’s KRANZ_BASE_SHA — the existing machinery, no new secrets channel), and tails are scrubbed here AND again at event-append (defense in depth).

Enums§

DataHookKind
The four golden-data hooks, in lifecycle vocabulary. Wire/decision names match the contract’s camelCase fields.

Constants§

DATA_SUMMARY_PREFIX
orchestrator.decision summary prefix for every data-hook step (workspace data: clone ... / ... migrate ... / ... reset ... / ... skewCheck ...).