• Stefy Lanza (nextime / spora )'s avatar
    twelve red tests were wrong about the code, not the other way round · bd698488
    Stefy Lanza (nextime / spora ) authored
    The suite has carried 25 failures for long enough that a real regression could
    hide in them — which is the failure mode that cost a full day this week. Twelve
    are fixed here. Every one was a test pinning behaviour that had been
    deliberately changed; no product bug was found.
    
    Two were actively harmful rather than merely stale:
    
      * test_build_hardware_summary faked `torch` and asserted 10240 MB of free
        VRAM. The summary moved off torch.cuda.mem_get_info on purpose — that path
        pinned a ~256 MiB CUDA context just to answer a hardware question — so the
        fake went unused and the test measured the REAL card of whatever machine
        ran it. It read 24111 here. A test that depends on the host's GPU is not a
        test; it now patches visible_gpu_memory(), which is what the code calls.
    
      * test_main_wiring_falls_back drove the whole of main() through a wall of
        stubs to reach one line, so every new config field or call surfaced as an
        AttributeError raised from INSIDE the code under test. Three of them, each
        reading exactly like a product bug. It now asserts the thing it exists
        for — an invalid broker config yields a disabled runtime rather than
        stopping the server — directly.
    
    The rest, by cause:
    
      * the broker protocol's accept field is `status: "ok"`. Six fixtures sent
        `accepted: true`, a field that appears nowhere in the client, which sends
        {"event":"pending","status":"pending"} itself and documents the server's
        heartbeat reply as status=ok. Registration now succeeds in the fakes.
      * `v1/…` endpoint lists were frozen copies that broke every time the product
        gained a route (eight by the time anyone looked) while saying nothing
        about whether the advertised routes exist. The studio-endpoints test now
        checks them against the app's real routes — the contract its name always
        claimed — comparing route SHAPES, since parameter names are local detail.
      * whisper: posting an existing id is an EDIT. The handler says so where it
        does it ("Otherwise editing an existing whisper-server model would either
        409 or silently create a duplicate config"); the test demanded the 409
        that comment describes removing.
      * whisper runtime fake: `is_running` always answered True and then expected
        start() to be called, and it defined `cleanup` but not `stop` — the unload
        path calls stop(), so it raised into an `except Exception: pass` and the
        server looked un-stopped with nothing saying why.
      * calling a FastAPI handler as a function leaves unpassed parameters as
        Form(...) sentinels: "unsupported operand type(s) for +: 'Form' and
        'Form'". That test drives the real route now.
      * there is no GET /admin/api/settings any more, and the LongCat image builds
        its 3.10 venv in a python:3.10-slim stage rather than with a literal
        `python3.10 -m venv`.
    
    One real inconsistency surfaced on the way: the broker is advertised
    `v1/video/compose/{id}` where the app serves `{job_id}`. Shape-compatible, so
    nothing breaks; the advertised list is simply inaccurate. Not changed here,
    because what we advertise is a wire-visible contract.
    
    13 remain: the broker handshake tests encode server-greets-first against a
    client that says "Client speaks first", plus streaming and studio shapes.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01KnfkxBpcZ1v6ypRFFyhrVM
    bd698488
test_broker_config.py 19.1 KB