Skip to content

Gate visual screenshot harness failures - #4915

Merged
lawrencecchen merged 1 commit into
mainfrom
fix-visual-screenshot-gating
May 28, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
fix-visual-screenshot-gating

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • remove the visual screenshot harness non-blocking failure allowlist
  • make the v2 D12 close-top scenario close the captured surface ID and retry responsiveness while the split tree settles
  • add Python harness byte-compilation to workflow guard CI

Validation

  • ./tests/test_ci_self_hosted_guard.sh
  • git ls-files 'tests/.py' 'tests_v2/.py' 'scripts/*.py' | xargs python3 -m py_compile\n- git diff --check

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


Note

Cursor Bugbot is generating a summary for commit 88085ec. Configure here.


Summary by cubic

Make visual screenshot harness failures block CI by removing the non-blocking allowlist, and stabilize the D12 “close top” scenario to reduce flakiness. Also add Python byte-compilation in CI to catch syntax errors early.

  • Bug Fixes

    • D12: close the original top surface by ID and retry responsiveness (with surface refresh) while the split tree settles.
  • Migration

    • Visual screenshot failures now fail CI; fix tests instead of relying on the old allowlist.

Written for commit 88085ec. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Chores

    • Updated CI workflow to validate macOS runner guards and Python syntax compliance.
  • Tests

    • Enhanced visual screenshot test stability with improved terminal detection and pane identification.
    • Simplified test failure reporting to consistently treat all failures as blocking.

Review Change Stack

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@vercel

vercel Bot commented May 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment May 28, 2026 2:00am
cmux-staging Building Building Preview, Comment May 28, 2026 2:00am

@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

CI workflow adds Python syntax validation for harness files, and both visual screenshot test frameworks remove non-blocking failure classification to treat all failures uniformly. The tests_v2 suite enhances terminal detection resilience and enables closing panes by captured surface ID instead of fixed indices.

Changes

Test Framework and CI Guard Updates

Layer / File(s) Summary
CI workflow guard validation updates
.github/workflows/ci.yml
Relabel macOS runner guards and add Python syntax validation step to compile all Python files in tests/, tests_v2/, and scripts/ directories.
Unified failure classification removal
tests/test_visual_screenshots.py, tests_v2/test_visual_screenshots.py
Remove _is_known_non_blocking_failure helper and non-blocking failure annotations from both test runners; simplify end-of-test summary output to report all failures uniformly and return exit code based only on test pass/fail counts.
Enhanced close test stability and surface tracking
tests_v2/test_visual_screenshots.py
Upgrade _close_and_verify to accept surface IDs as strings or numeric indices (Union[int, str]). Enhance blank terminal detection with a retry loop that refreshes surfaces between verification attempts. Update test_d12_nested_close_top to capture and close the specific top surface by ID instead of assuming a fixed index.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Tests now fail with clarity so bright,
No more "non-blocking" in the night,
Python syntax guards stand tall,
Surface IDs answer the call,
Screenshot tests resilient and right! 📸✨


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Cmux Swift Logging ❌ Error Found print() in Sources/TerminalController.swift and Sources/Feed/FeedPreviewWindowController.swift (runtime, not CLI); 73+ NSLog in app/runtime; file paths exposed in logging. Replace print() with Logger; replace NSLog with os.log Logger; audit logs for sensitive data per swift-logging.md rules.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description uses a non-standard format. While it includes summary and validation sections, it deviates significantly from the required template structure with missing sections like Testing, Demo Video, Review Trigger, and Checklist. Reorganize the description to follow the template: add Testing section with manual verification details, include Review Trigger block, and complete the Checklist to ensure consistency with repository standards.
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective: removing the non-blocking failure allowlist to make visual screenshot harness failures block CI.
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.
Cmux Swift Actor Isolation ✅ Passed PR contains no Swift changes—only Python test files and CI workflow modifications. Swift actor isolation check is not applicable.
Cmux Swift Blocking Runtime ✅ Passed PR only modifies test files and CI workflow (no production Swift changes). Blocking synchronization patterns found in Swift code are pre-existing and not introduced or expanded by this PR.
Cmux No Hacky Sleeps ✅ Passed PR adds sleeps only in test scaffolding (tests/test_visual_screenshots.py) and CI workflow YAML (out of scope). No hacky sleeps in production code.
Cmux Algorithmic Complexity ✅ Passed All changes are in test files and CI infrastructure, not production code. Test scaffolding is explicitly exempt from complexity rules.
Cmux Swift Concurrency ✅ Passed PR contains no Swift code changes—only YAML workflow and Python test file modifications. Check does not apply to non-Swift files.
Cmux Swift @Concurrent ✅ Passed PR contains no Swift files; check only applies to Swift changes. Changes are YAML workflow and Python test files only.
Cmux Swift File And Package Boundaries ✅ Passed PR only modifies non-Swift files (YAML CI workflow and Python test scripts), so the Swift file/package boundaries check does not apply.
Cmux User-Facing Error Privacy ✅ Passed PR modifies only test files and CI configuration (.github/workflows/ci.yml, tests/*.py), which are developer-only and not user-facing per review rules.
Cmux Full Internationalization ✅ Passed All modified files are in allowed exemption categories: CI workflow (operational docs) and test files. No user-facing text or localization catalogs modified.
Cmux Swiftui State Layout ✅ Passed PR contains only CI workflow and Python test file changes—no SwiftUI code modifications. Check does not apply to non-Swift files.
Cmux Architecture Rethink ✅ Passed PR contains no Swift code changes—only Python tests and CI configuration updates. The check for Swift architecture violations is not applicable.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PR contains no Swift window code changes. Only modifications are to Python test files and YAML CI workflow, not NSWindow/NSPanel/NSWindowController/WindowGroup declarations.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-visual-screenshot-gating

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 and usage tips.

@greptile-apps

greptile-apps Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hardens the visual screenshot test harness by removing the non-blocking failure allowlist, fixing the root cause of D12's VIEW_DETACHED flakiness (closing by captured surface ID instead of positional index 0), adding a transient-blank retry loop in _close_and_verify, and adding a Python syntax compilation guard to CI.

  • Non-blocking allowlist removed from both tests/ and tests_v2/ — all visual test failures are now gate-blocking, and the D12 scenario is fixed at the source rather than tolerated.
  • test_d12_nested_close_top now captures the initial surface's UUID before splitting, so the close targets the correct pane even after positional indices shift.
  • CI gains a Python syntax check via git ls-files … | xargs python3 -m py_compile and renames the runner guard step to "macOS runner guards".

Confidence Score: 4/5

The changes are safe to merge — the test logic fixes a real flakiness root cause and the harness is strictly more correct than before.

The D12 surface-ID fix and the non-blocking allowlist removal are both well-reasoned improvements. The only concern is the CI xargs invocation that can silently pass without running py_compile if no Python files are found at the hardcoded paths — a real but low-likelihood gap that does not affect current behavior.

.github/workflows/ci.yml — the xargs python3 -m py_compile step could silently become a no-op if Python test files are relocated.

Important Files Changed

Filename Overview
.github/workflows/ci.yml Adds a "Validate Python test harness syntax" step using `git ls-files …
tests/test_visual_screenshots.py Removes _is_known_non_blocking_failure and its allowlist; all failures are now gate-blocking. Clean change with no issues.
tests_v2/test_visual_screenshots.py Removes the non-blocking allowlist, fixes D12 to close by UUID rather than positional index, and adds a 3-attempt retry loop with refresh_surfaces + sleep in _close_and_verify. All sleeps are test-only scaffolding.

Sequence Diagram

sequenceDiagram
    participant Test as test_d12_nested_close_top
    participant Client as cmux client
    participant CAV as _close_and_verify
    participant VAR as verify_all_responsive

    Test->>Client: list_surfaces()
    Client-->>Test: [(0, "uuid-A", …)]
    Note over Test: top_surface_id = "uuid-A"
    Test->>Client: new_split("down")
    Test->>Client: focus_surface(1)
    Test->>Client: new_split("right")
    Test->>CAV: "close_idx="uuid-A", expected=2"

    CAV->>Client: close_surface("uuid-A")
    CAV->>Client: wait_surface_count(2)
    loop up to 3 attempts
        CAV->>VAR: verify_all_responsive(after_label)
        VAR->>Client: surface_health()
        VAR-->>CAV: blank_err or None
        alt blank_err
            CAV->>Client: refresh_surfaces()
            Note over CAV: sleep(0.8 + 0.4*attempt)
        else no error
            CAV-->>Test: change (passed)
        end
    end
    CAV-->>Test: change (passed or failed)
Loading

Reviews (1): Last reviewed commit: "Gate visual screenshot harness failures" | Re-trigger Greptile

Comment thread .github/workflows/ci.yml
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Validate WarpBuild runner guards
- name: Validate macOS runner guards

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.

P2 Silent no-op when no Python files match

On macOS, BSD xargs without -r still invokes the utility when stdin is empty. python3 -m py_compile called with no filename arguments reads from its own stdin; in CI that stdin is /dev/null, so it exits 0 without compiling anything. If the Python test files are ever moved out of tests/, tests_v2/, or scripts/ the step will appear to pass while checking nothing. Adding xargs -r (GNU) or restructuring the command to fail-fast on empty input would prevent this silent pass-through.

@lawrencecchen
lawrencecchen merged commit 73dd9cf into main May 28, 2026
21 checks passed
@lawrencecchen
lawrencecchen deleted the fix-visual-screenshot-gating branch May 28, 2026 02:04

This branch was successfully deployed

1 active deployment
Preview – cmux — 88085ecb Deployed May 28, 2026 by vercel[bot]
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