Files
yetone 31dcfcc336 testenv: a docs page edited without its site index fails the package run
site/public/llms-full.txt and search/*.json are built from the docs
pages and committed. A Go change that edited a docs page and ran only Go
tests left them stale on main five times from 11-13 to 11-17
(459d668b3, 256910f17, 9dcec6751, dbbb2f26b, 00b2c11a6), each caught by
CI's node tests after the push.

site/docs-index.mjs now writes all three: llms-full.txt, search/*.json,
and docs-index.sums, a sha256sum line per page they are built from.
`node llms-full.mjs` and `node search-index.mjs` each run all of it, so
running either one is enough. After a package's tests, testenv checks the
pages against the sums the way it checks eagerHere, and fails the run
when any page is edited, added or gone, naming each page. That covers
the 64 packages that use testenv, a -run of one test included.
search.test.mjs checks that the sums are current. The code standards'
criterion 3 and LESSONS say so.

Generating at this base changed neither llms-full.txt nor the search
indexes, so they were current.

Run:
- mote: go vet ./internal/testenv; go test ./internal/testenv
  (TestDocsIndexStaleNamesEachChangedPage, TestDocsIndexCurrent) and
  internal/agent's TestEveryFieldLabelHasTUIZh: ok.
- mote: node --test site/search.test.mjs site/worker.test.mjs: 47 pass.
- Linux (wsl-run) and Windows (win-run): go test ./internal/testenv ok.
- mote: GOOS=windows/linux go vet ./internal/testenv: ok. gofmt -l:
  clean.

Broken by hand: appending a <p> to docs/alma.html without regenerating
made `go test -run TestEveryFieldLabelHasTUIZh ./internal/agent` fail
("testenv: docs pages changed … docs/alma.html") with its test passing.
search.test.mjs went red too.

Not run: the full Go suite. It starts after the push.
2026-11-17 15:17:35 +08:00
..
gateway, provider tests: the tests stay off the network (testenv.Offline in their TestMains) — after 555f5706 (#1016) routing reads a plan key's quota windows, and a test whose provider has a vendor's real base URL and a made-up key would ask the vendor in the background. Routing's own read (keyAllowance, allowances) was already stubbed in routing_test.go's init, and a survey with a dial guard found no plan-key dial, but it found others: every plugin host's first start fetched models.dev's catalog (65 dials in the gateway's plugin tests), and provider tests asked api.github.com (TestSubscriptionUsageEachAccount, TestSubscriptionUsageServesStale), chatgpt.com (TestCopilotQuotaWithoutEditorsSignIn), server.codeium.com (TestDevinSignedInOnlyInMagpie) and decide.test (TestModelTest) with made-up accounts; each passed whether the vendor answered or not. internal/testenv's Offline wraps http.DefaultTransport's DialContext (so http.DefaultClient and every transport cloned from it later): localhost, *.localhost, loopback and unspecified addresses are dialled, anything else is refused before it is looked up, said once per address on stderr ("testenv: a test asked models.dev:443, refused: tests stay off the network"). internal/gateway's TestMain and internal/provider's (kiro_main_test.go, in RunIn's setup) call it before the tests run. TestLocal (the address table) and TestOffline (a loopback httptest server answers through DefaultClient; models.dev is refused through it and through a Clone made after the call) pass -race -count=3. go test -race -tags nogui -timeout 30m ./internal/testenv ./internal/provider ./internal/gateway passes under a temp HOME (gateway 516 s). The gateway and provider test binaries were then run under sandbox-exec with every non-loopback network-outbound denied, with the kernel's Sandbox reports streamed: both PASS, Offline refused only the six addresses above, and the kernel reported no denial, so no transport outside DefaultTransport reaches the network either. go vet, gofmt -l, linux and windows (nogui) builds pass. Tests only.
2026-10-06 21:08:57 +08:00
gateway, provider tests: the tests stay off the network (testenv.Offline in their TestMains) — after 555f5706 (#1016) routing reads a plan key's quota windows, and a test whose provider has a vendor's real base URL and a made-up key would ask the vendor in the background. Routing's own read (keyAllowance, allowances) was already stubbed in routing_test.go's init, and a survey with a dial guard found no plan-key dial, but it found others: every plugin host's first start fetched models.dev's catalog (65 dials in the gateway's plugin tests), and provider tests asked api.github.com (TestSubscriptionUsageEachAccount, TestSubscriptionUsageServesStale), chatgpt.com (TestCopilotQuotaWithoutEditorsSignIn), server.codeium.com (TestDevinSignedInOnlyInMagpie) and decide.test (TestModelTest) with made-up accounts; each passed whether the vendor answered or not. internal/testenv's Offline wraps http.DefaultTransport's DialContext (so http.DefaultClient and every transport cloned from it later): localhost, *.localhost, loopback and unspecified addresses are dialled, anything else is refused before it is looked up, said once per address on stderr ("testenv: a test asked models.dev:443, refused: tests stay off the network"). internal/gateway's TestMain and internal/provider's (kiro_main_test.go, in RunIn's setup) call it before the tests run. TestLocal (the address table) and TestOffline (a loopback httptest server answers through DefaultClient; models.dev is refused through it and through a Clone made after the call) pass -race -count=3. go test -race -tags nogui -timeout 30m ./internal/testenv ./internal/provider ./internal/gateway passes under a temp HOME (gateway 516 s). The gateway and provider test binaries were then run under sandbox-exec with every non-loopback network-outbound denied, with the kernel's Sandbox reports streamed: both PASS, Offline refused only the six addresses above, and the kernel reported no denial, so no transport outside DefaultTransport reaches the network either. go vet, gofmt -l, linux and windows (nogui) builds pass. Tests only.
2026-10-06 21:08:57 +08:00