Skip to content

feat(assets): update react-compiler-migration and make it team-agnostic - #255

Open
Prithpal-Sooriya wants to merge 5 commits into
mainfrom
fm/rc-skill-stable
Open

Prithpal-Sooriya wants to merge 5 commits into
mainfrom
fm/rc-skill-stable

Conversation

@Prithpal-Sooriya

@Prithpal-Sooriya Prithpal-Sooriya commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Update assets/react-compiler-migration and make it usable by any team. It stays maturity: experimental for now; promotion to stable can come after other teams have used it.

Description

  • Maturity unchanged: stays experimental, so it still installs only on opt-in. Adds the recommended ## When To Use section, which clears its yarn audit:skills warning.
  • Remove team-specific content: no assets file paths, ticket ids or PR numbers. Each pattern keeps a "Verified in metamask-mobile" line with its evidence. metamask-mobile facts now live in one Repo notes: metamask-mobile section: Jest gating via scripts/react-compiler.js, the offline .npmrc, react-hooks lint, ONLY_INCLUDE_IF fences and yarn lint:tsc. The rest of the text refers to them conditionally. Both marker commands are pinned to react-compiler-marker@0.2.0.
  • New section, "When yarn lint:react-compiler fails": a new failing file or a higher count fails the check. An improved file must leave the baseline via yarn lint:react-compiler --update. Never grow the baseline. If the repo has no such script, the marker run is the check.
  • New validated recipes in references/patterns.md:
    • exhaustive-deps suppressions: useEffectEvent for deps that must stay out; inlining a render-body helper into the effect; a run-once ref guard when a mount-only [] effect gets honest deps (missing guard → Jest OOM loop), guarding on the tracked dep.
    • Refs during render: declare the sync effect before the effects that read the ref; usePrevious for "previous render" refs; a state-held previous key instead of a ref for reset-on-prop-change; don't move useAnimatedValue into an effect.
    • failRequest must be a function declaration. A never arrow assigned to an unannotated const does not narrow (TS2345; reproduced under tsc --strict).
    • Reanimated .set()/.get() evidence (Jest toHaveAnimatedStyle, 3.16+).
    • Helper extraction: name hook-calling helpers use... and reuse the existing props type.
    • Diagnostic surfacing: one pass lists every finally/throw, but value blocks surface next run.
    • Refs read during render to produce output are a "do not fix, report" case.
  • Comment rule: principle 6 no longer allows the one-line "extracted for the compiler" comment. That context goes in the commit and PR body instead.

New recipes were checked with react-compiler-marker@0.2.0 and babel-plugin-react-compiler@1.0.0 on minimal reproductions. The state-held previous key compiles; the ref version still fails Cannot access refs during render. A probe-by-throw recipe from the source notes was dropped because 0.2.0 has no --log-level and the probe gave no signal.

Testing

  • yarn lint ✅, yarn test 77/77 ✅, yarn audit:skills 0 errors (react-compiler-migration has no warnings).

Adversarial review (adverse)

Final verdict (round 2/3, run while the PR still promoted the skill to stable): SHIP-WITH-CAVEATS (3/3 ship, 0/3 block)
Findings: 0 critical · 6 warning · 6 info. Fixed: unpinned npx @latest (pinned 0.2.0); false useCallback re-run claim; Jest-gating mechanism duplicated outside Repo notes. Round 1 also fixed: one-pass-vs-first-failure contradiction; new recipes missing verification lines; repo facts stated unconditionally; shared-value .set() during render (now kept in an effect); useEffectEvent passed as a value (now called); broken sentence; unverifiable probe recipe (removed).
Declined:

  • Skill documents a proposed CI script (disputed): requested scope. The section reads correctly with or without the script.
  • Restore a searchable comment on compiler-forced helpers: the maintainer's rule is zero comments, with that context kept in the commit and PR. Code-comment fixes are declined by policy.
  • Provenance no longer re-checkable: removing team file paths and tickets was the goal; each entry keeps its evidence and the compiler/marker versions.
    Reviewer: Pi Opus 5.5 (litellm/claude-opus-5-5) via adverse (3 personas, 2 rounds).

Type of Change

  • Skill improvement/update

Checklist

  • I have read the CONTRIBUTING.md guidelines
  • My skill does not contain any secrets, private keys, or sensitive data
  • My changes don't break existing skills

Make the skill team-agnostic, label metamask-mobile specifics as repo notes,
add a section on the lint:react-compiler burndown baseline, and add validated
recipes for exhaustive-deps suppressions, render-time refs and failRequest
narrowing.
@Prithpal-Sooriya Prithpal-Sooriya changed the title feat(assets): promote react-compiler-migration to stable feat(assets): update react-compiler-migration and make it team-agnostic Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant