feat: make the conformance checker one installable command - #5
Merged
Merged
Conversation
The checker was good and running it was not: an undeclared websockets import, a path into a checkout rather than a command, and a race between starting the server and starting the client that CI worked around with a wait loop copied into three jobs. It moves to plugrl_protocol.conformance with a plugrl-conformance entry point and a conformance extra that declares websockets, and gains --client, which starts the client once the socket is listening and waits for it afterwards. A non-zero exit from the client is now its own reported failure rather than showing up as no client having finished. examples/conformance_server.py stays as a shim because E2 and E7 quote it as the command they ran, and a record pointing at a missing file is worth less than five lines.
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.
The checker that grades a client against SPEC.md existed already and was good. Running it was the problem.
What it took before
From the documentation, verbatim:
uv run --with websockets examples/conformance_server.py --port 8000 --steps 20 & /tmp/plugrl_client 127.0.0.1 8000 20Three things wrong with that for somebody outside this project:
--with websockets, because the checker imported a library the package never declared. A freshuv synccould not run it.What it takes now
uv run --extra conformance plugrl-conformance \ --port 8000 --steps 20 --client "./my_client 127.0.0.1 8000 20"websocketsis declared, as aconformanceextra.plugrl-conformanceis a console script; the implementation moved toplugrl_protocol.conformance, which also removes thesys.pathinsert it needed to import the real codec fromexamples/.--clientstarts the client after the socket is listening and waits for it afterwards. A non-zero exit from the client is reported as a failure of its own, rather than surfacing as "no client ever finished".Without
--clientit waits for a client started elsewhere, exactly as before.examples/conformance_server.pystill worksIt is now a five-line shim, kept deliberately: E2 and E7 both quote
python examples/conformance_server.py ...as the command they ran. A published record that points at a file which no longer exists is worth less than the shim. It keeps thesys.pathinsert so a fresh checkout still runs without installing anything, which is how those commands were run.Verified: both forms produce the same report and exit 0 against
raw_client.py.CI
The three conformance jobs lose their wait loops. One of them pipes to
teeto grep the client's output; that now hasset -o pipefailabove it, because without it a failing check would have been masked by tee's exit status. That was true of the original too.uv run pytest -q: 30 passed.