Skip to main content

Figma Code Connect Template Migration

ADR-031: Figma Code Connect template migration

  • Status: Accepted
  • Deciders: Abyss Team
  • Date: 2026-10-14

Context​

products/abyss-code-connect connects 84 Abyss components (37 web, 47 mobile) to their Figma designs using @figma/code-connect's React parser ("parser": "react" in figma.config.json), pinned at version 1.4.9. Figma has deprecated framework-specific parsers (React, iOS, Android, Web Components) in favor of a framework-agnostic "template" format, and this is not a future risk: support for parsers already ended on August 17, 2026, and @figma/code-connect@2.0.0 (released August 18, 2026) restricts framework-specific parsers to the migrate and unpublish commands only — every other command, including publish, now refuses to run against parser-based files.

Abyss's 1.4.9 pin predates that cutoff but is fragile: the last version bump (1.3.1 → 1.4.9) was a routine copilot-swe-agent security-dependency PR, not a deliberate upgrade decision. The next such bump could just as easily land on 2.x and silently break pnpm run publish in production with no warning.

A spike (US10937748) investigated Figma's claim that its migrate CLI command deterministically and losslessly converts existing Code Connect files to the template format, and scoped the knock-on impact to the internal tooling that reads these files: script/build-manifest/build-manifest.js, script/test/validate-code-connect-static.js, script/test/validation-rules.js, scripts/figma/audit-figma-links.js, scripts/figma/fix-figma-links.js, products/abyss-test/code-connect/validate-production.js, the .github/skills/code-connect skill, and the abyss-validate-code-connect CI workflow.

As part of the spike, Claude Code converted a representative pilot subset of web components (Accordion, Footer, CheckboxGroup, Card, Drawer, and both Button.figma.tsx files) using the migrate CLI (2.0.1), writing output to a scratch directory only. It separately ran migrate against the full 84-file tree, also to a scratch directory, to measure the command's real output shape — nothing in the repository itself was changed by either run.

To verify the live publish path end to end, a full duplicate of the production web library — Figma file "Web: Component Library | Abyss DS Core (Copy)" — was created as a disposable scratch file. Claude Code retargeted a scratch copy of figma.config.json at that copy, ran publish --dry-run against the pilot's migrated templates, then published them for real; Figma confirmed all 7 templates (covering the 5 pilot components) published successfully to the copy. No changes were made to the production Abyss Global Web library or to any file inside the repository. Findings:

  • Prop-mapping is correct and verified empirically: figma.enum → getEnum, figma.boolean → getBoolean, figma.instance → getInstanceSwap(...).executeTemplate().example, all confirmed against real pilot output (Accordion, Footer, Card, Drawer, Button).
  • figma.children has no first-class template equivalent yet; migrate falls back to the legacy, Figma-deprecated __properties__.children() API. It works, but is not what Figma recommends for new templates.
  • figma.className has zero usage anywhere in the Abyss codebase, so this migration cannot empirically validate that mapping.
  • migrate groups output by distinct Figma node-id, not by source file. A source file with N distinct node-ids becomes N output files (Name.figma.ts, Name_1.figma.ts, Name_2.figma.ts, ...). Migrating the full tree produced 139 output files from 84 sources — a ~65% increase that breaks the "one file = one component" assumption in build-manifest.js and validate-code-connect-static.js.
  • --batch mode (which would consolidate a component's many node-id-specific files into one .figma.batch.ts/.figma.batch.json pair) does not work for Abyss's files: --batch auto, the CLI default, produced zero batch files across the entire tree. Both files above the 10-connection auto-batch threshold (web/Button.figma.tsx, 64 connections; mobile/Button.figma.tsx, 15 connections) failed batch conversion outright and fell back to many separate numbered files instead.
  • figma.config.json's documentUrlSubstitutions survives migration unchanged (confirmed empirically — migrate's own rewritten config preserved it verbatim). parser, importPaths, and the React-specific paths aliases are dropped, and the new config no longer needs to resolve the real component source packages at all (no more include/paths entries pointing at packages/abyss-web/src or packages/abyss-mobile/src), decoupling Code Connect parsing from component package internals.
  • The story's requested byte-for-byte diff of the rendered Dev Mode snippet (via figma:validate-prod) could not be completed in the spike: that script drives Puppeteer against an already-logged-in Chrome profile, which requires a one-time interactive login not available in an automated environment, and the Figma REST API does not expose rendered Code Connect snippet text as an alternative. The script also hardcodes the production file IDs with no override for a scratch file.

Decision​

Abyss will migrate products/abyss-code-connect from the React parser to Figma's template format, on the following terms:

  • Upgrade @figma/code-connect to 2.0.1 (current latest) as part of the migration, rather than staying on 1.4.9. Parser support is already past Figma's own end-of-support date, and 2.0.1 still fully supports migrate/unpublish against the existing parser-based files. Testing against the version Abyss will inevitably land on surfaces any breakage deliberately, instead of via a future unplanned dependency bump.

  • Accept the file-count growth (84 → ~139) rather than fighting it. Do not attempt to force a 1:1 file mapping through --batch or hand-splitting — both were tried and rejected (see Alternatives). Rewrite build-manifest.js to discover components by globbing *.figma.ts and grouping by the base name with any trailing _\d+ suffix stripped, collecting multiple node-ids per component instead of taking the first node-id= match in a file.

  • Update validate-code-connect-static.js to match the new .figma.ts extension and the grouped-manifest shape, and rewrite validation-rules.js's ruleMustCallConnect check (which looks for the literal substring figma.connect, absent from every migrated file) to assert on figma.code / the export default shape instead.

  • Leave audit-figma-links.js, fix-figma-links.js, and download-component-def.js unchanged. They are decoupled from the raw file format (the first two only read code-connect-manifest.json; the third calls the Figma REST API directly with CLI-supplied arguments) and only need the manifest's top-level shape preserved.

  • Migrate web and mobile together. parser is a single project-wide figma.config.json flag. The file-level migrate step can run per platform independently, but once the config is changed to drop parser, any platform not yet migrated stops working entirely. Both trees will be migrated and hand-reviewed in parallel, then cut over together.

  • Accept the figma.children → legacy __properties__.children() fallback as-is for now, since no first-class replacement exists in @figma/code-connect@2.0.1.

  • Docs and skill update: rewrite .github/skills/code-connect/SKILL.md's references to figma.boolean/figma.instance/figma.enum (replaced by getBoolean/getInstanceSwap/getEnum) and products/abyss-code-connect/README.md's link to the deprecated React parser docs.

  • CI coordination: confirmed, no changes needed. The external uhc-tech/abyss-pipelines workflow has no Code Connect format-specific logic — it just runs this package's own validate:files and validate:dry-run scripts. Both passed in the actual CI run against this branch's push, including against the review copies.

  • Stage the full migration behind scratch Figma copies for team review. Until this ADR is accepted, the production entries in figma.config.json's documentUrlSubstitutions will be commented out and temporarily replaced with URLs for duplicated, disposable copies of the production libraries (e.g. "Web: Component Library | Abyss DS Core (Copy)" for web, with a corresponding mobile copy). The full migrated tree — all ~139 output files, not just the pilot — will be published to these copies, so reviewers can inspect the live, Dev-Mode-rendered Code Connect output in Figma alongside reviewing this ADR, rather than reviewing diffed template source alone.

    This is confirmed safe for the production libraries: Code Connect publish data is keyed by (file_key, node_id), and a copy has a distinct file key from production, so publishing to it cannot read, overwrite, or remove anything already published against the production libraries. Verified both architecturally and empirically — publish --dry-run against production, re-run after the scratch-file publish completed, still reported every file valid, with the original production entries completely untouched and available for side-by-side comparison, exactly as during the spike's pilot publish.

  • On acceptance, cut over without re-doing the work. documentUrlSubstitutions will be restored to the production URLs and the already-reviewed template files published for real — no reconversion needed. Before that swap, reconcile node-ids between each scratch copy and its production counterpart across the full file set: the spike only spot-checked this for 5 pilot components plus both Button files, and a copy can drift from production if production is edited after the copy is made. Any component whose node-id has drifted needs its template's url= reference corrected before the final publish.

  • Fix pre-existing stale files per component during migration, rather than deferring to a follow-up story. Hand-reviewing each component against its live Figma node during migration surfaces files that were already out of date before this migration started — independent of the parser/template format change. The web Accordion found during review: its url= pointed at a node-id distinct from the one actually in current use, its instance-swap property reference used a stray Unicode variation selector that no longer matched the live property's exact name, and the Figma component had gained a subheading and a paragraph-visibility toggle with no corresponding template mapping. None of this is template-migration fallout — the same file would have shown as broken or incomplete against the old React-parser pipeline too. Since migration already requires opening each component's live Figma node to reconcile node-ids (previous bullet), auditing its property mappings in the same pass is close to free; fixing what's found there is now in scope per component as it's migrated, rather than batched into a separate follow-up story as this ADR originally proposed under Future considerations.

Alternatives considered​

Stay on the current 1.4.9 pin indefinitely​

Rejected. Framework-specific parser support already ended August 17, 2026, per Figma's own changelog. The dependency is one routine security-patch PR away from landing on 2.x and breaking publish/connect in production without warning — exactly how the current 1.4.9 pin was reached. Staying still does not avoid the migration; it only removes control over when it happens.

Force a strict 1-file-per-component mapping​

Tried via --batch none and reviewed --batch auto (the default) empirically. Neither preserves a 1:1 mapping: migrate splits by distinct node-id regardless of the --batch setting, and --batch mode itself failed for both Abyss files that would need it (Variant Code Connect docs are not supported yet / Templates did not reduce to one compatible shape). Hand-merging the split outputs back into one file per component was also considered and rejected — it would fight the shape Figma's own tooling (preview, publish) expects by default, adding ongoing manual-merge work on every future design change rather than a one-time migration cost.

Wait for Figma to improve batch-mode support before migrating​

Rejected. There is no committed timeline from Figma for better batch handling of variant-restricted, high-connection-count files, and the parser is already unsupported today. Waiting only extends the window in which an unrelated dependency bump could break production unintentionally.

Skip the scratch-copy review step and publish directly to production on acceptance​

Rejected. Under this alternative, the team would review only diffed template source during ADR review, with no way to see how Figma's Dev Mode actually renders the migrated connections until after acceptance — at which point a rendering problem is far more expensive to walk back. The spike already proved publishing to a disposable copy is low-cost and fully isolated from production: the pilot publish to "Web: Component Library | Abyss DS Core (Copy)" round-tripped successfully, and a production dry-run immediately afterward confirmed zero interference with production's existing entries. There is no reason not to extend that same mechanism to the full migrated tree for review purposes.

Consequences​

Pros​

  1. Removes the risk of an unplanned dependency bump silently breaking publish in production — the current 1.4.9 pin predates the deprecation only by luck, not by design.
  2. Prop-mapping correctness is verified, not assumed: figma.enum/figma.boolean/figma.instance were confirmed against real migrated output, and a full publish round-trip against a live scratch Figma file succeeded.
  3. The new figma.config.json no longer needs to resolve the real component source packages (packages/abyss-web/src, packages/abyss-mobile/src), decoupling Code Connect from component package internals and shrinking its configuration surface.
  4. documentUrlSubstitutions and the overall publish workflow carry forward unchanged, so the authoring team's mental model of "one Figma library URL per platform" is preserved.
  5. Reviewers can inspect live, Dev-Mode-rendered Code Connect output during ADR review via disposable scratch copies, rather than relying on template-source diffs alone — and acceptance converts directly into a production publish with no rework, since the reviewed files are already migrated.

Cons​

  1. File count grows roughly 65% (84 → ~139), requiring real rewrites to build-manifest.js and validate-code-connect-static.js, not just a search-and-replace of the file extension.
  2. validation-rules.js's static checks are React-parser-shape-specific and need rewriting; the exact replacement assertions could only be finalized against real migrated output, not from documentation alone.
  3. figma.children usage (Footer, CheckboxGroup, and others) will rely on a legacy, Figma-deprecated API with no first-class replacement — functional today, but a known soft spot.
  4. Web and mobile must land in one combined cutover commit, since parser is a single shared config flag — this is a larger blast radius than migrating either platform fully independently.
  5. The "no rework needed on acceptance" benefit depends on every migrated component's node-id matching between its scratch copy and production, and on its template's property mappings still matching what's live in Figma. Only 6 of the ~139 output files were spot-checked for either during the spike, so a full reconciliation-and-audit pass is required before the final cutover publish, and any component with a drifted node-id or a stale property mapping needs manual correction at that point — as found on the web Accordion.

Future considerations​

  • Resolve pre-existing errors: some files, prior to conversion, currently have errors for certain props in Figma. A follow-up story can be made to go through and fix such errors if any have been missed in this current work.
  • Connect additional components: perform a review for components not currently covered by Code Connect and write new figma.ts files for them.
  • V3 Code Connect: restructure folders for Code Connect to be contained within V2 and V3 folders as applicable. Design wants to have a single Figma file for both web and app (mobile), which should only require consolidation to a single source of truth instead of separate documentUrlSubstitutions.

References​

Revision history​

2026-10-14: Initial draft created from the US10937748 spike findings.

2026-10-14: Added the staged-review approach — publishing the full migration to disposable scratch Figma copies so the team can review live Dev Mode output alongside the ADR, with production entries confirmed to remain untouched throughout. Added the node-id reconciliation requirement this introduces before the final cutover publish.

2026-10-14: Resolved CI coordination — the external abyss-pipelines workflow just calls this package's own validate scripts, confirmed passing in the actual CI run.

2026-10-20: Expanded scope to fix pre-existing stale Code Connect files per component during migration, rather than deferring that work to a separate follow-up story as originally noted under Future considerations.

2026-10-21: Accepted and cut over to production.

Table of Contents