[rust-compiler] Green the snap suite: Flow match parsing + fixture nesting#36707
Merged
Conversation
…sting The "Test babel-plugin-react-compiler" CI job has failed 7 fixtures since the Flow `match` fixtures landed. Six match-* fixtures never parsed in CI: Flow match syntax requires hermes-parser >= 0.28 and the enableExperimentalFlowMatchSyntax parser option, while snap pinned 0.25.1 and never passed the flag. Bump snap's hermes-parser to ^0.28.0 and pass the flag in parseInput. The six checked-in .expect.md snapshots pass unchanged, so they were authored under a compatible parser. babel-plugin-syntax-hermes-parser stays at 0.25.1: nothing in snap's pipeline re-parses match syntax (hermes desugars match to an IIFE in babel mode before sprout evaluates). method-call-scope-merge-mutable-range-sync rendered a bare <tr> into sprout's container; React's validateDOMNesting warning fires in exactly one of the two evaluations (warning dedup shares process state), so the recorded logs diverged while rendered output was identical. Rename tr/td to div/span: valid nesting, no warning, and the compiled shape is unchanged (37 memo slots before and after; the snapshot diff is tag literals only). The regenerated eval output is a real render replacing a stale toSorted exception recorded on an older Node. yarn.lock also gains the previously-missing typescript entry for the babel-plugin-react-compiler-rust workspace (pre-existing drift that any yarn install regenerates). Test plan: - yarn snap: 1800 Tests, 1800 Passed, 0 Failed (was 1793/1800) - yarn snap -p 'match-*': 6/6 against checked-in snapshots - yarn workspace babel-plugin-react-compiler lint: clean
…at drift The repo-wide prettier check (scripts/prettier/index.js) failed on 59 files, all pre-existing on this branch lineage. Two classes: Six Flow `match` fixtures fail to PARSE: prettier's Flow parser does not support the experimental match syntax (snap parses these with hermes-parser plus enableExperimentalFlowMatchSyntax, fixed alongside this commit). Add them to .prettierignore with an unignore-when-caught- up note; their formatting is curated with the fixture corpus. The remaining 53 files are accumulated formatting drift (fixtures plus a handful of source files like bridge.ts and minimize.ts). Format them with the repo formatter and regenerate the 45 affected fixture snapshots; the snapshot churn is Input-section text only, and the full snap suite stays green. Test plan: - node scripts/prettier/index.js: exit 0 (was 59 failures) - yarn snap: 1800 Tests, 1800 Passed, 0 Failed
Replace the .prettierignore entries for the Flow match fixtures with a real formatter: a .prettierrc.js override scoped to the match-* fixture paths uses prettier-plugin-hermes-parser (added at ^0.32.0, sharing the root hermes-parser 0.32 family, minimal lockfile churn), whose parser handles the experimental match syntax. The four fixtures whose checked- in formatting differed from hermes output are reformatted and their snapshots regenerated. Test plan: - node scripts/prettier/index.js: exit 0, match fixtures now checked - yarn snap: 1800 Tests, 1800 Passed, 0 Failed
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.
Summary
The "Test babel-plugin-react-compiler" CI job has failed 7 fixtures on this branch lineage since the Flow
matchfixtures landed. This makes it fully green so the suite can act as a hard gate again (rust burn-down failures stay in the rust job, where they belong).match-*fixtures never parsed in CI. Flowmatchrequires hermes-parser >= 0.28 plus theenableExperimentalFlowMatchSyntaxparser option; snap pinned 0.25.1 and never passed the flag (0.26 carries an incompatible draft grammar). Bump snap's hermes-parser to ^0.28.0 and pass the flag inparseInput. All six checked-in snapshots pass unchanged.babel-plugin-syntax-hermes-parserstays at 0.25.1: nothing in snap's pipeline re-parses match syntax, since hermes desugarsmatchto an IIFE in babel mode before sprout evaluates.method-call-scope-merge-mutable-range-synchad a logs-only sprout divergence. It renders a bare<tr>into sprout's container; React'svalidateDOMNestingwarning fires in exactly one of the two evaluations (warning dedup shares process state), so logs differed while rendered output was identical. Renamedtr/tdtodiv/span: valid nesting, no warning, compiled shape unchanged (37 memo slots before and after; the snapshot diff is tag literals only).yarn.lockalso gains the previously-missingtypescriptentry for thebabel-plugin-react-compiler-rustworkspace (pre-existing drift that anyyarn installregenerates; included so it stops appearing in unrelated PRs).Test plan
yarn snap: 1800 Tests, 1800 Passed, 0 Failed (was 1793/1800)yarn snap -p 'match-*': 6/6 against checked-in snapshots, no regenerationyarn workspace babel-plugin-react-compiler lint: cleanSecond commit: the prettier check
Run prettierfailed on the same lineage for two reasons: the sixmatchfixtures fail to parse (prettier's Flow parser predates the experimental syntax; now in.prettierignorewith an unignore note), and 53 files of accumulated formatting drift (now formatted, with the 45 affected fixture snapshots regenerated; churn is Input-section text only).node scripts/prettier/index.js: exit 0 (was 59 failures)yarn snapafter regeneration: 1800/1800Update (third commit): replaces the
.prettierignoreapproach with a real formatter. A.prettierrc.jsoverride scoped to thematch-*fixture paths formats them viaprettier-plugin-hermes-parser^0.32.0(shares the root hermes 0.32 family, minimal lockfile churn). The four fixtures whose checked-in formatting differed from hermes output are reformatted with snapshots regenerated. Both suites verified green after the swap:node scripts/prettier/index.jsexit 0 with the match fixtures actually checked,yarn snap1800/1800.