ci: ui-rules and gallery coverage fail only for the PR's own findings (no bead)

Merged
TE
1mo ago
+379-25

Summary

Base reds in two whole-tree webviews checks failed every PR's react-apps-check until someone fixed them on the base branch: ui-rules.test.ts (GitActions.tsx after 75fd77581f5f) and gallery-coverage.test.ts (SurfaceOps after b27a7aff59e3). This gives both the own-files-only scoping that #19539 gave the Swift lint gates.

  • On a pull request, react-apps-check checks out the merge commit with its parents and writes git diff --name-only HEAD^1 HEAD to CMUX_PR_CHANGED_FILES.

  • webviews/test/support/prScope.ts counts a finding when:

    • it names a file the PR changes, or
    • its name is quoted on a pending, allowlist or *.gallery.tsx covers line that the PR adds or removes, or
    • the PR changes the check's own code, in which case every finding counts.
  • Other findings print as ::warning title=On the base branch, not in this PR::… and the check passes.

  • Locally and on base pushes every finding still counts.

  • scripts/tests/test_pr_scoped_webviews_checks.py builds a fixture merge commit (the real webviews tree plus one base finding) and runs both checks as CI does. react-apps-check runs it, and the web path filters include it.

  • run-webviews-tests.sh now prints a passing file's ::warning lines. Before, they were dropped along with the file's log.

Known gap (pre-existing)

A PR that changes only Swift does not route to react-apps-check, so a new PageDescriptor with no gallery entry is not caught on its own PR. Base push CI for web is dispatch-only. Before this change, the next web PR went red on it. Now that PR shows a warning. Fixing this needs Swift page descriptors to route to react-apps-check. It is not in this PR.

Base reds in Lawrence's files are still fixed properly: #19566 (GitActions) and #19568 (home-channels).

Testing

  • python3 scripts/tests/test_pr_scoped_webviews_checks.py (7 cases at first, 9 after review: duplicate entry id and idle owner prefix):
    • Red on base at 914d4fd007ff: 2 failures, the cases where a base finding should only warn.
    • Green at the fix.
  • bun run check: pass.
  • bun test test/gallery-coverage.test.ts test/ui-rules.test.ts unscoped: still fails on the current base's GitActions finding, as it should until #19566 lands.

Changelog

none

🤖 Generated with Claude Code