v0.3.6: opt-in, capped create preview (#20)#21
Merged
Conversation
_do_create no longer embeds a full 800x600 iso PNG on every call. include_preview defaults False; when True the preview is rendered at 384x288 and gated behind PARTSMITH_PREVIEW_INLINE_MAX (~48 KB), with preview_sha256/size_bytes for parity with the v0.3.5 file contract. Kills the last unbounded inline payload that overflowed the client response budget.
…ed verifiable preview (#20)
…lure) Rewrote pure-ASCII (dropped em-dashes/any ambiguous unicode) and re-verified with `ruff check` under the repo's E,F,I,W + line-length 100 config. Same coverage: default-no-preview, preview opt-in (capped + sha-verifiable), export integrity metadata, section/drawing round-trips.
Unpinned `pip install ruff` made CI nondeterministic: ruff 0.15.17 (released since the last green run) flags pre-existing code that 0.15.16 accepted, so a docs/feature PR fails lint for unrelated reasons. Pin to the known-good version; bump deliberately in its own PR when adopting a newer ruff + fixing whatever new rules it introduces.
The v0.3.6 push accidentally appended the heredoc delimiter as a literal trailing line, which ruff flagged as F821 (undefined name) + W292. This was the real CI ruff failure (not a ruff-version regression). File is otherwise unchanged and ruff-clean.
…ot ruff The ruff failure was F821 from a stray MCPEOF line in mcp_transport.py (now fixed), reproduced across ruff 0.15.15/16/17 — not a version regression. Restore the original unpinned install; pinning can be a separate, deliberate hardening if desired.
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.
Theme 4 (validated quality). Resolves #20. Fixes the oversized auto-preview that overflowed the client response budget on every
create_model(you hit it again on 0.3.5).Root cause
_do_create()unconditionally rendered a full 800×600 iso PNG and embedded it as inline base64 (preview_data_b64) in every create/modify/load result — ~75–150 KB → ~25 K+ tokens. Non-blocking (the model registered fine) but it overflowed/cluttered the response for no benefit, and it never went through the v0.3.5 file-delivery machinery.What changed (
src/mcp_transport.py)include_preview: bool = Falseoncreate_model/modify_model/load_design. Default response is justsuccess+geometry+stdout(tiny).PARTSMITH_PREVIEW_INLINE_MAX(default 48 KB); over the cap → bytes dropped +preview_notepointing atpartsmith_render_3d. Inline previews carrypreview_size_bytes+preview_sha256(parity with the v0.3.5 contract).Decisions / scope
measureor an explicit render; visuals are now a deliberate, bounded request.create_modelleft unchanged — HTTP clients aren't subject to the chat token cap.preview_data_b64no longer appears unlessinclude_preview=True.Tests / verification
test_create_model_preview_optional: default create carries nopreview_data_b64;include_preview=Trueyields either a capped sha-verifiable inline preview or apreview_note— never an unbounded raw embed.py_compile+ruffclean.Bump 0.3.5 → 0.3.6 + CHANGELOG + ROADMAP. This closes the last unbounded inline payload (exports verifiable in #18, preview bounded here).