Skip to content

Keep the most severe findings within GitHub's annotation limits - #159

Open
Xalert wants to merge 1 commit into
prooflinedev:mainfrom
Xalert:ci-annotations-limits
Open

Xalert wants to merge 1 commit into
prooflinedev:mainfrom
Xalert:ci-annotations-limits

Conversation

@Xalert

@Xalert Xalert commented Dec 3, 2026

Copy link
Copy Markdown

Who this helps

Teams that use proofline ci review --annotations on pull requests with many findings. The Actions runner shows at most 10 error, 10 warning and 10 notice annotations per step. It keeps the first ten of each level and drops the rest without saying so on the pull request (_maxCountPerIssueType and AddIssue in actions/runner's src/Runner.Worker/ExecutionContext.cs; the limit is also listed under "Limitations" in actions/toolkit's docs/problem-matchers.md). Annotations were printed in review order, so on a large review a CRITICAL finding could be dropped while SERIOUS ones were shown, and nothing said annotations were missing.

What changes

  • Within the limits, nothing changes. A review whose findings fit prints the same lines in the same order as before.
  • A level that overflows keeps its most severe findings: CRITICAL before SERIOUS, WARNING before NOTE, and within one severity a finding with a verified location at the head before one without, then review order.
  • A notice counts what was left out and links the review, for example: "GitHub shows at most 10 annotations of each level per step, so 2 error annotations and 1 warning annotation were left out. The review lists every finding: ". It takes one notice slot.
  • When anything is left out, the notice comes first and the kept annotations follow most severe first. The runner keeps the first annotations it reads, so an earlier annotation elsewhere in the step would otherwise displace the last one printed, which could be the notice or a critical finding that came late in review order.
  • The --annotations help text and the README describe the limit.

Decisions

  • Selection, not truncation. "Most severe" is the text output's order (Severity::display_rank), and "located" is SARIF's verified head location (sarif::location). Within one severity, a located finding shows on the diff line, which is more actionable than a job-level annotation, so it is kept first.
  • Left-out findings are not printed as workflow commands. The runner would log them but not annotate them, and the text or JSON result on stdout already lists every finding. Printing only what is shown keeps the notice's count true.
  • Output within the limits is byte-for-byte unchanged. Review order is kept there; the order changes only when something is already being left out.
  • Only the per-step limit for these annotations is counted. Other annotations in the same step (such as the runner's own Process completed with exit code 3. error) and the job's limit of 50 depend on things the CLI can't see. Printing the notice and the most severe findings first means those are the last to be displaced. The README and the code comment say so.
  • Untrusted text is handled as before. The finding annotations and the notice share one command writer, which uses the existing escape_property / escape_data. The notice carries only counts, a constant title and the console's review URL.

Verification

  • Unit tests in src/annotations.rs cover:
    • review order within the limits;
    • which findings a full level keeps (a critical finding without a location beats located serious ones), and the notice-first, most-severe-first order once something is left out;
    • one limit across the code lane and several environments, with each lane's title;
    • WARNING before NOTE;
    • resolved findings not counting;
    • exactly 10 notices with no overflow, and the same 10 giving up a slot when another level overflows, with errors printed before notices;
    • only notices overflowing;
    • all three levels overflowing;
    • singular and plural wording.
  • A new test in tests/http.rs runs ci review --annotations against the mock console with 11 serious findings. It checks that 10 errors are shown, that the notice comes first and names the review's console URL, and that the JSON result still holds all 11 findings. The two annotation tests now share an annotations_console helper; the existing test passes with its assertions unchanged.
  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and cargo deny check are clean. No dependency changed.
  • cargo test --locked passes, except two tests/agent_install.rs tests that also fail on unmodified main on macOS (unattended_registration_preserves_settings_and_uses_the_installed_binary fails on macOS (/var vs /private/var) #112 reports the first; Fix macOS agent_install test portability and add macos-15 CI #138 fixes both).

Overlap

I'm happy to rebase on any of them.

The runner shows at most 10 annotations of each level per step and
drops the rest without saying so on the pull request. `ci review
--annotations` printed findings in review order, so on a large review a
critical finding could be dropped while lesser ones were shown, and
nothing said annotations were missing.

A level with more findings than the runner shows now keeps its most
severe ones (CRITICAL before SERIOUS, WARNING before NOTE, located
before unlocated, then review order). A notice that counts the
annotations left out and links the review comes first, and the kept
annotations follow most severe first, so other annotations in the step
cannot push them out. The printed result still lists every finding. A
review within the limits prints exactly as before.

This branch has not been deployed

No deployments
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