Skip to content

ci: label pull requests by their local CI declaration - #2592

Merged
houko merged 5 commits into
nsgo-dev:mainfrom
Laotree:ci/local-ci-attestation
Nov 29, 2026
Merged

houko merged 5 commits into
nsgo-dev:mainfrom
Laotree:ci/local-ci-attestation

Conversation

@Laotree

@Laotree Laotree commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Give every pull request a machine-readable account of the checks its author ran, so a reviewer can see which pull requests still need a test audit and which ones already carry the evidence. Fixes #2582.

## Verification asked for the commands and for what could not run, in free text that nothing read: a pull request that ran nothing looked like one that ran everything. It now carries a block that pr-triage.yml reads, the head commit, the base commit, each command with its exit code, the result and what the local run cannot cover. A new triage job compares the declared head with the pushed one and applies exactly one of local-ci-pass, local-ci-fail and local-ci-skipped, creating the labels when a fork cannot. A skipped or failed declaration carries one bot comment that asks a maintainer to audit the pull request, and the comment goes away once the block is fixed.

The declaration is a promise, not evidence: required checks still decide the merge. test.yml is untouched, because letting it skip jobs from the label needs data on how often a declaration matches what CI finds, and the merge queue re-runs every test anyway.

Targets

Documentation and .github/ only: no platform code, so no backend needs the same change.

Screenshots

None

Verification

  • head: 7080d4ca81aff3c1b793efd5f496a2c8d96e8655
  • base: 809497c3d6f79f34d28f754d22221a3c6c7d92ff
  • commands: go tool nsgo check → 0, actionlint -color → 0, git diff --check → 0, go tool nsgo test → 1
  • result: fail
  • not covered: go tool nsgo test -target on other targets, the Android emulator, Windows and the browser jobs, and the Linux and web targets of the tests below, which this macOS host cannot run; test.yml runs them, and pull_request_target itself only runs on a real pull request

On this head go tool nsgo test exits 1 with 5327 passed, 1 failed and 86 skipped. The one failure is TestMaxRefreshRateReadsEveryMode: it needs a display that reports a rate for every mode, and this host reports 0 Hz for its fastest mode. The test fails the same way on main on this host, since the failure follows the display; #2652 fixes the test.

$ go tool nsgo check
exit 0, 1m28s

$ actionlint -color          # v1.7.12, the version quality.yml installs
exit 0

$ git diff --check
exit 0

$ go tool nsgo test
5327 passed, 1 failed, 86 skipped
  ✗ TestMaxRefreshRateReadsEveryMode (0s)

The head merges main at 809497c3d, which fixes the jobs that were red on the earlier head: web passes, and test-suite (core) passes TestLaterViewsCoverHostedNatives, TestRoundedParentsClipHostedNatives and TestVideoShowsWhatIsBehindItsTransparentPixels after af43ab1e8. test-suite (core) is still red on TestFileDialogsReachGTK, which runs the GTK file dialog on the runner and ends in a SIGSEGV after libEGL warning: DRI3 error; this branch does not touch that code.

main at 809497c3d does not touch .github/workflows/pr-triage.yml, so the script below is the one this branch verified. Taken from the workflow and run under Node.js with a stubbed GitHub client, one label of another state set and one stale bot comment in place:

valid block, result pass                → local-ci-pass     creates the label, removes local-ci-fail, deletes the old comment
the same body with CRLF line endings    → local-ci-pass
nested commands list                    → local-ci-pass
pass with a non-zero exit code          → local-ci-skipped  rejects the contradiction
declared skipped                        → local-ci-skipped  its own wording
block without base                      → local-ci-skipped
head is another commit                  → local-ci-skipped
no block                                → local-ci-skipped
empty template as shipped               → local-ci-skipped  lists the problems
10-character head prefix                → local-ci-pass
null body                               → local-ci-skipped
closed pull request                     → no call
label created by a concurrent run (422) → local-ci-pass

Checklist

  • The title is a Conventional Commit, such as fix(linux): keep the caret after a paste; a squash merge uses it as the commit subject.
  • Docs whose facts change are updated. No changelog.d/ line: contributors see the labels, app authors and users do not.
  • No new third-party code, assets or dependencies.

🤖 Claude Opus 5.5
🤖 Generated with Claude Code

The Verification section asked for the commands a pull request ran and
for what it could not run, in free text that nothing read: a pull request
that ran nothing looked like one that ran everything. It is now a block
pr-triage.yml reads: the head commit, the base commit, each command with
its exit code, the result, and what the local run cannot cover.

A new triage job compares the declared head with the pushed one and
applies exactly one of local-ci-pass, local-ci-fail and local-ci-skipped,
creating the labels when a fork cannot. A skipped or failed declaration
carries one bot comment that asks a maintainer to audit the pull request,
and the comment goes away once the block is fixed.

AGENTS.md and the contributing pages in both languages state the rule:
the declaration decides how closely a maintainer reads the pull request,
never whether a required check passes. test.yml is untouched, as skipping
its jobs from the label needs data on how often a declaration matches CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size/M documentation Improvements or additions to documentation ci labels Nov 27, 2026
Read the body and head with pulls.get and give the job its own concurrency group keyed by the pull request, so a push and the body edit that declares it no longer race on frozen payloads and the last run labels the current state.

Normalise CRLF bodies from the web editor, accept indented continuation lines so commands can be a nested list, cap line length and use a regex whose parts cannot overlap on untrusted input.

Require base to be a SHA, reject the template's placeholder values, require an exit code in commands and treat a pass with a non-zero exit code as invalid. The comment now lists what makes a block invalid and has its own wording for a declared skip.

Exempt bot authors, tolerate a 422 when a concurrent run created the label first, skip closed pull requests and leave an unchanged comment alone. Update the template, AGENTS.md and both contributing pages to match.
@houko

houko commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

The idea is right and the pull_request_target boundary holds (no checkout, the body never reaches ${{ }} or the log). Review found several ways a correct declaration would still be labelled local-ci-skipped, or a wrong one labelled local-ci-pass, so I pushed 969c2e5 on top:

  • Race between the edited and head runs. The workflow's concurrency group splits edited from other actions, so a push and the body edit that declares it run at the same time, each with a frozen payload (the push sees the old body, the edit sees the old head), and whichever finishes last wins. The job now reads body and head.sha from pulls.get and has its own concurrency group keyed only by the pull request number, so the last run labels the live state.
  • CRLF bodies. The body was split on \n only, and ./$ do not match \r, so a body with CRLF line endings parsed to {}. It is normalised first.
  • Nested command lists. - commands: followed by indented sub-bullets ended the parse, so result and not covered were never read. Indented lines now continue the key above.
  • Validity. base was never checked although the docs call a block without it incomplete; the template's placeholder text for commands and not covered counted as filled; result: pass with → 1 was accepted. All three are now invalid, and commands needs at least one → N.
  • Untrusted input. \s*-\s+([A-Za-z ]+):\s*(.*)$ backtracks quadratically on long whitespace runs; the new pattern's parts cannot overlap, lines over 2000 characters end the block, and backticks are stripped without a regex.
  • Comments. The invalid-block comment lists what is wrong, a declared skipped gets its own wording instead of "no valid declaration", and an unchanged comment is not rewritten.
  • Smaller things. Bot authors (Dependabot) are exempt, a 422 from createLabel when a concurrent run created the label first is tolerated, closed pull requests are skipped. The template comment, AGENTS.md and both changes.md pages say the same.

Verified with actionlint, git diff --check, and the job's script run under Node.js against a stubbed client: valid pass, the same body with CRLF, a nested commands list, pass with a non-zero exit code, fail, declared skipped, missing base, another head, a 10-character head prefix, no exit code, the template as shipped, no block, a null body, a 422 label race, a closed pull request, and 50,000-character lines (0 ms). Because the job runs from the base branch under pull_request_target, this pull request's own label only appears after merge.

@houko
houko marked this pull request as ready for review November 27, 2026 10:05
@Laotree

Laotree commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Verified 969c2e50 on fed081c2 independently:

  • The script as this branch holds it, extracted from the workflow and run under Node.js with a stubbed client, against thirteen bodies: pass, the same body with CRLF, a nested commands list, pass with a non-zero exit code, declared skipped, no base, another head, no block, the template as shipped, a 10-character head prefix, a null body, a closed pull request, and a 422 from a concurrent createLabel. Each lands on the label and the comment the job describes, including the 422 path proceeding to the label.
  • actionlint -color (v1.7.12), git diff --check and go tool nsgo check (4m26s) pass on this head. go tool nsgo test exits 1 with 5220 passed, 1 failed and 86 skipped; the failure is TestMaxRefreshRateReadsEveryMode, which fails the same way on 6416e1a0b, so it follows the host's display.
  • The Local CI block now names fed081c2 and this run. It had still named 9c2a7713, which the job would have labelled stale.

On the two red jobs, test-suite (core) and web: they fail on TestLaterViewsCoverHostedNatives, TestRoundedParentsClipHostedNatives, TestVideoShowsWhatIsBehindItsTransparentPixels and TestRestrictedWebViewNavigationGrants, which run on Linux and in the browser backend. This branch differs from 6416e1a0b only in .github/ and the two contributing pages. A rerun would show whether it is the runner; a fork cannot rerun this repository's runs.

🤖 Claude Opus 5.5

@Laotree

Laotree commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Merged main at 809497c3d into the branch, so the head is now 7080d4ca8. The two jobs that were red have moved:

  • web passes. TestRestrictedWebViewNavigationGrants no longer times out.
  • test-suite (core): TestLaterViewsCoverHostedNatives, TestRoundedParentsClipHostedNatives and TestVideoShowsWhatIsBehindItsTransparentPixels now pass. main fixed them in af43ab1e8, which this merge brings in.
  • test-suite (core) is still red, on TestFileDialogsReachGTK alone: system_native_test.go:267: exit status 2, after libEGL warning: DRI3 error and a SIGSEGV in the test process. This branch does not touch the GTK dialog code, so the crash looks like the runner. A rerun of that job would show it; a fork cannot rerun this repository's runs. For comparison, the same test passed in fix(web): resume the gallery's wasm download after an interruption #2644's test-suite (core) at 12:07 (7.07 s) and in ci(android): run the emulator script on three runners #2583's at 09:21 (5.55 s).

@Laotree

Laotree commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Same crash as the one below, with a candidate fix under test on its own: #2664 gives the dialog test's own process GDK_DEBUG=no-portals,gl-disable, so GDK opens no GL context where EGL has no DRI3 device.

@houko
houko merged commit eb5f536 into nsgo-dev:main Nov 29, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci documentation Improvements or additions to documentation size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: label pull requests by their local CI declaration

2 participants