Repository navigation
feat(ci): hand-rolled network parsing gate and first rules (Part of #1107) - #1764
Merged
dan-petty merged 1 commit intoOct 21, 2026
Merged
Conversation
10 tasks
dan-petty
added a commit
that referenced
this pull request
Oct 21, 2026
* perf(tests): answer the review report's group analysis from the model fake (#1726) * perf(tests): answer the review report's group analysis from the model fake test_fake_scanner_results_with_absolute_paths_come_out_repository_relative faked the scanners but left the model edge real. generate_consolidated_report runs the group analysis stage on the admitted scanner findings, so the orchestrator built a real client through get_llm_client, the network guard refused its loopback connect to the model server, and the HTTP transport retried five times with 1, 2, 4 and 8 seconds of backoff before the stage recorded a model-call error. That backoff was 15.0s of the test's 15.15s, on every run locally and on CI. The test now takes the model_fake fixture, which installs the shared ModelFake into the client factory seam, so the group analysis asks the fake and the report is written with no socket and no retry. Every assertion is unchanged. The test went from 15.15s to 0.16s under uv run pytest -n 0 --durations=0 -q tests/ai/review/test_pipeline.py, removing 15.0s. The product's retry policy is unchanged: backing off on a refused connection is what the client should do while a gateway restarts, and the wait came from the test's missing double, not from a fixed timeout standing in for an event. No other test in tests/ai/review/ or in the review report tests waits on a retry backoff. Part of #1725 * docs(tasks): record #1725's rows, with the review pipeline wait done Part of #1725 * perf(ci): make test_isolation_tripwire cheaper with in-process pytester (Part of #1725) (#1727) * test(devcontainer): post-create and post-start tests start no real installer, uv sync, kubectl or sudo (#1730) * test(devcontainer): answer post-create's programs as installed so no real installer runs Four post-create tests were among the slowest on the GitHub runner but fast here: test_devcontainer_post_create_scaffolds_agent_instructions 16.9s (2.5s here), and the post_create, setup_volume and run_lifecycle tests of TestDevcontainerCli 13.0s, 12.8s and 12.0s. post-create installs uv, pre-commit and claude when shutil.which cannot find them, and the runner has no claude, so each of the four ran Claude Code's real installer, `curl -fsSL https://claude.ai/install.sh | bash`: a 276 MB download into the test's home, which took 18-19s here with claude taken off PATH. The instruction-generator test also ran a real `uv venv` and `uv pip sync --require-hashes` of the locked semgrep (67 packages) and bandit into its data directory, which took 4.7s more with a cold uv cache, as the runner's pruned setup-uv cache is for semgrep. The three TestDevcontainerCli tests take an image_programs_installed fixture that doubles shutil.which at the stdlib, answering every program as installed, as in the published image, and the instruction-generator test does the same and passes --skip-tools. Every assertion is kept. On a runner-like PATH without claude and with a cold uv cache, the post_create test went from 19.4s to 0.03s and the instruction-generator test from 24.0s to 0.09s; setup_volume and run_lifecycle now take 0.15s and 0.11s, and none of the four starts an installer or uv. Locally, with claude installed and a warm uv cache, the instruction-generator test went from 0.9-1.3s to 0.05s, and the two files from 9.5-15.6s to 7.3-8.6s serially. setup_volume and run_lifecycle still run a real `kubectl config get-contexts` from post-start, which the row for real kubectl covers. Part of #1725 * test(devcontainer): name no Kubernetes context so post-start tests run no real kubectl Four TestDevcontainerCli tests, the post_start, post_start MCP sync, run_lifecycle and setup_volume tests, ran a real `kubectl config get-contexts -o name` (0.06-0.07s each) through post-start's step that aligns kubectl with the configured context. The context they saw was minikube, KubernetesConfig's built-in default: HOME is isolated and holds no global config, the per-test config.yaml has no k8s section and no variable sets one, so nothing leaked from the user's config or environment. None of the four asserts on the context step. A no_configured_k8s_context fixture appends an empty `k8s.context` to the config.yaml the autouse isolate_devops_cli_config fixture yields, then resets the settings and context caches, the context cache because it is keyed on the config file's modification time alone, which a write in the same clock tick as an earlier test's leaves unchanged. With no context named, post-start leaves kubectl alone, and the four tests now start only `git config --global` against their own HOME. Every assertion is kept. Part of #1725 * test(devcontainer): the ownership test removes getuid instead of running a real sudo chown test_ensure_path_ownership_and_mount_edge_cases meant to test a missing os.getuid but made it return None, which reads as a different owner, so _ensure_path_ownership ran a real `sudo chown -R None:1000` on the test directory. The step now deletes getuid inside monkeypatch.context(), and the function returns before any chown. The task file and changelog fragment record the item. Closes #1731 * perf(ci): make test module imports lazy to speed runner collection (Part of #1725) (#1736) * perf(tests): committed kustomizations render once per test process, with kubectl's offline renderers run as real tools (#1737) * perf(tests): render each committed kustomization once per test process kubectl's offline renderers, `kubectl kustomize` and `kubectl patch --local`, read only files and reach no cluster, so tests run them for real as they run git, and docs/TESTING.md now lists them with the real local tools. Every other kubectl call stays off a cluster through the floor's empty throwaway kubeconfig, which the root conftest's session-wide `isolate_kubeconfig` sets for every test. tests/k8s_manifests.py now renders a committed kustomization under k8s/ once per test process, keyed by its resolved directory, and shares that render; a kustomization a test builds under tmp_path is still rendered each time it is asked for. The Argo CD application, network policy and monitoring invariants and the overrides test read the repository's renders through it instead of starting kubectl themselves, and tests/test_k8s_argocd_apps.py parses them with libyaml's CSafeLoader, as tests/k8s_manifests.py already does. Every assertion is unchanged. Measured on the 33 tests that start kubectl, interleaved before and after at load 10 to 19: serially (-n 0) 15.9s summed and 17.6s wall before, 11.5s summed and 12.8s wall after; at -n 4, 36.0s summed and 19.9s wall before, 21.8s summed and 14.8s wall after. The nine repository-render tests other than the Argo CD gate test, whose renders run inside devops-cli, went from 7.3s to 2.5s serially and from 14.6s to 6.0s summed at -n 4. Part of #1725 * docs(adr): ADR 0007 lists kubectl's offline renderers with the programs tests run for real The decision on #1725 lets tests run `kubectl kustomize` and `kubectl patch --local` like git, and docs/TESTING.md now says so; ADR 0007's edge definition and its consequence on real programs say the same. Part of #1725 * docs(tasks): record #1732, committed kustomizations rendered once per test process Closes #1732 * test(ci): the review tests run on recorded scanner results, and no test starts a real gh or scanner (#1738) Six review tests started the real Semgrep, Gitleaks and Bandit, and Semgrep downloaded its `p/default` rules over HTTPS from inside the test, where the suite's in-process network block cannot see it. They now ask for `scanner_fake` (`tests/support/fakes/scanners.py`), which doubles `shutil.which` and `subprocess.run` and answers each scanner with the run recorded from the real tool at its locked version, started as a review starts it. The contract suite, `tests/test_scanner_contract.py`, holds each recording to its adapter's command and to `tools.lock`. Alone with `-n 0` beside other agents' work, the six took 49.6 s before and 5.2 s after, about 44 s removed; their files and the two other tests measured with them went from 61.0 s to 15.1 s. A session-wide fixture in `tests/conftest.py`, `refuse_real_programs`, now fails any test that starts gh or the binary of any scanner the security scanner registry holds. `tests/support/refused_programs.py` reads those names from the registry once, when the guard is installed, so a scanner added there is refused with no list to edit; building it then took 0.02-0.08 s per worker, since the conftest has already loaded its modules. The guard sits on `subprocess.Popen`, beneath every seam, and fails the test with `pytest.fail`, which the scanner adapters' handlers of every exception cannot turn into a failed scan. `docs/TESTING.md` says so, and marks sudo and uv installing from PyPI as the target. The post-create test's real uv and the ownership test's real sudo are stopped in #1730. It counts toward the v0.2.38 CI time budget in #1725. Closes #1666 * perf(tests): the startup-import checks start one interpreter per command line (#1739) * perf(tests): measure each startup import argv once tests/test_cli_startup_imports.py started 63 interpreters for its 62 tests, and nine of them measured a start another test had already measured: the root `--help` ran for the telemetry check, the heavy-module check and both structural budgets, and `--version`, `ci --help`, `workspace --help`, `ai --help`, `review --help` and `k8s --help` ran twice each. `test_cli_help_startup_imports` now runs each help argv once, in a fresh interpreter under `-X importtime`, and checks that one run against everything that applies to the argv: no module of `CONST_CLI_HEAVY_MODULES`, in `sys.modules` or reported by importtime, for `--version`, the root help, every command group's help and `ai benchmark --help`; no logfire, opentelemetry.sdk or pydantic_ai for the root, `ci` and `workspace` help (#858); and #1687's main-and-version and command-help budgets for the same six argvs as before. Every argv still runs in an interpreter of its own, so no command's imports count against another's. The probe imports `devops_cli.entry` and calls `main`, as the `devops` script does; against `-m devops_cli.entry` it reports the same number of modules, `devops_cli.entry` in place of `runpy`, so each devops_cli count is one higher (52 of 75 for `--version`, 209 of 250 for `ai --help`). The heavy-package control and the CPU-load control read the same probe. `test_cli_dry_run_imports_only_plan_dependencies` is parametrized by argv, so its three runs can go to three workers instead of holding one for 9.5 s on the runner; its docstring records why the review case can still take over 5 s. Measured back to back with `uv run pytest --durations=0 -q tests/test_cli_startup_imports.py` while other sessions held the host's load average between 20 and 70, which stretches every number: at `-n 0` the file took 321 s and 314 s of wall time and 192 and 181 CPU-seconds before, and 157 s and 166 s and 147 and 142 CPU-seconds after; at `-n 4`, 175 s and 157 s and 231 and 245 CPU-seconds before, and 93 s and 184 CPU-seconds after (a second run during a spike to 71 took 338 s and 262 CPU-seconds). A start costs the same CPU through the new probe as through the old ones, so the saving is the nine starts, about 15 CPU-seconds at a load average of 16, and the three dry runs no longer hold one worker in turn. With kubernetes imported by `devops_cli.commands.ci`, logfire by `devops_cli.commands.workspace` and the command-help devops_cli limit lowered to 100, the new test failed for the help of `ci`, `format`, `lint`, `repos` and `workspace` (heavy and telemetry modules) and of `ai`, `ai benchmark`, `k8s` and `review` (the budget), and passed for the other 33 argvs; with docker imported by `devops_cli.commands.k8s`, the `k8s deploy-stack --dry-run` case failed. docs/TESTING.md says that each argv starts one interpreter. Part of #1725 * docs(tasks): record #1733, one interpreter start per startup-import command line Closes #1733 * perf(tests): the dashboard tests wait on conditions, with animations off and a doubled Docker engine (#1740) * perf(tests): wait on the dashboard tests' conditions instead of pauses, animations and the real Docker engine Most of the time the Textual dashboard tests spent asleep was Textual's own waiting. After every key, `pilot.press` waits until the process stops using CPU, for up to a second, and `pilot.pause()` does the same once. Three things kept the process busy. A tab switch animated its underline for 0.3 s, so the root conftest now sets Textual's own `TEXTUAL_ANIMATIONS=none` before Textual is imported, and the underline moves at once. The endless log source of the stream-switching tests wrote a line every 2 ms, which held every key in those tests at the one-second cap; it now writes one every 10 ms. And the lifecycle, refresh-before-mount and four `--summary` tests in `tests/test_ui_dashboard.py` listed the workstation's own Docker engine, 2 to 10 s per test, and the keys sent to the TUI waited on those refresh threads; they now use the shared `docker_engine` double with an empty engine. The fixed pauses are now waits for the condition each test checks. `_settle` reads its predicate every `POLL_INTERVAL_SECONDS` under `THREAD_HANDOFF_BOUND_SECONDS`, pumping the UI between reads, in place of a 50 ms poll under a 10 s deadline of its own. The 0.3 s window of the stream-switching tests and the 0.2 s window of the stop test wait instead for the old stream's reader thread and consumer worker to end, after which no leaked line can still arrive; with the stop flag removed from `start_stream` and `stop_stream`, all three still fail. The quit test waits for `q` to stop the app, the daemon-reader test for the reader to enter its read, and the help-screen steps of the lifecycle test for pending messages only. `docs/TESTING.md` states how a Textual test waits. Both trees ran at the same time, so they shared the load other sessions put on the host (load average 20 to 56). Summed per-test time for the two files went from 224.1 s to 140.9 s at load 32 to 42 (`test_ui_dashboard.py` 50.0 s to 8.1 s, `test_ui_reactive.py` 174.1 s to 132.8 s), from 328.6 s to 290.5 s at load 22 to 43, and from 614.1 s to 574.7 s at load 42 to 56. The dashboard file's saving holds at every load; the reactive file's shrinks as the load rises, because a starved process stretches the real rendering work and looks idle to the pilot sooner. Part of #1725 * docs(tasks): record #1339, the dashboard tests' waits Closes #1339 * feat(review): link related findings across groups and order review remediation plan (#1148) (#1742) - Deterministic cross-group keys: CWE, rule family, symbol-graph component from ai/review/ast_imports.py, purl, and manifest source, written as correlation table in analysis.json and review.md. - Strict G10 verification: enforce that any "same root cause" statement or relation only links findings with shared correlation keys. - Review-level remediation plan stage: orders findings by introduced first, then severity rank, then file path, line, and fingerprint. - Grouping: consolidates related findings (such as the 9 DaemonSets in k8s/llm/profiles/ollama-profiles.yaml) under a single step. - Property test: verifies findings, findings.json, and findings.sarif are identical with stage on vs off. - Offline tests: all tests run offline with recorded fakes in <1s per test. Closes #1148 * perf(ci): the gate's test workers steal work and Bandit runs under nice (#1745) * perf(ci): steal work across xdist workers and run the gate's Bandit under nice The test row is the gate's critical path, locally and on the runner, and how the gate schedules its work held it back in two places. Under xdist's default `load` scheduler each worker is handed blocks of consecutive tests that only it then runs, so a block of slow tests handed out late keeps one worker busy after the others are done. `addopts` now passes `--dist worksteal`, under which a worker that runs dry takes half of another worker's unstarted tests. Replaying xdist 3.8's two schedulers over the per-test times of a full 16-worker coverage run, the tests end at 103.7 s under `load` and 97.1 s under `worksteal` on 16 workers (6.6 s sooner), and at 358.1 s and 316.2 s on the CI runner's 4 (41.9 s sooner), where Tests & Coverage shows a 51 s tail today. Three full runs of the gate's pytest command each on this shared host, alternating, at load averages of 19 to 71: the last worker finished 85.7, 36.1 and 302.8 s after the median one under `load`, and 64.1, 22.3 and 35.3 s after it under `worksteal`; wall times of 466, 372 and 910 s against 519, 405 and 446 s follow the other work on the host more than the scheduler. A run with `-n 0` keeps xdist's `dist` at `no`, so the narrowed `devops ci test` worker choice of #1669 is unchanged, and the pytester runs that name `-n 2 --dist loadfile` use their own ini and keep it. Bandit, beside the test row's 16 workers, took 61 s in the gate against 21 s alone. Its row now starts it as `uv run nice -n 10 bandit ...` (DEFAULT_CI_BANDIT_NICENESS), so it takes the CPU the workers leave idle instead of theirs, over the same `.bandit` targets at the same medium threshold; `devops ci security` runs the same row. One gate run each, before and after, at load averages of 24 to 56 and 20 to 42: 13m53s (test 13m26s, Bandit 5m47s) and 7m23s (test 7m2s, Bandit 6m28s, ending 34 s before the test row). At those loads the host sets both totals, so the runs show that a niced Bandit stays off the critical path rather than measure its gain. No coverage option is changed. On CPython 3.14, coverage 7.16.1 already measures through sys.monitoring (COVERAGE_DEBUG=core reports "Using sysmon because SYSMON_DEFAULT is set"), so COVERAGE_CORE=sysmon changes nothing, and `--cov-context=test` needs dynamic contexts, which sysmon lacks, so it falls back to ctrace and records a context per test: over two test modules at a load average of 17 to 24, without coverage, sysmon, ctrace and per-test contexts took 27.2, 49.7, 51.1 and 54.4 CPU-seconds. Part of #1725 * docs(tasks): record #1734, worksteal scheduling and a niced Bandit Closes #1734 * test(ci): no test connects to a localhost service it did not start, and a guard fails one that does (#1744) * perf(tests): fail a test that reaches a loopback port it does not bind, and double the services tests reached A scratch plugin recorded every loopback connect over the suite with -n 4. Apart from servers the tests start themselves, 2,249 tests reached the OTLP collector on 4318, because the floor's config turns export on there; 79 reached Valkey on 6379, 10 Qdrant on 6333, 5 Ollama on 11434, 2 the gateway on 4000 and 8787, 2 the port-forward probes of `devops k8s configure-urls`, and 13 ports picked by hand to refuse (9, 9999, 65530 and ports freed after binding). The network guard refused every one of them in-process, so no test reached a real service, but each refusal sent the client into its retry backoff: Qdrant waited 0.5 and 1 s per read, the gateway embeddings three waits of about 4.5 s in all, and the Ollama prewarm 1, 2, 4 and 8 s on a thread that outlived its test. The guard now owns a loopback port while a socket in the test process binds it, not only while one listens, and records every other loopback connect it refuses. The new autouse fixture `unexpected_loopback_connects` fails the test at teardown, naming host, port and thread, even when the code under test swallowed the refusal. A test that checks a service that is down binds `refusing_port`, a loopback port it never listens on, so the kernel refuses each connect. The floor's config sends telemetry export and the Valkey cache, side channels nearly every test reaches, to `unserved_side_channel_port`, a refusing port bound for the run. The tests in test_ai_cmd and test_pipeline_context_budget that hand a command their own `Settings()`, whose telemetry names no endpoint, point it at that port, so the tracer does not fall back to the built-in localhost:4318. The floor leaves OpenTelemetry's own `OTEL_EXPORTER_OTLP_ENDPOINT` unset: the SDK's OTLP exporters read it too, through logfire and in child processes, and with it set they retried their metric exports against the refusing port with backoff. Qdrant keeps an address no test binds, so a test that reaches Qdrant without a double fails. The guard's port ownership moved into a small class, which lowers its fixture's complexity from 10 to 9. Each test that reached a service now fakes it or refuses it through the double, with no product change. The chat and pipeline tests take `model_fake`, so the prewarm asks the shared fake. The RAG tests and the gateway routes refuse Qdrant and the gateway through `refusing_port`, tests that build their own `Settings()` point Valkey there, the k8s configure-urls tests refuse the port-forward probes at `socket.create_connection`, and the probe, metrics, run-store and collector-export tests replace their hand-picked ports with `refusing_port`. Retry waits behind a direct `time.sleep` return at once through the stdlib fallback in docs/TESTING.md "Clock", and the embedding tests now assert how many backoffs they took. Two leaks the guard surfaced are fixed at the source: the floor clears the RAG investigation cache after each test, whose cached retriever carried one test's Qdrant address into the next, and test_llm_client_properties_and_list_models waits for its non-blocking preload and asserts its result, which otherwise ran after the test against the real client and retried for 15 s. The review pipeline test takes `model_fake` with the same hunk as perf/1725-pipeline-test-wait, so the guard passes on this branch alone. Measured back to back on the same shared host with uv run pytest -n 0 --durations=0 -q, the base versions of the six files against the changed ones: test_ai_subcommands_rag, test_builtin_tools, test_rag_embeddings, test_rag_cli, test_rag_drift and test_ai_cmd went from 76.86 s to 56.80 s, removing 20.1 s. test_try_retrieve_rag_context_success went from 5.03 s to 0.45 s, test_gateway_failures_raise_naming_model_endpoint_and_error[unreachable] from 4.21 s to 0.18 s, test_rag_status_command from 1.74 s to 0.27 s, and the two embedding retry tests from 0.81 s and 0.55 s to 0.04 s and 0.02 s. test_builtin_security_and_iac_tools waited 4.5 s whenever it made the first knowledge base check in its worker (5.56 s in the full run) and now waits none. test_ai_token_count_route_pipeline_bundle went from 6.53 s to 3.98 s once its neighbour's Ollama retries stopped running beside it; it and three other test_ai_cmd tests of 2 to 5 s spend their time building the Typer command tree and the agent's tool schemas, not waiting. docs/TESTING.md records the guard, `refusing_port` and the side-channel port. Part of #1725 * docs(tasks): record #1741, no test reaches a localhost service it did not start Closes #1741 * test(ci): reset the knowledge-base check per test, so reaching Qdrant without a double fails in any order The knowledge-base check's cooldown is process state, so only the first test in a process to reach Qdrant made the check, and the loopback guard failed whichever test that was: under CI's shuffled seed 4031974453, test_rag_search_names_an_embedding_failure, which builds its own Settings() and so reached Qdrant at its built-in localhost address and exported telemetry to the built-in collector, whose connect the guard then reported against the next test. The floor now resets that state through its public reset_kb_sync_state() before and after every test, as it clears the investigation cache, and the test refuses Qdrant through refusing_port and sends telemetry to the floor's collector. Part of #1741 * docs(tasks): record #1741's per-test knowledge-base reset Part of #1741 * feat(review): dependency advisories and package inventory from osv-scanner (#1146) (#1747) - osv-scanner 2.6.0 runs over commit lockfiles offline with database snapshots cached under a 24-hour TTL. - Findings carry AdvisoryAnchor models with purl@locked-version, snapshot digest, advisory id, and database origin. - Exact advisory severity is preserved without defaulting to HIGH; unknown/unspecified values map to UNKNOWN. - CycloneDX 1.5 SBOM inventory is saved in EnvironmentFacts and finding properties; missing lockfiles for detected package manifests are recorded as coverage gaps. - Removed live OSV client queries and regex package extraction from the review pipeline. - Network threat intelligence queries (Shodan InternetDB and Cloudflare Radar) are guarded behind an opt-in threat_intel flag (defaulting to False). - osv-scanner v2.6.0 is registered in recorded scanner runs and scanner fake test harness. - All unit and integration tests run offline with fakes in <1s per test without network, real scanners, or live models. Closes #1146 * feat(review): ground explanations in version-matched kb manuals (#1149) (#1754) * fix(telemetry): devops-cli metrics reach prometheus in one hop (#1132) (#1756) * perf(tests): invariant tests share one parse of the source tree (#1749) (#1757) * fix(tests): process and session-exit tests finish under 5 seconds (#1748) (#1759) * perf(ci): structural-invariants hook runs in one pass without uv sync (#1667) (#1760) * docs(agents): the full gate runs once per push, after the last rebase or amend (#1663) (#1761) * refactor(docs): writing and checking docs consume a generated doc set (#774) (#1762) * perf(ci): the runner keeps its built environment and compiles bytecode once, and a test session starts without pydantic-ai (#1763) * perf(ci): the gate's uv runs keep the runner's environment, and the toolchain compiles its bytecode once The gate's child-environment allowlist dropped every UV_ variable, so the test row's `uv run pytest` on a GitHub runner lost UV_PYTHON, UV_CACHE_DIR and UV_PYTHON_INSTALL_DIR: it fell back to .python-version's 3.14.7, removed the 3.14.8 environment the workflow's `uv sync` had built, downloaded CPython and every wheel again into an empty cache, and reinstalled 221 packages without bytecode (about 5s in the CI log). The allowlist now passes uv's own settings; a uv credential such as UV_PUBLISH_TOKEN still matches a denied pattern. A fresh runner's environment holds no bytecode, so each of the four xdist workers compiled the same modules while collecting: a cold four-worker collection takes 38.4s here against 14.2s warm, and 28.9s with site-packages and src compiled. The shared toolchain action's `uv sync` now passes --compile-bytecode, which compiles the environment once in parallel. Part of #1735 * perf(tests): a test session starts without importing pydantic-ai A narrowed run of two trivial tests took 6.3-7.2s wall, and cProfile put pydantic-ai behind three start-up imports: the support registration imported tests/support/fakes/model.py (2.9s), the session fixture guard_live_rag_data imported the Qdrant clients (4.9s with qdrant_client), and the per-test RAG reset imported devops_cli.ai.rag.investigator (2.4s). The bootstrap registers as plugins only the support modules that could give pytest a fixture or hook: one in which the test selector finds one, one that imports pytest or another support module, or one that answers attribute lookups itself. A plain helper such as the model fake loads when a test imports it, and the four ways of hiding a fixture from the selector still fail the registration. guard_live_rag_data is removed: the floor's network block already refuses every external lookup, every non-loopback connect and every loopback port the test process does not bind, and the guard refused only Qdrant URLs on a configured domain, nothing on CI. The RAG reset resets only the modules a test has loaded. The narrowed run now takes 2.9-3.1s wall. Closes #1735 * feat(ci): hand-rolled network parsing gate and first rules (Part of #1107) (#1764) * refactor(review): group analysis without personas (Part of #1151) (#1765) * fix(github): fail closed on commit-status runner exceptions and stop swallowing StopIteration (#1350) (#1766) * fix(ai): strip fastmcp injected ctx parameter from mcp agent tools (#1498) (#1767) * fix(ci): run toolchain cache on node 24 and save setup-uv cache in one job per event (#1495) (#1768) * fix(tests): close sqlite test connections, silence inspected library deprecations, and upgrade starlette (#1497) (#1769) * fix(ai): populate tiktoken cache at image build and warn on fallback (#1421) (#1770) * refactor(review): delete persona review stage, legacy engine, and review-time RAG (Part of #1151) (#1771) * refactor(tests): add clock fake backed by time-machine and waiting seam (#1320) (#1772) * refactor(review): remove #1150 leftovers from hardening surface, finding schema, and challenger persona (Part of #1151) (#1773) * refactor(review): diff parsing and target extraction relocations to diff.py and targets.py (Part of #1151) (#1774) * refactor(review): update documentation, delete review.md and obsolete persona references (Closes #1151) (#1775) * test(cli): enforce hermetic floor edge denial and process-wide state reset (#1310) (#1776) * test(cli): enforce hermetic floor edge denial and process-wide state reset (#1310) * test(cli): isolate outside_dir temp directories across shuffled test runs * perf(ci): re-measure CI performance budgets, verify hermetic floor, and record task completion (Closes #1725) (#1777) * feat(k8s): scrape alloy collectors, grafana and pyroscope and alert on drops (#1128) (#1778) * feat(ci): net-address-list ast-grep rule and ipaddress TLS defaults (Part of #1107) (#1779) * feat(k8s): alert when an alloy-logs pod ships no log entries (#1128) (#1780) * fix(k8s): disable loki-canary, lower pyroscope log level, and scope grafana sidecars (#1128) (#1781) * feat(ci): scheme, URL authority, and IPv6 bracket ast-grep rules (Part of #1107) (#1782) * feat(k8s): collect profiles via k8s-monitoring alloy-profiles and alert on query errors (#1128) (#1783) * feat(ci): domain suffix, domain list, normalization, and hostport ast-grep rules (Closes #1107) (#1784) * feat(k8s): add CoreDNS dashboard and metric capture (#1128) (#1785) * fix(grafana): align stack dashboard queries with exported metrics (#1136) (#1786) Part of #1128 * fix(deps): the lockfile moves virtualenv to 21.14.12, which fixes four advisories that fail the audit check (#1791) uv audit reported virtualenv 21.14.1 with four known vulnerabilities, all fixed in 21.14.7, so the audit check of every pull request into v0.2.38 failed. virtualenv comes in only through pre-commit, in the dev group. uv lock --upgrade-package virtualenv moves it to 21.14.12 and its helper python-discovery to 1.6.4, and uv audit then finds no known vulnerability. Closes #1790 * fix(k8s): the collector starts after the tempo it exports traces to (#1788) The collector's otlp_grpc/tempo exporter sends to tempo.otel.svc.cluster.local:4317. deploy-stack installed the infra releases in list order with --wait and listed otel-collector before tempo, and no Argo CD Application carried a sync wave, so the cluster app-of-apps synced them together. Either way the collector's first exports were refused and logged as a burst that reads like an outage. tempo now comes before otel-collector in the infra stack, and the otel-collector Application has sync wave 1, after tempo's wave 0. A test pins both orderings against the exporter's endpoint. An init-container gate was not used, because it would also hold the collector's metrics and logs pipelines whenever Tempo is down at restart. Closes #409 * feat(k8s): monitor ArgoCD, Valkey, and registry and alert on service health (#551) (#1789) Part of #1128 * chore(release): delete the v0.2.37 changelog fragment for #1723 (#1793) The fragment arrived in the v0.2.37 release commit, 954914e, although CHANGELOG [0.2.37] already holds its entry. The v0.2.38 cut collects every fragment, so it would have published the entry a second time under 0.2.38. Closes #1792 * refactor(k8s): move llm-gateway ServiceMonitor to the llm stack (Closes #1128) (#1794) Closes #1128 * feat(k8s): coredns metrics, dashboard, and servfail alert (Closes #822) (#1795) * feat(k8s): deploy-stack warns about GPU nodes no Ollama tier accepts (#1796) A node without the nvidia.com/gpu.total-vram-gib label its tier accepts runs no Ollama pod, and the gateway's routes to that tier fail with nothing said at deploy time. deploy-stack read nodes only in step 8, after the Argo CD early return, through a reader that returned [] on every failure. deploy-stack --stack llm now reads the nodes once, right after the reachability check and before the early return, through a reader that reports a failed read. It warns about each GPU node no tier accepts, naming the node and the label with the kubectl label node command, says no Ollama pod will schedule when no node satisfies any tier, and says it could not check the labels when the read fails; the deploy always goes on. The accepted values are read from each tier's required matchExpressions in ollama-profiles.yaml, which a test holds to the In operator. The README's GPU placement section lists them per tier, what sets the labels, the gateway's alias Services and what llm-gateway-perimeter admits, and the 36 commented-out selector lines left by the vLLM/Ollama split are removed. Closes #1367 * feat(k8s): alert on Argo CD disabled autosync and stuck operations (Closes #551) (#1797) * fix(docker): the service image installs gh 2.102.1, whose Go toolchain fixes a HIGH advisory (#1801) Trivy failed the v0.2.38 release pull request's Service Image job on usr/local/bin/gh: CVE-2026-111943, HIGH, in the crypto/x509 package of the Go standard library gh 2.102.0 was built with (Go 1.27.1, fixed in 1.27.3). gh 2.102.1 changes only the Go toolchain to 1.27.3 and golang.org/x/net to 0.60.0. The Dockerfile now installs it with the sha256 digests GitHub lists for the amd64 and arm64 tarballs, and the amd64 one matches the file hashed locally. Closes #1800
dan-petty
added a commit
that referenced
this pull request
Oct 21, 2026
* perf(tests): answer the review report's group analysis from the model fake (#1726) * perf(tests): answer the review report's group analysis from the model fake test_fake_scanner_results_with_absolute_paths_come_out_repository_relative faked the scanners but left the model edge real. generate_consolidated_report runs the group analysis stage on the admitted scanner findings, so the orchestrator built a real client through get_llm_client, the network guard refused its loopback connect to the model server, and the HTTP transport retried five times with 1, 2, 4 and 8 seconds of backoff before the stage recorded a model-call error. That backoff was 15.0s of the test's 15.15s, on every run locally and on CI. The test now takes the model_fake fixture, which installs the shared ModelFake into the client factory seam, so the group analysis asks the fake and the report is written with no socket and no retry. Every assertion is unchanged. The test went from 15.15s to 0.16s under uv run pytest -n 0 --durations=0 -q tests/ai/review/test_pipeline.py, removing 15.0s. The product's retry policy is unchanged: backing off on a refused connection is what the client should do while a gateway restarts, and the wait came from the test's missing double, not from a fixed timeout standing in for an event. No other test in tests/ai/review/ or in the review report tests waits on a retry backoff. Part of #1725 * docs(tasks): record #1725's rows, with the review pipeline wait done Part of #1725 * perf(ci): make test_isolation_tripwire cheaper with in-process pytester (Part of #1725) (#1727) * test(devcontainer): post-create and post-start tests start no real installer, uv sync, kubectl or sudo (#1730) * test(devcontainer): answer post-create's programs as installed so no real installer runs Four post-create tests were among the slowest on the GitHub runner but fast here: test_devcontainer_post_create_scaffolds_agent_instructions 16.9s (2.5s here), and the post_create, setup_volume and run_lifecycle tests of TestDevcontainerCli 13.0s, 12.8s and 12.0s. post-create installs uv, pre-commit and claude when shutil.which cannot find them, and the runner has no claude, so each of the four ran Claude Code's real installer, `curl -fsSL https://claude.ai/install.sh | bash`: a 276 MB download into the test's home, which took 18-19s here with claude taken off PATH. The instruction-generator test also ran a real `uv venv` and `uv pip sync --require-hashes` of the locked semgrep (67 packages) and bandit into its data directory, which took 4.7s more with a cold uv cache, as the runner's pruned setup-uv cache is for semgrep. The three TestDevcontainerCli tests take an image_programs_installed fixture that doubles shutil.which at the stdlib, answering every program as installed, as in the published image, and the instruction-generator test does the same and passes --skip-tools. Every assertion is kept. On a runner-like PATH without claude and with a cold uv cache, the post_create test went from 19.4s to 0.03s and the instruction-generator test from 24.0s to 0.09s; setup_volume and run_lifecycle now take 0.15s and 0.11s, and none of the four starts an installer or uv. Locally, with claude installed and a warm uv cache, the instruction-generator test went from 0.9-1.3s to 0.05s, and the two files from 9.5-15.6s to 7.3-8.6s serially. setup_volume and run_lifecycle still run a real `kubectl config get-contexts` from post-start, which the row for real kubectl covers. Part of #1725 * test(devcontainer): name no Kubernetes context so post-start tests run no real kubectl Four TestDevcontainerCli tests, the post_start, post_start MCP sync, run_lifecycle and setup_volume tests, ran a real `kubectl config get-contexts -o name` (0.06-0.07s each) through post-start's step that aligns kubectl with the configured context. The context they saw was minikube, KubernetesConfig's built-in default: HOME is isolated and holds no global config, the per-test config.yaml has no k8s section and no variable sets one, so nothing leaked from the user's config or environment. None of the four asserts on the context step. A no_configured_k8s_context fixture appends an empty `k8s.context` to the config.yaml the autouse isolate_devops_cli_config fixture yields, then resets the settings and context caches, the context cache because it is keyed on the config file's modification time alone, which a write in the same clock tick as an earlier test's leaves unchanged. With no context named, post-start leaves kubectl alone, and the four tests now start only `git config --global` against their own HOME. Every assertion is kept. Part of #1725 * test(devcontainer): the ownership test removes getuid instead of running a real sudo chown test_ensure_path_ownership_and_mount_edge_cases meant to test a missing os.getuid but made it return None, which reads as a different owner, so _ensure_path_ownership ran a real `sudo chown -R None:1000` on the test directory. The step now deletes getuid inside monkeypatch.context(), and the function returns before any chown. The task file and changelog fragment record the item. Closes #1731 * perf(ci): make test module imports lazy to speed runner collection (Part of #1725) (#1736) * perf(tests): committed kustomizations render once per test process, with kubectl's offline renderers run as real tools (#1737) * perf(tests): render each committed kustomization once per test process kubectl's offline renderers, `kubectl kustomize` and `kubectl patch --local`, read only files and reach no cluster, so tests run them for real as they run git, and docs/TESTING.md now lists them with the real local tools. Every other kubectl call stays off a cluster through the floor's empty throwaway kubeconfig, which the root conftest's session-wide `isolate_kubeconfig` sets for every test. tests/k8s_manifests.py now renders a committed kustomization under k8s/ once per test process, keyed by its resolved directory, and shares that render; a kustomization a test builds under tmp_path is still rendered each time it is asked for. The Argo CD application, network policy and monitoring invariants and the overrides test read the repository's renders through it instead of starting kubectl themselves, and tests/test_k8s_argocd_apps.py parses them with libyaml's CSafeLoader, as tests/k8s_manifests.py already does. Every assertion is unchanged. Measured on the 33 tests that start kubectl, interleaved before and after at load 10 to 19: serially (-n 0) 15.9s summed and 17.6s wall before, 11.5s summed and 12.8s wall after; at -n 4, 36.0s summed and 19.9s wall before, 21.8s summed and 14.8s wall after. The nine repository-render tests other than the Argo CD gate test, whose renders run inside devops-cli, went from 7.3s to 2.5s serially and from 14.6s to 6.0s summed at -n 4. Part of #1725 * docs(adr): ADR 0007 lists kubectl's offline renderers with the programs tests run for real The decision on #1725 lets tests run `kubectl kustomize` and `kubectl patch --local` like git, and docs/TESTING.md now says so; ADR 0007's edge definition and its consequence on real programs say the same. Part of #1725 * docs(tasks): record #1732, committed kustomizations rendered once per test process Closes #1732 * test(ci): the review tests run on recorded scanner results, and no test starts a real gh or scanner (#1738) Six review tests started the real Semgrep, Gitleaks and Bandit, and Semgrep downloaded its `p/default` rules over HTTPS from inside the test, where the suite's in-process network block cannot see it. They now ask for `scanner_fake` (`tests/support/fakes/scanners.py`), which doubles `shutil.which` and `subprocess.run` and answers each scanner with the run recorded from the real tool at its locked version, started as a review starts it. The contract suite, `tests/test_scanner_contract.py`, holds each recording to its adapter's command and to `tools.lock`. Alone with `-n 0` beside other agents' work, the six took 49.6 s before and 5.2 s after, about 44 s removed; their files and the two other tests measured with them went from 61.0 s to 15.1 s. A session-wide fixture in `tests/conftest.py`, `refuse_real_programs`, now fails any test that starts gh or the binary of any scanner the security scanner registry holds. `tests/support/refused_programs.py` reads those names from the registry once, when the guard is installed, so a scanner added there is refused with no list to edit; building it then took 0.02-0.08 s per worker, since the conftest has already loaded its modules. The guard sits on `subprocess.Popen`, beneath every seam, and fails the test with `pytest.fail`, which the scanner adapters' handlers of every exception cannot turn into a failed scan. `docs/TESTING.md` says so, and marks sudo and uv installing from PyPI as the target. The post-create test's real uv and the ownership test's real sudo are stopped in #1730. It counts toward the v0.2.38 CI time budget in #1725. Closes #1666 * perf(tests): the startup-import checks start one interpreter per command line (#1739) * perf(tests): measure each startup import argv once tests/test_cli_startup_imports.py started 63 interpreters for its 62 tests, and nine of them measured a start another test had already measured: the root `--help` ran for the telemetry check, the heavy-module check and both structural budgets, and `--version`, `ci --help`, `workspace --help`, `ai --help`, `review --help` and `k8s --help` ran twice each. `test_cli_help_startup_imports` now runs each help argv once, in a fresh interpreter under `-X importtime`, and checks that one run against everything that applies to the argv: no module of `CONST_CLI_HEAVY_MODULES`, in `sys.modules` or reported by importtime, for `--version`, the root help, every command group's help and `ai benchmark --help`; no logfire, opentelemetry.sdk or pydantic_ai for the root, `ci` and `workspace` help (#858); and #1687's main-and-version and command-help budgets for the same six argvs as before. Every argv still runs in an interpreter of its own, so no command's imports count against another's. The probe imports `devops_cli.entry` and calls `main`, as the `devops` script does; against `-m devops_cli.entry` it reports the same number of modules, `devops_cli.entry` in place of `runpy`, so each devops_cli count is one higher (52 of 75 for `--version`, 209 of 250 for `ai --help`). The heavy-package control and the CPU-load control read the same probe. `test_cli_dry_run_imports_only_plan_dependencies` is parametrized by argv, so its three runs can go to three workers instead of holding one for 9.5 s on the runner; its docstring records why the review case can still take over 5 s. Measured back to back with `uv run pytest --durations=0 -q tests/test_cli_startup_imports.py` while other sessions held the host's load average between 20 and 70, which stretches every number: at `-n 0` the file took 321 s and 314 s of wall time and 192 and 181 CPU-seconds before, and 157 s and 166 s and 147 and 142 CPU-seconds after; at `-n 4`, 175 s and 157 s and 231 and 245 CPU-seconds before, and 93 s and 184 CPU-seconds after (a second run during a spike to 71 took 338 s and 262 CPU-seconds). A start costs the same CPU through the new probe as through the old ones, so the saving is the nine starts, about 15 CPU-seconds at a load average of 16, and the three dry runs no longer hold one worker in turn. With kubernetes imported by `devops_cli.commands.ci`, logfire by `devops_cli.commands.workspace` and the command-help devops_cli limit lowered to 100, the new test failed for the help of `ci`, `format`, `lint`, `repos` and `workspace` (heavy and telemetry modules) and of `ai`, `ai benchmark`, `k8s` and `review` (the budget), and passed for the other 33 argvs; with docker imported by `devops_cli.commands.k8s`, the `k8s deploy-stack --dry-run` case failed. docs/TESTING.md says that each argv starts one interpreter. Part of #1725 * docs(tasks): record #1733, one interpreter start per startup-import command line Closes #1733 * perf(tests): the dashboard tests wait on conditions, with animations off and a doubled Docker engine (#1740) * perf(tests): wait on the dashboard tests' conditions instead of pauses, animations and the real Docker engine Most of the time the Textual dashboard tests spent asleep was Textual's own waiting. After every key, `pilot.press` waits until the process stops using CPU, for up to a second, and `pilot.pause()` does the same once. Three things kept the process busy. A tab switch animated its underline for 0.3 s, so the root conftest now sets Textual's own `TEXTUAL_ANIMATIONS=none` before Textual is imported, and the underline moves at once. The endless log source of the stream-switching tests wrote a line every 2 ms, which held every key in those tests at the one-second cap; it now writes one every 10 ms. And the lifecycle, refresh-before-mount and four `--summary` tests in `tests/test_ui_dashboard.py` listed the workstation's own Docker engine, 2 to 10 s per test, and the keys sent to the TUI waited on those refresh threads; they now use the shared `docker_engine` double with an empty engine. The fixed pauses are now waits for the condition each test checks. `_settle` reads its predicate every `POLL_INTERVAL_SECONDS` under `THREAD_HANDOFF_BOUND_SECONDS`, pumping the UI between reads, in place of a 50 ms poll under a 10 s deadline of its own. The 0.3 s window of the stream-switching tests and the 0.2 s window of the stop test wait instead for the old stream's reader thread and consumer worker to end, after which no leaked line can still arrive; with the stop flag removed from `start_stream` and `stop_stream`, all three still fail. The quit test waits for `q` to stop the app, the daemon-reader test for the reader to enter its read, and the help-screen steps of the lifecycle test for pending messages only. `docs/TESTING.md` states how a Textual test waits. Both trees ran at the same time, so they shared the load other sessions put on the host (load average 20 to 56). Summed per-test time for the two files went from 224.1 s to 140.9 s at load 32 to 42 (`test_ui_dashboard.py` 50.0 s to 8.1 s, `test_ui_reactive.py` 174.1 s to 132.8 s), from 328.6 s to 290.5 s at load 22 to 43, and from 614.1 s to 574.7 s at load 42 to 56. The dashboard file's saving holds at every load; the reactive file's shrinks as the load rises, because a starved process stretches the real rendering work and looks idle to the pilot sooner. Part of #1725 * docs(tasks): record #1339, the dashboard tests' waits Closes #1339 * feat(review): link related findings across groups and order review remediation plan (#1148) (#1742) - Deterministic cross-group keys: CWE, rule family, symbol-graph component from ai/review/ast_imports.py, purl, and manifest source, written as correlation table in analysis.json and review.md. - Strict G10 verification: enforce that any "same root cause" statement or relation only links findings with shared correlation keys. - Review-level remediation plan stage: orders findings by introduced first, then severity rank, then file path, line, and fingerprint. - Grouping: consolidates related findings (such as the 9 DaemonSets in k8s/llm/profiles/ollama-profiles.yaml) under a single step. - Property test: verifies findings, findings.json, and findings.sarif are identical with stage on vs off. - Offline tests: all tests run offline with recorded fakes in <1s per test. Closes #1148 * perf(ci): the gate's test workers steal work and Bandit runs under nice (#1745) * perf(ci): steal work across xdist workers and run the gate's Bandit under nice The test row is the gate's critical path, locally and on the runner, and how the gate schedules its work held it back in two places. Under xdist's default `load` scheduler each worker is handed blocks of consecutive tests that only it then runs, so a block of slow tests handed out late keeps one worker busy after the others are done. `addopts` now passes `--dist worksteal`, under which a worker that runs dry takes half of another worker's unstarted tests. Replaying xdist 3.8's two schedulers over the per-test times of a full 16-worker coverage run, the tests end at 103.7 s under `load` and 97.1 s under `worksteal` on 16 workers (6.6 s sooner), and at 358.1 s and 316.2 s on the CI runner's 4 (41.9 s sooner), where Tests & Coverage shows a 51 s tail today. Three full runs of the gate's pytest command each on this shared host, alternating, at load averages of 19 to 71: the last worker finished 85.7, 36.1 and 302.8 s after the median one under `load`, and 64.1, 22.3 and 35.3 s after it under `worksteal`; wall times of 466, 372 and 910 s against 519, 405 and 446 s follow the other work on the host more than the scheduler. A run with `-n 0` keeps xdist's `dist` at `no`, so the narrowed `devops ci test` worker choice of #1669 is unchanged, and the pytester runs that name `-n 2 --dist loadfile` use their own ini and keep it. Bandit, beside the test row's 16 workers, took 61 s in the gate against 21 s alone. Its row now starts it as `uv run nice -n 10 bandit ...` (DEFAULT_CI_BANDIT_NICENESS), so it takes the CPU the workers leave idle instead of theirs, over the same `.bandit` targets at the same medium threshold; `devops ci security` runs the same row. One gate run each, before and after, at load averages of 24 to 56 and 20 to 42: 13m53s (test 13m26s, Bandit 5m47s) and 7m23s (test 7m2s, Bandit 6m28s, ending 34 s before the test row). At those loads the host sets both totals, so the runs show that a niced Bandit stays off the critical path rather than measure its gain. No coverage option is changed. On CPython 3.14, coverage 7.16.1 already measures through sys.monitoring (COVERAGE_DEBUG=core reports "Using sysmon because SYSMON_DEFAULT is set"), so COVERAGE_CORE=sysmon changes nothing, and `--cov-context=test` needs dynamic contexts, which sysmon lacks, so it falls back to ctrace and records a context per test: over two test modules at a load average of 17 to 24, without coverage, sysmon, ctrace and per-test contexts took 27.2, 49.7, 51.1 and 54.4 CPU-seconds. Part of #1725 * docs(tasks): record #1734, worksteal scheduling and a niced Bandit Closes #1734 * test(ci): no test connects to a localhost service it did not start, and a guard fails one that does (#1744) * perf(tests): fail a test that reaches a loopback port it does not bind, and double the services tests reached A scratch plugin recorded every loopback connect over the suite with -n 4. Apart from servers the tests start themselves, 2,249 tests reached the OTLP collector on 4318, because the floor's config turns export on there; 79 reached Valkey on 6379, 10 Qdrant on 6333, 5 Ollama on 11434, 2 the gateway on 4000 and 8787, 2 the port-forward probes of `devops k8s configure-urls`, and 13 ports picked by hand to refuse (9, 9999, 65530 and ports freed after binding). The network guard refused every one of them in-process, so no test reached a real service, but each refusal sent the client into its retry backoff: Qdrant waited 0.5 and 1 s per read, the gateway embeddings three waits of about 4.5 s in all, and the Ollama prewarm 1, 2, 4 and 8 s on a thread that outlived its test. The guard now owns a loopback port while a socket in the test process binds it, not only while one listens, and records every other loopback connect it refuses. The new autouse fixture `unexpected_loopback_connects` fails the test at teardown, naming host, port and thread, even when the code under test swallowed the refusal. A test that checks a service that is down binds `refusing_port`, a loopback port it never listens on, so the kernel refuses each connect. The floor's config sends telemetry export and the Valkey cache, side channels nearly every test reaches, to `unserved_side_channel_port`, a refusing port bound for the run. The tests in test_ai_cmd and test_pipeline_context_budget that hand a command their own `Settings()`, whose telemetry names no endpoint, point it at that port, so the tracer does not fall back to the built-in localhost:4318. The floor leaves OpenTelemetry's own `OTEL_EXPORTER_OTLP_ENDPOINT` unset: the SDK's OTLP exporters read it too, through logfire and in child processes, and with it set they retried their metric exports against the refusing port with backoff. Qdrant keeps an address no test binds, so a test that reaches Qdrant without a double fails. The guard's port ownership moved into a small class, which lowers its fixture's complexity from 10 to 9. Each test that reached a service now fakes it or refuses it through the double, with no product change. The chat and pipeline tests take `model_fake`, so the prewarm asks the shared fake. The RAG tests and the gateway routes refuse Qdrant and the gateway through `refusing_port`, tests that build their own `Settings()` point Valkey there, the k8s configure-urls tests refuse the port-forward probes at `socket.create_connection`, and the probe, metrics, run-store and collector-export tests replace their hand-picked ports with `refusing_port`. Retry waits behind a direct `time.sleep` return at once through the stdlib fallback in docs/TESTING.md "Clock", and the embedding tests now assert how many backoffs they took. Two leaks the guard surfaced are fixed at the source: the floor clears the RAG investigation cache after each test, whose cached retriever carried one test's Qdrant address into the next, and test_llm_client_properties_and_list_models waits for its non-blocking preload and asserts its result, which otherwise ran after the test against the real client and retried for 15 s. The review pipeline test takes `model_fake` with the same hunk as perf/1725-pipeline-test-wait, so the guard passes on this branch alone. Measured back to back on the same shared host with uv run pytest -n 0 --durations=0 -q, the base versions of the six files against the changed ones: test_ai_subcommands_rag, test_builtin_tools, test_rag_embeddings, test_rag_cli, test_rag_drift and test_ai_cmd went from 76.86 s to 56.80 s, removing 20.1 s. test_try_retrieve_rag_context_success went from 5.03 s to 0.45 s, test_gateway_failures_raise_naming_model_endpoint_and_error[unreachable] from 4.21 s to 0.18 s, test_rag_status_command from 1.74 s to 0.27 s, and the two embedding retry tests from 0.81 s and 0.55 s to 0.04 s and 0.02 s. test_builtin_security_and_iac_tools waited 4.5 s whenever it made the first knowledge base check in its worker (5.56 s in the full run) and now waits none. test_ai_token_count_route_pipeline_bundle went from 6.53 s to 3.98 s once its neighbour's Ollama retries stopped running beside it; it and three other test_ai_cmd tests of 2 to 5 s spend their time building the Typer command tree and the agent's tool schemas, not waiting. docs/TESTING.md records the guard, `refusing_port` and the side-channel port. Part of #1725 * docs(tasks): record #1741, no test reaches a localhost service it did not start Closes #1741 * test(ci): reset the knowledge-base check per test, so reaching Qdrant without a double fails in any order The knowledge-base check's cooldown is process state, so only the first test in a process to reach Qdrant made the check, and the loopback guard failed whichever test that was: under CI's shuffled seed 4031974453, test_rag_search_names_an_embedding_failure, which builds its own Settings() and so reached Qdrant at its built-in localhost address and exported telemetry to the built-in collector, whose connect the guard then reported against the next test. The floor now resets that state through its public reset_kb_sync_state() before and after every test, as it clears the investigation cache, and the test refuses Qdrant through refusing_port and sends telemetry to the floor's collector. Part of #1741 * docs(tasks): record #1741's per-test knowledge-base reset Part of #1741 * feat(review): dependency advisories and package inventory from osv-scanner (#1146) (#1747) - osv-scanner 2.6.0 runs over commit lockfiles offline with database snapshots cached under a 24-hour TTL. - Findings carry AdvisoryAnchor models with purl@locked-version, snapshot digest, advisory id, and database origin. - Exact advisory severity is preserved without defaulting to HIGH; unknown/unspecified values map to UNKNOWN. - CycloneDX 1.5 SBOM inventory is saved in EnvironmentFacts and finding properties; missing lockfiles for detected package manifests are recorded as coverage gaps. - Removed live OSV client queries and regex package extraction from the review pipeline. - Network threat intelligence queries (Shodan InternetDB and Cloudflare Radar) are guarded behind an opt-in threat_intel flag (defaulting to False). - osv-scanner v2.6.0 is registered in recorded scanner runs and scanner fake test harness. - All unit and integration tests run offline with fakes in <1s per test without network, real scanners, or live models. Closes #1146 * feat(review): ground explanations in version-matched kb manuals (#1149) (#1754) * fix(telemetry): devops-cli metrics reach prometheus in one hop (#1132) (#1756) * perf(tests): invariant tests share one parse of the source tree (#1749) (#1757) * fix(tests): process and session-exit tests finish under 5 seconds (#1748) (#1759) * perf(ci): structural-invariants hook runs in one pass without uv sync (#1667) (#1760) * docs(agents): the full gate runs once per push, after the last rebase or amend (#1663) (#1761) * refactor(docs): writing and checking docs consume a generated doc set (#774) (#1762) * perf(ci): the runner keeps its built environment and compiles bytecode once, and a test session starts without pydantic-ai (#1763) * perf(ci): the gate's uv runs keep the runner's environment, and the toolchain compiles its bytecode once The gate's child-environment allowlist dropped every UV_ variable, so the test row's `uv run pytest` on a GitHub runner lost UV_PYTHON, UV_CACHE_DIR and UV_PYTHON_INSTALL_DIR: it fell back to .python-version's 3.14.7, removed the 3.14.8 environment the workflow's `uv sync` had built, downloaded CPython and every wheel again into an empty cache, and reinstalled 221 packages without bytecode (about 5s in the CI log). The allowlist now passes uv's own settings; a uv credential such as UV_PUBLISH_TOKEN still matches a denied pattern. A fresh runner's environment holds no bytecode, so each of the four xdist workers compiled the same modules while collecting: a cold four-worker collection takes 38.4s here against 14.2s warm, and 28.9s with site-packages and src compiled. The shared toolchain action's `uv sync` now passes --compile-bytecode, which compiles the environment once in parallel. Part of #1735 * perf(tests): a test session starts without importing pydantic-ai A narrowed run of two trivial tests took 6.3-7.2s wall, and cProfile put pydantic-ai behind three start-up imports: the support registration imported tests/support/fakes/model.py (2.9s), the session fixture guard_live_rag_data imported the Qdrant clients (4.9s with qdrant_client), and the per-test RAG reset imported devops_cli.ai.rag.investigator (2.4s). The bootstrap registers as plugins only the support modules that could give pytest a fixture or hook: one in which the test selector finds one, one that imports pytest or another support module, or one that answers attribute lookups itself. A plain helper such as the model fake loads when a test imports it, and the four ways of hiding a fixture from the selector still fail the registration. guard_live_rag_data is removed: the floor's network block already refuses every external lookup, every non-loopback connect and every loopback port the test process does not bind, and the guard refused only Qdrant URLs on a configured domain, nothing on CI. The RAG reset resets only the modules a test has loaded. The narrowed run now takes 2.9-3.1s wall. Closes #1735 * feat(ci): hand-rolled network parsing gate and first rules (Part of #1107) (#1764) * refactor(review): group analysis without personas (Part of #1151) (#1765) * fix(github): fail closed on commit-status runner exceptions and stop swallowing StopIteration (#1350) (#1766) * fix(ai): strip fastmcp injected ctx parameter from mcp agent tools (#1498) (#1767) * fix(ci): run toolchain cache on node 24 and save setup-uv cache in one job per event (#1495) (#1768) * fix(tests): close sqlite test connections, silence inspected library deprecations, and upgrade starlette (#1497) (#1769) * fix(ai): populate tiktoken cache at image build and warn on fallback (#1421) (#1770) * refactor(review): delete persona review stage, legacy engine, and review-time RAG (Part of #1151) (#1771) * refactor(tests): add clock fake backed by time-machine and waiting seam (#1320) (#1772) * refactor(review): remove #1150 leftovers from hardening surface, finding schema, and challenger persona (Part of #1151) (#1773) * refactor(review): diff parsing and target extraction relocations to diff.py and targets.py (Part of #1151) (#1774) * refactor(review): update documentation, delete review.md and obsolete persona references (Closes #1151) (#1775) * test(cli): enforce hermetic floor edge denial and process-wide state reset (#1310) (#1776) * test(cli): enforce hermetic floor edge denial and process-wide state reset (#1310) * test(cli): isolate outside_dir temp directories across shuffled test runs * perf(ci): re-measure CI performance budgets, verify hermetic floor, and record task completion (Closes #1725) (#1777) * feat(k8s): scrape alloy collectors, grafana and pyroscope and alert on drops (#1128) (#1778) * feat(ci): net-address-list ast-grep rule and ipaddress TLS defaults (Part of #1107) (#1779) * feat(k8s): alert when an alloy-logs pod ships no log entries (#1128) (#1780) * fix(k8s): disable loki-canary, lower pyroscope log level, and scope grafana sidecars (#1128) (#1781) * feat(ci): scheme, URL authority, and IPv6 bracket ast-grep rules (Part of #1107) (#1782) * feat(k8s): collect profiles via k8s-monitoring alloy-profiles and alert on query errors (#1128) (#1783) * feat(ci): domain suffix, domain list, normalization, and hostport ast-grep rules (Closes #1107) (#1784) * feat(k8s): add CoreDNS dashboard and metric capture (#1128) (#1785) * fix(grafana): align stack dashboard queries with exported metrics (#1136) (#1786) Part of #1128 * fix(deps): the lockfile moves virtualenv to 21.14.12, which fixes four advisories that fail the audit check (#1791) uv audit reported virtualenv 21.14.1 with four known vulnerabilities, all fixed in 21.14.7, so the audit check of every pull request into v0.2.38 failed. virtualenv comes in only through pre-commit, in the dev group. uv lock --upgrade-package virtualenv moves it to 21.14.12 and its helper python-discovery to 1.6.4, and uv audit then finds no known vulnerability. Closes #1790 * fix(k8s): the collector starts after the tempo it exports traces to (#1788) The collector's otlp_grpc/tempo exporter sends to tempo.otel.svc.cluster.local:4317. deploy-stack installed the infra releases in list order with --wait and listed otel-collector before tempo, and no Argo CD Application carried a sync wave, so the cluster app-of-apps synced them together. Either way the collector's first exports were refused and logged as a burst that reads like an outage. tempo now comes before otel-collector in the infra stack, and the otel-collector Application has sync wave 1, after tempo's wave 0. A test pins both orderings against the exporter's endpoint. An init-container gate was not used, because it would also hold the collector's metrics and logs pipelines whenever Tempo is down at restart. Closes #409 * feat(k8s): monitor ArgoCD, Valkey, and registry and alert on service health (#551) (#1789) Part of #1128 * chore(release): delete the v0.2.37 changelog fragment for #1723 (#1793) The fragment arrived in the v0.2.37 release commit, 954914e, although CHANGELOG [0.2.37] already holds its entry. The v0.2.38 cut collects every fragment, so it would have published the entry a second time under 0.2.38. Closes #1792 * refactor(k8s): move llm-gateway ServiceMonitor to the llm stack (Closes #1128) (#1794) Closes #1128 * feat(k8s): coredns metrics, dashboard, and servfail alert (Closes #822) (#1795) * feat(k8s): deploy-stack warns about GPU nodes no Ollama tier accepts (#1796) A node without the nvidia.com/gpu.total-vram-gib label its tier accepts runs no Ollama pod, and the gateway's routes to that tier fail with nothing said at deploy time. deploy-stack read nodes only in step 8, after the Argo CD early return, through a reader that returned [] on every failure. deploy-stack --stack llm now reads the nodes once, right after the reachability check and before the early return, through a reader that reports a failed read. It warns about each GPU node no tier accepts, naming the node and the label with the kubectl label node command, says no Ollama pod will schedule when no node satisfies any tier, and says it could not check the labels when the read fails; the deploy always goes on. The accepted values are read from each tier's required matchExpressions in ollama-profiles.yaml, which a test holds to the In operator. The README's GPU placement section lists them per tier, what sets the labels, the gateway's alias Services and what llm-gateway-perimeter admits, and the 36 commented-out selector lines left by the vLLM/Ollama split are removed. Closes #1367 * feat(k8s): alert on Argo CD disabled autosync and stuck operations (Closes #551) (#1797) * feat(release): v0.2.38 The v0.2.38 cut, as devops roadmap close --confirm makes it: version 0.2.38, CHANGELOG [0.2.38] collected from the 33 changelog.d fragments (deleted), and docs/ROADMAP.md rendered from GitHub. It is committed on chore/cut-v0.2.38 and merged by pull request, since the no-commit-to-branch hook refuses the cut's own commit on release/v0.2.38 (#1628).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1107
Description
First of five PRs introducing the network parsing gate:
ast-grep-cli==0.51.0todevdependency group inpyproject.tomland locks inuv.lock.TID251(banned-api) banningsocket.inet_aton,socket.inet_ntoa,socket.inet_pton, andsocket.inet_ntopwith"Parse and format addresses with ipaddress.ip_address.".CONST_RUFF_LINT_KEYSwith"flake8-tidy-imports".sgconfig.ymland the first threenet-*rules to.ast-grep/rules/and tests to.ast-grep/rule-tests/:net-cidr-buildnet-port-tablenet-ip-literalsrc/:src/devops_cli/core/validation.py: replaces default-port table withhttpx2.URL(url).origin.port.src/devops_cli/core/validation.py: parses legacy IPv4 numbers without bannedsocket.inet_aton.src/devops_cli/security/sanitizer.py: replaces loopback literal list withis_loopback_host(host).constructscheck row intoget_check_specs()insrc/devops_cli/commands/ci.py.ast-grep-scanandast-grep-testlocal pre-commit hooks to.pre-commit-config.yaml.test_the_network_construct_gate_has_no_escapeand escape casestest_every_network_construct_escape_is_reportedintests/test_architectural_invariants.py.tests/test_net_construct_rules.py.docs/agent/tasks/task-1107-hand-rolled-network-parsing-gate.md.Fail-to-pass: not applicable: new CI gate and rules; base lacks sgconfig.yml and ast-grep.