← Back to Pull requests

Fix two tests that fail in GitHub Actions containers #5659

Closed
unknown closed this pull request without merging on Nov 10, 2026 22:02 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 08:09 UTC
Author

test_contentsEqual and test_cookieInXDGSpecPath now pass when the tests run as root with HOME set to a directory other than the user's home directory, as in the GitHub Actions containers that #5523 uses.

Motivation:

#5523 runs the tests with the shared GitHub workflows, and two Linux tests fail there. In those containers the tests run as root, and HOME is /github/home while /etc/passwd says /root.

  • test_contentsEqual creates an empty file with no read permission and expects contentsEqual to return false for it. Root can read the file, so contentsEqual returns true.

  • test_cookieInXDGSpecPath looks for the cookie file under NSHomeDirectory(). The cookie storage gets its folder from FileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask), which uses $HOME/.local/share, as the XDG spec says (_xdgHomeURL in swift-foundation). NSHomeDirectory() reads the home directory from getpwuid before it looks at HOME, so the test looks under /root.
  • Modifications:

  • test_contentsEqual: as root, expect true, because both files are empty and root can read them, like the existing Windows branch. Other users still expect false.

  • test_cookieInXDGSpecPath: build the expected path from $HOME, the value the cookie storage uses, and keep NSHomeDirectory() when HOME is not set.
  • Result:

    The two tests pass as root, as a regular user, and when HOME differs from the home directory in /etc/passwd. Only tests change.

    Testing:

    All tests in the swift:6.4.1-noble Docker image (Linux aarch64), on main and with this change:

    | Run | main | this change |
    |---|---|---|
    | all 1933 tests, root, HOME=/github/home | 2 failures (these two tests) | 0 failures |
    | TestFileManager and TestHTTPCookieStorage, root, HOME=/root | test_contentsEqual fails | pass |
    | TestFileManager and TestHTTPCookieStorage, regular user | pass | pass |

    With the workflow from #5523 in my fork (Linux x86_64, nightly-main and nightly-6.4.x), all 1933 tests run: on main, these two tests fail (run); with this change, there are 0 failures (run).

    Diff: 282 lines (+211 / -71) across 3 files Reviewer: finagolfin Review duration: 832m
    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 · 282 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.338
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5659"
    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.7% (MEDIUM) · Higher = larger blast radius
    39.7%
    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%