Fix two tests that fail in GitHub Actions containers #5659
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
finagolfin
test_contentsEqualandtest_cookieInXDGSpecPathnow pass when the tests run as root withHOMEset 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
HOMEis/github/homewhile/etc/passwdsays/root.test_contentsEqualcreates an empty file with no read permission and expectscontentsEqualto returnfalsefor it. Root can read the file, socontentsEqualreturnstrue.test_cookieInXDGSpecPathlooks for the cookie file underNSHomeDirectory(). The cookie storage gets its folder fromFileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask), which uses$HOME/.local/share, as the XDG spec says (_xdgHomeURLin swift-foundation).NSHomeDirectory()reads the home directory fromgetpwuidbefore it looks atHOME, so the test looks under/root.Modifications:
test_contentsEqual: as root, expecttrue, because both files are empty and root can read them, like the existing Windows branch. Other users still expectfalse.test_cookieInXDGSpecPath: build the expected path from$HOME, the value the cookie storage uses, and keepNSHomeDirectory()whenHOMEis not set.Result:
The two tests pass as root, as a regular user, and when
HOMEdiffers from the home directory in/etc/passwd. Only tests change.Testing:
All tests in the
swift:6.4.1-nobleDocker 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 ||
TestFileManagerandTestHTTPCookieStorage, root,HOME=/root|test_contentsEqualfails | pass ||
TestFileManagerandTestHTTPCookieStorage, 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).