feat(figma): retrieve original image bytes through the bridge - #56
Merged
Conversation
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.
Two screens worked in parallel. One gained a capability, one gained an explanation. Neither claims a pixel improvement, and both say so.
1. Original image bytes are now retrievable
A
CROPfill names its source by hash, but nothing could fetch the pixels behind that name. The official MCP returns text only, so the bytes had no transport; the connector tool that would supply them answersUNAUTHORIZEDand belongs to the metered path anyway.The bridge has no such limit - a local socket where nothing is truncated. A read-only
getImageByHashroute now retrieves the selected fill's original bytes with their intrinsic codec, never a whole-node rendition, and decodes and verifies them against the declared hash.The remote path refuses outright, with a named reason. That refusal is the more valuable half: a silently wrong image is worse than a missing one.
No document is mutated. The temporary-rectangle technique that would have produced an isolated rendition creates and removes nodes, and was rejected for exactly that reason.
What is not claimed
The isolated-fill renderer that would consume these bytes is not implemented, and
about-422-3376is unchanged at 5.43%. Capturing live source bytes requires re-importing the rebuilt plugin in Figma - a desktop menu action neither the worker nor I can perform. The report names the exact capture (filef1AJyo27afkkr6U9PhnWSu, node422:3378, fill 0, hash09939a0d…, and the call) so nobody has to re-derive it.This corrects an earlier diagnosis, too: the previous cycle read
UNAUTHORIZEDas "our token needs reauthentication". It does not -devup_figma_auth { doctor }reports connected with a valid token. The failing request was the metered connector'sdownload_assets, and the route that does work was named in that same report and had simply never been implemented.2. Landing mobile, quantified rather than fixed
landing-833-3640sits at 4.78%. With identical DOM geometry, a Chromium probe with LCD subpixel antialiasing disabled measures 2.91% (and 1.61 / 1.03 for its siblings, against 2.47 / 1.50).That attributes a large share of this screen's divergence to font rasterisation, not to generated layout. Default-probe PNGs are byte-identical to the harness, so this is a property of the comparison, not of the code under test. Production is unchanged and no improvement is claimed; residual glyph advances still need separate evidence.
Worth absorbing corpus-wide: after nine cycles of real layout fixes, a meaningful part of what remains may be the renderer, not the generator.
Verification
Gates:
fmt0,clippy --locked --workspace --all-targets --all-features -D warnings0,cargo test --workspace1122 passed / 0 failed / 2 ignored (mainis 1118),insta --checkno drift, plugin bundle rebuild clean.All 14 measurable screens re-measured by me: identical to
main. All 268 plugin byte-parity goldens unchanged. Koreankeep-alluntouched. No threshold moved - correctly, since nothing improved.