← Back to Pull requests

Add screen_capture_format attribute to ios_xctestrun_runner #3021

Closed
unknown closed this pull request without merging on Aug 21, 2026 00:01 UTC
View on GitHub
unknown unknown commented on Jul 16, 2026 20:26 UTC
Author

Summary

Adds a new screen_capture_format string attribute to ios_xctestrun_runner that threads Xcode's PreferredScreenCaptureFormat xctestrun key (added in Xcode 15) into the generated file. Accepted values:

  • "" (default): key is not written, so Xcode's platform default is used — no behavior change for existing users.

  • "screenshots": capture screenshots only.

  • "screenRecording": capture a full screen recording of each UI test run, attached to the resulting .xcresult bundle.
  • The same value can be set ad hoc for a single run without editing the runner target via --test_arg=--xctestrun_screen_capture_format=<value>.

    Setting a non-empty value implies:
    1. Use of xcodebuild test-without-building (the direct xctest path does not read the xctestrun file).
    2. create_xcresult_bundle = True (the capture is only observable in the .xcresult).

    Both are documented on the attribute and echoed as note: lines when triggered, matching the existing attachment_lifetime/xcodebuild_args conventions.

    Interaction with attachment_lifetime

    Screen captures are system attachments, so attachment_lifetime must be "keepAlways" or "deleteOnSuccess" for the capture to survive into the .xcresult — the default "keepNever" discards it. This is called out in the attribute doc, and the runner emits a warning: at runtime when a capture format is requested while the lifetime is "keepNever".

    Test plan

  • //test:ios_xctestrun_runner_ui_test — 2 new template-emission cases:

  • - test_ios_ui_test_default_screen_capture_format_arg — asserts PreferredScreenCaptureFormat is not emitted when the flag is unset.
    - test_ios_ui_test_screen_capture_format_arg — asserts the key + screenRecording value + SystemAttachmentLifetime=keepAlways are all written when both flags are set.
  • //doc:check_ios passes with regenerated doc/rules-ios.md.

  • buildifier --lint=warn passes clean.

  • Manual end-to-end verification against a UI test on iOS 18.6 simulator: .xcresult produced and opens in Xcode with the .mov video attachment visible in the Attachments panel.

  • Verified locally on Xcode 26.2 / iOS 26.2 simulator: both new cases plus test_ios_ui_test_pass and test_ios_ui_test_attachment_lifetime_arg pass.
  • Diff: 287 lines (+215 / -72) across 3 files Reviewer: erneestoc Review duration: 50614m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 287 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.339
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3021"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.8% (MEDIUM) · Higher = larger blast radius
    39.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.7% · Safe to merge
    15.7%