fix(cli): validate attestation event input like the other commands
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:
--stepand--statusare required flags, and positional arguments are rejected.- An invalid step or status fails the command before it sends the event, as a usage error.
--currentand--totalare 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,pushandresetdo, so--graceful-exitturns it into exit 0. - The best-effort rule stays for the automatic events that
initandaddsend.
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