conftest.py checks every connect and every name lookup of the test process: loopback and local sockets pass, anything else is refused at once
(ConnectionRefusedError / gaierror, which the code under test reads as offline) and the test FAILS at its end, naming the host and the place in
the code the reach came from. A live test sets STRATA_TEST_ALLOW_NETWORK=1 itself (the live-download test class in tools/ does). Child
processes are not covered.
Three named allowances, counted per test and printed once at the end of the run ("network guard: allowances used": test id, allowance, address):
(a) a UDP connect() (it only names the peer and sends nothing), (b) a lookup of this computer's own host name, (c) the RFC 5737 documentation
addresses 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 (nothing answers them). tests/terminal/test_net_guard.py pins that an address outside
them, a real host name and a TCP connect outside those ranges still fail, and that each use is counted.
tests/terminal/test_owner_transport.py::TestLoopbackTransport::test_it_binds_loopback_only (a TCP connect to 203.0.113.1, on purpose) and
serve/test_security.py::ListenAddress::test_ipv6_loopback (a UDP connect to learn the outgoing address, and the computer's own name) pass through
allowances (c) and (a)/(b); those two tests are not changed.
Five tests of setup / launch / update looked up real host names and are fixed with a PC that has no name service (net_dead.no_name_resolution)
or, for setup.main's model-list read, STRATA_FEED_MODELS=0: tools/test_setup_unsloth.py::IQ4XS::test_family_default_and_menus,
tests/terminal/test_drafting_tuned.py::SetupOnAMac::test_offline_it_says_nothing, tests/terminal/test_update_notice.py::Offline (the DNS and the
proxy test), tests/tuning/test_components.py::TestInterruptedTransfer::test_a_partial_file_larger_than_the_declared_size_is_discarded.
Full check with the guard on (py-tools / py-tests / py-serve): p2006 (internet) 1713 / 3556 / 1495 passed, 0 failed; l620 (no internet)
1713 / 3556 / 1495 passed, 0 failed.
The rest of the call table goes through strata_control/netpolicy.py:
- transfer.read_small and transfer.download: 12 s then a 30 s retry for the connection; a download resumes from the byte it reached, in the same
run, while bytes keep coming, and stops after 5 minutes in a row with no new byte (W6), never on a total time. transfer.Unreachable /
Interrupted carry the host and the words.
- feed.fetch (the update check): W7 and its two companions (offline; "did not answer a moment ago"), raised as feed.FeedUnreachable(FeedError,
exit code 6). Callers that must stay silent at a launch catch the class, not the words: dsv41_engine.upgrade matched the text "could not be
read" and would have printed "A newer DeepSeek engine may be available but could not be checked: ..." offline with the new sentence; drafting_fetch
names the class too. feed_models.load reads under shorter limits, prints the waiting line and no failure sentence. Silence offline / refused /
never answering is tested for dsv41_engine.upgrade, shape_engine.ensure, drafting_fetch, feed_models.load, driver_floor.from_feed and the daily
check (tests/terminal/net_dead.py, test_net_silent_callers.py and the callers' own test files).
- updater, pictures and drafting_fetch say what they download, so the failure reads "... so <what> could not be downloaded".
- components._fetch and tools/mtp_fetch.py use netpolicy.urlopen through open_url in full (the draft layer's 120 s x 6 loop is gone); setup runs
the draft-layer fetch again only when the last run moved bytes, and stops on its NO_ANSWER exit (4) with the fetch's own lines.
- setup's parallel and single downloads end after 5 minutes without a new byte (W6) instead of 30 rounds or 35 minutes of silence.
- Host memory: only a call that used the whole window (12 s, then 30 s) writes it; shorter calls only read it.
transfer._copy keeps what arrived before a stall. It read 1 MiB blocks with read(): when a connection stalled mid-block the received bytes were
thrown away, so a stalled download lost up to 1 MiB and the 5-minute clock (counted on the .part size) saw no progress. It now gathers read1 pieces
up to 1 MiB and hands them on at once when a read had to wait; on an error the gathered bytes are written first. Measured on loopback, 2 GiB per
run, 3 runs alternating, client CPU, MiB/s (copy CPU s):
p2006 HTTP old 4044 (0.51) read1 only 3945 (0.52) gathered 3899 (0.52)
p2006 TLS old 1751 (1.14) read1 only 1264 (1.60) gathered 1523 (1.32)
l620 HTTP old 2918 (0.57) read1 only 2896 (0.70) gathered 2937 (0.65)
l620 TLS old 1160 (1.74) read1 only 826 (2.45) gathered 970 (2.10)
HTTP is within noise; TLS is 13-16% under the old loop at 1.5 and 0.97 GiB/s, above any link a user downloads over. The gathering is kept on
purpose: it is what keeps received bytes across a stall; do not remove it to win the TLS figure back.
Existing tests that encoded the old behaviour are updated to the new rule: the "cut download resumes" tests (updater, dsv41 engine and upgrade,
shape engine, update-with-model) now assert that the first run completes, that exactly one more request follows with the header
"Range: bytes=<kept>-" and that no byte is fetched twice; the W6 test also resumes on the next run from the kept size. The unreachable-feed tests
assert the approved sentences.
Tests: tests/terminal/test_net_transfer.py (including the 365 s real-time trickle tests with STRATA_SLOW_NET_TESTS=1, which passed on the final
tree), test_net_silent_callers.py, tools/test_setup_dl_fix.py, tools/test_mtp_fetch.py, tools/test_setup_pins.py, tests/tuning/test_components.py,
tests/terminal/test_net_launch_waits.py (the short model-list read keeps the download its own attempt).
The command-line and TUI client with profiles, doctor, monitor, serve, calibrate,
bench, the runtime owner, component registry and offline policy, plus tests/terminal,
the component/offline tests, the smoke tools, the terminal CI workflows and the
terminal docs. Tuning and Time-skip modules of strata_control follow in their own
commits (strata_cli/cli.py imports them lazily).
From the owner's rebuild branch strata/rebuild-2026-10 (1e4171e2, based on 296b59d2).
README.md and tools/calibrate.py applied as small 3-way patches.