feat: attestation progress events, M1 automatic progress (#3825)
Implements milestone M1 ("Automatic progress") of the attestation progress events spec. Refs #3825. Spec and plan: #3857.
What it adds
-
Run events in the control plane (R-006, R-007, R-008, R-011). A new
workflow_run_eventstable stores short, timestamped progress events with the workflow run.AttestationService/RecordEventwrites events. It applies the same checks asStore.WorkflowRunService/GetProgressreturns the events of the run, oldest first, with the same checks asView. For a run in progress, it also returns its progress, which the control plane builds: one row for each expected material with its requirement and status (missing, provided, or failed), the required counts, and the attestation policy results ofinit. Clients render it as is.- The expected materials are the ones that
initresolves, from the contract and its policy groups. The start event lists them. A run of an older CLI uses the materials of its contract. - No new policy is added.
RecordEventis exempt from the authz middleware next toStoreandCancel, andGetProgressmaps toPolicyWorkflowRunRead, asViewdoes.Viewdoes not change. - Events are accepted only while the run is in progress, up to 1,000 events for each run.
- The control plane records the closing event in the same transaction as the run status change, on store, reset, and expiry.
Expirenow skips a run that is no longer in progress. - The run expiry job deletes events older than
workflow_run_events_retention, 90 days by default. The Helm value iscontrolplane.attestations.workflowRunEventsRetention.
-
Automatic events from the CLI (R-010, R-002, R-005). The attestation commands record best-effort events:
- the start of the attestation, at the end of
init, with the init policy results and the expected materials - each material that collectors add
- each
addthat succeeds or fails, with the error text cut to 1 KB
The push records no event. The closing event of the store ends the push, and the signed attestation holds its policy results (D-011).
Material policy results go in the material events. Events hold only names, types, statuses, counts, digests, and the material value cut to 256 characters. Each call has a 2-second timeout, and the recorder turns off with no warning against a control plane without the new calls.
- the start of the attestation, at the end of
-
chainloop workflow run describe(R-004). It callsGetProgressafterViewand shows the progress and the events it returns. For a run in progress, it shows:- the elapsed time
- each expected material as required, optional, or one of a group, and as provided, missing, or failed, with the error of a failed add. A failed add after a successful one keeps the material as provided.
- the materials that are not in the contract
- the attestation policy results so far
- a timeline tree: one line for each step, with the attempts of a repeated step folded below it
For a finished run, the timeline shows as history after the signed attestation. Its last line, "pushed and stored", shows the policy status of the signed attestation and the short digest. Against an older control plane, which does not have
GetProgress,describeshows the run as before. A run from an older CLI, which records no events, shows no timeline. JSON output getseventsandprogressfields.
Example of describe output
Spec changes
The spec merged in #3857. This PR supersedes two entries:
- R-001 with R-010: the CLI records no push event. D-011 records the decision: the push and the store are one step, and the signed attestation is the source of the policy results.
- R-003 with R-011, and D-007 with D-012: a new read call,
GetProgress, returns the events and the progress, and the control plane builds the progress. The run view does not change. This also makes the progress count the materials that policy groups require.
The plan steps are updated to match.
AI assistance: this change was implemented with Claude Code.
๐ค Posted by Maximus bot (Claude Code) on behalf of @migmartri