Skip to content

feat(cli): the swipe codemod defines each swipe once - #11670

Merged
cixzhang merged 16 commits into
meta:mainfrom
vjeux:uikit/swipe-codemod-define-once
Nov 18, 2026
Merged

cixzhang merged 16 commits into
meta:mainfrom
vjeux:uikit/swipe-codemod-define-once

Conversation

@vjeux

@vjeux vjeux commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

User need

astryx upgrade rewrites the deprecated swipeActions of Item and ListItem. Its output called createSwipe inline on each row, with ids such as 'trailing-0'. spec:AST-057 FR11 allows that, but defines a swipe once. So callers moved each swipe by hand.

Problem and solution fit

The codemod now writes that definition where the swipe keeps its meaning, and the inline call with a TODO elsewhere.

Current specification

  • spec:AST-057 FR11 and DEC-10: one definition; a handler receives the action's id and the row's itemKey.
  • spec:AST-057 DEP-0017: its migration and codemod fields describe this output.
  • spec:AST-017 FR29c and FR29d: the codemod reports what it cannot rewrite.

Public delta and caller burden

The codemod's output only. Only an entry's onActivate is a handler. A swipe is defined once:

  • At module scope, when every value outside a handler is a literal, a JSX element, an import or a module const.
  • Else in useMemo in the component or hook whose props or state it reads. A call there calls one of its locals directly, such as a hook's t, not a ref.
  • On a ListItem, a handler that compares the row's own itemKey with === or !== takes ({itemKey}).
  • Ids come from the label, then the handler's name, then side and place with a TODO. A condition migrates only when its ids are readable and its swipes key as the props did; else its props stay, with a TODO.

Otherwise createSwipe stays on the row with a TODO. An Item row's TODO says an Item passes no itemKey.

Design and alternatives

  • A component or hook has a capitalized or use name, directly or through memo or forwardRef, never a map callback.
  • Rejected: definitions that freeze a render-time t('archive') or a local reassigned, written through or handed on. Rejected too: a definition that a call above it reads before it runs.
  • Rejected: itemKey passed on, as in remove(itemKey), which fails tsc where the row's own key passed.

Evidence

  • On main's transform, 49 of the 55 tests fail, as does the type-level test; all pass now.
  • Each review's tests fail on its head; see Testing.

Scope

Components: the migrate-item-swipe-actions-to-swipe codemod, and the sandbox's Swipe Actions Cases page, which defines its swipes once.

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split. The exceptions are three feat(core): swipe actions come from createSwipe on the shared drag path #8690 follow-ups the owners accepted: the shared drag's dependency list, two AST-057 rows and a pinch-zoom test comment (after Testing).
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run --project node packages/cli/assets/codemods at 8f48352a6d: 88 files, 1,118 tests pass.
  • Each review's tests fail on its head: six on 6c7e4a1692, with the id test, and five on 631873b89d. Then four on 99ed1fbcfb, nine on 9761889d52, three on 66ae73835d, two on 5df4f01179, three on da896c643c, four on b9ba8ec2b6 and three on c34f4c2ae1. The two on 5df4f01179 compare a condition's two swipes, which now carry the same ids, so an open row stays open when it flips. The three cover the reported shape, an id matching another branch's label, and every condition up to two entries a side. The four cover a free id, imported ids in the table, and an id that is not a string literal. That id faces a literal in one test and no id in another. The three on c34f4c2ae1 cover an entry spread, a name id now kept, and the table.
  • The type-level test runs tsc over typed fixtures after the codemod. The migrated rows pass, and a hand-written remove(itemKey) control fails with TS2345.
  • The table test runs 5,920 conditions. Each side has up to two entries, each with a string literal id or none. With a name id, a spread or a computed key too, a side has up to one entry, or two with one of those. Any of those keeps the props with one TODO.
  • Each test also runs the codemod on its output, which changes nothing, and parses it.
  • An Item test opens a row through such a condition, with the deprecated props and with the codemod's output, and flips it. The row stays open and relabels in both. With the output's ids from 5df4f01179, it closes.
  • A second Item test opens a row through one entry against none on a side, whose props the codemod now keeps, and flips it. It stays open; with the output from da896c643c, it closes.
  • A third Item test flips a row whose branches set one place's id as a name and as the same string literal. It stays open with those props, which the codemod now keeps.
  • pnpm -F @astryxdesign/cli typecheck, after pnpm build: 0 errors.
  • eslint and prettier on the changed files, pnpm check:knowledge, pnpm check:changesets and pnpm check:repo pass.
  • Codemod Verify ran against main 1addd72da4, which has feat(core): swipe actions come from createSwipe on the shared drag path #8690. It passes with no exception, and the codemod changes nothing in the sandbox or in Storybook.
  • For the review notes, at 6c7e4a1692: Core's tsc reports 0 errors. The unit suites of Item, Swipe, List and the shared drag pass 4,905 tests in 231 files. The swipe interaction spec passes 27 in Chromium (8 skipped) and 28 in WebKit (7 skipped), and the Item accessibility specs pass 37. Since then, this pull request changes only the codemod, its tests, its changeset, one record sentence and three Item tests. At 8f48352a6d, pnpm exec vitest run --project ui over Item, Swipe, List, hooks, gestures, motion, dragToSnapPoints and utils in packages/core/src passes 4,931 tests in 231 files.
  • The sandbox page ran at 4b4aede2c4, an earlier version of this page commit on an older base. It was built by pnpm build and pnpm -F @astryxdesign/sandbox build, then served by vite preview. A touch script in Chromium at 390 px passes 13 of 13 checks over its three cases. They cover the read toggle, a drag from the open row's Delete, a tapped Delete and a commit release. The page before this change passes the same 13.
  • The story comparison: git show a4fe0154fb:apps/storybook/stories/List.stories.tsx > /tmp/List.stories.tsx, then pnpm -F @astryxdesign/cli exec jscodeshift --parser=tsx -t assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs /tmp/List.stories.tsx. Format the result with pnpm exec prettier --stdin-filepath apps/storybook/stories/List.stories.tsx < /tmp/List.stories.tsx, so the repo's config applies. Then diff it against apps/storybook/stories/List.stories.tsx. The deleteSwipe definition and its row match, but for one blank line before onActivate. The definition sits before the return, not above containerRef.

Review notes from #8690

  • useSwipeAction.ts adds latestRef, the options ref its begin check reads, to an effect's dependency list. A ref's identity is stable, so behavior does not change, and no device run is needed.
  • spec:AST-057's modality split row says what FR4 says: a trackpad's horizontal scroll swipes a row, and a mouse drag or a mouse wheel's notches don't. Its builder-impact example gives the action the id every swipe action needs.
  • The pinch-zoom spec's comment says a finger's swipe begins at the row's 8 px claim, with the row then at the finger's travel since touch-down.

Public and internal API delta

None. No export, prop, type or default changes, and the transform adds no shared module.

Size: +3295/−186 in 10 files. Shipped: the transform +1828/−62, and useSwipeAction.ts +3/−3. Tests: the transform's +1086/−36, its type-level test +140, and Item's flip tests +137. The record +20/−20: two DEP-0017 cells, the modality row and the builder-impact example; prettier re-pads the DEP-0017 table. The changesets +8/−1 (swipe-codemod.md and Core's new internal entry); the sandbox page +71/−63; the pinch-zoom spec's comment +2/−1.

Writing rubric results

Edited: spec:AST-057 DEP-0017's migration and codemod fields, its modality split row, and its builder-impact example.

R1 narration: none; each field describes the codemod or the input split in the present tense.
R2 research: none.
R3 evidence: no evidence cell changed.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none touched.
R7 project status: none.

The deprecations codemod wrote createSwipe(...) inline on each row,
with positional ids, so every render built a new swipe. It now
defines each swipe once: at module scope, or in useMemo in the
enclosing component or hook when a handler reads its props or state.
A useState or useReducer setter and a ref stay out of the
dependencies. Each new id is named after the action's label, then
its handler.

On a ListItem, a handler that reads the row's own itemKey value takes
itemKey from onActivate instead, so one swipe serves every row. A
conditional value keeps its condition on the row, and each of its
objects is defined once. A spread of a local constant object with no
swipe props gets no TODO. Where the codemod cannot define a swipe
once, createSwipe stays on the row with a TODO.
The page built a new swipe for every row on every render. Each case
now builds two swipes once, in useMemo: unread rows offer Read and
read rows offer Unread. Each handler reads its row from the itemKey
that every row now passes, and the row's click shares the same read
toggle.
@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 18, 2026 2:10am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 14, 2026
@astracat-bot

astracat-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 3:58 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 8f48352

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
DropdownMenu 108.8 kB (+3 B) · 18.9 kB CSS (0) — — · — · —
Item · Storybook 20.6 kB (+1 B) · 6.2 kB CSS (0) 958 (0) ✓ · ✓ · —
SelectorOption 24.2 kB (+1 B) · 6.7 kB CSS (0) — — · — · —
24 more components
Component Size LoC Visual · A11y · RTL
Table 121.8 kB (+1 B) · 19.8 kB CSS (0) — — · — · —
TableCell 104.7 kB (+1 B) · 19.3 kB CSS (0) — — · — · —
lab/CommentThread 370.3 kB (+1 B) · 2.4 kB CSS (0) — — · — · —
BreadcrumbItem 98.0 kB (0) · 13.3 kB CSS (0) — — · — · —
CheckboxListItem 80.4 kB (0) · 12.1 kB CSS (0) — — · — · —
ContextMenu 103.4 kB (0) · 18.8 kB CSS (0) — — · — · —
ContextMenuItem 35.9 kB (0) · 7.1 kB CSS (0) — — · — · —
DropdownMenuCheckboxItem 28.8 kB (0) · 7.3 kB CSS (0) — — · — · —
DropdownMenuItem 28.0 kB (0) · 6.9 kB CSS (0) — — · — · —
DropdownMenuSubMenu 78.9 kB (0) · 10.5 kB CSS (0) — — · — · —
ListItem 79.5 kB (0) · 12.1 kB CSS (0) — — · — · —
Pagination 147.6 kB (0) · 19.1 kB CSS (0) — — · — · —
RadioListItem 76.5 kB (0) · 10.7 kB CSS (0) — — · — · —
TableHeaderCell 104.5 kB (0) · 19.1 kB CSS (0) — — · — · —
lab/TabBarMoreList 102.4 kB (0) · 1.8 kB CSS (0) — — · — · —
lab/TransferList 136.4 kB (0) · 1.2 kB CSS (0) — — · — · —
lab/TransferListSelector 145.3 kB (0) · 1.4 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 309.2 kB (0) · 454 B CSS (0) — — · — · —
DropdownMenuRadioItem 28.8 kB (−1 B) · 7.3 kB CSS (0) — — · — · —
Markdown 205.5 kB (−1 B) · 22.1 kB CSS (0) — — · — · —
PowerSearch 310.3 kB (−1 B) · 25.6 kB CSS (0) — — · — · —
Selector 114.8 kB (−1 B) · 18.7 kB CSS (0) — — · — · —
lab/Comments 377.1 kB (−1 B) · 2.5 kB CSS (0) — — · — · —
MoreMenu 109.1 kB (−3 B) · 18.9 kB CSS (0) — — · — · —

Package size:

  • @astryxdesign/cli 5.40 MB packed (+14.9 kB); no new dependencies
  • @astryxdesign/core 7.66 MB packed (+28 B); no new dependencies

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec b38b0b9

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
The shared drag lists the committed options ref that its begin check
reads; the ref is stable, so a root keeps one drag. The row-actions
record's modality split says what FR4 says: a trackpad's horizontal
scroll swipes a row, and a mouse drag or a mouse wheel's notches
don't. The record's builder-impact example gives its action the id
that every swipe action needs. The pinch-zoom spec's comment says a
finger's swipe begins at the 8 px claim.
A row that spreads what an array literal's map callback takes, such as
Item's States story, got the codemod's TODO, though every element gives
it an object literal with no swipe props. The codemod now proves that
case, for the callback's parameter or one place in its array pattern,
and keeps the TODO when any element might carry a swipe prop.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. The define-once output is the direction an engineering owner approved for DEP-0017, but five problems need fixing first:

  • The codemod treats a .map or useCallback callback assigned to a capitalized name (for example const Rows = rows.map(row => …)) as a component and inserts useMemo inside it, so React throws when the list length changes; climb only a memo(…) or forwardRef(…) call that takes the function as its first argument.
  • Rewriting () => remove(row.id) to ({itemKey}) => remove(itemKey) makes TypeScript reject the output with TS2345, because itemKey is string | number | undefined, where the old output compiled; rewrite only key reads used in ===/!== comparisons, or keep the closure with the TODO, and typecheck a typed fixture.
  • Module-scope placement moves render-time calls such as label: t('archive') to import time, so the label is computed once before the app sets its locale, which contradicts the migration's promise that the panel and every handler behave as before; keep options that call or construct anything outside a handler inline with the TODO.
  • On a plain Item, the TODO tells callers to read the row from the itemKey that onActivate receives, but Item has no itemKey and passes undefined, so Item rows need their own guidance.
  • Three claims do not hold: the spec allows an inline createSwipe call, so the old output was valid rather than a defect to fix; the changeset leaves out the side-and-place id fallback; and five output tests do not run expectStable, although the description says every output test runs twice and parses.

One smaller point: in an expression-bodied component, the second object of a conditional stays inline with a TODO whose reason does not apply. The inline comments point at each location.

Claims and files checked
  • Changeset: the codemod rewrites the deprecated swipe props on Item and ListItem where every entry is an object literal. Verified by the tests.
  • Changeset: it defines each swipe once, at module scope or in useMemo. Verified, except for callbacks named like components (first finding).
  • Changeset: an entry with no id is named after its label or handler. False in part: the side-and-place fallback is not mentioned (fifth finding).
  • Changeset: a ListItem handler that reads its row's key takes it from onActivate. Verified, but typed handlers stop compiling (second finding).
  • Changeset: it keeps createSwipe on the row with a TODO where it cannot define the swipe once, and it reports hidden entries and spreads. Verified by the tests.
  • Core changeset: the shared drag lists the committed options ref its begin check reads, the ref is stable, and nothing new is exported. Verified in useSwipeAction.ts.
  • Description: the old output built a new swipe on each row in every render, with positional ids. Verified against the old transform.
  • Description: the spec rejects that pattern. False (fifth finding).
  • Description: module scope when the options read only earlier module bindings, else useMemo, with setters and refs left out of the dependencies. Verified, with the first and third findings.
  • Description: ids from the label, then the handler, then side and place; conditionals keep their condition; identical options share one definition; spreads proven free of swipe props get no TODO. Verified by the tests.
  • Description: the sandbox page defines two swipes per case in useMemo, with handlers that read the row's key. Verified.
  • Description: 11 of the 17 tests fail on the old transform, and all 17 pass. Verified by a rerun.
  • Description: each output test also runs twice and parses. False (fifth finding).
  • Description: the codemod suite (86 files, 1,067 tests), the knowledge and changeset checks, lint and formatting pass. Verified by a rerun.
  • Description: the migrated story matches the hand-written lines except for one blank line. Verified by a rerun.
  • Description: the CLI, Core and Storybook typechecks, the browser interaction and accessibility specs, the codemod verify run and the sandbox touch script pass. Not rerun.
  • Description: the four review-note edits (story comment, drag dependencies, record wording, pinch-zoom test comment). Verified.
  • Description: no public or internal API change, and +1201/−155 lines in 9 files. Verified.
  • .changeset/swipe-codemod.md: fifth finding.
  • .changeset/swipe-shared-drag-deps.md: clear.
  • apps/sandbox/src/app/(raw)/pages/swipe-actions-cases/cases.tsx: clear.
  • apps/storybook/stories/Popover.stories.tsx: clear.
  • docs/specs/AST-057-row-actions/spec.md: clear (owner-approved).
  • packages/cli/assets/codemods/transforms/next/__tests__/migrate-item-swipe-actions-to-swipe.test.mjs: fifth finding.
  • packages/cli/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs: first to fourth findings.
  • packages/core/src/Item/__tests__/ItemSwipePinchZoom.a11y.chromium.spec.ts: clear.
  • packages/core/src/Swipe/useSwipeAction.ts: clear.

Automated review (maintainer link)

Comment thread .changeset/swipe-codemod.md Resolved
@vjeux
vjeux force-pushed the uikit/swipe-codemod-define-once branch from b38b0b9 to 6c7e4a1 Compare November 14, 2026 04:30
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 6c7e4a1

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. The define-once output is the direction an engineering owner approved for DEP-0017 on this head, but six problems in the codemod and its description need fixing first:

  • The codemod treats a .map, useCallback or useMemo callback assigned to a capitalized name (for example const Rows = rows.map(row => …)) as a component and inserts useMemo inside it, so the migrated code throws "Rendered more hooks than during the previous render" once the list grows; climb only a memo(…) or forwardRef(…) call that takes the function as its first argument, and add a regression test.
  • Rewriting () => remove(row.id) to ({itemKey}) => remove(itemKey) makes TypeScript reject the output with TS2345, because itemKey is string | number | undefined, where the old output compiled; rewrite only key reads used in ===/!== comparisons, or keep the closure with the TODO, and typecheck a typed fixture.
  • Module-scope placement moves render-time expressions such as label: t('archive') or a window read to import time, so the label stops following the locale and server rendering can throw; choose module scope only when every value outside a handler is a literal, an import or a JSX element.
  • On a plain Item, the TODO tells callers to read the row from the itemKey that onActivate receives, but Item passes undefined, so Item rows need their own guidance.
  • Miss: in an expression-bodied component only the first swipe gets a definition, and the rest stay inline with a TODO that wrongly says their actions read values the codemod cannot move; re-resolve the row's statement after the body is wrapped, and add a test with two rows in an arrow component.
  • Three claims do not hold: the spec allows an inline createSwipe call, so the old output was not a defect to restore; the changeset leaves out the side-and-place fallback id and the useMemo placement for props; and five output tests never run the output twice or parse it.

The sandbox page rewrite, the Core dependency-list change and the record wording check out.

Claims and files checked
  • Claim: the codemod changeset describes define-once placement, label or handler ids, itemKey from onActivate, inline rows with a TODO and the reports. False in part: it omits the side-and-place fallback and useMemo placement for props.
  • Claim: the Core changeset says the shared drag now lists its committed options ref, which is stable and not exported. Verified (useSwipeAction.ts:587, :1355; not exported from the package entry points).
  • Claim: the old output is a pattern the spec rejects, and this restores a defect. False: FR11 allows an inline call, and DEP-0017 specified the old output.
  • Claim: the placement, id, conditional, shared-definition and spread rules. Verified by the tests, except that identical options in an arrow component do not share a definition and globals do not block module scope.
  • Claim: 11 of the 17 tests fail on the old transform and 17 of 17 pass now. Verified.
  • Claim: each output test also runs twice and parses. False for the tests at lines 44, 74, 90, 134 and 220.
  • Claim: the codemods suite passes 1,067 tests in 86 files. Verified.
  • Claim: the CLI typecheck reports 0 errors after the build. Verified.
  • Claim: prettier, the knowledge check and the changeset check pass. Verified; eslint and the repository check were not rerun.
  • Claim: the codemod output for the List stories matches the hand-written lines but for one blank line, and the Item story rows with no itemKey stay inline with a TODO. Verified.
  • Claim: the sandbox page defines two swipes per case in useMemo, with handlers that read itemKey. Verified; the file has no type errors.
  • Claim: the drag dependency change, the record's modality and builder-impact cells and the pinch-zoom comment change no behavior. Verified against FR4, FR1 and the swipe motion constants.
  • Claim: no public API changes, and the size is +1193/−150 in 8 files. Verified.
  • Claim: Codemod Verify, the Core typecheck, the unit suites and the browser runs passed. Not rerun; CI did not run on this draft, and no finding depends on them.
  • File packages/cli/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs: five findings above.
  • File packages/cli/assets/codemods/transforms/next/__tests__/migrate-item-swipe-actions-to-swipe.test.mjs: five output tests lack the stability check.
  • File .changeset/swipe-codemod.md: incomplete, as above.
  • File docs/specs/AST-057-row-actions/spec.md: clear; the DEP-0017 cells are owner-approved for this head.
  • File apps/sandbox/src/app/(raw)/pages/swipe-actions-cases/cases.tsx: clear.
  • File packages/core/src/Swipe/useSwipeAction.ts: clear.
  • File .changeset/swipe-shared-drag-deps.md: clear.
  • File packages/core/src/Item/__tests__/ItemSwipePinchZoom.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

The swipe codemod defines a swipe only where every value outside a
handler stays the same. At module scope that is a literal, a JSX
element, an import or a module const. In useMemo it also takes the
owner's locals, as dependencies, and calls or property reads on them.
Any other call, construction, property read or global stays at render,
with createSwipe on the row and a TODO. Only a function declared or
assigned under a capitalized or use name, directly or through memo or
forwardRef, gets useMemo; a map or useCallback callback does not. A
handler reads itemKey from onActivate only where it compares the row's
key with === or !==, since itemKey can be undefined, and a typed
fixture checks that output with tsc. An Item row's TODO says an Item
passes no itemKey. An arrow component with an expression body defines
every swipe in the one block it makes.
@vjeux vjeux changed the title fix(cli): the swipe codemod defines each swipe once feat(cli): the swipe codemod defines each swipe once Nov 14, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 631873b

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the define-once output is the right shape and the record change is approved, but three input shapes now produce output that throws or shows stale labels where the old output worked.

  • Miss: each definition is inserted just before the row's top-level statement, so when that statement is a function declaration called earlier (const rows = buildRows(); above function buildRows(), or rows.map(renderRow) above function renderRow in a component), the output throws ReferenceError at import or on the first render.
  • A callback inside the options (tags.map(tag => t(tag)) with an imported t) or a ref's .current passes the fixed-value check, so useMemo freezes that label until an unrelated dependency changes; only onActivate should count as a handler, and a ref read outside it should keep createSwipe on the row.
  • Miss: an owner let counts as one value, so two identical rows across label = 'Remove' share the first value, and a row in a loop that reassigns label reads the value from before the loop; a reassigned let or var should keep createSwipe on the row.

Please add each shape as a regression test beside the existing ones. The earlier feedback is fixed on this head.

Claims and files checked
  • Codemod changeset, swipes defined once at module scope or in useMemo: verified by the tests, false for the three shapes above.
  • Codemod changeset, ids from the label, then the handler, else side and place with a TODO: verified (id test).
  • Codemod changeset, a ListItem handler that compares the key with === or !== reads itemKey: verified (unit and type-level tests).
  • Codemod changeset, options that call or read something at render keep createSwipe on the row: false for render-time callbacks and ref reads.
  • Codemod changeset, an Item row's TODO says an Item passes no itemKey: verified.
  • Core changeset, the shared drag lists the stable committed options ref and nothing is exported: verified.
  • Description, 17 of the 23 transform tests fail on the old transform and all pass now: verified.
  • Description, the codemods suite passes 1,075 tests in 87 files: verified.
  • Description, every test reruns the codemod on its output and parses it: verified.
  • Description, the type-level test passes and its passed-on control fails with TS2345: verified.
  • Description, no export, prop, type or default changes: verified (API surface comparison finds no rows).
  • Description, the record's migration route keeps every handler behaving as before: false for the three shapes above.
  • Description, the drag dependency change, modality row, builder example and pinch-zoom comment change no behavior: verified.
  • Description, lint, package typecheck, Codemod Verify and the sandbox touch script: not rerun.
  • Files: the transform (three findings); the codemod changeset (render-time claim); the record, both test files, the sandbox page, the Core hook, the Core changeset and the pinch-zoom test comment: clear.

Automated review (maintainer link)

DEP-0017's codemod row said a ListItem handler gets the row's itemKey
from onActivate. The codemod does that only for a handler that compares
the key with === or !==; any other read keeps its closure. The row now
says so.
When a row sits in a hoisted function declaration, its swipe's
definition goes right after the last statement that declares a binding
it reads when it runs, so a call above the declaration finds it. At
module scope a handler's reads do not count, since a handler reads them
when its action fires; useMemo reads its dependencies at once. Where
code above that point can still reach the function, createSwipe stays
on the row with a TODO. Such a row reuses a definition only if that
definition already sits that early.

Only an entry's onActivate counts as a handler: any other callback in
the options runs at render and is checked like any value, and a ref's
current or a setter call there stays at render. Rows share one
definition only when every local their options read is a const, a
parameter, or a function or class declaration.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 99ed1fb

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec da896c6

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one conditional shape still changes how a migrated row behaves, and the codemod does not report it.

  • Miss: a conditional swipeActions whose branches differ by one entry against none on a side, such as isUnread ? {leading: [Read], trailing: [Delete]} : {trailing: [Delete]}, still gets different ids per branch because sharedIds gives up when a side's entry counts differ, so a row resting open on Delete closes when the condition flips (with the deprecated props it stayed open, since one id-less entry and an empty side both key as '') and no TODO reports it; compare the branches' deprecated keys instead of their counts, leave such a site's deprecated props in place with a TODO where shared ids cannot keep the keys equal, correct the sharedIds comment and the test title that say the key changed before, and add a codemod test and an Item flip test for this shape.

The earlier conditional finding is fixed: branches with as many entries on each side now share ids, and the new tests fail on the previous head and pass on this one. The spec:AST-057 record change has an engineering owner's approval for this head.

Claims and files checked

Review mode: same-head; reason: none

  • Claims (changesets):
    • The codemod rewrites the deprecated props to a swipe defined once with createSwipe: verified (transform; 49 tests).
    • Module scope when every value outside a handler is fixed at import: verified (fixedWhereDefined; test).
    • useMemo in the enclosing component or hook, named capitalized or use…, directly or through memo or forwardRef: verified (placementOf, functionName; tests).
    • Ids from the label, then the handler, else side and place with a TODO: verified (entryIds; test).
    • A ListItem handler that compares the row key with === or !== takes itemKey from onActivate: verified (readItemKey; type-level test).
    • Map-callback values, a ref's current, locals assigned, written through or handed on, and unfixed render-time reads keep createSwipe on the row with a TODO: verified (reassigned, written, escapes; tests).
    • Only onActivate runs when an action fires; an Item row's TODO says it passes no itemKey; unseen entries and risky spreads are reported: verified (inActivate, the TODO texts; tests).
    • The shared drag lists its stable committed options ref, which no package entry exports: verified (useSwipeAction.ts, Swipe/index.ts).
  • Claims (description):
    • The old output called createSwipe inline with positional ids: verified (base transform).
    • The cited records and the define-once rules: verified against the current records.
    • On main's transform 43 of the 49 tests and the type-level test fail, and all pass now: verified (red-first run; 49 pass at this head).
    • The latest round's two conditional tests fail on the previous head: verified (red-first run); earlier rounds' counts were verified at their heads.
    • The codemods suite passes 1,109 tests in 88 files; the type-level control fails with TS2345; every test re-runs the codemod on its output and parses it: verified.
    • The new Item test keeps an open row open through the flip in both forms, and the previous head's ids close it: verified.
    • eslint, prettier, the knowledge and changeset checks pass: verified; the repository check and the CLI typecheck were not re-run.
    • The Item, Swipe and List unit suites pass: verified for 465 tests in 20 files; the stated 4,908-test total was not reproduced.
    • Codemod Verify, the List story comparison and the sandbox touch run: not re-run.
    • The follow-ups change no behavior; the record rows match FR4 and FR1; the test comment matches the 8 px claim: verified.
    • No public or internal API change; +2,855/−184 in 10 files; no internal context: verified (API surface generator, 0 rows; numstat; scan).
  • Files:
    • migrate-item-swipe-actions-to-swipe.mjs: the finding above, including the sharedIds comment that says the key changed before.
    • migrate-item-swipe-actions-to-swipe.test.mjs: no test for one entry against none (finding above); its "changed the key before too" title is true only for its own one-against-two input.
    • migrate-item-swipe-actions-to-swipe.tsc.test.mjs, Item.test.tsx, swipe-actions-cases/cases.tsx, spec:AST-057's record, both changesets, useSwipeAction.ts, ItemSwipePinchZoom.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

One entry with no id and an empty side key alike, as '' in idsKeyOf.
So a deprecated condition with one entry against none on a side kept
an open row open when it flipped. The codemod stopped sharing ids when
a side's counts differed, so the migrated row closed, with no TODO.

The codemod now builds each branch's deprecated key as idsKeyOf does,
and plans the ids before it writes any. A condition migrates only when
its two swipes key alike exactly where the deprecated props did: own
ids where the keys differ, shared ids where they match. Otherwise the
props stay, with a TODO. That covers one entry against none on a side,
and an id in one branch that the other takes from its label.

A table test covers every condition with up to two entries a side,
each with an id or none. On the previous head it fails for the 32
shapes whose props now stay. An Item test opens a row through the
reported shape and flips it: with the props, it stays open, and with
the previous output, it closes.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec b9ba8ec

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one conditional shape still changes how a migrated row behaves without a TODO, and two description claims need correcting.

  • A conditional whose branches carry ids that are not string literals and match in value but not in source (such as id: READ_ID against id: 'read') gets per-branch ids and no TODO, because sharedIds compares the branches' keys as source text (migrate-item-swipe-actions-to-swipe.mjs:480, :505-507), so a row resting open closes when the condition flips where the deprecated props kept it open; where the keys differ only at places where both entries carry an id and one is not a string literal, share ids at the id-less places, or keep the props with the TODO, and add such a pair to the table test.
  • The description's size line gives +3130/−185 with the transform's tests at +996/−36, but the change is +3126/−185 with the tests at +992/−36.
  • The description says every test re-runs the codemod on its output, but the table test re-runs it only for the conditions it keeps and not for the 2,369 it migrates (they are stable), so add that check or narrow the sentence.

The one-entry-against-none conditional is handled: it keeps its props with a TODO, and its tests pass. The spec:AST-057 record change has an engineering owner's approval for this head. Optional: the new condition TODO says no ids can keep the keys apart, which is not so when an id only collides with one derived from a label.

Claims and files checked

Review mode: same-head; reason: none

  • Claims (changesets):
    • The codemod defines each swipe once with createSwipe, at module scope when every value outside a handler is fixed, else in useMemo in a capitalized or use… component or hook: verified (transform; tests pass).
    • Ids come from the label, then the handler, else side and place with a TODO; a ListItem handler that compares the row key with === or !== takes itemKey from onActivate: verified (tests; type-level test).
    • Map-callback values, a ref's current, locals reassigned, written through or handed on, and unfixed render-time reads keep createSwipe on the row with a TODO; only onActivate runs when an action fires; an Item row's TODO says it passes no itemKey; unseen entries and risky spreads are reported: verified (tests pass).
    • A condition no ids can key as the deprecated props did is left unchanged with a TODO: verified for string-literal ids (transform :2015-2021; tests :310-446); not for non-literal ids (first finding).
    • The shared drag lists its stable committed options ref, which no package entry exports: verified.
  • Claims (description):
    • The old output called createSwipe inline with positional ids: verified (base transform).
    • The cited records and the define-once rules: verified against the current records.
    • A condition's swipes key alike exactly where the deprecated props did, else the props stay with a TODO: false for non-literal ids (first finding).
    • On main's transform 46 of the 52 tests fail, and all pass now, the type-level test included: verified.
    • The latest round's three tests fail on the revision before it: verified (red-first run).
    • The codemods suite passes 1,112 tests in 88 files; the type-level control fails with TS2345: verified.
    • Each test re-runs the codemod on its output and parses it: false for the table test's migrated conditions (third finding).
    • The second Item test keeps the one-against-none row open: verified; the first Item test passes.
    • eslint and prettier on the changed files: verified for the latest round's files; the knowledge, changeset and repository checks and the CLI typecheck were not re-run.
    • Codemod Verify, the sandbox touch run, the story comparison and the Core suite totals: not re-run.
    • The follow-ups change no behavior; the record rows match FR4 and FR1; the test comment matches the 8 px claim: verified.
    • No public or internal API change and no internal context: verified; the size line: false (second finding).
  • Files:
    • migrate-item-swipe-actions-to-swipe.mjs: first finding; the new condition TODO's wording (optional).
    • migrate-item-swipe-actions-to-swipe.test.mjs: third finding; no non-literal id pair in the table test (first finding).
    • .changeset/swipe-codemod.md: its last sentence holds for string-literal ids only (first finding).
    • Item.test.tsx, migrate-item-swipe-actions-to-swipe.tsc.test.mjs, swipe-actions-cases/cases.tsx, spec:AST-057's record, .changeset/swipe-shared-drag-deps.md, useSwipeAction.ts, ItemSwipePinchZoom.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

The codemod compared a condition's two deprecated keys as text, so an
id that is not a string literal compared by its source. READ_ID against
'read' read as apart, each branch kept its own ids, and an open row
closed on a flip where the deprecated props kept it open.

An id a branch sets stays as written, so a place where both branches
set one keys as before, whatever the values. Now only the places with
no id decide. Where the keys could match, those places share one id.
Where an entry with no id faces a string literal, it takes a free id,
so the keys stay apart. Where it faces no entry, '' or an id that is
not a string literal, the props stay with a TODO.

The table test adds an imported id that the codemod cannot read. It
checks every value those ids may take, and runs the codemod again on
every output. An Item test flips the reported shape.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec c34f4c2

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one conditional shape still changes how a migrated row behaves without a TODO.

  • Miss: a condition whose entry spreads a shared action that carries an id, such as {...deleteAction, label: 'Delete'} with deleteAction.id === 'delete' against an inline {label: 'Delete', …}, gets id: 'delete' in both branches and no TODO, because keyedId reads only an id property and the planned id is written before the spread (migrate-item-swipe-actions-to-swipe.mjs:472-482, :682-685), so a row that closed when the condition flipped now stays open; treat an entry with a spread as one whose id the codemod cannot read, keep such a condition's props with the TODO unless the branches are already apart, and add entry spreads to the table test.

The non-literal id case and the TODO wording from the last review are fixed: ids a branch sets now stay as written, and the new table, red-first and Item flip tests pass. The spec:AST-057 record change has an engineering owner's approval for this head.

Claims and files checked

Review mode: full; reason: over-500-lines

  • Claims (changesets):
    • The codemod defines each swipe once with createSwipe, at module scope when every value outside a handler is fixed, else in useMemo in a capitalized or use… component or hook: verified (transform placement code; tests pass).
    • Ids come from the label, then the handler, else side and place with a TODO; a ListItem handler that compares the row key with === or !== takes itemKey from onActivate: verified (tests; type-level test).
    • Map-callback values, a ref's current, locals reassigned, written through or handed on, and unfixed render-time reads keep createSwipe on the row with a TODO; only onActivate runs when an action fires; an Item row's TODO says it passes no itemKey: verified (tests pass).
    • A value whose entries it cannot see and a JSX spread that may carry the props are reported and left unchanged: verified (tests).
    • A condition is left unchanged with a TODO where it cannot be sure the ids key as before, and an id a branch sets stays: false for an entry with a spread (the finding); verified otherwise (table test; a wider check with null, empty and differing ids).
    • The shared drag lists its stable committed options ref, which no package entry exports: verified.
  • Claims (description):
    • The old output called createSwipe inline with positional ids: verified (base transform).
    • The cited records and the define-once rules: verified against the current records.
    • A condition's swipes key alike exactly where the deprecated props did, else the props stay with a TODO: false for an entry with a spread (the finding).
    • On main's transform 48 of the 54 tests fail, as does the type-level test, and all pass now: verified (red-first run).
    • This round's four tests fail on the previous revision: verified (a fifth fails there only on the changed TODO wording).
    • The table test runs 3,268 conditions over every value an imported id may take, and each test re-runs the codemod on its output: verified.
    • The three Item flip tests keep the row open: verified; the older outputs closing it follows from the row's id key.
    • The type-level control fails with TS2345: verified; prettier on the changed files: verified.
    • The full codemods suite count, the CLI typecheck, eslint, the knowledge, changeset and repository checks, Codemod Verify, the sandbox touch run, the story comparison and the Core suite totals: not re-run.
    • The follow-ups change no behavior; the record rows match the trackpad and id rules; the test comment matches the 8 px claim: verified.
    • Only the codemod, its tests, its changeset, one record sentence and three Item tests changed since the earlier revision named: verified.
    • No public or internal API change, the size line, and no internal context: verified.
  • Files:
    • migrate-item-swipe-actions-to-swipe.mjs: the finding.
    • migrate-item-swipe-actions-to-swipe.test.mjs: no entry spread in the table test (the finding).
    • .changeset/swipe-codemod.md: its last claim fails for an entry with a spread (the finding).
    • migrate-item-swipe-actions-to-swipe.tsc.test.mjs, Item.test.tsx, swipe-actions-cases/cases.tsx, the spec:AST-057 record, .changeset/swipe-shared-drag-deps.md, useSwipeAction.ts, ItemSwipePinchZoom.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

An entry that spreads a shared action can carry an id the codemod does
not see, and the id it wrote went before the spread. So a condition
with such an entry could key its two swipes otherwise than the
deprecated props, and no TODO said so.

A condition now migrates only when every entry in both branches is a
plain object literal whose id is a string literal or absent: no
spread, computed key, method or accessor, and one id at most. Then
every id is known, so the codemod computes both keys before and after,
exactly as idsKeyOf does, and migrates only when they compare alike.
That check is the only gate. Any other condition keeps its props, with
a TODO. An id that is a name, which the last change shared, now keeps
its props too.

The table test adds entries with a name id, a spread and a computed
key. On the previous head it fails for 2,947 of its 5,920 conditions.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec ffc7019

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet, because the pull request is a draft. Mark it ready for review so CI runs; the merge guard waits for the required checks.

The entry-spread case from the last review is fixed: a condition with any id the codemod cannot read now keeps its props with a TODO, and the new spread, name-id and table tests cover it. One optional wording suggestion for the transform's header is inline.

Claims and files checked

Review mode: incremental; reason: none

  • Claims (changesets):
    • The codemod defines each swipe once with createSwipe, at module scope when every value outside a handler is fixed at import, else in useMemo in a component or hook named with a capital or use…, directly or through memo or forwardRef: verified (transform placement code; 55 transform tests pass).
    • Ids come from the label, then the handler, else side and place with a TODO; a ListItem handler that compares the row's key with === or !== takes itemKey from onActivate: verified (tests; type-level test).
    • Map-callback values, a ref's current, locals reassigned, written through or handed on, and unfixed render-time reads keep createSwipe on the row with a TODO; only onActivate runs when an action fires; an Item row's TODO says it passes no itemKey: verified (tests).
    • A value whose entries it cannot see and a JSX spread that may carry the props are reported and left unchanged: verified (tests).
    • A condition migrates only when every id is readable and both swipes key alike exactly where the deprecated props did, else it stays with a TODO: verified (the transform's condition check; table test; extra shapes such as an id before a spread, a method shorthand and id: null).
    • The shared drag lists its stable committed options ref, and the package entry does not export it: verified (useSwipeAction.ts; the Swipe entry exports no such hook).
  • Claims (description):
    • The old output called createSwipe inline with positional ids: verified (base transform).
    • The cited records and the define-once, id and condition rules: verified against the current records and the transform.
    • On main's transform 49 of the 55 tests fail, as does the type-level test, and all pass now: verified (red-first run).
    • This round's three tests (entry spread, name id, table) fail on the previous revision: verified; the earlier rounds' counts: not re-run.
    • The table test runs 5,920 conditions of the shapes described, and every test re-runs the codemod on its output and parses it: verified.
    • The type-level control fails with TS2345: verified.
    • The three Item flip tests keep the row open: verified; that the older outputs close it: not re-run.
    • The codemods suite passes 88 files and 1,115 tests: verified.
    • eslint and prettier on the changed files, the knowledge check and the changeset check: verified.
    • The CLI typecheck reports 0 errors: verified (after building Core and the themes).
    • Core's unit suites over Item, Swipe, List, hooks, gestures, motion, the snap-point drag and utils pass 4,910 tests in 231 files at this head: verified; the earlier revision's Core tsc, interaction and accessibility runs: not re-run.
    • The story comparison: verified (the deleteSwipe definition and its row match but for one blank line before onActivate, and the definition sits before the return).
    • The repository check, Codemod Verify and the sandbox touch run: not re-run (CI does not run on a draft, and the sandbox run needs a device browser).
    • The follow-ups change no behavior, the record rows match the trackpad and id rules, and the test comment matches the 8 px claim: verified.
    • No public or internal API change: verified (API surface comparison of Core and the seven themes; no CLI command change).
    • The size line and the absence of internal context: verified.
  • Files:
    • migrate-item-swipe-actions-to-swipe.mjs: clear (one optional header wording suggestion).
    • migrate-item-swipe-actions-to-swipe.test.mjs, migrate-item-swipe-actions-to-swipe.tsc.test.mjs, Item.test.tsx, ItemSwipePinchZoom.a11y.chromium.spec.ts, useSwipeAction.ts, swipe-actions-cases/cases.tsx, the spec:AST-057 record, .changeset/swipe-codemod.md, .changeset/swipe-shared-drag-deps.md: clear.

Automated review (maintainer link)

Comment on lines +21 to +23
* alike exactly where the deprecated props did. Where those keys match, the
* places with no id share one id. Otherwise the props stay, with a TODO, as
* with an entry that spreads, or one entry against none on a side. Rows with

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: "Otherwise the props stay" reads as if a condition whose keys differ keeps its props, but it migrates with each branch's own ids (the test at line 303 of the test file). Suggested: "Where the keys were equal, the places with no id share one id; where they differed, each branch takes its own. Where it cannot read an id or keep the keys so, as with an entry that spreads or one entry against none on a side, the props stay, with a TODO."

@vjeux
vjeux marked this pull request as ready for review November 18, 2026 01:19
@vjeux
vjeux marked this pull request as draft November 18, 2026 01:35

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one description fix, no code change.

  • Regression: after the merge of main, the Testing section's counts are no longer true at this head: the codemods run passes 88 files and 1,118 tests (not 1,115, since main added three tests to run-codemod.test.mjs), and the ui run over the eight Core folders passes 231 files and 4,931 tests (not 4,910), so please update both numbers or name the revision they come from.

The code is unchanged since the last review, and every test the pull request cites passes at this head. The optional header wording suggestion in the open inline thread still applies. CI has not run yet because the pull request is a draft.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (1): Whatever the scope, these are computed…: checked: the recipe change, this pull request's history and the whole-pull-request checks it names, no finding.
  • Claims (changesets):
    • The codemod defines each swipe once with createSwipe, at module scope when every value outside a handler is fixed at import, else in useMemo in a component or hook named with a capital or use…, directly or through memo or forwardRef: verified (transform placement code; 55 transform tests pass).
    • Ids come from the label, then the handler, else side and place with a TODO; a ListItem handler that compares the row's key with === or !== takes itemKey from onActivate: verified (tests; type-level test).
    • Map-callback values, a ref's current, locals reassigned, written through or handed on, and unfixed render-time reads keep createSwipe on the row with a TODO; only onActivate runs when an action fires; an Item row's TODO says it passes no itemKey: verified (tests).
    • A value whose entries it cannot see and a JSX spread that may carry the props are reported and left unchanged: verified (tests).
    • A condition migrates only when every id is readable and both swipes key alike exactly where the deprecated props did, else it stays with a TODO: verified (the condition check; table test).
    • The shared drag lists its stable committed options ref, and the package entry does not export it: verified (useSwipeAction.ts; the Swipe entry exports only createSwipe and types).
  • Claims (description):
    • The old output called createSwipe inline with positional ids: verified (base transform).
    • The cited records and the define-once, id and condition rules: verified against the current records and the transform.
    • On main's transform 49 of the 55 tests fail, as does the type-level test, and all pass now: verified (red-first run on the current base).
    • The earlier rounds' red-first counts: not re-run (earlier revisions).
    • The table test runs 5,920 conditions, and every test re-runs the codemod on its output and parses it: verified.
    • The type-level control fails with TS2345: verified.
    • The three Item flip tests keep the row open: verified; that the older outputs close it: not re-run.
    • The codemods suite passes 88 files and 1,115 tests: false at this head (88 files, 1,118 tests pass).
    • The CLI typecheck reports 0 errors: verified (after building Core and the themes).
    • eslint and prettier on the changed files, the knowledge check and the changeset check pass: verified.
    • The repository check passes: partly verified (its steps through the demo-media check pass; the executable-bits step needs a git checkout, which the review tree is not).
    • Codemod Verify against an earlier main: not re-run (CI does not run on a draft); no deprecated swipe prop remains in the sandbox or Storybook at this head, so the codemod has nothing to change there.
    • The earlier revision's Core typecheck, interaction and accessibility runs: not re-run.
    • Core's unit suites over the eight folders pass 4,910 tests in 231 files at this head: false at this head (231 files, 4,931 tests pass).
    • The sandbox touch run: not re-run (it needs a device browser).
    • The story comparison: verified (the transform is identical to the last reviewed one, and the merge leaves the story file unchanged).
    • The follow-ups change no behavior, the record rows match the trackpad and id rules, and the test comment matches the 8 px claim: verified.
    • No public or internal API change: verified (API surface comparison of Core and the seven themes; no CLI command change).
    • The size line and the absence of internal context: verified.
  • Files:
    • migrate-item-swipe-actions-to-swipe.mjs: clear (the optional header wording suggestion stays open inline).
    • migrate-item-swipe-actions-to-swipe.test.mjs, migrate-item-swipe-actions-to-swipe.tsc.test.mjs, Item.test.tsx, ItemSwipePinchZoom.a11y.chromium.spec.ts, useSwipeAction.ts, swipe-actions-cases/cases.tsx, the spec:AST-057 record, .changeset/swipe-codemod.md, .changeset/swipe-shared-drag-deps.md: clear.

Automated review (maintainer link)

@vjeux

vjeux commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in the description: both counts now name 8f48352a6d, where they ran again. The codemods run passes 88 files and 1,118 tests, and the ui run over the eight Core folders passes 4,931 tests in 231 files.

@astracat-bot

astracat-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

In reply to @vjeux

I'll run a full review to re-check this with your note.

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: the CI run on this head was turned away because CI was full, so build, test and typecheck have not run yet; re-run all jobs of that run once there is room (the ci:run label is already set).

No blocking findings: an engineering owner approved the record change for this exact revision, and the codemod's tests, its type-level check and the Item flip tests pass on it. The optional header-wording suggestion in the open inline thread still applies.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none since the last review.
  • Claims (changesets):
    • The codemod rewrites the deprecated swipe props on Item and ListItem to swipe={…} and defines each swipe once with createSwipe: verified (transform; 55 transform tests).
    • The definition goes to module scope when every value outside a handler is fixed at import, else into useMemo in a component or hook named with a capital or use…, directly or through memo or forwardRef: verified (placement code; module-scope, useMemo and wrapper tests).
    • Ids come from the label, then the handler, else side and place with a TODO; a ListItem handler that compares the row's key with === or !== takes itemKey from onActivate: verified (id test; type-level test).
    • Map-callback values, a ref's current, locals assigned later or written through or handed on, and unfixed render-time reads keep createSwipe on the row with a TODO; only onActivate runs when an action fires; an Item row's TODO says it passes no itemKey: verified (one test per shape).
    • A value whose entries it cannot see and a JSX spread that may carry the props are reported and left unchanged: verified (tests).
    • A condition migrates only when every id is readable and both swipes key alike exactly where the deprecated props did, else it stays with a TODO: verified (the condition gate; 5,920-condition table test).
    • The shared drag lists its stable committed options ref, and the package entry does not export it: verified (useSwipeAction.ts; the Swipe entry exports only createSwipe and types).
  • Claims (description):
    • The old output called createSwipe inline with positional ids: verified (base transform run).
    • The cited records and the placement, handler, id, condition and Item TODO rules: verified against the current records and the transform.
    • The component naming rule and the rejected alternatives: verified (transform; tests; type-level control).
    • On main's transform 49 of the 55 tests fail, as does the type-level test, and all pass now: verified (red-first run).
    • The earlier rounds' red-first counts: not re-run (earlier revisions).
    • The codemods suite passes 88 files and 1,118 tests: verified.
    • The type-level test passes and its control fails with TS2345: verified.
    • The table test runs 5,920 conditions with the stated entry kinds, and every test reruns the codemod on its output and parses it: verified.
    • The three Item flip tests keep the row open: verified; that the older outputs close it: not re-run.
    • The CLI typecheck reports 0 errors after a build: verified (with CI's build output for this revision).
    • eslint, prettier, the knowledge, changeset and repository checks pass: verified (knowledge and changeset checks run here; the lint job passed on this revision).
    • Codemod Verify passes: verified (passed on this revision).
    • The earlier revision's Core typecheck, interaction and accessibility runs, the sandbox touch run and the story comparison: not re-run.
    • Since that revision, only the codemod, its tests, its changeset, one record sentence and three Item tests changed: verified (commit history).
    • Core's unit suites over the eight folders pass 4,931 tests in 231 files: verified.
    • The follow-ups change no behavior, the record rows match the trackpad and required-id rules, and the test comment matches the 8 px claim: verified.
    • No public or internal API change: verified (CI's API report for this revision; no new module).
    • The size line, the writing-rubric edits and the absence of internal context: verified.
  • Files:
    • migrate-item-swipe-actions-to-swipe.mjs: optional header wording note (open inline thread).
    • migrate-item-swipe-actions-to-swipe.test.mjs, migrate-item-swipe-actions-to-swipe.tsc.test.mjs, Item.test.tsx, ItemSwipePinchZoom.a11y.chromium.spec.ts, useSwipeAction.ts, swipe-actions-cases/cases.tsx, the spec:AST-057 record, .changeset/swipe-codemod.md, .changeset/swipe-shared-drag-deps.md: clear.

Automated review (maintainer link)

@vjeux
vjeux marked this pull request as ready for review November 18, 2026 03:28
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 8f48352

@cixzhang
cixzhang merged commit ee8a33a into meta:main Nov 18, 2026
274 of 282 checks passed
@vjeux
vjeux deleted the uikit/swipe-codemod-define-once branch November 18, 2026 06:11

This branch was successfully deployed

1 active deployment
Preview — 8f48352a Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants