Commit 9639878
fix(crawl): make TestConfigureLauncher/sandbox pass in containers (LAB-4994) (#184)
* fix(crawl): assert TestConfigureLauncher sandbox against go-rod baseline (LAB-4994)
TestConfigureLauncher/sandbox asserted the absolute presence of the
`no-sandbox` launcher flag. go-rod's launcher.New() adds --no-sandbox by
default when it detects a container (defaultFlags[NoSandbox] set when
inContainer), so l.Has("no-sandbox") reported true in Docker/dev-containers
regardless of Vespasian's own logic. The three "flag should be absent"
sub-cases therefore failed inside containers, breaking `make check`
locally even on a clean checkout.
Assert on Vespasian's contribution relative to the launcher baseline
instead of the absolute flag: the flag must be present whenever
configureLauncher opts in, and otherwise must match go-rod's default.
On CI's VM runner (no container -> baseline absent) this reduces to the
original assertion, preserving full regression detection of Vespasian's
sandbox logic; in dev-containers (baseline present) it passes for both
uid 0 and uid != 0. Test-only change; no runtime behavior is altered.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(crawl): assert Vespasian sandbox decision via pure helper (LAB-4994)
Extract the no-sandbox opt-in decision (opts.NoSandbox ||
VESPASIAN_NO_SANDBOX=="true") from configureLauncher into a pure
vespasianEnablesNoSandbox helper and assert on it directly in the sandbox
subtest, alongside the existing launcher-baseline Has("no-sandbox") check.
The prior baseline-relative assertion (want := tt.vespasianOn ||
baselineNoSandbox) becomes a tautology inside dev-containers, where
go-rod's launcher.New() auto-adds --no-sandbox so baselineNoSandbox==true:
the three negative cases would then pass even if configureLauncher were
regressed to unconditionally enable the flag. Asserting the pure decision
directly restores full regression detection in every environment (verified
in-container: injecting an always-on regression now fails the negative
cases), while the launcher-baseline check is kept for go-rod compatibility.
Addresses capability-pr-review findings SEC-BE-001 / TEST-001 and the Codex
review suggestion on PR #184. browser.go runtime behavior is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor(crawl): dedupe sandbox doc comment and test options literal (LAB-4994)
Address non-blocking review nits from capability-pr-review on PR #184:
- QUAL-001: configureLauncher's doc comment restated the no-sandbox opt-in
condition that now lives in vespasianEnablesNoSandbox; trim it to reference
the helper so the condition has a single documented source of truth.
- TEST-001: hoist the BrowserOptions{NoSandbox: tt.noSandbox} literal into one
local reused by both the helper assertion and the configureLauncher call.
No behavior change; make check (fmt, vet, lint, go test -race ./...) passes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* docs(crawl): reword vespasianEnablesNoSandbox helper comment (LAB-4994)
Address capability-pr-review QUAL-001 (nit): the helper reads
os.Getenv("VESPASIAN_NO_SANDBOX"), so 'pure helper' was inaccurate.
Reword to 'self-contained helper'. Comment-only; no behavior change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test(crawl): address capability-pr-review nits on sandbox test (LAB-4994)
- QUAL-001: reword test comment 'pure helper' -> 'self-contained helper'
to match browser.go (the helper reads an env var, so not pure).
- QUAL-002: rewrap browser.go helper doc comment to <=79 cols.
- TEST-001: document the load-bearing 'CI runs on a non-container VM'
assumption behind the launcher-baseline assertion (vacuous in a
container; the vespasianEnablesNoSandbox assertion is the
environment-independent guard).
Comment/test-only; no production behavior change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 9ed54b6 commit 9639878
2 files changed
Lines changed: 63 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
60 | 73 | | |
61 | | - | |
62 | | - | |
| 74 | + | |
| 75 | + | |
63 | 76 | | |
64 | 77 | | |
65 | 78 | | |
66 | 79 | | |
67 | | - | |
| 80 | + | |
68 | 81 | | |
69 | 82 | | |
70 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
57 | 71 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
62 | 76 | | |
63 | 77 | | |
64 | 78 | | |
| |||
70 | 84 | | |
71 | 85 | | |
72 | 86 | | |
73 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
74 | 101 | | |
75 | 102 | | |
76 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
77 | 117 | | |
78 | | - | |
79 | | - | |
| 118 | + | |
| 119 | + | |
80 | 120 | | |
81 | 121 | | |
82 | 122 | | |
| |||
0 commit comments