Skip to content

docs(api): a create* callback receives what it acts on - #11176

Draft
cixzhang wants to merge 3 commits into
mainfrom
spec/create-config-callbacks
Draft

cixzhang wants to merge 3 commits into
mainfrom
spec/create-config-callbacks

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Builders can create a behavior definition once at module scope or memoize it, because its callbacks receive the item they act on. createSwipe's onActivate already receives the entry's id and the row's itemKey, and createReorderable's callbacks receive their keys; future create* factories follow the same rule. People using the app get fewer re-renders and no stale-closure bugs, where an action fires against an old item.

Expected behavior and authority

  • architecture:public-component-api INV28: a callback in a create* config receives what it acts on as arguments (the instance key, the typed id, the event), never through a closure over render state. It applies to new APIs; released APIs that already pass their input (the Markdown plugin factories, createStaticSource, the gesture controllers) satisfy it.
  • DEC-7: decided by cixzhang on 2026-11-11, extending her swipe decision ("per action and allow it to be memoized") to every create* config. Rejected: a rule for swipe actions only.
  • A verification row for INV28 and DEC-7, with its failure signal: a new create* config whose callback gets the instance key, typed id or event from a closure over render state instead of an argument.
  • INV28 is in the record's global public-api review triggers, so public-API review loads it.
  • spec:AST-057 already matches the createSwipe that ships on main: SwipeAction.id is required, onActivate receives {id, itemKey}, and DEP-0017's mapping names both. This pull request no longer edits that record.
  • INV28 lists createSwipe among the released APIs that satisfy it.

Numbering: INV26 and INV27 and DEC-3 to DEC-5 are held by other open records pull requests on this file, so this uses INV28 and DEC-7.

Writing rubric results

R1 narration: none; the invariant and decision are present tense.
R2 research: none in the record.
R3 evidence: none cited beyond the owner's decision.
R4 rejected alternatives: one, inside DEC-7, one line.
R5 change references: none.
R6 open questions: none added.
R7 project status: none.

Records the owner decision that callbacks in a create* config take their
instance key, typed id, or event as arguments, so a definition can be made
once at module scope or memoized.
@vercel

vercel Bot commented Nov 11, 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 19, 2026 5:06pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 11, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2f93bfd

@astracat-bot

astracat-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 5:27 PM UTC

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 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.

Changes requested. INV28 and DEC-7 carry an engineering owner's approval for this head, so the rule itself is settled; three fixes remain in this pull request.

  • spec:AST-057 still types SwipeAction.onActivate as () => void | Promise<void> and its FR11 relies on handlers that read the caller's latest state, which INV28 forbids for the unbuilt createSwipe; amend AST-057 here so onActivate receives the row it acts on (its SwipeAction row, FR1, FR11 and the DEP-0017 type mapping), or say in INV28 how createSwipe relates to it.
  • The INV28, DEC-7 verification row in docs/architecture/public-component-api.md (line 496) has no Failure signal cell; add the condition that fails INV28, as the architecture record template requires.
  • The description says builders can create createSwipe definitions once because every callback receives its item, but at this head createSwipe's contract still passes nothing (and createReorderable already passed its key); deliver the swipe half with the AST-057 amendment or narrow the sentence.

Also worth doing: add INV28 to the record's review-applicability public-api list so global public-API review loads it.

Automated review (maintainer link)

…r row; INV28 has a failure signal

- AST-057: SwipeAction.id is required and onActivate receives {id,
  itemKey}, as createSwipe ships; FR11 and the DEP-0017 mapping say so.
- INV28 lists createSwipe among the released APIs that satisfy it, is in
  the global public-api review triggers, and its verification row names
  the failure signal.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 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.

Approval waits on an engineering owner's spec decision, and two fixes are needed in this pull request first.

  • The spec:AST-057 edits (the Public API rows, FR1, FR11 and the DEP-0017 replacement row) were made against an older copy of the record. main already amends those lines for the shipped createSwipe (ItemSwipeActionVariant, ItemSwipeBehavior, literal-typed ids, and a ListItem that adds its itemKey), so this branch conflicts with main there and describes types that do not ship: please rebase and keep main's text in those four places.
  • The description says AST-057 "matches the createSwipe that ships", which is not true yet: the record here names SwipeActionVariant and SwipeBehavior and still calls createSwipe unbuilt, and the rebase above makes the claim true.

INV28 as now worded, DEC-7 and the INV28 verification row are new requirements, and the earlier /approve-spec covers only the previous commit. An engineering owner records the decision by commenting /approve-spec <full head SHA> on the commit that lands, and the author may do so as an engineering owner. Two optional wording points: INV28 calls createSwipe released before any release contains it, and DEC-7 could point to AST-057 DEC-10, where the owner's quote is recorded.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: createSwipe's onActivate already receives the action's id and the row's item key. Verified on main in the Swipe module's types.
  • Claim: createReorderable's callbacks receive their keys. Verified.
  • Claim: INV28 states the rule for new APIs and lists released factories that satisfy it. Verified; createSwipe is not yet in a release (wording note).
  • Claim: DEC-7 records the owner's decision and rejects a swipe-only rule. Verified.
  • Claim: the INV28 verification row names its failure signal. Verified.
  • Claim: INV28 is in the record's public-API review triggers. Verified.
  • Claim: AST-057 matches the shipped createSwipe, and DEP-0017's mapping names the two differences. False at this commit (finding above).
  • Claim: AST-057's action row, FR1 and DEC-1 require an id and pass the id and item key, and FR11 adds the module-scope case. Present, but written against an older record (finding above).
  • Claim: INV26, INV27, DEC-4 and DEC-5 are taken by other open pull requests, so this uses INV28 and DEC-7. Verified; both numbers are free on main.
  • Claim: fewer re-renders and no stale-closure bugs. A prediction a records change cannot show.
  • Claim: the writing rubric results. Consistent with the added text.
  • File docs/architecture/public-component-api.md: owner approval pending; otherwise clear.
  • File docs/specs/AST-057-row-actions/spec.md: blocking finding above.

Automated review (maintainer link)

Comment thread docs/specs/AST-057-row-actions/spec.md Resolved
Comment thread docs/specs/AST-057-row-actions/spec.md Resolved
Comment thread docs/specs/AST-057-row-actions/spec.md Resolved
Comment on lines +334 to +336
APIs; released APIs that already pass their input (the Markdown plugin
factories, `createStaticSource`, the gesture controllers, `createSwipe`, whose
`onActivate` receives the entry's `id` and the row's `itemKey`) satisfy it

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.

Non-blocking: createSwipe is on main but not yet in a published release, so "released APIs" is not quite true for it. Wording that does not depend on release state reads truer, for example "APIs that already pass their input (…) satisfy it".

spec:AST-057 on main already gives SwipeAction a required id and has
onActivate receive {id, itemKey}, with the DEP-0017 mapping, so this
branch takes main's record; the public-component-api edits stay.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec cf4f364

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 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.

Changes requested: one claim in the description needs fixing; the rule itself is settled.

  • The description says spec:AST-057 DEC-1's shape requires an id and passes {id, itemKey} to onActivate, but merging main replaced that record whole, so DEC-1 still reads {id?, label, icon?, onActivate, …}: please restore the earlier commit's DEC-1 line (the new commit then needs its own /approve-spec), or drop "and DEC-1's shape" from the description.

INV28, DEC-7 and the verification row have an engineering owner's approval for this commit, and the earlier spec:AST-057 conflicts with main are gone. Optional: INV28 calls createSwipe released before any release contains it, INV16's bare "DEC-7" now also reads as this record's new DEC-7, and DEC-7 could point to spec:AST-057 DEC-10, where the owner's words are recorded.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: createSwipe's onActivate already receives the action's id and the row's item key. Verified in the Swipe module's types.
  • Claim: createReorderable's callbacks receive their keys. Verified.
  • Claim: future create* factories follow the same rule. Stated by INV28.
  • Claim: fewer re-renders and no stale-closure bugs. A prediction a records change cannot show.
  • Claim: INV28 states the rule for new APIs and lists APIs that already satisfy it. Verified; createSwipe is not in a release yet (wording note).
  • Claim: DEC-7 records the owner's decision and rejects a swipe-only rule. Verified.
  • Claim: the INV28 verification row names its failure signal. Verified.
  • Claim: INV28 is in the record's public-API review triggers. Verified.
  • Claim: AST-057 requires an action id and passes the id and item key in its action row and FR1. Verified.
  • Claim: AST-057's DEC-1 shape says the same. False (finding above).
  • Claim: AST-057 FR11 covers a module-scope definition. Verified.
  • Claim: AST-057's deprecation mapping names the two differences. Verified.
  • Claim: INV28 lists createSwipe among the APIs that satisfy it. Verified.
  • Claim: INV28 and DEC-7 are free numbers in this record. Verified on main.
  • Claim: the writing rubric results. Consistent with the added text.
  • File docs/architecture/public-component-api.md: owner-approved; two optional wording notes.

Automated review (maintainer link)

APIs; released APIs that already pass their input (the Markdown plugin
factories, `createStaticSource`, the gesture controllers, `createSwipe`, whose
`onActivate` receives the entry's `id` and the row's `itemKey`) satisfy it
(DEC-7).

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.

Non-blocking: this record now has its own DEC-7, and INV16 above cites (spec:AST-111 FR15, DEC-7) with a bare DEC-7 that means AST-111's. Writing that one as spec:AST-111/DEC-7 keeps the two apart.

@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 a draft pull request runs none; marking it ready for review starts it.

INV28, DEC-7 and the verification row have an engineering owner's approval for this commit, and what the description now says about spec:AST-057 matches that record. Optional wording notes: INV28 calls createSwipe released before any release contains it, INV16's bare "DEC-7" now also reads as this record's new DEC-7, and DEC-7 could point to spec:AST-057 DEC-10, where the owner's words are recorded. Any such edit makes a new commit that needs its own /approve-spec.

Claims and files checked

Review mode: same-head; reason: none

  • Claim: createSwipe's onActivate already receives the action's id and the row's item key. Verified in the Swipe module's types.
  • Claim: createReorderable's callbacks receive their keys. Verified.
  • Claim: future create* factories follow the same rule. Stated by INV28.
  • Claim: fewer re-renders and no stale-closure bugs. A prediction a records change cannot show.
  • Claim: INV28 states the rule for new APIs and lists released APIs that already satisfy it. Verified; createSwipe is not in a release yet (wording note).
  • Claim: DEC-7 records the owner's decision and rejects a swipe-only rule. Verified; the quoted words are in spec:AST-057 DEC-10.
  • Claim: the INV28 verification row names its failure signal. Verified.
  • Claim: INV28 is in the record's public-API review triggers. Verified.
  • Claim: spec:AST-057 already requires an action id, passes the id and item key to onActivate, and its deprecation mapping names both. Verified in its action row, FR1 and the deprecation mapping.
  • Claim: this pull request no longer edits spec:AST-057. Verified.
  • Claim: INV28 lists createSwipe among the APIs that satisfy it. Verified.
  • Claim: INV28 and DEC-7 are free numbers in this record. Verified on main.
  • Claim: the writing rubric results. Consistent with the added text.
  • File docs/architecture/public-component-api.md: owner-approved; three optional wording notes.

Automated review (maintainer link)

This branch was successfully deployed

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

Labels

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.

1 participant