refactor: strip tool-version probing and discarded home-dir enumeration from bootstrap#361
Conversation
The bootstrap handshake previously shelled out to `<tool> --version` for python/node/npx/uvx/docker plus the stdio-local-proxy shim deps (bash/shasum/grep) and reported the results in the payload's `host.runtimes` dict. Remove the probing end to end: - drop `_probe_tool_version`, `get_tool_versions`, and their constants (`_TOOL_VERSION_PROBE_TIMEOUT`, `_DEFAULT_PROBED_TOOLS`) from utils, along with the now-unused `asyncio` / `Iterable` imports - drop the `runtimes` field from `HostInfo` so the bootstrap payload no longer carries it - collapse the `_build_request` gather to the home-dir enumeration alone (call retained for its access-probe logging side effects) - remove the probe and payload tests covering the feature
`_build_request` called `get_readable_home_directories` and threw the result away — home directories were never part of the bootstrap payload (there's a test asserting `"paths" not in data`). The call only produced access-probe log lines and, on Windows, spawned PowerShell + wsl.exe subprocesses. Remove it and the dead plumbing it pulled in: - drop the `get_readable_home_directories` call and import from bootstrap - drop the stale `_HOME_DIRECTORIES_LIMIT` constant - remove the now-dead `scan_all_users` parameter from `bootstrap_first_control_server` / `_impl` / `_build_request`, and stop forwarding it from the CLI bootstrap wrapper (the scan/inspect discovery flow in run_scan still uses --scan-all-users, unchanged) - correct the security-review allowlist comment to match the fields the payload actually carries - remove the obsolete bootstrap tests (slow/failing home enumeration, to_thread usage), the autouse home-dir mock, the scan_all_users forwarding tests, and the now-pointless home-dir monkeypatch stubs `get_readable_home_directories` itself is unchanged — it remains in use by the scan/inspect pipeline via pipelines.py.
PR Summary by QodoRefactor bootstrap: remove tool probing and discarded home-dir enumeration WalkthroughsDescription• Remove bootstrap subprocess probing of tool versions and drop host.runtimes from payload. • Stop enumerating readable home directories during bootstrap and remove dead scan_all_users plumbing. • Update request models and prune/adjust unit tests to match the slimmer handshake contract. Diagramgraph TD
A["CLI bootstrap wrapper"] --> B["bootstrap_first_control_server"] --> C["_build_request"] --> D["ClientBootstrapRequest"]
C --> E["utils host signals"]
B -->|POST JSON| F{{"Control server /bootstrap"}}
High-Level AssessmentThe following are alternative approaches to this PR: 1. Keep runtimes telemetry behind an opt-in/feature flag
2. Defer tool probing to a later, non-blocking telemetry path
Recommendation: The PR’s approach (remove probing and discarded home-dir enumeration entirely) is the best fit if the control server does not depend on these fields: it reduces startup latency, eliminates fragile subprocess behavior (notably on Windows), and narrows the bootstrap payload’s security surface. If telemetry is still desired later, prefer a deferred/async telemetry path rather than reintroducing subprocess work into the handshake. File ChangesRefactor (4)
Tests (4)
|
What
Removes two pieces of best-effort work the bootstrap handshake did at startup, neither of which the control server depends on: