Skip to content

Report a snapshot that failed to generate under its own name (sc-9177) - #210

Merged
ndbroadbent merged 2 commits into
mainfrom
snapshot-failures
Dec 4, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
snapshot-failures

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

sc-9177. When the code under test crashed, its file didn't exist, and the build showed the snapshot as removed. The WeasyPrint case study uploaded each error as a separate text file to explain why, so build #6 read "14 removed, 14 added" when the truth was "14 failed".

Now: a client can send a failure under the snapshot's own name.

  • API: a snapshot entry with error and no file (sha256, size and content_type left out; kind defaults to document). It's stored as failed with that error and no blob, needs no upload, and a retried request is fine. The error is limited to 16 KB, and an entry with both a file and an error is refused (400).
  • CLI: visualci fail <name> --message "…" (or --message-file, --kind, --platform). A manifest entry {"name", "error", "kind"?} with no path does the same. Failures skip the group check's hashing and are always sent. The "nothing changed since build #N" shortcut isn't taken when there's a failure. Bumps the CLI to 0.2.26. If CLI 0.2.26: the pull request's base branch from every CI provider; API calls retry through a deploy; a floating v0 tag; Action and orb defaults follow each release (sc-9247) #200 lands first, I'll rebase this onto 0.2.27.
  • Processing: a failed snapshot now gets base_snapshot_id for the version it would have been compared with, so its page shows that version beside the error. Baselines already treat a failed snapshot as standing for that base, so the last approved version stays the baseline, and the next build compares with it.
  • Check / PR comment: unchanged code. They already say "N snapshots failed", which now counts these.
  • Docs: "When the code under test crashes" in the PDF and screenshot guides, visualci fail in the CLI reference, and the API's error field. The visualci-pdfs skill is regenerated and the plugin bumped to 0.1.62.

Different from the story (a question for the coordinator): the story asks for a failure to count as a change to review, failing CI only in strict mode. Today any failed snapshot (a render failure, a file that never arrived) fails the whole build: it isn't reviewable, and CI fails in every mode. This PR keeps that, so a crash fails CI, as the test run itself would. Making failures reviewable would change render failures and missing uploads too, so I've left it as its own decision.

Tests:

  • processing::a_test_that_crashed_shows_its_snapshot_failed_in_place_and_keeps_the_baseline covers the whole flow through the API:
    • refuses a failure with a file, and an empty error;
    • registers the failure with no upload URL, and accepts a retry;
    • the snapshot is failed in place with its error and base;
    • stats show 1 failed and 0 removed, and the check says "1 snapshot failed";
    • the next build with the file again compares unchanged with the original baseline.
      The base assertion fails without the processing change.
  • CLI: a failure is sent with its message and no file (no PUT), a failure's kind comes from the name or --kind, manifest failure entries (and their errors), and message truncation at a character boundary.

The app, CLI and core suites pass locally.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@ndbroadbent
ndbroadbent force-pushed the snapshot-failures branch 3 times, most recently from 89f810d to 5e281d0 Compare December 4, 2026 16:12
@ndbroadbent
ndbroadbent merged commit aaee1d4 into main Dec 4, 2026
16 checks passed
@ndbroadbent
ndbroadbent deleted the snapshot-failures branch December 4, 2026 17:00
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.

1 participant