You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(ratchet): a first ratchet run exits 1 with no report file and no printed reason #1332
Note: this is an in-house item already being handled by the maintainer - not open for contribution. Filed for tracking only.
A first ratchet run writes no JSON report, and now that such a run can exit 1 there is a failing build with no artifact and no printed reason.
What happens
Measured on examples/no-fix-available with no baseline present, using --ratchet --json --fail-on high --no-cache:
exit
JSON file written
before the save-run gate
0
no
with the save-run gate
1
no
The missing file is not new. Neither side writes one, because on a first ratchet run the save path returns before the report is emitted. What is new is the exit code, which turns a silent omission into a red build that cannot explain itself.
Why both halves matter together
Under --json the gate line is suppressed, so the run prints nothing about why it failed. Combined with no report file, a CI job has an exit code and nothing else. The adopter cannot tell a genuine gate failure from a crash, and neither can we when they send us the run.
The suppression is deliberate and was asked for in review, on the grounds that --json output should stay machine-readable. That reasoning still holds for stdout and does not extend to leaving the failure unexplained everywhere at once.
What to decide, not just fix
Three things, and the first is a design call rather than a defect:
Whether a save run should emit the report at all. It currently returns early, which is defensible when the run is purely a baseline write and wrong once that run can fail.
Where the reason goes when stdout is reserved for machine output. The report file is the obvious place, and exitReason alongside the existing fields would make the artifact self-describing.
Whether the gate line belongs on stderr under --json, since stderr is not the machine-readable channel and CI surfaces it.
Related
Same family as #1315, which covers --sarif writing no file when --ratchet suppresses everything. #1315 is about a baseline already existing; this is about the first run, where no baseline does. They should be fixed together or at least decided together, because both come from the same early return.
Found while reviewing #1314, which introduced the exit code and is not the cause of the missing file. Committed to filing this on that thread.
Activity