docs: describe mcpi drain() accurately (best-effort, already-arrived only) - #64
Merged
Conversation
…only) Live-verification against a real Paper 26.2 server showed the previous wording overstated drain(): a server's Fail to an *unimplemented* command arrives a tick later, so drain() (a non-blocking clear before each send) cannot catch it - it only discards bytes already buffered. In practice this never bites because the client emits only implemented commands, so no stray is ever produced. Tighten the module/method docstrings and the test name/comment to say exactly that, rather than implying drain() guards the in-flight async case. No behavior change; 25 tests still pass.
Open
9 tasks
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.
Summary
Live-verifying the mcpi client (#63) against a real Paper 26.2 server surfaced that the
drain()docstrings overstated the guarantee. A server'sFailreply to an unimplemented command arrives a tick later, sodrain()— a non-blocking clear run before each send — can't catch it; it only discards bytes already buffered. This never bites in practice because the client emits only implemented commands (no stray is ever produced). This PR tightens the module/method docstrings and the drain test's name/comment to say exactly that (Lens 3: claims should trace to code), with no behavior change.Everything the client actually does was verified working live: block round-trips (gold/air/wool-with-data),
Vec3args, cuboid setBlocks/getBlocks, getHeight, entity spawn/getEntities/removeEntity, setSign — plus cross-session removal-ownership (a second connection can't remove another's entities, incl.removeEntities(-1)).Test plan
pytest mcpi-client— 25 tests pass (docstring/comment-only change)https://claude.ai/code/session_01AcK3SgXRTVzAKBdPZw72sr