atakans/Arete-27B-NVFP4 declares no KV cache: served as published, SGLang gives it a bf16 one and about half the pool. The A/B of 2026-11-14 served it with the declaration of the lane's NVFP4 (RadixArk @ 52d1adc) written into copies of its config.json and hf_quant_config.json: target cache float8_e4m3fn, draft cache bfloat16, pool 905,941 tokens. This writes that declaration into the cached snapshot, as patch-yarn.py writes YaRN there: atomically, the link replaced and the blob kept, idempotent, another scheme or a quantization that is not ModelOpt's refused, --check to ask. Run after patch-yarn.py on copies of Arete's two cached files, it writes the bench's two files key for key. --kv-cache-dtype fp8_e4m3, the FP8 targets' way, would have put the draft's cache in fp8 too. Its test runs main() in process for the coverage gate, which gives it patch-yarn.py's floor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 KiB
How this repo is tested
This project was written with an AI coding agent, which changes what a test suite is for. The risk is not that a human forgot a case; it is that code and tests were written together from the same assumption, so both are wrong in the same way and the suite is green anyway. Every choice below is aimed at that failure mode: measure what is covered rather than assume it, generate inputs instead of choosing them, and check that the tests actually fail when the code is broken.
Run everything the way CI does:
./ci-local.sh # every gate, exactly as GitHub runs it
./ci-local.sh Coverage # one gate by name fragment
CI_LOCAL_SERIAL=1 ./ci-local.sh # one step after the other, in this checkout as it is
The workflow's jobs run side by side, on GitHub and in ci-local.sh, each in a checkout of its
own: static (the tree, lint, templates, fixtures, pins), suite (each test file once, under the
offline guard), single (every unittest module of tests/ beside the others, in groups, each group
one process), coverage (the floors of the root modules), coverage-cockpit (the cockpit's),
cockpit (its unit tests and the headless browser) and fuzz (fuzz, mutation, properties). checks
ends the run: it passes when the seven others have passed, and fails on GitHub when one of them failed
(ci-local.sh does not run it then). Here each checkout of a full run is a detached worktree
of HEAD, so ci-local.sh refuses a tree with changes nobody committed: commit first, or test the
checkout as it is with CI_LOCAL_SERIAL=1. A fragment runs in the checkout as it is, one step
after the other. A full run took 12 minutes on the reference box on 2026-10-28 (741 and 744 s,
the length of single), against 63 one step after the other the same day (v1.40.4), and 72 on
GitHub when the steps ran as one job (v1.40.3). On 2026-11-10 a full run took 30 minutes there
(single, some 3,000 tests in one process, 1,808 s), and a little over 9 since single runs its
modules in groups (557, 559, 558 and 558 s that evening, four runs, the length of suite). On one
machine the jobs share its ports, as they
do not on GitHub, where each job has a runner of its own: a test takes the port of a server it starts
from tests/localports.py, which keeps that port the test's beside the other jobs and any program of
the machine, and test_localports.py fails on a test file that takes a port number out of a socket
it closes. While working, run the gate you care about by name fragment, and the whole thing before
pushing.
What a test module leaves to the modules after it (a variable of the environment, the directory,
sys.path, a thread, a signal handler) shows only where they share a process. single shares one
within a group: each of the pair's four files alone, the others dealt in turn into two groups
(tests/run_single.py), four processes at a time. What a module does to a module of ANOTHER group
is seen by the pass that runs them all in one process, tests/run_single.py --one-process, half an
hour: GitHub runs it every night (.github/workflows/nightly.yml), and a release runs it on the box
before it is pushed.
CI_LOCAL_WORKFLOW=.github/workflows/nightly.yml ./ci-local.sh # every module of tests/ in one process
The runtime is stdlib only and stays that way. Four measuring gates need pip
packages (coverage, hypothesis); they ask tests/testpy.sh for an
interpreter that has them, and a developer sets that up once:
python3 -m venv .venv-test && .venv-test/bin/pip install coverage hypothesis
That venv is found by tests/testpy.sh: QWEN38_TEST_PYTHON first, then the checkout's own
.venv-test and .venv, then ~/.local/share/qwen38-testenv, then python3. A fresh clone
has no .venv-test, so run the gates there with QWEN38_TEST_PYTHON=/path/to/.venv-test/bin/python ./ci-local.sh, or the four steps that need coverage or hypothesis (the fuzz suite, both
coverage floors, the property checks) are reported SKIPPED, missing the package.
ci-local.sh runs every step as GitHub does (bash -e), each under a HOME and a TMPDIR of its
own, both removed when the step ends: a test that read the developer's real API key passed here
and failed on the runner, and the suite's temporary directories used to stay in /tmp (761 of
them on the reference box on 2026-10-03). The workflows' own scratch files (coverage reports,
rendered units, pin-watch's report) go under ${TMPDIR:-/tmp} too, and a step fails CI on a
fixed path in /tmp in any workflow: on a runner, which sets no TMPDIR, that is /tmp as before. A
step that calls shellcheck, docker or gh when the tool is not installed is reported
SKIPPED (a stub records the call), and so is a step whose runner-only pip install line names a
package this box cannot provide (ruff must be on PATH; the others are looked for through
tests/testpy.sh). A skipped gate checked nothing: a run in which every step it ran was skipped
exits 3, but one in which only some were exits 0, so read the last line, and a complete run ends with 0 sautes
(CI local: N ok, N echecs, N sautes).
The layers
| layer | where | what it answers |
|---|---|---|
| Unit and contract | tests/test_*.py, dashboard/tests/test_*.py |
does this function do what its docstring says, on the inputs this box really produces? |
| Fixtures from the real box | dashboard/tests/fixtures/ |
does the parser survive the output the actual commands print, [N/A] and all? |
| Hostile input sweeps | test_cockpit_collectors.py, test_cockpit_http.py |
does anything raise, crash a thread, or return a plausible wrong number when the input is nothing like expected? |
| Property-based | dashboard/tests/property_checks.py |
does the invariant hold for every input, not the ones we thought of? |
| Fuzzing | tests/proxy_fuzz.py |
can generated bytes get the proxy to raise, rewrite a good body, or drop a pattern it should keep? |
| Simulation | tests/proxy_fuzz.py (RelaySimulation) |
across generated sequences of client behaviour, is the engine ever left generating for a client that is gone? |
| Concurrency | dashboard/tests/test_concurrency.py |
with 24 callers firing at one instant, does exactly one privileged action start, is the loser told, and is the lock always released? |
| Mutation | tests/mutation.py |
if the code were wrong, would any of the above notice? |
| Browser | dashboard/tests/*.mjs |
does the page work in a real headless Chromium, at four iPhone geometries? |
| Anti-drift | CI steps | do the four places that must agree still agree (targets, flags, sudoers allowlist, pins)? |
Can it be 100%? Measured, not argued
Yes for coverage, no for the thing that matters, and the gap between those two answers is the most useful number in this file.
100% branch coverage is reachable. lifecycle.py and recipes.py are both at
100% (303 and 263 statements, 164 and 140 branches, nothing missed, nothing
partial), and getting there took one afternoon of tests plus two declared
exclusions, both in lifecycle.py, both provably unreachable rather than merely
awkward:
- the
elifchain inparse_boot_logends in a defensivebreak. Reaching it needs a marker name the chain does not handle, and the chain handles every name inMARKERS. Rather than only silencing it,test_every_marker_is_handled_by_the_chainparses the function's own AST and fails the day a marker is declared without an arm, which is strictly stronger than covering the branch would have been; if stage in STAGES:followed byfor s in STAGES: if s == stage: breakcannot finish the loop, because the guard in front of it guarantees a match.
The seven statements found on the way there were not plumbing. Two were real
holes: outcome_kind's own in flight and no end logged branches had never
been called (parse_feed sets those kinds itself), and the drain-ceiling log
line had never been parsed in a test, although the verdict for ceiling > 0
was covered through a hand-built dict. The other five were malformed-timestamp
paths, which is exactly what a truncated journal line produces.
And lifecycle.py, at 100% coverage, has a mutation score of 91.7%: 17
injected faults that its 139 tests of 2026-09-10 did not notice (it has 285 now), in code where every branch is
executed. That is the whole point. Coverage measures execution; only mutation
measures detection.
100% mutation score is not reachable, and not because of effort. Equivalent mutants exist, and deciding whether a mutant is equivalent is undecidable in general (it reduces to program equivalence). Four of the seventeen, from this repo:
| survivor | why no test can kill it |
|---|---|
weight_ends >= 2 to > 2 |
the or clause beside it already covers the boundary, and no real log has two weight-ends with fewer than two begins: you cannot end a load you did not begin |
pool <= 0 to < 0 |
not pool in front of it already catches zero |
secs > drain_max_s to >= |
on equal values it assigns the same value |
outcome[:40] to [:41] |
a truncation width no behaviour depends on |
So the target this repo actually holds: 100% on the pure-logic modules, where there is no excuse and the number is honest; a floor that only ever rises on the modules that shell out or serve HTTP; and a mutation floor as the real quality gate, because that is the one that asks whether the tests would notice.
cockpit.py is at 71% and climbing. Of what remains, about seven statements in
ten are plain reachable logic, so 100% there is cost and not impossibility; the
rest is process-lifetime code (main, serve_forever, the sampler loops), which
the .mjs browser checks already exercise in a real spawned process where
coverage cannot follow it.
Coverage is a floor, not a badge
ci.yml measures branch coverage per module and fails under a floor. The floors
are the numbers measured on 2026-09-10 minus a point of slack, and they are
raised in a commit, never lowered quietly:
| module | floor | why it is where it is |
|---|---|---|
lifecycle.py |
100% | pure logic, no excuse, two declared exclusions |
recipes.py |
100% | pure logic |
agent_relay.py |
88% | the rest is socket error paths |
registry.py |
88% | the rest is filesystem error paths |
cockpit.py |
68% | 2,898 lines at v1.18.7; the auth, CSRF, static, action, job and diagnostics surfaces are covered, the sampler threads are not |
A floor belongs to the most constrained environment that has to pass it.
cockpit.py reads 71% on the reference box and 69% on a GitHub runner, because
the runner has no docker, no systemctl and no nvidia-smi, so several collector
branches never run there. Setting the floor from the local number failed the first
push, which is the gate working. lifecycle.py and recipes.py read 100% in both,
which is what being pure logic buys you.
And the root modules, which had no floor at all until 2026-09-10:
| module | floor | why it is where it is |
|---|---|---|
keepalive-proxy.py |
85% | the production serving path; the rest is socket teardown |
patch-yarn.py |
90% | it rewrites the config the engine reads |
patch-kv.py |
90% | it writes the KV cache declaration into the config the engine reads |
oc-fit-limits.py |
37% | the arithmetic is property-tested, the CLI plumbing is not |
build-token-map.py |
35% | the ranking is tested; loading a real tokenizer is not offline work |
It was 14% on cockpit.py and 68% overall before 2026-09-10, and went 14 to 30
to 53 to 59 over one day of writing tests. Measuring is what made that visible:
nobody had ever run coverage on this repo.
Property-based checks
property_checks.py states invariants over generated inputs. The ones worth
naming, because each is a class of bug rather than a case:
- every parser returns a value and never raises, for any text (they read journals, container logs and configs other tools wrote);
outcome_kindis total: every string maps to one of five kinds, so the UI never has to guess;_switchesmatches whole arguments, so--disable-radix-cachecan never answer for another flag;drift(p, p) == []for any profile, and drift is symmetric in the keys it finds;oc-fit-limits.fit(pool, ceiling)never grants more than the pool, never a negative budget, always whole thousands, and never less context for a bigger pool.
The relay boundary gets the same treatment, because it puts a browser interface
on a tailnet in front of an opencode that can run commands: only the relay's own
origin is ever allowed, null never is (a sandboxed iframe and a file:// page
both send it), host_name never returns a port, no caller header survives under
a name the relay owns (Host, Authorization, Connection, Upgrade), and the
upstream can never set a cookie named like the cockpit session, which would be
session fixation on the cockpit.
Two of these tests were wrong before the code was: one asserted fit always
returns a positive budget, which is false and taught the real contract (it rounds
down to a thousand, so a pool too small for a thousand-token answer correctly
returns (0, 0)); another expected an Upgrade header on a non-websocket
forward. Both were rewritten to state what the code actually promises. That is
the method working: a property you cannot state correctly is a contract you did
not understand.
Fuzzing and simulation
The keepalive proxy is the only component that reads bytes it does not control,
so it gets both. The fuzz properties are the interesting half: a body with
nothing wrong in it comes back byte-identical, a pattern Python can compile
is never dropped, a dropped one genuinely does not compile, the result is
valid JSON whenever it changed, and sanitizing twice changes nothing more. That
matters because the v6.13 fix exists to stop one tool schema from killing a
session; a sanitizer that quietly rewrote good bodies would be the worse bug.
RelaySimulation is a state machine, not a script. Hypothesis generates
sequences of client behaviour (read nothing and vanish, read a little and vanish,
stay to the end, on either dialect, with or without a slow prefill) against a
real proxy and a fake engine that reproduces SGLang's abort rule: an abort for a
rid whose state is gone is recorded as ignored, not as an abort. After every
step two invariants are checked: no abort was discarded by the engine, and no
request was aborted with an id the engine never had (in particular, never a
locally minted msg_<uuid>). That is the production bug of 2026-09-09 expressed
as a property instead of a story.
Mutation score
tests/mutation.py edits one operator at a time in a module (comparison,
boundary, arithmetic, boolean, constant, not) and runs that module's suite after
each edit. A mutant the suite does not catch is a line the suite covers but does
not check.
python3 tests/mutation.py --all # every module, against its floor
python3 tests/mutation.py dashboard/lifecycle.py "python3 dashboard/tests/test_lifecycle.py"
First run on lifecycle.py: 74.8%, 53 survivors out of 210 mutants. The
survivors were read one by one and turned into the two MutantsThatSurvived
classes in test_lifecycle.py, each test naming the mutant it kills. Second run:
90.8%. What is left is mostly equivalent mutants, which no test can kill:
weight_ends >= 2 sits next to an or clause that already covers the boundary,
and pool <= 0 is unreachable past the not pool in front of it. One survivor
was removed by deleting code instead of adding a test: an if whose body was
pass decided nothing, so four mutants in it were undetectable by construction.
The System One block (2026-09-19). The typed-decisions endpoint is one block of
keepalive-proxy.py, so it was walked on its own: the repo's operators, the block's
own suite, and only the mutants that land between the block's first line and its
handler's last. 271 mutation points, 224 killed, 82.7%, re-measured on 2026-09-21
against the suite as it stands. The survivors that mattered were read one by one
and turned into tests that name them: the cap that serves its own value and refuses
one past it, the ten score levels against eleven, the refusal that echoes what failed
but never a state over 512 bytes, the served name asked again once its cache is old,
six decimals on a probability, the weakest question of a call in the label-mass
header, the floor that serves at its own value, and the two default options of a Noul
in order. Two families of survivor are worth naming because they are not equivalent
mutants and a test does kill them: every int(os.environ.get(X, "8") or 8) line
(a fresh interpreter is asked for its constants, so a default that moves is caught)
and the or in those same lines (an empty environment variable, which is what
Environment=SYSTEMONE_FANOUT= in a systemd drop-in gives you, must fall back to the
default instead of stopping the proxy at boot).
The 2026-09-21 run found one survivor that was neither equivalent nor already named: the
or fallback of SYSTEMONE_RETRY_TOP_K, and of the two relay ceilings added the same
day. Those three are now in the list the empty-variable test walks, and adding them found
a real defect immediately: TOP_LOGPROBS_CEILING= (an empty variable, which is what a
systemd drop-in writes) fell back to 0, and 0 is what turns the refusal off. The guard
against a one-request engine kill was one empty drop-in line away from being absent. That
is the whole argument for the mutation gate in one line: the test that caught it was
written to catch a mutant, not a bug, and it caught the bug on its first run.
A live matrix, because a fake engine cannot serve a model (systemone-check.py).
Every shape of the contract sent to the real lane and graded against the contract, every
refusal compared with what api.typesafe.ai answers to the same bytes, every lever on its
own proxy, the door under twelve simultaneous callers, and typed decisions mixed with
ordinary chat, plain and streamed, on the same engine. 44 of 44 on 2026-09-21. Its own
first run failed five checks and all five were the checker being wrong, each settled by
asking the hosted API rather than by reading this repo's code: a Score returns the expected
level index, not a fraction (the hosted model answers 8.45 on a ten-level scale), and three
refusals this tool expected as 422 are 400 there, one of them with the same message to the
character. The expectations in that file now carry where they came from.
Two tests in that suite skip rather than lie when what they check is absent: the round
trip through TypeSafe's own SDK (installed in CI since 2026-09-19, so it runs there
too) and the label list re-derived from the served model's tokenizer.json, which is a
box-side check because a runner has no model.
The tool had two bugs of its own, both worth recording because they are the failure modes of every home-made mutation runner.
Stale bytecode. CPython validates a .pyc against its source mtime and
size, so two mutants written inside the same mtime granularity with the same
length are indistinguishable to that check and the interpreter silently re-runs
the previous mutant's bytecode. That reported a mutant as surviving which the
suite kills in one second by hand. It now sweeps __pycache__ and runs with
PYTHONDONTWRITEBYTECODE=1. The first 94.2% it printed was not real; 90.8% is.
Mutating the working tree. The first version edited the real file and restored
it in a finally, which is wrong twice: anything else reading the repo at that
instant sees a mutant (a parallel test run reported 46 errors and one baffling
parse failure, which was this tool editing recipes.py underneath it), and a
kill -9 between the write and the restore leaves a mutated source staged for
commit. It now copies the repo to a temp directory and mutates the copy, so a
killed run cannot touch the tree at all. Verified by killing one mid-walk and
checking git diff.
The secret the diagnostics bundle must not leak
job_diag_bundle collects journals, container logs, the launch script and the
engine's own server_info into a tarball a user is meant to attach to an issue.
Every one of those sources has the serving API key in it: SGLang prints
api_key=... in its ServerArgs banner, which lands in the docker log and the
journal, and the launcher passes it on its command line. The bundle masks it, and
that masking has been wrong before, committed as "key masked, verified".
test_cockpit_jobs.py does not trust the word. It plants a known key in every
source the bundle reads (a stubbed run() for the journals and logs, a stubbed
http_json for the server info, a real launch script on disk), builds a real
tarball, and greps every member for the key. Two more tests close the obvious
holes in that check: one requires the <masked> marker in at least three members,
because a grep for the key also passes when the bundle collected nothing; another
requires the launcher to still contain --port 30000, because a bundle that
gutted the file instead of masking it would also pass.
The keepalive, which is why the proxy exists
An agent CLI gives up on a silent stream: opencode and the AI SDK were measured dying at 140 to 180 seconds, and a 200,000-token prefill on this hardware is longer than that, so the proxy writes into the stream while the engine is quiet. That loop had no test, and it is where a subtle mistake is most expensive: v6.4 injected a keepalive in the middle of an SSE event and corrupted the stream.
tests/test_proxy_keepalive.py scripts a fake engine's silences to the
millisecond and pins the contract:
- a silent engine gets keepalives and the real answer still arrives afterwards;
- the OpenAI keepalive is an authentic empty chunk (
choices: []) and not a comment, because a comment is what client stall detectors ignore; the test parses it as JSON and requires the empty list; - the Anthropic route gets the official
event: pingand never the OpenAI one; - every record the client receives parses on its own, which is the v6.4 bug as an assertion;
- a fast answer gets no keepalive at all;
- past
MAX_SILENCE_Sthe request is dropped, not before it, and an Anthropic client is told why rather than having its stream just stop; - a clean close with no
[DONE]is end of stream and the proxy must not invent the[DONE]the engine never sent, while a transport reset is different and does produce an error event.
That took keepalive-proxy.py from 68% to 75%.
Concurrency
Threads make failures probabilistic, so test_concurrency.py hammers rather than
samples: 24 callers released from one barrier, eight attempts per property. What
it pins is the cockpit's entire safety story, that only ONE privileged action
ever runs:
- exactly one caller gets 202 and the other 23 get
409 busywith the running job named, whatever the interleaving; - a refused parameter (400) and an unknown action (404) never take the lock, so they cannot cost the next caller its turn;
- the lock is released even when starting the job raises, which is why
start_actioncatches around it (the test makes it raise on purpose); - the audit log has one unbroken JSON line per started job, parsed back to prove no line was torn by two writers;
- the state snapshot the SSE stream serializes stays serializable while four
samplers write into it, the event ring stays bounded under six writers, and
CpuTrackernever returns a percentage outside 0 to 100 while sampled from four threads.
Writing these found test pollution rather than a product bug, which is itself
worth recording: a tearDown that released the job lock while the job thread
still held it made run_job's own release raise release unlocked lock in a
background thread, printing a traceback that reads exactly like a product defect.
The suite now waits for the lock instead of taking it.
What the tests found
Not a hypothetical list. Every item below was found by writing the tests above, on code that was already in production:
- 21 unauthenticated or authenticated crash paths in the cockpit. Valid JSON
of the wrong shape (
{"key": null}, a non-object body, non-dictparams) reached.get()andhmac.compare_digest()and raised, killing the handler thread and dropping the connection with no answer. Five are reachable before authentication. One assumption in three places; fixed at the boundary and pinned by aMalformedJsonclass that keeps every one of the 21. - A drift panel blind to a whole class of flag. Recipes held flags as
"flag -> value" pairs, so
--sleep-on-idlehad no representation and the panel whose job is to say where the box differs from the repo had nothing to report about a lane missing it. - A benchmark printing the wrong reference.
bench.shannounced the 27B lane and its baseline whatever lane was serving, so a normal 41.9 tok/s on the flash lane read as a regression against another model's number. - A feed painting a client that walked away in the same red as a dead engine,
because the browser was matching outcome strings with one rule: not
okmeans failure. - Test pollution that reads like a product bug: a
tearDownreleasing the cockpit's single-job lock while the job thread still held it maderun_job's own release raise in a background thread.
Where it stands, 2026-09-10
| before | after | |
|---|---|---|
| offline test functions | 216 | 461 |
| generated inputs per run | 0 | ~17,000 (57 property and fuzz checks x 300) |
| branch coverage, dashboard total | 68% | 91% |
branch coverage, cockpit.py |
14% | 71% |
| modules at 100% branch coverage | 0 | 2 |
| modules at 0% | 3 | 0 |
mutation score, lifecycle.py |
never measured (74.8% when first asked) | 91.7% |
| CI gates | 28 | 38 |
| defects found and fixed by the new tests | 21 crash paths, 1 dead branch, 3 wrong outputs |
Where it stands, 2026-09-19
The table above is the snapshot of the campaign that built this suite. Nine days
later, counted mechanically and the same way on both commits (tests/test_*.py
plus dashboard/tests/test_*.py, def test_ inside them, and - name: steps in
the CI workflow; the 2026-09-10 column is measured on commit 5cf4c98, which is
why its test-function count differs from the row above it, counted differently):
| 2026-09-10 | 2026-09-19 | |
|---|---|---|
| test files | 20 | 34 |
def test_ functions in them |
442 | 587 |
| CI steps | 38 | 55 |
What arrived since: the installer's Xet retry (6 gates), tools-check.py and its
fake engine (11), the suite-isolation pair that fails when a test file moves HOME
for the files that run after it (2), the cockpit's fit verdict (4), and the gate
that a native install warns before it strands an installed 1m unit (6). Each was
verified the way this file requires, by breaking what it guards: the Xet retry
fails 4 of its 6 against the code without the fix, the fit verdict fails 40 grid
cases against the pair the banner used to print, and the isolation gate names
test_tools when the module-level assignment comes back.
Who tests the gates
A gate that cannot fail is decoration, so each one was verified by breaking the
thing it guards and checking it caught it (2026-09-10, each restored immediately
and git diff checked clean):
| gate | broken on purpose | caught |
|---|---|---|
| Every serving lane parks its scheduler | --sleep-on-idle deleted from the flash template |
yes |
| The proxy writes exactly the outcomes this file knows | an outcome renamed in keepalive-proxy.py |
no at first, see below |
| Mutation score | floor raised to 99% | yes |
| Coverage floors | floor raised above the measured value | yes |
| Property-based checks | hypothesis made unavailable | yes |
| The offline suite touches nothing | a suite writing into HOME |
yes (found for real) |
The one that did not catch it is the interesting one. The first version asserted
"every outcome the proxy writes lands on a kind the UI knows", and outcome_kind
falls back to fail, so a new outcome that should have read gone or ok
passed the gate while being mis-coloured in the feed. The vocabulary is now a
closed set with the kind each string must read as, so adding an outcome to the
proxy fails CI until someone decides what it is.
Reading the vocabulary out of the proxy took three attempts, which says something
about extracting facts from source with a regex: re.findall on self._done(
caught the first literal only and silently hid "UPSTREAM CUT" inside
self._done("ok" if kind == "f" else "UPSTREAM CUT"); then an ast.walk over
every string Constant picked up the pieces of the f-strings ("503 engine unreachable (upstream ") as if they were outcomes. It now resolves each argument
by node type: a literal is itself, an f-string is its parts with a stand-in for
the hole, a conditional is both branches.
Conventions
- Every test file runs its own tests when invoked directly (
python3 tests/test_x.py), and CI counts what ran against what the file declares. A file with 58 tests and no__main__block once exited 0 having run nothing: silence is not a pass. - Fixtures are real output from the reference box, trimmed, not invented.
An
[N/A]fromnvidia-smion unified memory, the engine's log tail and the docker, systemctl and proxy journal outputs are indashboard/tests/fixtures/; a Frenchfree -gand aReceived output for rid=...flood line are written inline in the tests that feed them (test_cockpit_collectors.py,test_lifecycle.py). - A test names the bug it prevents, in the words of what went wrong.
git logandCHANGELOG.mdcarry the story; the test carries the guard. - Nothing in the offline suite touches the box: no network, no docker, no
systemctl, no real API key. That is a checked property, not an intention,
because these tests are run on the machine that serves production: the CI step
"The offline suite touches nothing outside itself" gives the suite a witness
HOME, hashes every file in it before and after, and runs the suite undertests/suite_reaper.py, a child subreaper: whatever the suite's processes leave running, listening or not, is theirs to answer for, while an editor that opens a port meanwhile is not (comparing every listener of the machine failed twice on 2026-10-03 while VS Code opened and closed ports). It earned its place immediately by catchingtest_cockpit_code.pywritingcockpit-secretinto the developer's own~/.config/qwen38, because importingcockpit.pypersists an HMAC secret (so a service restart does not log every browser out) and that suite had not redirectedCOCKPIT_CONFIG_DIR.test_cockpit_collectors.pyadds the other half by recording every argv its stub was asked for. The step runs the files up to four at a time. A file that callsgetsockname()[1]takes a port number out of a socket it closes, to start a server on it later or to have a port where nothing listens, and a file running beside it could be handed that port meanwhile, so such a file runs alone once the others are over. None does sincetests/localports.py(2026-10-28):held()keeps a port where nothing listens,serve()starts a server of the test's process on it, andspawn()starts a server in a process of its own on port 0 and reads back from /proc the port it listens on.test_localports.pyfails on a test file that takes a port the old way.