Repository navigation
feat(plugin-design): the design plugin rewritten on machines and Effect - #1252
Merged
Merged
Conversation
…nd Effect services Figma facts, tree, roles, layout inference, structure with implied groups, reflow tags, components and token names as pure machines; Figma REST, frame reading, the design cache and the session memory as Effect services; the Figma key integration and its settings page and refused-key card. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hines Id tree, Figma pairer (a pure fold), mapping, gate, paint and border rows, wraps, page height, drift, effect rows, reflow at widths, progress, verdict and round assembly as machines; raster on pngjs with the pixel score on blazediff and the masks on pixelmatch as two Effect layers; colours on culori; the check service runs one check at a time, waits for edits with the page's hmr.wait, retries a measure an edit lands in, and keeps per-session, per-frame-set memory. Adds the approved culori, color-blend, pngjs, @blazediff/core and pixelmatch catalog entries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y runs its effects CheckMachine holds every decision of a frame check as State/Event/Effect: measure retries when an edit lands, early exits, the collapse revote, the unsettled streak against stallRounds, keeping the last ids and mapping while unsettled, the variants rule and the status outcome. The checker runs load, settle, measure, confirm, decode, compare and persist effects and feeds the results back as events. The pairer's scoring terms move to PairTermsMachine so both files stay under 600 lines. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… one check queue per frame set The browser part registers design.measure and design.shots. A same-origin mirror iframe loads the route at the asked width; the reads (CSSOM snapshot, stamped element walk, page facts, runtime errors) are Effect services (Mirror, PageReader, Capture) and every derivation is a pure machine: the cascade (scan, plan, specificity on postcss-selector-parser, winner, sizing, media), the styles, the live tree with instance stamps, the page facts. Checks on one frame set queue behind a semaphore per session and frame set, owned by the checker layer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A compile machine keeps the last build error (first non-blank line, ANSI stripped, cwd-relative file, query cut) and clears it when the same file sends an HMR update. A check that settles while a compile error stands writes a broken round with the compile line and replies with it; the runtime-thrown round shares the same broken outcome. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each design_check round is logged into the plugin's own SQLite (drizzle, its own migration, under the plugin storage directory) as records per source: rounds, rows, missing, candidates, widths, regions, fom and nodes. A log machine builds the records; the checker only writes them. design_query reads one source of this session (all sessions when the where names session), filters and selects with CEL in an Effect service with typed parse and eval errors, and orders and pages in a machine. The CEL expressions are Schema-validated tool input. Adds @marcbachmann/cel-js 8.0.0 to the catalog. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The check log migration is generated as backend-defaults does: drizzle.config.ts, drizzle-kit generate into drizzle/, and the gen-migrations script writing src/store/migrations.gen.ts from those files. The hand-written migration module is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… frame's assets Paint sampling: a box with no paint gets its background from the frame render, and a gradient or picture when its row and column means say so (a childless picture becomes an image node). Assets: the image, vector and fill-stack nodes are written into public/design/ and the plugin storage cache, from the cache, else Figma REST (batched exports halving on 414, image fills decoded with photon and flattened with color-blend), else cropped from the frame render; the nodes get fields.asset and assetLayers, and the read reports the assets line. Wanted nodes, crops, flattening and the report are machines; the service only fetches, decodes and writes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…checks Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ines from the key map Co-Authored-By: Claude Opus 5.5 <[email protected]>
… output schemas Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd design_components Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rounds record of the check log carries image_mismatch, the share of each image node's picture that did not match, in a new check_log column (migration generated with drizzle-kit, migrations module regenerated). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The store never shipped, so check_log, catalog and image_mismatch are folded into one generated init migration; migrations module regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The plugin built its own fetch client, which bypassed the client the engine provides to plugins (the simulation's fixed network table among them). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…(spike, not yet run green) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er all measured rounds (review 1 items 1, 6) Progress ran on the gate rows only against all rows of the previous round, so page, drift, effect, image, reflow and component rows read as closed every round, and reflowHeld saw no reflow rows on this side. It now runs on the assembled round's rows. kept[].repeat counts back over every measured round instead of the last one only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…key store read off the REST path (review 1 items 2, 20) Every attached frame without a link keyed as 'attached' (or by its raw JSON), so responsive sets collapsed and the cache served the wrong frame. An attached frame now keys as attached/<version>/<frame node id>. The Figma key store is read only when the frame goes to the REST API. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e engine's own HMR record (review 1 items 3, 4, 9) The plugin now records every hmr-update the bundler reports (count and time on the engine clock). Settle waits until settleQuiet ms passed with no update and gives up at settleQuiet + settleWait, instead of one long hmr.wait that idled when nothing was pending; the page's hmr.wait runs only when an update arrived, so the page has applied it. An edit during the measure is the update count moving between settle and confirm, not a 1 ms hmr.wait. A compile error clears on the next successful update of any file or a bundler reconnect. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dit age, early exits skip the widths, one mirror user at a time, routes are page paths (review 1 items 5, 11, 17, 18) 5: the mirror no longer listens on the host window; its error list is cleared for every fresh mirror and stamped on the Effect clock; editedAgoMs is the time from the last HMR update to the measure, not a fixed settleWait. 18: the early-exit decision runs on the first measure, so an unchanged or still blank page skips the reflow widths. 11: measure and shots take one mirror lock, so they no longer remove each other's iframe. 17: page operation and design_get routes are Schema'd as paths on the page origin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ew 1 item 7) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…folder (review 1 item 14) Node ids are reduced to letters, digits, _ and - before they name a file, and a write whose resolved path leaves the folder fails as UNWRITABLE. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s in an error cause (review 1 item 19) Requests to Figma add x-figma-token to Headers.CurrentRedactedNames, and FIGMA_REQUEST carries the failure reason instead of the HttpClientError (whose request holds the header). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…path through a design.route page operation (review 1 item 8) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ne function per key, site and user ref, and React 18 plain function components get no ref (review 1 item 10) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rsion the session read, not the newest under the frame key (review 1 item 12) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lus the last settled one, round numbers come from the rounds, a deleted session drops its memory and locks (review 1 item 13) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er resolve, token parse, cache decode/read) are logged with their cause (review 1 item 15) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…as no match, and reads whether it names session from the CEL AST (review 1 item 16) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sage (method, url, reason), no _tag read Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ls imports with oxc-resolver and lists rendering components from pure walk machines (Q3) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…data-conciv-site (the ref rewrite dropped it) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…alls back to fetch), and its tools carry the design namespace so they are design_get, design_check and the rest Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ures removed, test budget 0, changeset for the rewrite Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # pnpm-lock.yaml
|
Important Review skippedToo many files! This PR contains 114 files, which is 14 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.
|
…o the rewrite can be tried there Co-Authored-By: Claude Opus 5.5 <[email protected]>
…oading state (spread order), so every check stopped without a reply; no open page is a NO_PAGE error that tells the agent to open the page; a stuck check names its step Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r reload, so a page served then is transformed by every plugin and its SSR HTML matches the client The design plugin stamps data-conciv-key/-site in its transform hook. A page served while plugins were (re)activating got server HTML from modules transformed without the hook and client modules transformed with it, so React reported a hydration mismatch on every stamped attribute. transform, resolveId and load now await plugin activation, as plugin.invoke does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This reverts commit 37003bf. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What
@conciv/plugin-designrewritten from scratch, at feature parity with the old design extension (design-catalogbranch), on the plugin API. The old code was read for behaviour only; nothing is copied. Spec:docs/specs/design-rewrite.md; behaviour inventory:docs/specs/design-rewrite-features.md.<name>-machine.ts(state, event, effect unions and onetransition, or pure functions for stateless steps): Figma reading, pairing, the gate, reflow, progress, verdict, the check flow itself, the cascade, stamping, the catalog walk. No I/O, clock or randomness in a machine.PixelDiffinterface with a blazediff layer (the check's score) and a pixelmatch layer (the masks).design_get,design_check,design_status,design_query(CEL over the stored check log),design_components.public/design/and cached in the plugin's storage.design_get({frames})reads frames, cached by Figma's file version.design_check({frames})is refused unless those frames were read in the session. Per session and frame set the plugin keeps the last rounds for progress and the stop rules; checks on one frame set queue.hmr.waitand registers its own page operations: measure in a mirror iframe at a width, element shots, pictures, the tab's route.data-conciv-key,-site,-instance) from a per-dev-server key map, never writing user files; component call sites are stamped through the ref (ref={concivStamp(...)}from the plugin's virtual module). Source lines come from the key map.figma(key+env FIGMA_API_KEY), settings page and thedesign_getcard, kept from the closed feat(plugin-design): Figma sources and design_get with the Figma key as a plugin integration #1234. The key isRedactedeverywhere and theX-Figma-Tokenheader is redacted in logs.Not carried over, by decision: the old UI and the x-ray, the PNG design path (OCR, segmentation), the component preview page (comes back with the design UI work), options and tolerances nothing read, the
comparatoroption.Outside the plugin
apps/examples/tanstack-start: adds the design plugin so the rewrite can be tried there.pnpm-workspace.yamlcatalog:@blazediff/core,pixelmatch,culori,color-blend,pngjs,@types/culori,@types/pngjs,@marcbachmann/cel-js,oxc-resolver,parse5,get-tsconfig;pnpm-lock.yaml.Tests
None in this PR, by decision: product code first, tests in a follow-up PR. The plugin's old tests, written for the code this replaces, are removed;
conciv.testBudgetis 0.Known follow-ups
FetchHttpClientwhen none is given (the simulation network does not reach Figma calls yet).🤖 Generated with Claude Code