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.childrenhas no first-class template equivalent yet;migratefalls back to the legacy, Figma-deprecated__properties__.children()API. It works, but is not what Figma recommends for new templates.figma.classNamehas zero usage anywhere in the Abyss codebase, so this migration cannot empirically validate that mapping.migrategroups 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 inbuild-manifest.jsandvalidate-code-connect-static.js.--batchmode (which would consolidate a component's many node-id-specific files into one.figma.batch.ts/.figma.batch.jsonpair) 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'sdocumentUrlSubstitutionssurvives migration unchanged (confirmed empirically —migrate's own rewritten config preserved it verbatim).parser,importPaths, and the React-specificpathsaliases are dropped, and the new config no longer needs to resolve the real component source packages at all (no moreinclude/pathsentries pointing atpackages/abyss-web/srcorpackages/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-connectto2.0.1(current latest) as part of the migration, rather than staying on1.4.9. Parser support is already past Figma's own end-of-support date, and2.0.1still fully supportsmigrate/unpublishagainst 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
--batchor hand-splitting — both were tried and rejected (see Alternatives). Rewritebuild-manifest.jsto discover components by globbing*.figma.tsand grouping by the base name with any trailing_\d+suffix stripped, collecting multiple node-ids per component instead of taking the firstnode-id=match in a file. -
Update
validate-code-connect-static.jsto match the new.figma.tsextension and the grouped-manifest shape, and rewritevalidation-rules.js'sruleMustCallConnectcheck (which looks for the literal substringfigma.connect, absent from every migrated file) to assert onfigma.code/ theexport defaultshape instead. -
Leave
audit-figma-links.js,fix-figma-links.js, anddownload-component-def.jsunchanged. They are decoupled from the raw file format (the first two only readcode-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.
parseris a single project-widefigma.config.jsonflag. The file-levelmigratestep can run per platform independently, but once the config is changed to dropparser, 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 tofigma.boolean/figma.instance/figma.enum(replaced bygetBoolean/getInstanceSwap/getEnum) andproducts/abyss-code-connect/README.md's link to the deprecated React parser docs. -
CI coordination: confirmed, no changes needed. The external
uhc-tech/abyss-pipelinesworkflow has no Code Connect format-specific logic — it just runs this package's ownvalidate:filesandvalidate:dry-runscripts. 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'sdocumentUrlSubstitutionswill 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-runagainst 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.
documentUrlSubstitutionswill 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 bothButtonfiles, 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'surl=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
Accordionfound during review: itsurl=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
- Removes the risk of an unplanned dependency bump silently breaking
publishin production — the current1.4.9pin predates the deprecation only by luck, not by design. - Prop-mapping correctness is verified, not assumed:
figma.enum/figma.boolean/figma.instancewere confirmed against real migrated output, and a full publish round-trip against a live scratch Figma file succeeded. - The new
figma.config.jsonno 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. documentUrlSubstitutionsand the overall publish workflow carry forward unchanged, so the authoring team's mental model of "one Figma library URL per platform" is preserved.- 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
- File count grows roughly 65% (84 → ~139), requiring real rewrites to
build-manifest.jsandvalidate-code-connect-static.js, not just a search-and-replace of the file extension. 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.figma.childrenusage (Footer,CheckboxGroup, and others) will rely on a legacy, Figma-deprecated API with no first-class replacement — functional today, but a known soft spot.- Web and mobile must land in one combined cutover commit, since
parseris a single shared config flag — this is a larger blast radius than migrating either platform fully independently. - 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.tsfiles 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
- Figma Code Connect: Template APIopens in a new window
- Figma Code Connect: Templates migration guideopens in a new window
- Figma Code Connect: Writing template filesopens in a new window
- Figma Code Connect: CLI referenceopens in a new window
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.