Skip to content

fix(cli): validate attestation event input like the other commands - #3875

Open
migmartri wants to merge 1 commit into
mainfrom
fix/cli-attestation-event-validation
Open

migmartri wants to merge 1 commit into
mainfrom
fix/cli-attestation-event-validation

Conversation

@migmartri

@migmartri migmartri commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

chainloop attestation event now behaves like the other attestation commands.

Before, every failure, including a wrong call, was a warning and the command exited 0. A mistake such as a missing --status showed only as WRN the event was not recorded error="invalid status \"\", ...", the pipeline stayed green, and the step was missing from the timeline.

Now:

  • --step and --status are required flags, and positional arguments are rejected.
  • An invalid step or status fails the command before it sends the event, as a usage error.
  • --current and --total are integer flags that must be set together, and an invalid progress fails the command before it sends the event.
  • A failure to record the event returns a graceful error, as init, push and reset do, so --graceful-exit turns it into exit 0.
  • The best-effort rule stays for the automatic events that init and add send.

The step and the progress are checked with the proto rules of the control plane, the same check that attestation add --step already uses, so the CLI keeps no copy of the rules.

Spec: this goes against R-013 and R-015 of docs/specs/issue-3825-attestation-progress-events.md, which made a wrong call, and a wrong progress value, a warning. The PR supersedes R-013 with R-016, which keeps the skipped status and the --step flag, supersedes R-015 with R-017, which makes a wrong progress value a failure too, and records the reason in D-016.

Refs #3825

This PR was written with AI assistance (Claude Code).

🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri

@chainloop-platform

chainloop-platform Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ⚠️ 1 failing

Status Policy Material Messages
⚠️ Failed pr-min-approvals pr-info PR/MR #3875 has 0 approving reviews, 1 required.
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — ⚠️ no AI session found

Missing AI Coding Sessions

This organization requires every PR to be backed by a Chainloop Trace AI coding session, and none was found for this one.

Please make sure the AI coding session evidence has been sent by the Chainloop CLI, or add the skip-ai-session label to this PR to bypass this check.

Learn more about Chainloop Trace.

Security Checks — ✅ 6 passing

✅ AI Security Analysis

Nothing this change touches re-opens a recorded security fix.

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 -
Scans not applied (3)
Scan Reason
Vulnerability Scan no manifest/lockfile changed
GitHub Actions Scan no workflow files changed
IaC Scan no IaC 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 7 files

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

View guided diff | Re-trigger cubic

@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 1 file (changes from recent commits).

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

View guided diff | Re-trigger cubic

@migmartri
migmartri force-pushed the fix/cli-attestation-event-validation branch from d1c4bb9 to 7dbf0d8 Compare December 2, 2026 22:57
chainloop attestation event now fails on a wrong call: --step and --status
are required flags, positional arguments are rejected, and an invalid step or
status is an error. A failure to record the event returns a graceful error,
as in the other attestation commands, so --graceful-exit turns it into exit 0.

The --current and --total progress flags follow the same rule: they are
integer flags that cobra requires together, and an invalid progress fails
before the event is sent.

The step and the progress are checked with the proto rules of the control
plane, so the CLI keeps no copy of them.

Supersedes R-013 with R-016 and R-015 with R-017, and records D-016 in the
spec of #3825.

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

Chainloop-Trace-Sessions: d7a81b32-8204-49c1-ac44-d405416d90a0
@migmartri
migmartri force-pushed the fix/cli-attestation-event-validation branch from 81142cd to 3240190 Compare December 4, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants