Skip to content

feat: attestation progress events, M1 automatic progress (#3825) - #3859

Merged
migmartri merged 20 commits into
mainfrom
issue-3825-m1-attestation-progress-events
Dec 1, 2026
Merged

migmartri merged 20 commits into
mainfrom
issue-3825-m1-attestation-progress-events

Conversation

@migmartri

@migmartri migmartri commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

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_events table stores short, timestamped progress events with the workflow run.

    • AttestationService/RecordEvent writes events. It applies the same checks as Store.
    • WorkflowRunService/GetProgress returns the events of the run, oldest first, with the same checks as View. 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 of init. Clients render it as is.
    • The expected materials are the ones that init resolves, 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. RecordEvent is exempt from the authz middleware next to Store and Cancel, and GetProgress maps to PolicyWorkflowRunRead, as View does. View does 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. Expire now 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 is controlplane.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 add that 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.

  • chainloop workflow run describe (R-004). It calls GetProgress after View and 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, describe shows the run as before. A run from an older CLI, which records no events, shows no timeline. JSON output gets events and progress fields.

Example of describe output

image

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

View guided diff

@chainloop-platform

chainloop-platform Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ✅ 3 passing

Status Policy Material Messages
✅ Passed pr-min-approvals pr-info -
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — 🟡 86% · ✅ 0 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟡 86% 1 ✅ 0 99% AI / 1% Human 50 +5633 / -724 16h39m59s

🟡 86% — 99% AI — ✅ All policies passing

Nov 30, 2026 19:00 UTC · 16h39m59s · $232.96 · 3.9k in / 1.8M out · claude-code 2.1.332 (claude-opus-5-5)

View session details ↗

Change Summary

Adds automatic attestation progress recording, server-built material status, and a CLI timeline. Stores closing events with run status changes and deletes old events through configurable retention. Adds compatibility and regression coverage and updates the design documents.

AI Session Overall Score

🟡 86% — Progress implementation is well tested, with a step-duration gap and recovered collaboration friction.

AI Session Analysis Breakdown

🟢 96% · scope-discipline

No notes.

🟢 94% · context-and-planning

No notes.

🟢 92% · solution-quality

🟢 Run-row locks and transactional closing events prevent client events from racing past terminal state changes. · High Impact

🟢 90% · verification

🟢 Mutation runs exposed missing state, limit and access guards; restored code then passed integration tests. · High Impact

🟢 Final affected server suites and full CLI suite returned zero; both lint runs reported zero issues. · High Impact

🟡 Complete regular-attestation acceptance is not established by the inspected component and synthetic event tests. · Low Severity

🟡 72% · alignment

🟠 Timeline groups repeated attempts but omits each step’s duration required by the spec. · Medium Severity

💡 Compare each visible requirement against actual rendered output before declaring the milestone complete.

🟡 66% · user-trust-signal

🟠 User called the timeline confusing, then revisited unclear event labels before choosing clearer evidence wording. · Medium Severity

🟠 User escalated from “so?” to “I don’t understand what are you waiting for?” before the push. · Medium Severity

💡 State whether you prefer immediate publishing or waiting for final checks when the work enters validation.


File Attribution

███████████████████░ 99% AI / 1% Human

Status Attribution File Lines
created ai app/cli/pkg/action/runevents_test.go +730 / -193
modified ai app/cli/pkg/action/workflow_run_describe.go +451 / -249
created ai app/controlplane/internal/service/workflowrunevent_integration_test.go +452 / -44
modified ai app/controlplane/internal/service/workflowrun.go +343 / -81
created ai app/cli/cmd/workflow_run_timeline.go +411 / -0
created ai app/cli/pkg/action/runevents.go +384 / -0
created ai app/controlplane/pkg/data/workflowrunevent_integration_test.go +341 / -0
created ai app/controlplane/pkg/biz/workflowrunevent.go +306 / -0
created ai app/controlplane/pkg/biz/mocks/WorkflowRunEventRepo.go +264 / -0
created ai app/controlplane/pkg/biz/workflowrunprogress.go +206 / -0
created ai app/controlplane/pkg/biz/workflowrunprogress_test.go +200 / -0
modified ai app/controlplane/api/controlplane/v1/workflow_run.proto +167 / -0
created ai app/cli/cmd/workflow_run_timeline_test.go +159 / -0
created ai app/controlplane/pkg/data/workflowrunevent.go +154 / -0
modified ai docs/specs/issue-3825-attestation-progress-events.md +95 / -59
created ai app/controlplane/pkg/biz/workflowrunevent_test.go +150 / -0
modified ai docs/plans/issue-3825-attestation-progress-events.md +83 / -64
modified ai app/cli/pkg/action/workflow_run_describe_test.go +97 / -0
created ai app/cli/pkg/action/runevents_compat_test.go +96 / -0
created ai app/controlplane/api/controlplane/v1/workflow_run_test.go +93 / -0
created ai app/controlplane/pkg/data/ent/schema/workflowrunevent.go +70 / -0
modified ai app/controlplane/pkg/biz/workflowrun.go +46 / -7
modified ai app/controlplane/pkg/data/workflowrun.go +40 / -9
modified ai app/controlplane/internal/service/attestation.go +41 / -1
modified ai app/controlplane/pkg/data/ent/migrate/schema.go +40 / -0

…and 25 more file(s).


Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-1cdb32 -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-1cdb32 -
✅ Passed ai-config-no-secrets ai-coding-session-1cdb32 -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-1cdb32 -

Security Checks — ⚠️ 1 failing

⚠️ AI Security Analysis

The per-PR audit did not finish: 245 concerns went unreviewed (spend ceiling or time). No introduced risk was found in what it reviewed, but treat this as incomplete, not clean.

View in Chainloop ↗ · How this works ↗

✅ Secret Scan

Status Policy Messages
✅ Passed secrets-detection -

✅ SAST Scan

Status Policy Messages
✅ Passed owasp-top10-2025 -
✅ Passed sast -
✅ Passed cwe-top25 -
✅ Passed cwe-top26-40-cusp -

✅ IaC Scan

Status Policy Messages
✅ Passed iac-misconfiguration -
Scans not applied (2)
Scan Reason
Vulnerability Scan no manifest/lockfile changed
GitHub Actions Scan no workflow files changed

View attestation ↗


Powered by Chainloop and Chainloop Trace

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 88 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread app/cli/pkg/action/attestation_add.go Resolved
Comment thread app/cli/pkg/action/attestation_push.go Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 11 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread app/controlplane/pkg/biz/workflowrun.go Resolved
@migmartri
migmartri marked this pull request as ready for review November 30, 2026 22:04
Add the RecordEvent and ListEvents calls, the workflow_run_events table, and
the closing event that the control plane records when it stores, cancels, or
expires a run. RecordEvent applies the checks of Store, and ListEvents the
checks of View, so no new policy is added.

Refs #3825 (M1, R-003, R-005, R-006, R-008)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
The run expiry job also deletes run events older than the new
workflow_run_events_retention setting, 90 days by default. The Helm chart
exposes it as controlplane.attestations.workflowRunEventsRetention.

Refs #3825 (M1, R-007)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
…scribe

The attestation commands record a best-effort progress event on init, on
each add, and on the policy evaluations. workflow run describe shows a run in
progress with its provided and missing materials, the policy results so far,
and its timeline. Against a control plane without run events, the recorder
turns off and describe shows the run as before.

Refs #3825 (M1, R-001, R-002, R-004, R-005, R-008)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
Drop the chainloop.policies.* events. The started event, now sent at the
end of init, carries the init policy results. A new chainloop.push event,
sent before the attestation is stored, carries the push policy results and
fails with the blocking policies when a gate blocks the push.

Refs #3825 (M1, R-001)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
Share one gate rule between the push event and the push command, select
only the columns the run locks need, delete old events in one statement,
and replace literals with constants.

Refs #3825 (M1)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
The push event is recorded after the dry-run return and before the
attestation is stored, so a dry run records none. The gate check now
lives in the push action, and the push command uses it.

Refs #3825 (M1, R-001)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
- the expiry sweep skips a run that finished during the sweep, with no
  expiry metric or log
- trace pushes do not enforce policy gates, so their push event never
  reports a block
- blocking policies are listed once
- describe counts a group of the contract once as required
- describe JSON always has remote_state and added_by_collector
- test the FailedPrecondition error mapping

Refs #3825 (M1)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
The key is at most 128 characters, each attribute string at most 256, and
the policy name lists at most 100 names. The CLI recorder keeps the lists
within the limit, and the counts stay complete.

Refs #3825 (M1, R-008)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
An add that expands an archive into more than 20 materials records one
event for the archive, with the sum of the policy counts, instead of one
event for each material. So a large archive does not use up the events
of the run.

Refs #3825 (M1, R-001)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
An add that expands an archive also stores the archive itself as an
EVIDENCE material. It now records an event for it, after the events of
the expanded materials or after the summary event.

Refs #3825 (M1, R-001)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
The timeline is one tree: the root line has the start and the end of the
attestation, and each step is one line. A step with more than one event,
such as a failed then repeated add, folds its events below it. For a run
in progress, the tree also shows each contract material that is missing
and the push that is still to come, so it replaces the materials table.

Refs #3825 (M1, R-004)

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
The CLI no longer records a separate push event. When the control plane
stores an attestation, it reads the attestation policy results and the
gated policies with violations from the stored predicate, and puts them
on the closing event of the run, in the same transaction as the status
change. workflow run describe shows the timeline end as one
"pushed and stored" line with the policy results, the blocking gates,
and the short digest.

The API drops the push event type and its attributes (numbers reserved)
and adds blocking_policies to the attestation attributes.

Supersedes R-001 and R-006 of spec issue-3825 with R-010 and R-011, and
records the reason as D-011.

Refs #3825

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
@migmartri
migmartri force-pushed the issue-3825-m1-attestation-progress-events branch from 5c80d42 to c5d1de3 Compare November 30, 2026 22:31
…event

Most pushes move the policy evaluations to the CAS, so the control plane
can't rebuild the per-policy results at store time. The closing event goes
back to digest only, and workflow run describe takes the policy status of
the "pushed and stored" line from the stored attestation it already loads.

Also:
- regenerate the ent code without the push event type
- restore the inline gate check of the push command from main
- simplify the timeline renderer
- spec: R-010 supersedes R-001, D-011 records the decision

Refs #3825

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
@migmartri
migmartri requested a review from a team November 30, 2026 22:57

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 27 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread app/cli/cmd/workflow_run_timeline.go Resolved
Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
jiparis
jiparis previously approved these changes Dec 1, 2026
The control plane now builds the progress of a run in progress and returns
it, with the events of the run, in WorkflowRunService.View, so the CLI, the
UI and other tools render it with no logic of their own. ListEvents and its
after_event_id option are removed.

The start event lists the materials that init resolves, from the contract
and its policy groups, so the progress also counts the materials that
policy groups require. A failed add after a successful one keeps the
material as provided, with the error.

Spec: R-011 supersedes R-003, D-012 supersedes D-007.

Refs #3825

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 36 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/cli/pkg/action/runevents.go">

<violation number="1" location="app/cli/pkg/action/runevents.go:167">
P2: `expectedMaterials` silently drops resolved materials after the first 1,000, so progress reports incomplete required totals and can label later additions as not in the contract. Preserve all resolved materials by raising/removing the wire cap, or expose truncation explicitly instead of presenting partial progress.</violation>
</file>

<file name="docs/plans/issue-3825-attestation-progress-events.md">

<violation number="1" location="docs/plans/issue-3825-attestation-progress-events.md:299">
P2: `View` drops progress when listing events fails, despite this plan promising progress for every in-progress run. Construct fallback progress outside the successful `List` branch, or explicitly exempt this failure from R-011.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread app/cli/pkg/action/runevents.go Resolved
Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
WorkflowRunService.View goes back to its main behavior. The new GetProgress call, with the checks of View, returns the events of a run and, while it is in progress, the progress that the control plane builds. describe calls it after View, and an older control plane without it shows the run as before. A run with no events from the CLI, as from an older CLI, shows no timeline.

Spec: R-011 and D-012 describe the separate call.

Refs #3825

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 20 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/plans/issue-3825-attestation-progress-events.md">

<violation number="1" location="docs/plans/issue-3825-attestation-progress-events.md:236">
P2: This M1 summary still says the run view returns events and progress, although `GetProgress` is now the read path and `View` does not change. Replace that stale reference so the plan does not describe the wrong API.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 1cdb3220-119c-4a14-ac50-52d5437ee4eb
@migmartri
migmartri merged commit 00866f2 into main Dec 1, 2026
16 checks passed
@migmartri
migmartri deleted the issue-3825-m1-attestation-progress-events branch December 1, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants