Skip to content

Fix GUI screenshot gate to use gui/ diff paths - #1405

Merged
Wibias merged 4 commits into
devfrom
fix/gui-screenshot-gate-from-diff
Aug 10, 2026
Merged

Fix GUI screenshot gate to use gui/ diff paths#1405
Wibias merged 4 commits into
devfrom
fix/gui-screenshot-gate-from-diff

Conversation

@Wibias

@Wibias Wibias commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Require UI screenshots only when the PR changes files under gui/, matching doctor/lint if-changed gating.
  • Pass changedFilePaths from pulls.listFiles in enforce-pr-target instead of treating GUI mentions in title/body as cues.
  • Update pr-quality unit tests, ci-workflows integration tests, and contributing docs.

Test plan

  • node --test .github/scripts/pr-quality.test.cjs .github/scripts/enforce-pr-target.test.cjs (88 pass)
  • bun test tests/ci-workflows.test.ts --test-name-pattern gui (26 pass)

Summary by CodeRabbit

  • Bug Fixes

    • GUI screenshot requirements now trigger for changes under gui/ or incomplete changed-file lists, rather than GUI-related pull request wording.
    • Negated GUI references no longer incorrectly trigger screenshot checks.
    • Maintainers can waive GUI classification or screenshot requirements when appropriate.
    • Changed-file checks now remain reliable when pull request file lists are incomplete.
  • Documentation

    • Updated contribution guidance for file-based GUI screenshot requirements.
  • Tests

    • Expanded coverage for GUI detection, truncated file lists, exemptions, and edge cases.

Require UI screenshots only when changed paths include gui/, not when title or body merely mention GUI. Wire changedFilePaths through enforce-pr-target and align unit and integration tests.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Wibias, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 46a94969-0445-45d6-a158-526eb30984f1

📥 Commits

Reviewing files that changed from the base of the PR and between 4a8653d and 7dd2662.

📒 Files selected for processing (2)
  • tests/ci-workflows.test.ts
  • tests/helpers/enforce-pr-target-harness.ts
📝 Walkthrough

Walkthrough

The PR changes GUI screenshot enforcement from title or description detection to changed-file detection. The workflow passes changed paths and file-list truncation state to collectPrQualityFailures. Tests, fixtures, and documentation cover the updated behavior.

Changes

GUI Screenshot Enforcement

Layer / File(s) Summary
Path detection and screenshot gate
.github/scripts/pr-quality.cjs, .github/scripts/pr-quality-messages.cjs, .github/scripts/pr-quality.test.cjs
The quality script detects gui/ paths and incomplete file lists. It requires screenshot evidence or an allowed waiver for these cases.
Changed-file workflow wiring
.github/workflows/enforce-pr-target.yml, .github/scripts/enforce-pr-target.test.cjs, tests/helpers/enforce-pr-target-harness.ts
The workflow captures a head-consistent changed-file list, detects truncation, reuses the list for hygiene checks, and passes the results to collectPrQualityFailures.
Integration coverage and documentation
tests/ci-workflows.test.ts, docs-site/src/content/docs/contributing/pr-quality.md
Integration tests and fixtures validate changed paths, pagination, head drift, truncation, screenshot evidence, and waivers. Documentation describes the updated gate.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant enforce-pr-target.yml
  participant GitHub API
  participant collectPrQualityFailures
  participant guiPathsChanged
  participant ScreenshotGate
  enforce-pr-target.yml->>GitHub API: retrieve changed files and PR head
  GitHub API-->>enforce-pr-target.yml: changed paths and file count
  enforce-pr-target.yml->>collectPrQualityFailures: pass paths and truncation state
  collectPrQualityFailures->>guiPathsChanged: inspect changed paths
  guiPathsChanged-->>collectPrQualityFailures: return GUI path match
  collectPrQualityFailures->>ScreenshotGate: validate screenshot evidence or waiver
Loading

Possibly related PRs

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: using gui/ diff paths to trigger the GUI screenshot gate.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gui-screenshot-gate-from-diff

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed.

UI screenshot waived by the gui-screenshot-waived label.

Hygiene

Deterministic PR hygiene checks passed.

@github-actions
github-actions Bot marked this pull request as draft August 10, 2026 05:39
@Wibias Wibias added the gui-screenshot-waived Maintainer waiver for false-positive GUI screenshot requirements label Aug 10, 2026
@Wibias
Wibias marked this pull request as ready for review August 10, 2026 05:42
@Wibias

Wibias commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/enforce-pr-target.yml:
- Around line 537-543: Update the changed-file handling around github.paginate
and collectPrQualityFailures to fetch pulls.get changed_files_count, detect when
the paginated list is incomplete, and pass an explicit filesTruncated flag. In
collectPrQualityFailures, add missing_ui_screenshot whenever filesTruncated is
true or changedFilePaths includes a gui/ file. Add a regression test covering
more than 3,000 changed files with a gui/ path.

In `@docs-site/src/content/docs/contributing/pr-quality.md`:
- Around line 40-43: Update the documentation around the maintainer waiver to
describe it as path-based: clarify that the label waives the screenshot
requirement for changes under gui/ or for a false-positive GUI-path
classification, while keeping the existing PR gate behavior description
unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4b935899-26c6-4323-870f-63f0917700d5

📥 Commits

Reviewing files that changed from the base of the PR and between bd991e1 and ed08efc.

📒 Files selected for processing (7)
  • .github/scripts/enforce-pr-target.test.cjs
  • .github/scripts/pr-quality-messages.cjs
  • .github/scripts/pr-quality.cjs
  • .github/scripts/pr-quality.test.cjs
  • .github/workflows/enforce-pr-target.yml
  • docs-site/src/content/docs/contributing/pr-quality.md
  • tests/ci-workflows.test.ts

Comment thread .github/workflows/enforce-pr-target.yml Outdated
Comment thread docs-site/src/content/docs/contributing/pr-quality.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/enforce-pr-target.yml:
- Around line 544-546: Update the changed-file retrieval flow around the PR
metadata and changedFiles fetch so the file list and count are tied to the same
PR head SHA; if the snapshots differ, retry the fetch or fail closed. Treat
missing or non-integer changed-file counts as truncated, and only consider the
list complete when the same-head count is a valid integer no greater than
changedFiles.length.

In `@docs-site/src/content/docs/contributing/pr-quality.md`:
- Around line 40-46: Update the screenshot-gate requirements in the contributing
PR quality documentation to state that an incomplete GitHub changed-file list is
conservatively treated as a GUI change, even when no gui/ path is returned.
Clarify that the gui-screenshot-waived label and maintainer waiver also apply to
this case, keeping the documented behavior aligned with the workflow.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dd22559f-c5c2-4364-b52c-cdf430627f33

📥 Commits

Reviewing files that changed from the base of the PR and between ed08efc and 68368ba.

📒 Files selected for processing (7)
  • .github/scripts/enforce-pr-target.test.cjs
  • .github/scripts/pr-quality-messages.cjs
  • .github/scripts/pr-quality.cjs
  • .github/scripts/pr-quality.test.cjs
  • .github/workflows/enforce-pr-target.yml
  • docs-site/src/content/docs/contributing/pr-quality.md
  • tests/ci-workflows.test.ts

Comment thread .github/workflows/enforce-pr-target.yml Outdated
Comment thread docs-site/src/content/docs/contributing/pr-quality.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/helpers/enforce-pr-target-harness.ts`:
- Around line 656-662: Update the changed_files handling near prChangedFiles to
detect whether options.pr explicitly contains the changed_files property,
defaulting to listedFileCount only when it is absent; preserve supplied
undefined, negative, and fractional values unchanged. Add a workflow-level
regression case that verifies malformed pulls.get metadata produces the
missing_ui_screenshot failure.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a3f03258-d3c9-4a85-8909-044a4b641295

📥 Commits

Reviewing files that changed from the base of the PR and between 68368ba and 4a8653d.

📒 Files selected for processing (7)
  • .github/scripts/enforce-pr-target.test.cjs
  • .github/scripts/pr-quality.cjs
  • .github/scripts/pr-quality.test.cjs
  • .github/workflows/enforce-pr-target.yml
  • docs-site/src/content/docs/contributing/pr-quality.md
  • tests/ci-workflows.test.ts
  • tests/helpers/enforce-pr-target-harness.ts

Comment thread tests/helpers/enforce-pr-target-harness.ts
@Wibias
Wibias merged commit 2036ed7 into dev Aug 10, 2026
23 checks passed
@Wibias
Wibias deleted the fix/gui-screenshot-gate-from-diff branch August 10, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gui-screenshot-waived Maintainer waiver for false-positive GUI screenshot requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant