Repository navigation
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Verified against Design-Verdict: PASS Correct root-cause fix for a dead patch target that hung two CI shards; minimal, test-only, and consistent with the existing [DESIGN-REVIEWED] 466fcb1 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
Reopened: #9682 went red on Backend Lint & Type Check (its own change); this PR is the same fix with 0 red, kept as the alternate so whichever is fully green first can merge. |
test_main_boots_platform_before_binding_server (from #9066) monkeypatches server.ThreadingHTTPServer, but main() instantiates the module's _Server subclass, bound at import time, so the patch is inert: the test binds a real socket on PORT and serve_forever() never returns. Every PR on main has been red on Backend Tests (3.12, 4) (Timeout >120s) and Backend Tests (Windows) (4) (xdist worker crash) since it landed. Patch _Server in both tests; the fail-closed sibling only passed because boot_platform raises before the server line.
85efe39 to
466fcb1
Compare
|
Superseded by #9682, which merged at 11:04Z with the same |
Summary
Main has been red on Backend Tests (3.12, 4) and Backend Tests (Windows) (4) since #9066 landed (
ebf9ffb55, "fix(workflows): bootstrap the platform context"): main's own run on67716d722fails the same two shards plus Coverage Gate, and so does every PR rebased onto it (e.g. #8947).The culprit is a test that patches the wrong name.
test_main_boots_platform_before_binding_serverdoesbut
server.main()instantiates the module's own subclass:_Serveris bound at import time, so replacing the importedThreadingHTTPServername changes nothing — the test binds a real socket onPORTandserve_forever()never returns. On Linux that isFailed: Timeout >120.0s; on Windows the xdist worker (gw3) crashes.Fix
Patch
server._Serverin both tests. The fail-closed sibling (test_main_fails_closed_when_platform_cannot_compose) had the same wrong target and only passed becauseboot_platformraises before the server line; it is corrected too so it keeps guarding the right thing.Test-only change; no production code touched.
Evidence
67716d722run 34328282177:Backend Tests (Windows) (4),Backend Tests (3.12, 4),Coverage Gatefailed.ebf99636brun 34328983606: identical failures,test_main_boots_platform_before_binding_server— LinuxTimeout >120.0s, Windowsworker 'gw3' crashed.git log 02921dfc1..67716d722 -- test/test_workflows_app.py→ onlyebf9ffb55(fix(workflows): bootstrap the platform context #9066).Local gates
ruff check test/test_workflows_app.pyclean. Tests not run locally (CI is the gate).Pattern harvest
server.ThreadingHTTPServer) while the code under test instantiates a module-level subclass (_Server) that captured the base at import time. The patch is silently inert; the test then does the real thing (bind a socket, block inserve_forever()), which shows up as a 120 s timeout on Linux and an xdist worker crash on Windows rather than an assertion failure — so it reads like flakiness, not a wrong patch target.PORThappened to be free and nobody waited 120 s. CI ran it in a sharded job where a single hang takes the whole shard.main()builds, patch the namemain()reads (_Server), not what that name was built from. A cheap tripwire for this family: any test that stubs a server/loop should assert the stub was called (calls == [...]here does that — it just never got to run).Rule candidate: a test that monkeypatches a class the code under test inherits from (rather than the name it instantiates) is a dead patch — flag
monkeypatch.setattr(<module>, "<BaseClass>", …)where<module>defines a subclass of<BaseClass>that the tested entrypoint constructs. Reviewers/AutoSDE: require the patched name to appear in the entrypoint's body.test_main_fails_closed_when_platform_cannot_composehad the identical wrong target and only passed becauseboot_platformraised first; fixed in the same commit so it keeps guarding the right thing.