Skip to content

docs: describe mcpi drain() accurately (best-effort, already-arrived only) - #64

Merged
sakebomb merged 1 commit into
masterfrom
docs/mcpi-drain-precision
Aug 20, 2026
Merged

docs: describe mcpi drain() accurately (best-effort, already-arrived only)#64
sakebomb merged 1 commit into
masterfrom
docs/mcpi-drain-precision

Conversation

@sakebomb

Copy link
Copy Markdown
Owner

Summary

Live-verifying the mcpi client (#63) against a real Paper 26.2 server surfaced that the drain() docstrings overstated the guarantee. A server's Fail reply to an unimplemented command arrives a tick later, so drain() — 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), Vec3 args, 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)
  • Verified live against Paper 26.2 that only-implemented-commands means no stray-reply desync in normal use

https://claude.ai/code/session_01AcK3SgXRTVzAKBdPZw72sr

…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.
@sakebomb
sakebomb merged commit 6188cdd into master Aug 20, 2026
4 checks passed
@sakebomb
sakebomb deleted the docs/mcpi-drain-precision branch August 20, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant