Skip to content

docs(public-component-api): interaction utilities have matching non-React equivalents; shipped APIs are grandfathered - #9973

Merged
cixzhang merged 6 commits into
mainfrom
docs/public-hooks-one-config
Nov 4, 2026
Merged

cixzhang merged 6 commits into
mainfrom
docs/public-hooks-one-config

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

People building with Astryx get non-React create… equivalents of interaction utilities that closely match their hooks. Slot hooks that only feed a component prop have no equivalent by default. Shipped APIs stay as they are until a real need arises. Records only.

Exact decision needed

None. The owner decided on 2026-11-04:

  • INV22 is "only about having non react equivalents of our utilities"; "its governance stops there". It makes no API judgement on any component's props, which "still need individual approval".
  • "Maybe we don't build create versions of component features" / "Like the ones that directly feed into a prop." A slot hook has no create… equivalent by default; the owner may add one.
  • "It's not worth making this breaking api change just for conformance reasons." Shipped APIs are grandfathered.
  • "The separate ref and options is ok." No signature-shape rule.

Existing authority searched

  • architecture:public-component-api INV2 (naming), INV21 (one API per job) and INV22 (non-React paths), with their verification rows and the INV22 known-gaps list.
  • Current source: public hooks name their element refs for the element's job (containerRef, scrollRef, menuRef, triggerRef, inputRef, and others).

Decision

  • INV22 (whole text): "Interaction utilities have non-React equivalents (create…) that closely match their hooks (the same option names and meanings, events and return concepts). A hook whose result only an Astryx component or StyleX can use (a slot hook, whose output feeds one Astryx component prop, or useAnimatedLayout, useEntryAnimation, useContainerReveal, useTouchTrigger, useTableRowExpansion, useTableColumnResize) has none by default; the owner may add one."
  • Removed from INV22:
    • signature rules and the "ref-taking signature beside it … deprecated" sentences;
    • the render-callback and handle references and the factory-strings line ("match closely" covers them); main's exempt-hooks list stays, folded into the no-equivalent case;
    • any example that names a component API.
  • INV21: a hook whose value a component takes through one slot prop is one API with that component, shown with a neutral illustration (const value = useX(…); <Component x={value} />) that names no unshipped API.
  • INV21a (new line): "A breaking or deprecating change to a shipped public API needs user value; conformance to a system rule alone does not justify it. New APIs follow the current rules; shipped APIs are grandfathered until a real need arises." It adds: "Each component API change still needs its own owner approval."
  • INV2: an element ref a hook takes is named for the element's job, or ref when it has none. This is naming only, not a shape rule.
  • Verification:
    • INV22's row fails an interaction utility hook with no create… equivalent (outside hooks whose result only an Astryx component or StyleX can use), or an equivalent whose options, events or return concepts differ.
    • A new INV21a row fails a breaking change justified only by conformance.

Rejected alternatives

  • A one-config-object signature rule for hooks and create… functions.
  • A ref-taking signature added beside a shipped hook for conformance alone.

Claim scope and non-goals

INV22 governs only the existence and close match of non-React equivalents. Component props and API shapes stay with each component's own approval.

Changed records

  • docs/architecture/public-component-api.md: INV2, INV21, new INV21a, INV22 (rewritten), their verification rows, and the INV22 known-gaps line.

Writing rubric results

  • R1 narration: none.
  • R2 research in the record: none.
  • R3 evidence naming a change: none.
  • R4 rejected alternatives over one line or outside a decision: none in the record.
  • R5 pull request or issue references remaining: none.
  • R6 ruled open questions still listing options: none.

Scope

  • Records only; no Changeset.
  • Public text contains no internal Meta context.

Validation

  • pnpm check:knowledge: "Knowledge templates and records are aligned."
  • Prettier: pass
  • git diff --check: clean

@vercel

vercel Bot commented Nov 4, 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 4, 2026 7:36pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 4, 2026, 7:52 PM UTC

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

cixzhang commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec f8e97ac

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 4, 2026
@cixzhang cixzhang changed the title docs(public-component-api): public interaction hooks take one config object; the element ref is a named field docs(public-component-api): interaction utilities have matching non-React equivalents; shipped APIs are grandfathered Nov 4, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 4, 2026
@cixzhang

cixzhang commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 08136ec

@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. An engineering owner approved the INV22 narrowing, the new INV21a and the INV2 ref-naming rule at this exact head; the new INV21 example still needs a fix.

  • docs/architecture/public-component-api.md lines 233–235 cite hasSnap={useSnapPaging()} as a slot hook, but no package defines useSnapPaging and Carousel ships hasSnap as a boolean, so the example contradicts INV3's rule that a has… boolean has no third state; drop it, or land this after #9666 (which adds the hook and the INV3 deviation) and rebase.
  • The description calls that pairing "the shipped hasSnap={useSnapPaging()}"; reword it as the pairing #9666 proposes, or remove it.

Any new commit needs a fresh /approve-spec naming the new head.

[Automated review]

Comment on lines +233 to +235
deprecation follows INV9. A hook whose value a component takes through one
slot prop is one API with that component, not a second one; for example,
`hasSnap={useSnapPaging()}` (owner decision, 2026-11-04).

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.

useSnapPaging does not exist in any package yet, and Carousel's hasSnap is a boolean (hasSnap?: boolean = false in the core API report). As written, this example shows a has… prop with a third state. INV3 above forbids that, and the known-deviation list does not exempt hasSnap. Drop the example and keep the rule sentence, or land this after #9666 and rebase so the hook and its INV3 deviation are on main.

Comment on lines +121 to +123
ref a hook takes is named for the element's job, as `containerRef`,
`viewportRef`, `trackRef`, and `inputRef` are, or `ref` when the element has
no narrower job.

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: viewportRef and trackRef are options of the internal usePager and appear in no API report. Public names such as scrollRef (useChatStreamScroll) or menuRef and triggerRef (useMenuPress) would ground the rule in shipped vocabulary.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 3d192ae

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 8 rows, core 2 rows; run pnpm api:report.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

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

cixzhang commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 3d192ae

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

Approved pending CI: the full CI run on this head, behind the required build, test and docsite-test checks, is still running.

The INV22 narrowing, the new INV21a, the INV21 slot-hook sentence and the INV2 ref-naming rule carry an engineering owner's approval at this head, and INV21's example is now a neutral illustration that names no unshipped API.

Two optional wording follow-ups:

  • INV21 still counts only a hook that delegates entirely to its factory as one API with it, while INV22 now accepts a closely matching equivalent; one clause saying a hook and its INV22 create… equivalent are one API would close the gap.
  • "Slot prop" and "slot hook" reuse INV18's word for rendered content slots, where plain data passed to a prop "is not a slot"; another word or a pointer to INV18 would keep one meaning.

[Automated review]

Comment on lines +230 to +232
factories. A hook that delegates entirely to a public factory, with no
behavior of its own, and a component built entirely on a public factory are
one API with that factory, not a second one (`spec:AST-107` FR6, FR8). A

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 clause makes only a hook that delegates entirely to its factory one API with it, while the new INV22 accepts an equivalent that closely matches without delegation. For a hook whose signature cannot delegate, its new create… can read as a second API for one job, and INV21a rules out deprecating the hook. One clause such as "a hook and its INV22 create… equivalent are one API" would close the gap.

behavior of its own, and a component built entirely on a public factory are
one API with that factory, not a second one (`spec:AST-107` FR6, FR8). A
deprecation follows INV9. A hook whose value a component takes through one
slot prop is one API with that component, not a second one, as in `const value

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: "slot prop" (and "slot hook" in INV22) reuses INV18's word for rendered content slots, while INV18 says plain data passed to a prop "is not a slot". Another word, or a pointer to INV18, would keep one meaning.

@cixzhang
cixzhang merged commit a1a6151 into main Nov 4, 2026
94 of 97 checks passed
@github-actions
github-actions Bot deleted the docs/public-hooks-one-config branch November 5, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 3d192ae9 Deployed Nov 4, 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