* ci: a repo-wide test pipeline, and the suites Camoufox was missing
Nothing checked a pull request before this. `build.yml` runs on tags and takes
about forty minutes, and `lint.yml` ran a single static script, so a change
could reach main having had no browser suite run against it at all.
This adds one pipeline, driven identically from a pull request, a push to main,
and -- through `workflow_call` -- any caller that needs to test a specific
browser version, so there is exactly one definition of "the tests pass".
resolve ──┬─ static ────────── tribal rules, skiplist, self-tests
├─ pythonlib ─────── the package's own tests
└─ build ──┬─ playwright upstream × 6 shards (conformance)
├─ playwright vendored (regression)
├─ native ───────────── leaks, contexts
├─ patch guards ─────── one per spoofing patch
├─ build-tester ─────── 8 fingerprint profiles
└─ sundial ──────────── stealth grade (off, see below)
│
summary ──► one comment on the PR
Two Playwright suites, because they answer different questions. `tests/` is a
frozen ~v1.55-era fork carrying roughly 1800 lines of Camoufox adaptations, so
every test in it has a known prior outcome: that is the regression check. The
upstream suite is fetched fresh at the tag `ci/versions.py` resolves and runs
unmodified, which is the conformance check -- `ci/pw_camoufox_plugin.py` adapts
the environment around it rather than editing it, hooking BrowserType at the
_impl layer so upstream can refactor its fixtures freely.
`native-tests/` covers what neither can ask about: that resource cost does not
scale with launch count (the shape an FD or socket leak actually has), that two
contexts in one browser get different fingerprints while two pages in one
context get the same one (get this wrong and per-context injection silently
degrades to process-global, which passes every single-context test there is),
and that decisions already made stay made -- `ci/tribal-rules.yml` lists them
with the issue or PR that settled each.
Cost is tiered so a two-second lint failure never reaches a build, and a
driver-only pull request never builds at all: it fetches the published release
and tests against the build users are actually running, a minute instead of
seventy. Merges gate on one required check, `All tests passed`, so the
branch-protection list does not need editing every time a suite is added or
resharded; `ci/branch-protection.json` holds the settings so they are reviewable
rather than lore.
**The stealth check ships disabled** (`ci/sundial.yml: enabled: false`). It
drives a private detection suite, and the deployment it talks to predates that
suite's score mode; an older one ignores `?score=1` and posts the entire report
-- every vector's id, name, brief, source and value -- to whatever collector
asked. Receiving that on a public runner and discarding it afterwards is not the
same guarantee as never being sent it, so while the flag is false the job is not
scheduled, no credential enters a runner, and `run_sundial.py` refuses a hand-run
too. When it is enabled, `redact()` publishes a grade and counts against a
runtime whitelist and refuses anything that is not already aggregated.
Also included: the fixes these suites exposed on a clean runner -- build-tester
hashing canvas pixels rather than a prefix of the data URL, the virtdisplay
cleanup when Xvfb has already died, a juggler sandbox released on frame destroy
rather than only on navigation, and the pythonlib geometry and version-floor
corrections. `lint.yml` is removed because the static job absorbed its one check.
Verified locally: ci/tests 68 passed, tribal rules 24 passed, pythonlib 209
passed, input-dispatch clean, `ci.versions` resolves 152.0.4/beta.31 against
playwright v1.61.0, and `ci.summarize` folds a run to "all suites passed".
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* ci: make result files survive the trip from job to summary
The first full run failed, and the summary could not say why: five suites came
back "required, but produced no result", including two whose jobs had passed.
Three separate plumbing bugs, none of them in a test.
**Hidden files.** `actions/upload-artifact@v4` excludes dotfiles unless told
otherwise, and every result we write lives under `.ci-work`. The jobs whose
`path:` was a list containing a glob uploaded nothing at all -- the Playwright
suites and the leak suite each wrote their evidence and then had it silently
dropped:
evidence -> .../.ci-work/results/playwright_vendored.json (fail, 1203 tests)
##[warning]No files were found with the provided path: .ci-work/results/
.ci-work/junit-*.xml. No artifacts will be uploaded.
**Common root.** Where a list did upload, the second entry moved
upload-artifact's common root from `.ci-work/results/` up to `.ci-work/`, so the
JSON arrived at `results/build_tester.json` instead of the artifact root. The
summary merges every `results-*` into one directory and `load_all()` globs a
single level, so the file was there and invisible. build_tester passed and was
reported missing.
Every `results-*` artifact now uploads exactly `.ci-work/results/`, with
diagnostics (junit XML, the build-tester graded tree) split into their own
`diagnostics-*` artifacts that the summary's `results-*` pattern ignores.
`include-hidden-files: true` everywhere that touches `.ci-work`.
**A required name nothing writes.** `static` was in the required list, but it is
a job, not a suite -- no runner writes a result by that name, so summarize
reported it missing on every run including a wholly green one. The suites that
job runs are the pipeline self-tests, which write no result, and native_rules,
which is required by name. The job is already covered: the gate fails on any job
that is not success.
Three guards, each verified by reintroducing the bug it catches:
- results-* artifacts upload exactly one path, so nothing nests
- anything touching .ci-work sets include-hidden-files
- every required name is one some runner can actually write
This changes no test. The real failures the first run found -- 6 in the vendored
suite, plus upstream shards 1 and 5 and the leak suite -- were masked by the
above and should now be reported rather than swallowed.
ci/tests 71 passed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* test: two failures that were the tests' fault, not the browser's
**The leak check waited on the wrong set of processes.**
`test_a_single_launch_leaves_nothing` failed with Gecko's GPU probe still alive:
1 process(es) this test started are still alive: glxtest(2887, now ppid=1)
`settle()` polled `children(recursive=True)`, but `survivors()` judges the
sampled PID set -- deliberately, so that a process reparented to init cannot
hide a leak. Those two sets differ exactly when a process outlives its parent:
it stops being our child, `settle()` sees nothing left and returns at once, and
anything still winding down is reported as leaked. `glxtest` does this on every
launch; it is spawned by Gecko, its parent exits first, and it needs a moment.
So settle on the set the assertion actually uses. This is a grace period, not an
exemption -- a process that is still there when the timeout expires fails the
test exactly as before, and no name is special-cased.
**Playwright renamed a protocol method the tracing tests spelled out.**
`Page.waitForEventInfo` is `Page.__waitInfo__` in newer versions, so two tracing
assertions failed on a name, not on behaviour. The suite is pinned to a range
(`playwright<1.63`), not a version, so hard-coding either spelling is wrong.
Normalised in `get_trace_actions()`, next to the comment about the last time
Playwright moved this data -- the tests care which actions ran and in what
order, not what Playwright calls them this month.
Neither of these was Camoufox misbehaving.
Still failing, and genuinely about the browser or by design -- triaged next:
navigation popup load state, locator handler visibility, clock pause off by 1ms,
websocket close reason, and the three upstream ones (request headers, worker
locale, screencast viewport) which all look like deliberate spoofing divergence
and probably belong in the skiplist with a stated reason.
ci/tests 71 passed, tribal rules 24 passed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix: the failures the new pipeline found, and the flake that hid them
Eleven gates were red on PR #9. Each one is now either a fixed defect or an
entry that says why the test cannot apply here -- nothing is silenced.
One real browser bug, found by the conformance suite:
The compositor-backed screencast added in fa8a935 reported the *scaled frame*
size as the viewport. Playwright's Firefox delegate maps deviceWidth/Height
straight onto the client-visible viewportWidth/viewportHeight, and every other
backend fills them from the page's viewport -- the native path right below it
sends pageWidth/pageHeight, clamped to the viewport and never scaled. So a
client asking for a 500x400 frame of a 1000x400 page was told the viewport was
500x200, and asking for a frame *larger* than the page reported a viewport
larger than the page. Confirmed against the built binary, fixed, and confirmed
again: 11 screencast and video tests pass, where the requested size no longer
moves the reported viewport at all.
Four stale expectations in the vendored suite. All four pass in upstream's
v1.61 suite against this same binary, which is what identified them as the
suite's problem rather than the browser's:
websocket Firefox no longer collapses a refused handshake to
CLOSE_ABNORMAL; it reports the HTTP status, like the other
engines. The handler also set a settled future twice, which
surfaced as a suite ERROR rather than a failure.
navigation Firefox now reports a window.open('') popup as "complete". The
old assertion also mis-parsed -- the conditional bound to the
whole assert, so the non-Firefox arm compared nothing.
locator expect().to_be_visible() kept re-arming the locator handler the
click was still waiting to see finish, so the check meant to
observe the interstitial kept it alive. One-shot is_visible().
page_clock resume() before reading the clock added the real second spent in
wait_for_timeout back, landing at 1001 -- one millisecond out,
every time.
Two upstream tests that encode a stock-Firefox quirk this fork does not
reproduce, now in the skiplist with the reason:
A worker inheriting the context locale -- upstream expects en-US from a
ru-RU context, citing playwright#38919, because stock Firefox applies the
locale to the page and not to its workers. Camoufox sets it below that layer,
so matching upstream would mean reintroducing a main-thread/worker
disagreement that anything looking in both places gets for free.
"Firefox" in the User-Agent -- the bare binary advertises its own build
token; the Python package replaces it when it injects a fingerprint. The
vendored suite already asserts what this layer can promise.
And three pieces of the harness that were reporting badly:
A profile that asked for llvmpipe is no longer graded as headless. camoufox's
own preset pool ships "llvmpipe, or similar", so when that preset is drawn,
reporting it is the WebGL spoof working -- and grading it a failure made this
gate fail at random depending on which presets the run happened to draw. The
check still fails on a software renderer the profile did not ask for, which
is the case it exists for.
junit ids put a test's class in the path (test_page_clock/TestWhileRunning.py
::test_should_pause), naming a directory that does not exist -- so the id
could not be fed back to pytest and no skiplist entry could match it.
A `test:` skiplist entry was compared for exact equality against a node id
that always ends in [firefox], so every such entry was a silent no-op: the
test went on running and failing while the list read as handled.
Finally, `mach bootstrap` pulls toolchains from Taskcluster, and a connection
reset there failed the whole pull request (run 34673115086). ci.run_prepare
retries the two steps that download things, and only when the failure reads as
transient -- a failed patch hunk still fails on the first try, because retrying
a broken tree only spends a runner to reach the same answer.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* docs(ci): say what the stealth gate actually guarantees now
The README described a `ci` role that is not merged into sundial's master and
so is not deployed, and a kill switch that had since been flipped. Both claims
now match what is running.
The substantive change is separating the two halves of the guarantee, because
only one of them is enforced by the server: `guest` is refused the
private-vector bundle by sundial's middleware, and this repository refuses to
process anything that is not a score payload. What is still missing is a server
that refuses the *request* -- which is what the `ci` role adds, and why the
upgrade path is worth keeping written down rather than implied.
Also documents ci.run_prepare, since "the build retries" is the kind of thing
that needs its limits stated: the network, and nothing else.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): authenticate to sundial with either shape of credential
`SUNDIAL_AUTOMATION_KEY` has been two different things over this repository's
life -- an automation key for `/automated?key=`, which is what sundial's
`make pages-automation-keys` mints and what resolves to the `guest` role, and a
password for the login form. They are indistinguishable by inspection, and the
gate only knew how to use it as a password, so a repository holding a key would
have failed to log in with no hint as to why.
Try the key route first, since it needs no username and so nothing has to be
kept in step with whatever `GUEST_USER` was set to, and fall back to the form.
When the secret really is a password the only cost is one extra request that
401s. If both routes fail the error names both attempts and says what the secret
is supposed to be.
Also sends browser headers on every request rather than `User-Agent:
camoufox-harness`. Cloudflare sits in front of this host and refuses a document
request from a non-browser agent before it reaches sundial at all, which
produces a 403 that looks like a permissions problem and is not one.
test_a_disabled_gate_makes_no_request now makes every route out fatal --
authenticate() and both login functions, not just the one main() used to call --
so the kill switch cannot be bypassed through a path the test does not watch.
Mutation-checked: making the gate ignore `enabled:` fails it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): never let run_prepare invent a success
`--attempts 0` would have fallen straight past the loop bound and returned 0
without running the step at all, which is the one answer it must not invent.
Clamps to one attempt and makes falling out of the loop an assertion rather
than a bare success.
Also corrects a direction in the screencast comment: the native path it
contrasts with sits above _startSnapshotScreencast, not below it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): a sundial category nobody has ruled on now fails the gate
ci/sundial.yml partitions sundial's taxonomy: its nine SECTIONS labels
(Identity, Security, JS Engine, Graphics, Display, Locale, Audio, CPU, Network)
are exactly the six gated plus the three ungated, with nothing left over. That
is now asserted, because it is the property the pass rate depends on and
nothing was checking it.
If sundial grows a tenth section, every check in it used to fold into
"out of scope" -- measured, never gated, and indistinguishable in the summary
from a category someone had deliberately decided not to gate. That answers
"does Camoufox claim this?" by default, in the only direction that never fails
a build: a stealth blind spot that reads as a clean run.
The count is now carried separately and fails the gate, with a note saying to
put the new section in one list or the other. Only ever a count -- which
category, like which vector, does not leave redact().
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): stream the prepare log, and make its timeout real
Two problems with capturing the output of `make dir` / `make mozbootstrap`
instead of streaming it. The visible one: the step printed nothing for minutes
while aria2c pulled a 500MB tarball, which looks exactly like a hung job. The
one that mattered: draining the pipe on the calling thread blocks in readline
until EOF and only *then* reaches proc.wait(timeout=...), so a step that wedged
without printing anything -- a stalled download, precisely the failure this
module exists for -- would never have been timed out at all.
The reader now runs on its own thread, so output appears as it arrives and the
timeout covers a silent hang. Both are asserted against real processes:
stdout and stderr both survive into the text the transient-classifier reads,
and `sleep 60` under a 2s timeout dies in 2s with exit 124 rather than
reporting success.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* docs(ci): two comments that said less than they meant to
The skiplist header claimed to quote failure text it only described, and the
sundial header comment had lost the word that made it a sentence.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* docs(ci): the stealth job comment described the role we do not have yet
It claimed the credential is for a role sundial refuses to serve a report to.
That is the `ci` role, which is not deployed. Says what is actually true of
`guest` instead: the request asks for counts, the role cannot load the private
vectors, and the gate refuses a payload that is not a score.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* test(ci): name what this section actually asserts
The heading said "the score-only `ci` role" and the docstring said the gate
runs as a role sundial refuses to serve a report to. Neither is true yet --
that role is not deployed. What the tests actually pin is that score mode is a
requirement rather than a preference: a full report is refused whoever asked
for it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): the sundial credential must not ride out on an error message
Whatever reaches result.note() is written to the results artifact and posted as
a pull request comment. An exception raised inside urllib can carry the URL that
produced it -- and for the token route that URL *is* the credential,
percent-encoded in the query string. A 401 from a stale key would have published
the key.
Every string built from an exception now goes through scrub() first, which
removes both the raw secret and its percent-encoded form. The message still says
which routes were tried and what the secret is supposed to be, so a real
misconfiguration is still diagnosable from the log alone.
Mutation-checked: with the replacement removed, both new tests fail.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* docs(ci): say which role the private-vector gate actually blocks
"serves that bundle to nobody else" read as though sundial withheld the private
vectors from everyone. It withholds them from `guest` specifically -- admin and
private still get them -- which is the whole reason CI authenticates as the
least privileged account rather than whichever one was to hand. Verified against
the deployed middleware: guests get a 200 with a no-op body, not a 404.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* docs(ci): the Cloudflare 403 is narrower than the comment claimed
It said any non-browser User-Agent is refused. In fact `POST /__auth/login`
worked for months with `User-Agent: camoufox-harness` -- the block tracks
document-shaped requests, which is what `/automated?key=` is. Browser headers
everywhere are still right, but as "cheaper than remembering which hop is
which", not as a fix for an outage that was never happening.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): verify the sundial role instead of assuming it
The CI log for the first real run says `sundial auth OK (automation key)` --
the stored credential is an automation key, not a form password. Which matters
more than it sounds: sundial's `/automated?key=` resolves to the **private**
role when handed the private key and to `guest` when handed the guest one, and
the two are indistinguishable by looking at them. `private` is served the
private vectors.
So the guarantee this gate has been documenting -- "CI runs as a role sundial
withholds the vectors from" -- was resting on whoever set the secret having
picked the right key. redact() does not help here: it governs what this
repository *publishes*, not what the browser is *given*, and the thing being
prevented is a public runner holding the vectors at all.
The gate now reads sundial's own /__auth/me and refuses to open the browser
unless the session is a role the vectors are withheld from. Not knowing the role
counts as not safe: an absent or unreadable endpoint fails closed, because the
alternative is loading them on the assumption that the credential was right.
Probed live: a bogus cookie yields no role and the check refuses, as it should.
The positive case is what the next run confirms -- and if that credential turns
out to be the private key, this goes red, which is the correct and useful
outcome.
Also corrects the Cloudflare comment, which I had just rewritten on a false
premise. The form-login route was never exercised in CI (the gate shipped
disabled), so "POST /__auth/login worked for months with camoufox-harness" was
unfounded. What is measured: /automated?key= answers 401 with a browser
User-Agent and 403 with urllib's default -- and since that is the route the real
credential uses, the browser headers were load-bearing, not cosmetic.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): record the sundial role in the evidence, not just in the log
`result.metrics["sundial_role"]` was set before the scan and then thrown away:
redact()'s output replaces result.metrics wholesale a few lines later. The check
itself was unaffected -- it ran, and it fails closed -- but the saved artifact
did not say which role had been confirmed, which leaves "the vectors were never
served to this session" unverifiable after the fact. That is most of the reason
to record it.
Caught by reading the artifact the live run actually published, not by the 105
tests, none of which exercised gate() end to end. There is now one that does,
and it fails when the re-assignment is removed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* test: delete the vendored Playwright fork, keep only what is ours
`tests/` held a fork of a ~v1.55-era playwright-python suite, run in CI as
`playwright_vendored` alongside upstream's own suite. Measuring the two against
the same binary says the fork was strictly the weaker of them:
* 73 of the 74 tests it skipped as "Not supported by Camoufox" PASS in
upstream's copy. Those skips predate main-world execution and were never
revisited, so the fork was asserting the browser is worse than it is.
* Of its passing tests, eight had no upstream counterpart. Six were genuinely
Camoufox-specific; the other two were tests upstream had since renamed.
* Everything else was upstream code, one generation stale, run twice.
So the fork goes, and the six tests that were doing real work become
`tests/camoufox/` -- three modules that `ci/suite.py` overlays into the fetched
upstream checkout, where they run against its conftest and its server at
whatever tag was resolved. Nothing frozen, so nothing to go stale.
Two of them take over from skiplist entries that had been pointing at the fork:
* the worker locale. Upstream expects a worker NOT to inherit the context
locale (playwright#38919); Camoufox sets it below that layer, so its workers
agree with the main thread. A page/worker disagreement is a free signal, so
the replacement asserts they match rather than hardcoding one string.
* the User-Agent. The bare binary advertises `Camoufox/<version>`, not
`Firefox/<version>`, and only the Python package rewrites it. The
replacement asserts a well-formed Gecko token and, more usefully, that the
wire and the DOM agree on it.
A skiplist entry that hands its job to another test now says so in a
`replaced-by:` field, and `ci/summarize.py` fails the run if that file does not
exist -- otherwise a rename quietly turns "covered elsewhere" into "not covered".
Also here, because deleting the fork exposed them:
* `tests/local-requirements.txt` was the only thing holding the suite below
pythonlib's `playwright = "<1.63"` ceiling, and it is gone. `ci/versions.py`
now applies that ceiling directly, so a future Firefox bump cannot silently
resolve to a client the shipped package refuses to install.
* the pytest header named `<plugin dir>/skiplist.yml` whatever it had actually
read. Since ci/suite.py copies the plugin into the checkout, that was a path
with no file at the end of it -- misleading precisely when someone is chasing
down a skip. It now reports the file it loaded.
* the summary line printed "Camoufox 152.0.4 ... against Playwright v1.61.0,
which targets Firefox 151.0", which reads like a misconfiguration. Playwright
trails Firefox and skips generations -- it pinned 151 then 153, never 152 --
so it now says which rule picked the tag and that the browser is Firefox 152.
`make tests` runs the one suite. Verified: the three overlaid modules pass
against 152.0.4-beta.31 (8/8), the overlay refuses to shadow an upstream module
and is idempotent across a reused checkout, and both new guards were
mutation-checked. ci/tests: 112 passed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* feat(ci): a local way to ask where the stealth failures are
"Which five sundial checks failed?" has no answer in CI, and the reason is worth
writing down rather than rediscovering: score mode's payload is buckets keyed
"<Category>|<class>" holding two integers each. It carries no check names and no
ids, so a failing check's identity is not something the gate discards -- it is
something sundial never sends. No artifact, log or sealed report can recover it.
What the payload does know is which category the failures are in, and the gate
was throwing that away too. `--explain` prints a per-category breakdown, and:
* it prints, never records -- `result` is untouched, so the artifact still
carries only `_PUBLISHABLE`;
* it is refused outright under GITHUB_ACTIONS, before anything is sent. A
category table is not a vector, but "Graphics 3/17" is the most useful
single fact an adversary could take from a public log, which is precisely
why redact() does not publish one;
* it says in its own output that names need --allow-full-report and a role
sundial serves full reports to, so a reader does not mistake the category
view for the whole answer;
* an unclassified category is flagged there too, on the same rule the gate
uses -- a new sundial section must not default to ignored.
Also corrects ci/README.md, which claimed "identities in the results file are
HMACs". They are not, and have not been: redact() ships no per-check rows at
all, deliberately, because a map of HMACs still says how many distinct checks
fail and lets a reader follow one across releases. The README was describing a
weaker guarantee than the code actually makes.
The CI refusal is mutation-checked. ci/tests: 116 passed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): 193 of the 202 tests the skiplist skipped actually pass
The skiplist was wrong, and wrong in the way that matters: it claimed the
browser could not pass tests it passes, and the stated reasons made that look
checked.
Where it came from: the first version of ci/skiplist.yml took all nine
`tests/async/*.disabled` modules from the vendored suite -- a 1:1 match, nothing
independently derived -- and gave each a plausible justification without running
any of them. That is the exact thing the file's own header calls "a regression
wearing a disguise", committed in the commit that wrote the header.
Ran every entry with the skiplist disabled, against 152.0.4-beta.31:
test_element_handle.py 59 skipped 0 fail
test_popup.py 26 skipped 0 fail
test_dispatch_event.py 12 skipped 0 fail
test_check.py 9 skipped 0 fail
test_launcher.py 9 skipped 0 fail
test_focus.py 6 skipped 0 fail
test_fill.py 3 skipped 0 fail
test_click.py 71 skipped 2 fail
client_certificates 5 skipped 5 fail
(two individual tests) 2 skipped 2 fail
Seven of nine modules failed nothing at all. 193 of 202 passed. The suite was
reporting 1339 passing while silently excluding 193 more that also pass -- and
nothing would have caught those 193 regressing.
Some reasons were not just over-broad but wrong. test_popup.py was skipped for
"Camoufox resolves the User-Agent from its fingerprint config, so an arbitrary
override does not and must not stick"; the two UA tests in it pass, because the
bare binary under plain Playwright does honour `user_agent=` -- the fingerprint
resolution is in the pythonlib wrapper, which this suite does not use. The
neighbouring test_request_headers_should_work entry gets that distinction right,
four entries earlier. test_dispatch_event.py was skipped for "Camoufox only
emits trusted events"; that is true and those tests never assert isTrusted.
So: 13 entries down to 5. test_click.py narrows from the module to the two tests
that fail -- Playwright's stable-position wait polls the bounding box then
dispatches instantly, and the humanized path spends real time travelling, so an
animating button is clicked mid-flight (offset 100, expected 300). The
client-certificate module stays whole: all five fail at the TLS layer, which is
support that genuinely is not compiled in. The `[chromium]` and `[webkit]`
patterns are deleted -- the runner pins `--browser firefox`, so they matched 0
tests and only made the list look more considered than it was.
And the guard, because a reason is an assertion about the browser and nothing
was checking it: ci/run_skiplist_audit.py runs every entry with the skiplist
disabled and FAILS THE BUILD if a skipped test passes. It is cheap exactly
because a correct skiplist is short -- 9 tests, 8 seconds -- so it runs on every
PR in tier 3a and is a required gate. Mutation-checked both directions: exit 1
naming the newly-passing tests when a stale entry is re-added, exit 0 now.
ci/tests: 118 passed, including that every shipped entry is actually auditable
(a `pattern` entry cannot be, and now fails that test rather than riding along
unverified).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* feat(ci): run the sync suite too, and say what is left out
The Playwright gate ran `tests/async/` and nothing else. Upstream v1.61 collects
2306 tests; that was 1584 of them. The other 722 -- `tests/sync/` (715),
`tests/common/` (4), `test_reference_count_async.py` (2), `test_installation.py`
(1) -- never ran, and unlike a skiplist entry there was nothing anywhere saying
so. No reason was recorded because there was no decision: the vendored fork in
tests/ carried `async/` and `async_imp/` and no sync suite, and this runner was
pointed at the same shape without checking what upstream had. Same inherited
shape as the stale skiplist, one level up.
TARGETS now names `tests/async/` and `tests/sync/`. The sync API is a greenlet
wrapper over the same Juggler traffic, so much of it duplicates async at the
protocol level; it is here because pythonlib ships a sync API users actually
drive, and the wrapper has its own timeout and reentrancy behaviour the async
tests cannot reach.
ISOLATED_TARGETS runs `tests/common/` and `test_reference_count_async.py` in a
second pytest process, on the first shard only. They cannot share a process with
the others: each calls sync_playwright()/async_playwright() inside the test body,
which cannot start while the session fixtures hold a loop. Together all six fail
with "Cannot run the event loop while another loop is running"; alone all six
pass. They are worth the extra invocation rather than dropping, because
ProtocolCallback objects accumulate when the browser never replies to a protocol
message -- and this fork patches Juggler heavily, so that leak can be ours.
EXCLUDED holds the one real exclusion with its reason: test_installation.py
pip-installs playwright to check packaging, which exercises Playwright's release
process and not this browser. A self-test requires every exclusion to carry a
reason.
And unclaimed() closes the level above the skiplist: if upstream adds a test path
that is in neither set, the run errors instead of quietly getting narrower. It
ignores assets/ and golden-*/ fixtures, and a self-test proves it catches a new
tests/integration/.
Verified against the CI-built binary: 2225 passed, 0 failed, 66 skipped, 2291
collected. ci/tests: 122 passed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): client certs are only unsupported where the BROWSER does the handshake
The skiplist audit failed its first CI run, on an entry written one commit
earlier. It was right to.
`tests/async/test_browsercontext_client_certificates.py` was skipped as a whole
module, reasoned as "client-certificate support is not built into the Camoufox
binary". On the GitHub runner two of its five tests pass:
test_should_throw_with_untrusted_client_certs PASSES
test_should_work_with_global_api_request_context PASSES
test_should_work_with_new_context fails
test_should_work_with_new_context_passing_as_content fails
test_should_work_with_new_persistent_context fails
The split is not noise. Playwright offers client certificates two ways:
playwright.request.new_context(client_certificates=...) the Node driver does
the TLS handshake itself -- works, and those are the two that pass.
browser.new_context(client_certificates=...) the BROWSER does the
handshake -- and this build has nothing to do it with.
So the reason was over-broad rather than wrong, and a module entry was exactly
the shape that hid the distinction. Now six per-test entries, async and sync,
naming the browser-side handshake specifically.
Worth recording how the bad entry got written, because the mechanism matters
more than the entry: locally all five fail, because this machine's Node/OpenSSL
rejects the fixture server outright ("wrong version number"). That looked like
uniform absence of support and it was not. A local run is a hypothesis; CI is
the authority for what fails. The audit is what turned that from an opinion into
a build failure, one run after the mistake.
The sync entries assume the same split from identical test names; the audit will
confirm or correct that on the next run rather than my asserting it from here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): async and sync cannot share a pytest process
Adding tests/sync/ to the same pytest run as tests/async/ produced 50 tests that
passed only on retry. 47 were fixture-setup errors in two fetch modules:
RuntimeError: Runner.run() cannot be called from a running event loop
Upstream's sync suite is a greenlet wrapper; its async suite runs under
pytest-asyncio. In one process, whichever runs second breaks the other's loop.
Measured, against the CI-built binary:
tests/async alone 1526 passed, 1 timing flake
the two fetch modules alone 102 passed
async fetch + one sync module 14 failed
sync module first, then async fetch 46 errors
So sharding was not hiding anything -- async alone is clean -- and the fault is
the mixing, not the size of the run.
What makes this worth a structural fix rather than a retry budget: the damage
lands in async FIXTURE SETUP, so it presents as "the fetch tests are flaky" --
a browser-shaped symptom for a harness-shaped cause -- and the retry pass then
makes it vanish. Left alone, CI goes green with 50 silent retries, and the
natural response to any that stuck would be a skiplist entry recording a browser
failure that does not exist. That is the failure this branch has spent its last
several commits removing.
GROUPS now names three sets, each run in its own process: tests/async/,
tests/sync/, and (tests/common/ + test_reference_count_async.py). The first two
shard; the third is six tests and does not, because splitting it hands some
shard an empty selection and pytest exits 5 for that. The pairing in the third
group is measured, not assumed -- those two run together cleanly (6 passed).
Retries stay inside their own group, for the reason the groups exist.
Verified: 2225 passed, 4 failed, 66 skipped, 2295 collected, and 1 retry-passer
instead of 50. All four failures are the two client-cert tests that go through
playwright.request.new_context(), which fail only on this machine -- its
Node/OpenSSL rejects the fixture server ("wrong version number"). They pass on
the runner, which is why they are not skiplisted; the audit is what will hold
that claim honest. Expect 2229/0 in CI.
ci/tests: 124 passed, three of them pinning this shape -- async and sync in
different groups, no target in two groups, and the small group unsharded.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): refuse to test a Firefox the branch does not pin
Suite selection follows the browser version correctly: ci/versions.py resolves
Firefox 155 to Playwright v1.62.0 and 152 to v1.61.0, and the workflow threads
`browser_version` from workflow_call/dispatch through resolve into the Playwright
job, which fetches that tag. That half works.
The other half does not. Nothing else honours the input:
ci.run_build / make read upstream.sh
fetch-browser `python -m camoufox fetch`, whatever is current
ccache key uses the resolved version (cosmetic)
So `browser_version: 155.0` on a branch pinning 152.0.4 compiles 152 and judges
it against the suite chosen for 155. It passes, it means nothing, and no output
anywhere says the browser and the suite are describing different releases. For a
gate whose entire job is to make an upgrade provable, that is the worst
available outcome.
The legitimate flow never had this in it: an upgrade to a new Firefox is a
branch that edits upstream.sh -- that is what an upgrade is -- and resolution
then reads it by default, so the build, the suite and the input cannot disagree.
The mismatch only arises from a dispatch that asks for a version the branch does
not pin.
`--check-upstream` refuses that combination with a message saying what would
have happened and what to do instead (bump upstream.sh). The workflow passes it,
and a self-test asserts the workflow passes it, because a guard nothing invokes
is decoration. Mutation-checked.
Not fixed here, and deliberately: making the build honour an arbitrary version
would mean synthesising an upstream.sh -- version plus release tag plus
closedsrc_rev -- for a release that may not exist. Refusing the contradiction is
the honest amount of machinery for it.
ci/tests: 126 passed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): the fetched browser must be the generation the suite was chosen for
A driver-only pull request does not build. It downloads the current release,
which is the right browser to judge a driver change against -- it is what users
run. But the Playwright suite is chosen from upstream.sh, and those two agree
only until an upgrade window opens.
The sequence that breaks: the version agent bumps upstream.sh to Firefox 155 and
that merges. No build of 155 is published yet. The next driver-only PR resolves
its suite for 155, fetches the published 152, and tests the old browser against
the new suite. It passes, and says nothing.
Today they happen to agree exactly -- upstream.sh pins 152.0.4-beta.31 and the
latest release is v152.0.4-beta.31 -- which is timing, not a guarantee, and
precisely the kind of coincidence that hides this until the upgrade it is
supposed to protect.
So the fetch step now reports which build it installed and refuses a mismatch.
Beta drift inside a generation is fine and expected: beta.30 against beta.31
does not change which Playwright tag is right, and demanding an exact match
would fail every run between a bump and a release. A generation apart is not
fine, and that is what is checked.
Fails closed on input it cannot read, rather than passing by accident.
Mutation-checked. A self-test asserts the workflow actually invokes it.
ci/tests: 128 passed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): a driver-only pull request cannot satisfy a required build
The summary was told to require the `build` suite on every run:
required="pythonlib native_rules"
if [ "$browser_changed" != "skip" ]; then
required="$required build patch_guards ..."
fi
`browser_changed` is only ever `true` or `false` -- nothing emits `skip` -- so
the branch is always taken and `build` is always required. But the build job is
deliberately skipped whenever the browser was fetched rather than compiled, and
only that job writes a `build` result. summarize then reports
`build` is required but produced no result file. A suite that did not run
has not passed.
which is the correct rule applied to a suite that was never supposed to run,
and the gate goes red.
That blocked every pull request touching only pythonlib/, ci/, tests/ or the
documentation -- most of them, and precisely the cheap path ci/README.md
advertises as "driver-only pull requests never build". It was never seen
because this branch edits the Makefile and additions/, so its own runs always
took the build path.
The browser suites stay required either way: fetched or built, the browser is
there and they run against it. `build` is the only one that follows.
`test_build_is_required_only_when_the_browser_was_built` extracts the workflow's
own `required=` assembly and runs it under bash for both values, rather than
pattern-matching the shell -- the bug was a comparison that read as deliberate,
and only running it says what it does. Mutation-checked: restoring `!= "skip"`
fails it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): sundial being down is a skip, not a verdict on the browser
The stealth check drives a service on another host. Any failure reaching it --
DNS, a refused connection, the edge answering 502 for a minute -- came back as
ERROR, failed the job, and failed the merge gate. So an outage over there
blocked every pull request in this repository, including ones that had nothing
to do with stealth, and the only fix available to a contributor was to wait.
That is not a statement about the browser. When sundial cannot be reached the
browser was not measured at all, so neither a pass nor a failure is true. It is
now recorded as SKIP with the reason attached, the job exits 0, and
`ci/summarize.py --allow-skip sundial` tolerates it: shown on the summary table
with its own icon and its reason, and not a merge block.
The line is drawn at whether sundial answered:
down no HTTP reply at all (URLError, timeout, connection reset), or a
5xx, or a 429 -- the origin is broken or is refusing everyone.
answered everything else. 401 is a bad credential, 403 is the edge refusing
a non-browser request, and both are this repository's problem to
fix. Skipping past those would turn a misconfigured stealth gate
into a permanently green one.
And an answer stays an answer further in: a role sundial would serve the
private vectors to, a full report where a score was requested, a pass rate under
the floor -- all still fail, as before.
Both auth routes are tried, and the key route 401s whenever the stored secret is
a password rather than an automation key. One real reply is enough to know
sundial is up, so `authenticate()` reports an outage only when neither route got
an answer.
The skip note goes through `scrub()` like every other published string: the
token route puts the credential in the URL, and a URLError carries the URL that
raised it.
`--allow-skip` is per suite and nothing else is on the list. Every other suite
runs on the runner; none of them has this excuse.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* feat(ci): run the suite isolated first, and count what needs the main world
The conformance suite forced `disableWorldIsolation` for every run. That made
upstream's tests pass -- they assert upstream semantics, reading globals their
own page scripts defined -- but it measured a mode nobody ships, and it produced
no number at all for what isolation costs. Isolation is the reason this fork
exists; running 2229 tests against it turned off says less than it looks like.
Each group is now run up to three times:
1. isolated -- the configuration users get. A test reading a page-defined
global fails here by design.
2. the same failures again, still isolated. A pass is a flake, and a flake
must not be counted as a world difference.
3. what is still failing, with isolation off.
A test that passes in 3 is a **main-world fallback**: it counts as a pass -- the
browser does honour the contract -- and its identity is recorded in
`metrics.main_world_fallbacks`, with the count on the summary table. That count
is the isolated-world conformance gap. It is invisible in the pass/fail totals
by construction, which is exactly why it has to be printed: a jump in it means
the isolation boundary moved, and nothing else in this pipeline would say so.
A test failing in *both* worlds is a plain failure, as before.
`CI_WORLD` selects the world and defaults to isolated, so a plain
`pytest -p pw_camoufox_plugin` by hand measures the browser as it ships.
`_apply_world()` *clears* a stale `disableWorldIsolation` as well as setting it:
the passes are separate processes inheriting one job environment, and a
leftover flag would make the isolated pass quietly measure the main world --
which would silently zero the very number this is for.
Two things this depends on, fixed here:
Each group gets its own pytest cache. All three run in one checkout, and
pytest only drops a `lastfailed` entry when that test is collected again and
passes -- so with the shared cache the async group's rerun was selecting from
a set the sync group had also written into. Depending on which groups had
failed that meant re-running the whole group or selecting nothing at all.
Per-group, `--last-failed` means what it says, and passes 2 and 3 can use it
to name exactly the right tests.
`ci/run_skiplist_audit.py` pins the MAIN world. The suite now counts a test
needing the main world as a fallback rather than a failure, so a skiplist
entry has to claim the test cannot pass in either world -- auditing under
isolation would let an entry justify itself with a failure the suite would
never have counted, which is the same class of untrue-but-plausible reason
the audit exists to catch.
Shard merging sums the fallback counts and unions the identity lists; taking
the first shard's, as the generic metric merge did, would report a sixth of the
number. Mutation-checked, along with the stale-flag clear.
The first CI run on this is what establishes the real fallback count. The
plugin's own note put it at roughly 37; that was measured a while ago and is not
a promise.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* docs: describe the pipeline that exists, not the one that is coming
CONTRIBUTING.md and the pull request template still described the process this
branch replaced: run both suites by hand, screenshot the output, paste it in.
CLAUDE.md was already pointing at CONTRIBUTING.md for "the full pipeline" that
CONTRIBUTING.md did not mention. Since the premise of this work is that the rule
in CONTRIBUTING.md was never enforced, leaving it unchanged left the rule
describing the wrong thing.
Both now say what CI does and what the one required check is. The template no
longer asks for a screenshot: nothing checked that the browser in one was built
from the branch under review, which is the whole reason the pipeline exists, and
CI leaves its own report as a comment. The local commands stay, because running
build-tester by hand while working on a spoofing patch is still the fastest way
to find out whether it did what you meant.
Several comments described this repository as containing an auto-update harness
that is not in it: `ci/results.py` credited `verify.py` and "the repair agent"
with computing the verdict that `ci/summarize.py` computes, and `ci/sundial.yml`
and `ci/build-tester.yml` sited themselves relative to a `harness/policy.yml`
nobody can open. Each now names what actually decides here and marks the harness
as the out-of-repository caller it is. `run_sundial.py waive` says outright that
the file it prints a stanza for is not in this repository, which is worth
knowing before going to look for it.
Also: PEP 8 blank lines around `resolve_verstr()`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* perf(ci): drop the same-world retry -- 7m50s a shard, nothing recovered
The first real run of the isolated-first suite took 21m13s a shard against
4m34s before. Most of that was a pass that could not have worked. Shard 4, both
sharded groups:
isolated (full) 335s + 331s 35 and 11 failures
isolated retry 205s + 265s 0 recovered
main world 19s + 12s 46 recovered
The retry was there so that a flake could not be mistaken for a world
difference. It cannot do that job:
* These failures are deterministic. A test reading a global its own page
script defined does not intermittently stop seeing it.
* Failing that way is slow. The read returns undefined rather than throwing,
so the test sits on a Playwright timeout -- which is why re-running 46
known failures cost nearly eight minutes while proving them in the other
world cost thirty-one seconds.
* Upstream already reruns. The `105 rerun` on that first line is every one of
those 35 failures having been retried three times by the suite's own
pytest-rerunfailures before the run reported them. A flake does not survive
that, so there was nothing left for a fourth and fifth attempt to find.
So: isolated, then the main world, then -- only for what failed in BOTH -- one
retry. That last set is normally empty, so the retry is free on a healthy run
and still answers the one open question on an unhealthy one: a test no world
satisfies is either broken or flaky. It runs in the main world, where a pass
means "not reproducible" rather than "needed isolation off", which is already
known by then.
A flake surviving upstream's three reruns and then passing in the main world
would now be counted as a fallback rather than as a flake. That is the trade,
and it is worth it: the count is reported, not gated, and no verdict moves.
Also adds the guard that was missing between the phases. `--last-failed` with
nothing previously failed does not select nothing -- pytest declines to filter,
and runs the whole group. Unguarded, a group that passed cleanly under
isolation would have been re-run end to end in the main world, silently
replacing the result it was meant to refine. Both rerun passes are now behind a
non-empty check, and a self-test asserts it of every `--last-failed` in the
loop. Mutation-checked, as is the single-isolated-pass rule -- "retry it in the
same world first, just to be safe" reads as obviously correct and costs eight
minutes a shard.
Expected shard time is now ~11 min: the isolated pass, which is the
measurement, plus half a minute to resolve it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* perf(ci): bound the isolated pass, which is where the timeouts come from
Some isolated failures do not fail. They hang for the full 180s per-test
timeout and are then rerun three more times, so one test can cost twelve
minutes. The main-world baseline had zero timeouts across all six shards, so
this arrived with isolation.
Reproduced against a build, and the cause is not the harness:
page script calls window.exposedFn() isolated -> HANG main -> resolves
evaluate() calls window.exposedFn() isolated -> resolves main -> resolves
`expose_function` installs its binding on the isolated world's global. Page
script calling `window.fn()` looks at the page's own window, does not find it,
and the call never reaches Python -- so a test awaiting the future that call was
meant to resolve waits forever, because that await has no Playwright timeout
behind it. evaluate() works because it runs in the same world as the binding.
That is isolation doing exactly what it is for. A page that can reach an
automation binding can detect it, which is the reason this fork exists. These
tests assert a behaviour Camoufox deliberately does not have, and they cannot be
fixed -- only recognised, which pass 2 does in about half a second each.
What can be fixed is the price of recognising them. Pass 1 is a classifier: its
only question is whether a test passes as Camoufox ships, and a test that hangs
has already answered it. So pass 1, and only pass 1, is bounded:
per-test timeout 90s. The slowest test in the entire main-world baseline was
30.4s of 2295; two exceeded 30s and none exceeded 45s. A Playwright action
times out at 30s. Three times the slowest honest thing that happens, and half
the previous bound.
upstream's reruns off, via CI="". tests/conftest.py sets `reruns = 3`
whenever $CI is set, and that is the only thing it reads $CI for. It is
insurance that almost never pays out -- 2 reruns across all 2295 baseline
tests -- and under isolation it turned every deterministic world difference
into four attempts: 138 reruns in a single shard's isolated pass, recovering
nothing. Note that `--reruns 0` as an argument would not work; conftest
overwrites config.option.reruns in pytest_configure, so the environment is the
only lever that holds.
A hang now costs one 90s wait instead of up to 720s. A flake missed by not
rerunning is not lost: it fails pass 1, passes pass 2, and is counted as a
fallback -- noise in a reported metric, not a change in any verdict.
Passes 2 and 3 keep upstream's conditions untouched. They are the ones deciding
what an answer means, and they run against a handful of tests.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* perf(ci): stop rebuilding a browser that has not changed
Every push to this branch recompiled Firefox, 24 minutes at a time, including
the three in a row that changed nothing but ci/ and documentation.
`browser_changed` is computed against the pull request's BASE, not against the
push, so a branch that touched patches/ or additions/ even once keeps rebuilding
forever. That part is correct and should stay: the published release does not
contain this branch's browser changes, so testing against it would test a
different browser than the one under review. Using the release is not the
alternative.
The alternative is not building the same thing twice. The build job now asks a
narrower question first -- not "does this branch change the browser" but "has
the browser changed since the last one we built" -- and answers it with a cache
keyed on a hash of every input that can alter the binary: the same path list
browser_changed greps for, plus this workflow, which pins the toolchain the
build runs on. On a hit the 634 MB dist is restored and every build step is
skipped, which is the difference between 24 minutes and about one.
Two things that would otherwise have made this quietly wrong:
A hit still has to report a `build` result. It is a required suite whenever
the browser was built rather than fetched, and a required suite that produced
no result is -- correctly -- a failure. Same trap as requiring `build` on a
driver-only pull request, reached from the other side. The hit path writes one
recording that the browser was restored and under which key, so "this run
compiled nothing" is a fact in the evidence rather than an absence in it.
No restore-keys. Everywhere else in this workflow a prefix match is right; a
partly warm ccache is still warm. Here it would hand the test jobs a browser
built from different sources while every suite reported on it looking
perfectly healthy.
The self-tests hold the two lists together: if a path is ever added to the
browser_changed grep without being added to the cache key, a change there would
neither force a build nor invalidate the cache, and the run would silently test
a browser that predates it. Mutation-checked, along with the guards on each
expensive step and the absence of restore-keys.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* perf(ci): a Juggler JavaScript change does not need libxul relinked
Juggler is mostly JavaScript, and JavaScript does not need a compiler. Measured
on a real build, ccache reported a 98.63% hit rate (4167/4225), so almost none
of those 24 minutes was compiling C++ -- it was Rust, linking libxul, and
packaging, none of which a .js file affects.
And there is no omni.ja to rebuild either. CI archives the UNPACKAGED dist/bin;
omni.ja only exists in dist/camoufox/, which `mach package` produces and nothing
here uses. In dist/bin, Juggler is loose files under chrome/juggler/ -- symlinks
into the source tree, dereferenced into the artifact by `tar -ch`. Delivering
new JavaScript is a copy.
So the build cache is now keyed on a hash of the COMPILED inputs only. If that
hash matches, the compiled half is identical by construction and this branch's
resources are laid over the restored browser. The hash is the classification:
there is no "did only JavaScript change?" diff, because a diff answers the wrong
question -- it compares against the pull request's base, while what matters is
whether the cached browser has the same native sources. Same hash, same binary,
whatever the diff says.
Two traps, both closed and both mutation-tested, because either one silently
serves a browser that is not the one under review while every suite reports
green:
additions/juggler/ is not all JavaScript. It also holds the screencast encoder
and the remote-debugging pipe -- 5 .cpp, 5 .h, 2 .idl, 3 components.conf, 4
moz.build -- compiled into libxul. Only the files jar.mn lists are treated as
resources; everything else, including any extension nobody has considered yet,
is native and forces a build. jar.mn is itself native, so a resource removed
from it cannot leave a stale copy behind.
The mapping is per-file, not a prefix. jar.mn maps TargetRegistry.js to
content/TargetRegistry.js (a level added), content/FrameTree.js to
content/content/FrameTree.js (preserved), and content/JugglerFrameChild.sys.mjs
to content/JugglerFrameChild.sys.mjs (dropped). Two files in one source
directory land at different depths. A prefix rule writes one of them to the
wrong path and leaves the old copy in place.
Verified against a real build rather than reasoned about: all 22 jar.mn entries
resolve to files that exist in dist/bin, and overlaying this branch onto a dist
built before it turns FrameTree.js from 0 occurrences of nukeSandbox to 1, with
all 22 resources byte-identical to the branch afterwards.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* docs(ci): name the mechanism that actually hangs, not the one I found first
The comment blamed expose_function. That mechanism is real -- verified against a
build -- but no upstream test has that shape, so it is not what hangs in CI.
Running the full async suite isolated against a build names them: four tests,
always the same four, all in tests/async/test_route_web_socket.py. 225 of 1509
fail under isolation; four of those hang.
The general shape, which is worth stating because it will recur: a Playwright
feature implemented by installing something on the page's global lands in the
isolated world instead, so anything the PAGE originates never reaches the
automation. route_web_socket replaces window.WebSocket from an init script;
isolated, that replacement is in the sandbox and a socket the page's own script
opens is never intercepted. expose_function puts its binding on the sandbox
global, so page script calling window.fn() finds nothing -- called from
evaluate() it works, which is why it does not hang.
They hang rather than fail because the waits involved have no Playwright timeout
behind them: a Twisted future from the test server, an asyncio future a binding
was meant to resolve. Everything else isolation breaks fails at Playwright's 30s.
One thing to flag beyond the test suite: the route_web_socket half is not a test
artifact. Measured with a page whose own script opens a socket -- what a real
site does -- the handler fires in the main world and never fires isolated. A
user calling page.route_web_socket() against a real site gets no interception
and no error. It is not fixable here, because the feature works by replacing a
page global and that is exactly what an isolated world exists to prevent a page
from seeing, but it deserves an issue of its own rather than a comment in a CI
runner.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): the isolated pass cannot bound a hang, so stop asking it to
Four shards ran for two hours each and were killed by timeout-minutes, three
runs in a row. The cause is not the duration of anything.
Measured on run 34799668707, with ISOLATED_TIMEOUT already lowered to 90s:
tests/async/ isolated pass completed in 296s. The bound works.
tests/sync/ test_should_work_with_ws_close printed pytest-timeout's
"+++ Timeout +++" banner at exactly 90s -- and the process
then sat there for the remaining 1h50m.
So the signal fires and the test dies; the process does not. pytest-timeout's
signal method raises at the next bytecode boundary, and Playwright's sync API is
parked in a greenlet switch that never reaches one cleanly, so the raise lands
inside the dispatcher and wedges it. `--timeout-method=thread` fires reliably but
kills the interpreter and takes the other ~1500 tests in the group with it. No
per-test value bounds this, which is why lowering 180 -> 90 changed nothing.
Declared rather than discovered, then. The isolated pass cannot learn that these
hang without hanging, so ISOLATION_HANGS tells it: they are --ignore'd out of
pass 1 and run directly in the main world, where they pass and are counted as
fallbacks exactly as if isolation had failed them honestly. Coverage is not lost
-- the same tests run, in the world that can run them. Verified in the same run:
tests/async/test_route_web_socket.py::test_should_work_without_server
isolated -> Timeout main -> PASSED
Deliberately not ci/skiplist.yml. That list means "fails in the most permissive
world", and run_skiplist_audit.py enforces it by running every entry with
CI_WORLD=main and failing the build on any that pass. These pass there, so an
entry would be rejected by the audit and would be untrue as written. The tests
keep the two lists apart.
The second half is the backstop, because the next unboundable hang will not be
this one. Each pytest invocation was bounded at args.timeout, default 10800s --
three hours, against a job capped at 120 minutes. It could never fire: GitHub
hard-killed the runner first, taking the junit and diagnostics uploads with it.
Now --group-timeout, 1200s, roughly four times the slowest healthy invocation
measured, and the job drops 120 -> 40. A wedge costs twenty minutes and still
reports what it collected, instead of two hours and nothing.
The browser bug underneath is real and is not a test artifact: route_web_socket
replaces window.WebSocket from an init script, which under isolation lands in the
sandbox, so a socket the page's own script opens is never intercepted and the
caller gets no error. Filed as #775, with the native-interception fix that keeps
it undetectable. When that lands these stop hanging and the declaration goes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): a cache-hit build cannot repack the archive over its own input
The prebuilt-browser path failed every time it actually hit:
zstd: camoufox-dist.tar.zst already exists; stdin is an input -
not proceeding.
tar: -: Cannot write: Broken pipe
`zstd -o` refuses an existing destination and exits 1, and the overlay step
repacks to the same filename it just unpacked from. It went unnoticed because
until now every run changed the browser sources and rebuilt instead -- the cache
restored, the overlay ran ("overlaid 22 resource(s)"), and the step died one
line later. The first pull request that did not touch the browser found it.
Repack to a temporary name and mv it into place. That sidesteps the refusal, and
means a repack that dies partway cannot leave a truncated archive where the
restored one was.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
* fix(ci): a six-test module cannot be sharded six ways
The declared-hang pass ran with the shard filter still applied, so a shard that
owned none of the module got:
collected 6 items / 6 deselected / 0 selected
============================ 6 deselected in 0.05s ===========================
pytest exits 5 on an empty selection and writes no junit, which is exactly what
"the module did not run" looks like -- so the guard that exists to catch lost
coverage failed three of six shards instead. The other three owned some of the
six and passed, which is why it looked intermittent.
Run it unsharded on the first shard, the way tests/common/ already is and for
the same reason. Running the module whole also keeps its fallback accounting in
one place rather than spread across shards that each saw a fraction of it.
CI_SHARD is cleared rather than dropped: ci/_util.run() layers env over
os.environ, so an omitted key would still inherit one. parse_shard() reads empty
as "no shard", the same way _NO_UPSTREAM_RERUNS clears $CI.
The rest of the run confirms the mechanism. On shard 3, which completed:
tests/sync/test_route_web_socket.py::test_should_work_with_ws_close PASSED
in 3.07s -- the test that wedged a runner for 1h50m two runs ago -- and the
shard finished 386 passed, 0 failed, 0 errored. No shard hung. The whole run
took 26 minutes against 2h35m, and the build was 53s against 24m now that the
prebuilt cache can repack.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1UY3f8gm2jA1J23C3ew9s
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The test pipeline
Everything that runs a suite against Camoufox. Driven identically from a pull
request, a push to main, and — through workflow_call — any caller that needs
to test a specific browser version, so there is one definition of "the tests
pass", not two.
resolve ──┬─ static ────────── tribal rules, skiplist, self-tests (seconds)
├─ pythonlib ─────── the package's own tests (a minute)
└─ build ──┬─ playwright × 6 shards (conformance + our own)
├─ skiplist audit ───── every skip must still fail
├─ native ───────────── leaks, contexts (ours)
├─ patch guards ─────── one per spoofing patch
├─ build-tester ─────── 8 fingerprint profiles
└─ sundial ──────────── stealth grade (off: see below)
│
summary ──► one comment on the PR
Which browser, which suite
ci/versions.py answers both, and every entry point uses it:
- browser — from
upstream.sh, or whatever a caller passes in. A caller moving to a new Firefox passes the version it is moving to, which is what lets one pipeline test both a pull request and an upgrade. - suite — the newest released playwright-python tag whose pinned Firefox is
not ahead of that browser, and which is below the Playwright ceiling
pythonlib/pyproject.tomlpins.
Newest-not-ahead, rather than an exact match, because Playwright trails Firefox and skips generations: it pinned Firefox 151 and then 153, never 152, so a browser built on 152 has no exact suite and never will. Requiring a match would leave most of a release cycle with no suite at all, and taking a newer one would test against an automation contract that assumes engine work the build does not have. So the suite's Firefox pin being a release or two behind the browser is the normal case, not a misconfiguration — the summary line says which rule picked the tag.
The ceiling matters for the same reason it exists in pythonlib: camoufox.server
imports playwright._impl._driver, a private API, and every Playwright minor is
free to change Juggler. Testing above the ceiling would exercise a client the
shipped package will not install.
python3 -m ci.versions --json # what would run
python3 -m ci.versions --browser-version 153.0.4 --json
The version under test has to be the version that gets built. Only suite
selection follows --browser-version; the build reads upstream.sh and the
fetch path downloads whatever pythonlib considers current. Asking for a version
the branch does not pin would therefore compile the old browser and judge it
against the new suite — green, meaningless and silent. --check-upstream
refuses that, and the workflow passes it.
So an upgrade to a new Firefox is a branch that edits upstream.sh, which is
what an upgrade is anyway. Resolution then reads it by default, the build
produces it, and the suite is chosen for it — the three cannot disagree. The
browser_version input exists for a caller that wants to state the version
explicitly; it must match.
The Playwright suite
One suite, fetched fresh per run: upstream playwright-python at the resolved tag.
It runs unmodified — ci/pw_camoufox_plugin.py adapts the environment around it
rather than editing it, hooking BrowserType at the _impl layer so upstream
can refactor its fixtures freely — and ci/suite.py overlays tests/camoufox/
into it.
tests/camoufox/ is small on purpose: behaviour upstream has no test for (that
page.route() must not change what a request looks like on the wire), or asserts
the opposite of on purpose (that a worker should not inherit the context
locale, which stock Firefox gets wrong and Camoufox does not). It is not a fork
of anything, so it cannot go stale; it runs against upstream's own conftest and
server at whatever tag was resolved.
tests/ used to hold a fork of a ~v1.55-era upstream suite. It was deleted after
measuring it against the same binary:
- 73 of the 74 tests it skipped as "Not supported by Camoufox" pass in upstream's copy. Those skips predated main-world execution and were never revisited, so the fork was asserting the browser was worse than it is.
- Of its passing tests, eight had no upstream counterpart. Six of those were
Camoufox-specific and now live in
tests/camoufox/as three modules; the other two were tests upstream had since renamed.
A re-fetched suite cannot drift, and a deliberate difference from upstream now
has to be written down in ci/skiplist.yml with a reason, where it is visible,
instead of being encoded as a silent edit to a vendored file.
What "the suite" means
ci/run_playwright.py names its targets explicitly rather than pointing at
tests/, so the one thing left out stays visible:
tests/async/ + tests/sync/ |
one pytest process |
tests/common/, tests/test_reference_count_async.py |
their own process |
tests/test_installation.py |
excluded, with a reason |
The isolated pair each call sync_playwright()/async_playwright() inside the
test body, which cannot start while the session fixtures already hold a loop
(Cannot run the event loop while another loop is running). Run with the others
all six fail; run alone all six pass. Skiplisting them for that would have
recorded a browser failure that does not exist.
This used to be tests/async/ alone — 722 tests, 31% of the suite, excluded with
nothing written down. Not a decision: the vendored fork carried async/ and no
sync suite, and this runner was pointed at the same shape without checking what
upstream shipped. unclaimed() now fails the run if upstream adds a test path
that is neither in TARGETS nor in EXCLUDED with a reason.
Which world, and the skip list
The suite runs isolated first — the configuration Camoufox actually ships — and falls back to the main world only for what fails, counting every test that needed the fallback.
Upstream asserts upstream semantics: tests read globals their own page scripts
defined and pass handles into evaluate(), and a test doing that fails under
isolation by design. Running the whole suite main-world-only (the previous
behaviour) made those pass, which is true but uninformative — it measured a mode
nobody ships and produced no number for what isolation costs.
Each group is therefore run up to three times, and normally twice:
| Pass | CI_WORLD |
What it establishes |
|---|---|---|
| 1 | isolated |
the browser as users run it |
| 2 | main |
the failures again with isolation off |
| 3 | main |
only what failed in both, retried once — normally empty |
There is deliberately no second isolated pass. One sat between 1 and 2 on the theory that a flake must not be mistaken for a world difference; measured on the first real CI run it cost 7m50s per shard and recovered nothing:
isolated (full) 335s + 331s 35 and 11 failures
isolated retry 205s + 265s 0 recovered <- deleted
main world 19s + 12s 46 recovered
Two reasons it was never going to earn that. These failures are deterministic —
a test reading a global its page script defined does not intermittently see it —
and failing that way is slow, because the read returns undefined and the test
sits on a Playwright timeout rather than throwing. And upstream's suite already
ships pytest-rerunfailures: pass 1 reported 105 rerun, which is each of
those 35 failures having been retried three times before the run even reported
them. A flake does not survive that.
A test that passes in pass 2 is recorded as a main-world fallback: it counts
as a pass for the run, and its identity goes into
metrics.main_world_fallbacks, with metrics.main_world_fallback_count on the
summary table (summed across shards). A test failing in both worlds and on
retry is a plain failure. The fallback count is the isolated-world conformance
gap — watch it between runs; a jump means the isolation boundary moved.
Both rerun passes are guarded on the failure set being non-empty, which is
load-bearing rather than tidy: pytest declines to filter when nothing it
collected previously failed, so an unguarded --last-failed runs the whole
group again — in the other world, silently replacing the result it was meant to
refine.
Why some isolated failures hang
Not every isolated failure fails. Some wait forever, in both
tests/async/test_route_web_socket.py and tests/sync/test_route_web_socket.py
— and the two are not equally recoverable, which is the subject of the second
half of this section.
The shape recurs, so it is worth stating generally: a Playwright feature implemented by installing something on the page's global lands in the isolated world instead, so anything the page itself originates never reaches the automation. Two instances, both measured directly against a build:
page's own script opens a WebSocket isolated -> handler never fires main -> intercepted
page script calls window.exposedFn() isolated -> HANG main -> resolves
evaluate() calls window.exposedFn() isolated -> resolves main -> resolves
route_web_socket works by replacing window.WebSocket from an init script;
isolated, that replacement lands in the sandbox, so a socket the page opens is
never seen. expose_function installs its binding on the sandbox global, so page
script calling window.fn() finds nothing — though called from evaluate() it
works, which is why that one does not hang here.
They hang rather than fail because the waits involved — a Twisted future from the test server, an asyncio future a binding was meant to resolve — have no Playwright timeout behind them. Everything else isolation breaks fails at Playwright's 30s.
Worth being clear that the route_web_socket half is not a test artifact: a
real site's WebSocket is not intercepted either, and the user gets no error
saying so. It is not fixable at this layer — the feature works by replacing a
page global, which is precisely what an isolated world exists to stop a page
from seeing. Tracked in #775; the fix is native interception below
the DOM object, which is also the only version of it that stays undetectable.
So pass 1 is cost-bounded, and only pass 1:
| Bound | Value | Why |
|---|---|---|
| per-test timeout | 90s | the slowest test in the whole main-world baseline was 30.4s; only two exceeded 30s and none exceeded 45s. A Playwright action times out at 30s |
| upstream reruns | off (CI="") |
tests/conftest.py sets reruns = 3 whenever $CI is set — the only thing it reads $CI for. The baseline recorded 2 reruns across all 2295 tests; the isolated pass recorded 138 in one shard, all re-running deterministic world differences |
Together that turns a hang from up to 4 × 180s into one 90s wait. A flake missed
by not rerunning is not lost — it fails pass 1, passes pass 2, and is counted as
a fallback. Note that --reruns 0 as an argument would not work: upstream's
conftest overwrites config.option.reruns in pytest_configure, so clearing
the environment variable is the only lever that holds.
The ones a timeout cannot bound
That bound is not enough for all of them, and it is worth knowing exactly where it stops working. Measured on run 34799668707 with the 90s bound already in place:
| Group | Isolated pass | Outcome |
|---|---|---|
tests/async/ |
completed in 296s | the bound works |
tests/sync/ |
test_should_work_with_ws_close printed pytest-timeout's +++ Timeout +++ banner at exactly 90s |
the process then sat for 1h50m, until the job's timeout-minutes killed it |
So the signal fires and the test dies; the process does not. pytest-timeout's
signal method raises at the next bytecode boundary, and Playwright's sync API is
parked in a greenlet switch that never reaches one cleanly — the raise lands
inside the dispatcher and wedges it. --timeout-method=thread fires reliably but
kills the interpreter, taking the other ~1500 tests in the group with it. There
is no per-test timeout value that bounds this.
So those modules are declared, not discovered — ISOLATION_HANGS in
ci/run_playwright.py. The isolated pass cannot learn that they hang without
hanging, so it is told: they are --ignored out of pass 1 and run directly in
the main world (pass 1b), where they pass and are counted as fallbacks exactly
as if isolation had failed them honestly. The same tests still run, in the world
that can run them.
Why not ci/skiplist.yml. That list means "fails in the most permissive
world", and ci/run_skiplist_audit.py enforces it by running every entry with
CI_WORLD=main and failing the build on any that pass. A route_web_socket
test passes there — the main world is precisely where the feature works — so an
entry would be rejected by the audit, and would be untrue as written. The two
lists are not interchangeable, and test_isolation_hangs_are_not_in_the_skiplist
keeps them apart.
Pass 1b sits above the if not failing: continue guard, deliberately: a
group whose isolated pass found nothing would otherwise skip it, and coverage
would disappear on exactly the runs that look healthiest.
tests/patches/isolated-evaluate.py still owns the direct coverage of isolated
evaluation, and must keep passing regardless. That file is what to check if
isolation itself regresses.
ci/run_skiplist_audit.py deliberately runs in the main world: a skiplist
entry has to claim a test cannot pass in either world, or the suite would have
counted it as a fallback rather than a failure.
Ten tests are deselected outright by ci/skiplist.yml, which
requires a stated reason per entry — ci/summarize.py fails the run on an
unreasoned one.
A reason is not evidence, so the reasons are checked. The first version of
this file inherited all nine tests/async/*.disabled modules from the vendored
suite and gave each a plausible justification without running any of them: of
the 202 tests it skipped, 193 passed, and seven of the nine modules failed
nothing at all. A written reason made them look verified, which is worse than
leaving them bare.
ci/run_skiplist_audit.py now runs every entry with the skiplist disabled and
fails the build if a skipped test passes. It is cheap precisely because a
correct skiplist is short — ten tests, a few seconds — and it is what keeps the
list from drifting back into a place failing tests go to disappear.
python3 -m ci.run_skiplist_audit --binary /path/to/camoufox-bin
What remains after the audit, 10 tests: two test_click.py tests where
Playwright's stable-position wait races the humanized travel time; six
client-certificate tests (async and sync) that need the browser to present a
certificate during the TLS handshake — the two that go through the Node driver's
own request context instead pass, and are not skipped; and the two upstream
expectations that encode a stock-Firefox quirk, replaced by tests/camoufox/.
That client-certificate split is the audit earning its place. The entry was first written as a whole module, because on a local machine all five fail — Node/OpenSSL there rejects the fixture server outright. In CI two of them pass, and the audit failed the build one run after the entry was written. CI is the authority for what fails; a local run is a hypothesis.
Camoufox's own suite
native-tests/ covers what the Playwright suite cannot ask about:
- Leaks. Launch browsers, kill them, prove nothing survived — file descriptors, sockets, child processes, X11 lock files. The real assertion is that cost does not scale with launch count, because that is the shape a leak actually has: a scraper that runs fine for six hours and then dies of EMFILE. Scope is honest: this measures resources held by our process and its children, not Gecko's internal heap.
- Contexts versus browsers. Two contexts in one browser must get different
fingerprints; two pages in one context must get the same one. Get this wrong
and per-context injection silently degrades to process-global — which passes
every single-context test there is. It has happened here before (commit
d17c887, "fix screen size leak in contexts"). - Settled decisions.
ci/tribal-rules.ymllists choices this project already made, each with the issue or PR that made it, andnative-tests/test_tribal_rules.pyasserts them. A comment explaining a decision only works on someone who reads it.
Sundial
On since 2026-09-12. sundial 0.5.0 is deployed and serving score mode, and sundial's master branch now deploys itself on push, so merged does mean deployed. It was off for as long as the live build predated score mode: an older sundial ignores
?score=1and posts the entire report — every vector's id, name, brief, source and value — to whatever collector asked. Receiving that on a public runner and discarding it afterwards is not the guarantee this section describes; not receiving it is.enabled: falseinci/sundial.ymlis still the kill switch, and the resolve job checks it before the credential comes into scope, so flipping it back stops the request rather than just the reporting.
The stealth check reports a letter grade and a count. Nothing else leaves
ci/run_sundial.py::redact() — not a vector name, description, measured value,
source, and not a per-category breakdown either: a table reading "Graphics 3/17"
is the most useful single fact an adversary could take from a public CI log.
There are no per-check rows in the results file at all — not even opaque
ones. An HMAC does not name a vector, but a map of them still publishes how many
distinct checks fail and lets a reader follow one across releases, which is
per-vector data wearing a hash. The instruction was a score, so it is a score:
regression detection is per-score, via min_pass_rate and a maximum allowed
drop. Scope and thresholds live in ci/sundial.yml; only
categories Camoufox actually claims are gated.
Everything that leaves redact() is checked against a whitelist at runtime,
not a blacklist — a blacklist only stops the leaks somebody already thought of.
Adding a field without adding it to _PUBLISHABLE fails the run:
{ "grade": "A", "checks_total": 412, "checks_passed": 403, "pass_rate": 0.978,
"out_of_scope_failed": 6, "cross_os_total": 24, "cross_os_passed": 5,
"os": "linux", "sundial_version": "0.3.1", "schema_version": 1 }
Cross-OS detectors are counted, never scored. They read the host machine rather than the disguise: a browser claiming macOS while running on Linux fails them however good its spoofing is, and Camoufox does not claim byte-identical cross-OS emulation. Folding them into one average would mark it down for a promise nobody made, and would hide a real regression behind noise it cannot control. They are reported separately so a drop there reads as "the host shows through more than it did", which is a different conversation.
The run asks sundial for ?auto=1&score=1, so it receives counts and the
vectors never cross the wire at all.
Finding out which checks failed
Worth being precise about, because the answer is "you can't, from CI", and that
is deliberate rather than an oversight. Score mode's payload is buckets keyed
"<Category>|<class>" holding two integers each. It carries no check names and
no ids, so a failing check's identity is not something the CI process discards
— it is something sundial never sends. Nothing in the artifact, the log, or the
sealed report can recover it.
Two steps down from there, both local only:
# which CATEGORY the failures are in -- works with the credential CI already has
python3 -m ci.run_sundial --explain --binary /path/to/camoufox-bin
# which CHECKS -- needs a role sundial serves full reports to
python3 -m ci.run_sundial --explain --allow-full-report --binary /path/to/camoufox-bin
--explain prints to the terminal and never writes to a result file, and is
refused outright under GITHUB_ACTIONS: a category-level table is not a
vector, but "Graphics 3/17" is still the most useful single fact an adversary
could take from a public log, which is exactly why redact() does not publish
one.
Order of operations
?score=1 needs a sundial that has it. An older deployment ignores the unknown
parameter and posts the whole report; the numbers still come out right and
redact() still discards everything identifying, but nothing is classified,
so every cross-OS tally reads 0 — which looks like "no host-OS failures"
rather than "nobody sorted them". score_mode: false in the result says which
it is, and the gate says so in its notes rather than leaving you to notice.
So the dependency runs one way, and setting the GitHub secrets is the last step, not the first:
- deploy sundial's score mode — done; it ships in 0.5.0, and master now deploys on push
gh secret set SUNDIAL_AUTOMATION_KEY -R <repo>for every repository whose CI runs this. Without it the job skips, which is the normal case for a fork pull request- flip
enabled: trueinci/sundial.yml— done
Two things keep a vector out of a public log, and it is worth separating them, because only one is enforced by the server:
| guarantee | |
|---|---|
| server-side | The run logs in as guest, and sundial's middleware refuses guest the private-vector bundle outright — those definitions are never served to the session. |
| client-side | This gate only ever requests /?auto=1&score=1, and redact(require_score_mode=True) fails the run if a full report arrives anyway, rather than folding it down and carrying on. |
The stricter option is sundial's score-only ci role, which is refused anything
but /?auto=1&score=1 server-side and so cannot be handed a report even if the
credential leaks. That role is not in sundial's master branch and is therefore
not deployed; when it lands, mint the credential (make pages-ci, then
redeploy) and set SUNDIAL_USERNAME=ci. Nothing in this repository changes —
the client-side half already behaves as though the server were enforcing it.
There are deliberately no per-vector rows, not even opaque ones. An HMAC names nothing, but a map of them publishes how many distinct checks fail and lets a reader follow the same id from release to release.
The cost is real: regression detection drops from per-vector ("the check that
passed last release fails now") to per-score ("we got worse"), covered by
min_pass_rate in ci/sundial.yml — and, once an auto-update pipeline exists
to compare releases, by a maximum allowed drop in its policy file. To get the per-vector view back for your own debugging,
set SUNDIAL_REPORT_AGE_RECIPIENT to an age public key — the full report is
then kept encrypted to you and nobody else can open it.
Needs SUNDIAL_AUTOMATION_KEY (the password). SUNDIAL_USERNAME is
optional and names the account, which is not a secret — it defaults to guest.
Absent the password — a pull request from a fork — the job is skipped and the
summary says so.
What actually stops a vector reaching the log
Asking for ?score=1 is a promise the caller makes, and a promise is not a
mechanism. Today two things back it:
guestcannot load the private vectors, and that is checked. sundial's middleware answersisPrivateVectorAssetpaths with an empty stub for that role specifically.adminandprivatedo get them — and/automated?key=resolves toprivatewhen handed the private key, which is indistinguishable from the guest one by looking at it. So "we set the right key" stays an assumption until something checks: the gate reads sundial's own/__auth/meand refuses to open the browser at all unless the session is a role the vectors are withheld from. Not knowing the role counts as not safe.- A non-score payload fails the run.
redact(require_score_mode=True)refuses to process a full report rather than folding it down, so a deployment that ignoredscore=1is a red build, not a quiet leak.
What is still missing is a server that refuses the request. sundial's
score-only ci role does exactly that — a bare /, auto=1 without score=1,
?mode=raw, ?download=true, ?key=, the /automated and /locale export
routes, and any parameter not on its allow-list each get a 403, and on the pages
it does serve the report is never written to a global, so there is nothing for
page.evaluate, devtools or a screenshot to read. That role is not merged into
sundial's master and so is not deployed. When it is, set SUNDIAL_USERNAME=ci;
nothing here changes, because this side already behaves as though the server
were enforcing it.
The distinction is worth keeping straight: under guest, dropping score=1 by
accident would put the whole report in the collector and leave redact() as the
only thing between it and a public artifact. Under ci, the same mistake is a
403 at the first request. --allow-full-report exists for a deliberate local
run under an account that is allowed one.
Blocking a merge
Branch protection on main requires exactly one check: All tests passed,
the gate job. Pointing at one job instead of a dozen means the required-check
list does not need editing every time a suite is added, renamed, or resharded.
The gate allows exactly three skips, each for a stated reason:
| Skipped | Because |
|---|---|
build |
the browser was fetched, not compiled |
fetch-browser |
the browser was compiled, not fetched |
sundial |
disabled in ci/sundial.yml, or a fork pull request with no stealth credentials |
Anything else that is not success fails it — including skipped. A suite
that did not run has not passed, and quietly skipping one is the cheapest route
to a green tick.
build is also the one suite dropped from --require when the browser was
fetched rather than compiled: that job writes no result, and requiring a name
nothing produces fails a run where everything passed.
One suite may additionally record a skip result without failing the run,
named explicitly in --allow-skip: sundial, and only when sundial itself is
unreachable. It is a separate service on a separate host, so an outage there
means this browser was never measured — neither a pass nor a failure is true,
and blocking every merge in the repository on someone else's downtime is the
wrong answer. The summary shows it as skipped with the reason. A rejected
credential, a role that would be served the private vectors, a full report where
a score was requested, or a score under the floor all still fail: those are
answers, and an answer gets judged.
The settings live in ci/branch-protection.json so
they are reviewable rather than lore. To apply them (needs admin):
gh api -X PUT repos/<owner>/<repo>/branches/main/protection \
--input ci/branch-protection.json
Two choices worth knowing about:
enforce_admins: false— you can still merge when CI itself is broken. Protection should stop mistakes, not lock you out of your own repository.strict: false— a pull request does not have to be rebased onto the latestmainbefore merging. Withtrue, every push tomainwould invalidate every open pull request and force another build, and a build here is over an hour cold.
Reviews are deliberately not required: a solo maintainer cannot approve their own pull request, so requiring one would block every merge.
Cost control
Each tier gates the next, so a two-second lint failure never reaches the build:
0 static lint, self-tests, settled decisions seconds
1 unit pythonlib ~1 min
2 browser build (patches/additions/settings/assets/upstream.sh/Makefile/scripts changed)
fetch (anything else -- driver changes test against the published release)
3a smoke patch guards, build-tester ~15 min
3b full Playwright x2, leaks, stealth ~40 min
4 gate the required check
Driver-only pull requests never build. There is nothing new to compile, so
fetch-browser downloads the published release and the browser suites run
against the build users are actually on — a minute instead of seventy.
Changing Juggler's JavaScript does not rebuild the browser. Measured on a
real build: ccache reported a 98.63% hit rate, so almost none of those 24
minutes was compiling C++ — it was Rust, linking libxul, and packaging, none of
which a .js file affects. And in the unpackaged dist/bin that CI archives
there is no omni.ja at all: Juggler is loose files under chrome/juggler/, so
delivering new JavaScript is a file copy.
So the build cache is keyed on a hash of the compiled inputs only
(ci/browser_inputs.py). If that hash matches, the compiled half is identical
by construction — no diff required, and no dependence on what the pull request
base happened to contain — and this branch's resources are laid over the
restored browser. A Juggler JavaScript change costs about a minute instead of
twenty-four.
Two things make that dangerous, and both are closed and mutation-tested:
| Trap | What closes it |
|---|---|
additions/juggler/ is not all JavaScript — it holds the screencast encoder and the debugging pipe (5 .cpp, 5 .h, 2 .idl, 3 components.conf, 4 moz.build) |
Only files jar.mn actually lists are resources. Everything else — including any extension nobody has considered yet — is native and forces a build. jar.mn itself is native, so removing an entry cannot leave a stale file behind |
| The source→destination mapping is per-file, not a prefix | It is read from jar.mn. TargetRegistry.js → content/TargetRegistry.js (a level added), content/FrameTree.js → content/content/FrameTree.js (preserved), content/JugglerFrameChild.sys.mjs → content/JugglerFrameChild.sys.mjs (dropped). Two files in one source directory landing at different depths is exactly what a prefix rule gets wrong — and it would run stale Juggler while every suite went green |
A browser that is already built is not built again. browser_changed is
computed against the pull request's base, so it stays true for every push to a
branch that touched patches/ even once. That is right — the published release
does not contain that branch's browser changes, so it cannot be tested against —
but taken alone it meant recompiling a byte-identical browser on every push, 24
minutes at a time, to fix a typo in ci/.
The build job therefore asks a narrower question first: not "does this branch
change the browser" but "has the browser changed since the last one we built".
The answer is a cache keyed on a hash of every input that can alter the binary —
the same path list browser_changed uses, plus this workflow, which pins the
toolchain. On a hit, a 634 MB camoufox-dist.tar.zst is restored and every
build step is skipped; the run still records a build result saying the browser
was restored rather than compiled, because a required suite that reports nothing
fails the gate, and "nothing was compiled" should be a fact in the evidence
rather than a hole in it.
Deliberately no restore-keys on that cache. Everywhere else a partial
match is fine — a partly warm ccache is still warm — but here it would hand the
test jobs a browser built from different sources, and every suite would report
on it looking perfectly healthy. A self-test asserts the key covers every path
browser_changed considers browser-affecting, so the two cannot drift apart.
The ccache is kept warm from main. Pushes to main populate it and a
twice-weekly schedule keeps it from being evicted (GitHub drops a cache after
seven days unused). Pull requests restore it through restore-keys, so a build
in a pull request starts warm even though its own key is new.
A prebuilt image in ghcr.io with the object cache baked in would be warmer
still and would not need the eviction guard. It also needs registry credentials
and a rebuild pipeline of its own; this is the version that works with no setup.
Preparing the tree retries the network, and nothing else. mach bootstrap
pulls toolchains from Taskcluster, and a connection reset there used to fail the
whole pull request. ci.run_prepare runs setup-minimal → dir →
mozbootstrap, retrying the two that download things and only when the failure
text reads as transient. A failed patch hunk or a compile error still fails on
the first attempt — retrying a broken tree only spends a runner to reach the
same answer, and a retry loop that swallows a real breakage turns a red build
into a slow red build.
One consequence of
cancel-in-progress: pushing to a branch cancels its running build. That is right while iterating, but a 70-minute build will not survive a push made 20 minutes in.
Running a piece by hand
python3 -m ci.run_playwright --binary path/to/camoufox-bin
python3 -m ci.run_playwright --binary path/to/camoufox-bin --shard 3/6
python3 -m ci.run_native --subset rules # no browser needed
python3 -m ci.run_native --subset browser --binary path/to/camoufox-bin
python3 -m ci.run_sundial --binary path/to/camoufox-bin
python3 -m ci.summarize --results-dir .ci-work/results
Each writes one result file to .ci-work/results/. ci/summarize.py folds the
shards, decides, and renders the table. A required suite that produced no result
file is a failure, never a skip — otherwise deleting a job would be the
cheapest way to a green tick.
Self-tests
ci/tests/ asserts the pipeline reports honestly: redaction leaks nothing,
skips carry reasons, shards partition exactly once, version resolution never
picks a suite newer than the browser. These run in the static job on every
pull request.