Repository navigation
spec(public-component-api): each private data attribute has one owner module (INV23) - #9182
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 6be9e0f |
There was a problem hiding this comment.
Changes requested: the direction of INV23 is approved, but the record contradicts two current component records and overstates how today's code conforms.
component:AspectRatio(FR3) andcomponent:ChatComposerTokenElement(FR1) promisedata-astryx-aspect-ratio-override,data-astryx-tokenanddata-astryx-token-value. Name those attributes public in INV23, or amend those records in this pull request.- Line 235 says both public attributes are built with
dataAttr(), butreset.css,generateThemeRules.tsand the CLI theme build write them otherwise. Reword the line, or list those sites in the INV23 gap. @astryxdesign/richtextwritesdata-astryx-richtext-code-syntaxbut cannot import Core's./internal/*, andapplies_tolists no Lab path although INV23 binds Lab files.
Please also say whether tests may name a private attribute. The new head then needs a fresh /approve-spec.
[Automated review]
| whose current signature cannot delegate gains a ref-taking signature beside | ||
| it; the old signature is deprecated under INV9. | ||
| - **INV23 — Each private data attribute has one owner module.** A | ||
| `data-astryx-*` attribute is private unless this invariant names it public. |
There was a problem hiding this comment.
This makes every unnamed attribute private, including two that current component records promise: component:AspectRatio keeps data-astryx-aspect-ratio-override "for product CSS that targets it" (FR3), and component:ChatComposerTokenElement FR1 says the root MUST expose data-astryx-token, with data-astryx-token-value marked stable. Name these three attributes public here, or amend those records in this pull request.
| compatibility promise, and may change in any release. The public data | ||
| attributes are `data-astryx-theme`, the theme scope (`spec:AST-066` FR6), and | ||
| `data-astryx-media`, the media-surface scope that theme compilation emits; | ||
| each is built with `dataAttr()` from `naming.ts` and changes only under INV9. |
There was a problem hiding this comment.
Today neither public attribute is consistently built with dataAttr(). packages/core/src/reset.css:396 and :400 hand-type [data-astryx-media=…] (a CSS file cannot call it), generateThemeRules.ts:56-64 builds both names from dataAttrNamespace, and the CLI theme build hand-types [data-astryx-theme…]. The verification row exempts the public list, so nothing flags these sites. Reword this line to "named through naming.ts where code builds it", or list the sites in the INV23 gap.
| The owner exports only ready-made styles that read the attribute and the | ||
| props or writer that set it, never the raw name or a selector. Every other | ||
| Core and Lab file spreads those exports and never writes the attribute or its | ||
| selector; Lab imports them through Core's `./internal/*` subpath (INV12). |
There was a problem hiding this comment.
Only Core and Lab can reach ./internal/* (INV12), but @astryxdesign/richtext also writes a private attribute (data-astryx-richtext-code-syntax, CodeSyntaxPlugin.tsx:52). With the only owner in Core, it has no conforming path. Separately, INV23 binds Lab files, but applies_to lists no Lab path, so pnpm specs:for never shows this invariant for a Lab file.
| `data-astryx-press`, `data-astryx-popover-fallback-close` (in Core and Lab), | ||
| `data-astryx-table-pinned` and `data-astryx-cell-gliding` (each named in two | ||
| files), `data-astryx-scrolling` (read but never written), the Chat | ||
| composer's `data-astryx-token`, `data-astryx-token-value`, and |
There was a problem hiding this comment.
data-astryx-token and data-astryx-token-value are the exposed, stable serialization contract in component:ChatComposerTokenElement (FR1 and its interface table), and its .doc.mjs names the span. Listing them as private contradicts that current record.
PR Analysis Report
📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Published Package SizeNo published package changed size (11 measured). Download is the gzip tarball npm fetches; unpacked is what lands in Accessibility AuditStatus: Accessibility did not run on this pull request; add Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
…tributes, per-package owners, and test exemption
|
/approve-spec 225974f |
There was a problem hiding this comment.
Changes requested. INV23's direction is approved at this head, but it still contradicts current records that this pull request leaves unchanged.
module:DropdownMenu/useMenuPressmarksdata-astryx-menu-pressasstable,component:SegmentedControlItemFR7 passesdata-astryx-pressablethrough, and DropdownMenu, ContextMenu and Selector require the menu marker, yet INV23 makes both attributes private and expects them to be deprecated. Name them (and the exporteddata-astryx-edge-comp) in INV23's public list, or amend those records here.- The sentence after INV23 still says the record applies to stable public packages, although
applies_tonow lists Lab and the gap requires Lab's Schedule to conform.
The red build-storybook check runs a script that landed on main after this branch was cut, so updating the branch should fix it. The amended head then needs a fresh /approve-spec.
[Automated review]
| any release. The public data attributes are `data-astryx-theme`, the theme | ||
| scope (`spec:AST-066` FR6); `data-astryx-media`, the media-surface scope that | ||
| theme compilation emits; `data-astryx-aspect-ratio-override` | ||
| (`component:AspectRatio` FR3); and `data-astryx-token` and | ||
| `data-astryx-token-value` (`component:ChatComposerTokenElement` FR1). They |
There was a problem hiding this comment.
Current records also promise two attributes this list leaves private. module:DropdownMenu/useMenuPress marks data-astryx-menu-press as stable (line 149), and DropdownMenu FR5, ContextMenu FR5 and Selector FR7 require it. component:SegmentedControlItem FR7 passes a caller's data-astryx-pressable through. Name both here with their records, as this list already does for AspectRatio and ChatComposerTokenElement, and add the exported data-astryx-edge-comp. If they are meant to retire instead, amend those records in this pull request.
| theme build, AspectRatio, and the Chat composer, and the lint rule allows | ||
| their names. | ||
|
|
||
| This record applies to stable public packages. Lab components are not stable |
There was a problem hiding this comment.
applies_to now lists packages/lab/src/, and the INV23 gap requires Lab's Schedule to conform, but this sentence still limits the record to stable public packages. Say that INV23 also governs private attributes in Lab.
…markers as public; scope sentence matches applies_to
|
/approve-spec a9253c7 |
There was a problem hiding this comment.
Changes requested: INV23's direction is approved at this head, but the record still conflicts with a current spec and leaves part of its own rule unworkable.
- The new scope sentence limits the record to Core, which takes the published RichText package out of INV1–INV22 while line 68 and
spec:AST-071still rely on the old scope; keep "stable public packages" and add INV23's Lab reach, or amend those records here. - INV23 lets an owner export only styles and props or writers, so code that reads a private attribute at runtime (for example
Popover.tsx:648orDropdownMenuSubMenu.tsx:429) cannot conform by moving into an owner module, as the gap bullet expects; let owners also export the readers their package needs. - The gap bullet's "each named in two files" also covers
data-astryx-press, whose selector is copied in 14 Core files.
The amended head then needs a fresh /approve-spec.
[Automated review]
|
|
||
| This record applies to stable public packages. Lab components are not stable | ||
| public promises until promotion. | ||
| This record applies to the published Core package, and INV23 also applies to |
There was a problem hiding this comment.
This replaces "applies to stable public packages" with Core only, so the published @astryxdesign/richtext (not canaryOnly) leaves INV1–INV22. Line 68 still says the record covers "stable Astryx components", and spec:AST-071 covers packages/richtext/src/** and leaves composition order to INV6. Suggest: "This record applies to stable public packages, and INV23 also applies to Lab source."
| written. The owner exports only ready-made styles that read the attribute and | ||
| the props or writer that set it, never the raw name or a selector. Every other | ||
| file in that package spreads those exports and never writes the attribute or | ||
| its selector, and no package imports another package's owner module through an |
There was a problem hiding this comment.
Several private attributes are read at runtime, not only styled: Popover/Popover.tsx:648 and Popover/usePopover.tsx:58 call closest() on [data-astryx-popover-fallback-close], DropdownMenu/DropdownMenuSubMenu.tsx:429 reads data-astryx-submenu-regions, and Table/glidingDivider.ts:283 reads data-astryx-table-pinned. With exports limited to styles and props or writers, those readers cannot conform by moving into an owner module, as the gap bullet says they will. Let the owner also export the readers its package needs, still never the raw name or a selector.
| `data-astryx-press`, `data-astryx-popover-fallback-close`, | ||
| `data-astryx-table-pinned` and `data-astryx-cell-gliding` (each named in two | ||
| files), `data-astryx-scrolling` (read but never written), the Chat composer's |
There was a problem hiding this comment.
"(each named in two files)" reads as covering data-astryx-press too, but its selector is copied in 14 Core source files. List it separately with its own count.
…scope stays stable packages plus Lab
|
/approve-spec 795cf8a |
There was a problem hiding this comment.
Recommending approval: INV23's direction is approved at this head, and every data-astryx-* attribute that a current record promises or the package exports is on its public list. One optional follow-up: ClickableCard.doc.mjs, SelectableCard.doc.mjs and Thumbnail.doc.mjs already name the private data-astryx-press in their --_press-overlay descriptions, so listing them in the INV23 gap bullet would help the press-owner follow-up find them.
[Automated review]
| named in two files; `data-astryx-scrolling`, read but never written; | ||
| DropdownMenu's `data-astryx-submenu-host`; the Chat composer's | ||
| `data-astryx-dictation-interim`; and RichText's | ||
| `data-astryx-richtext-code-syntax`. No full inventory exists yet. Each |
There was a problem hiding this comment.
Optional: three .doc.mjs entries already name the private data-astryx-press (ClickableCard.doc.mjs:41, SelectableCard.doc.mjs:43, Thumbnail.doc.mjs:82, in their --_press-overlay descriptions), which INV23's "appears in no … .doc.mjs" rules out. Listing them here would let the press-owner follow-up find them.
Maintainers get one place to name, change, and find each internal
data-astryx-*attribute, so its selectors can't drift across hand-typed copies. People building with Astryx have nothing new to learn and can't mistake an internal attribute for a contract.Exact decision needed
How Core and Lab own the
data-astryx-*attributes they use internally, and which of these attributes are public.Existing authority searched
architecture:public-component-api: INV12 (reachability makes something public;./internal/*is the one exception) and INV9 (released APIs change deliberately). Neither says how an internal DOM attribute is named, owned, or kept out of the public surface.architecture:react-component-runtimeINV16 (a shared concern lives in one owner). It covers lifecycle and effects, not names.spec:AST-066FR6 usesdata-astryx-themeas the theme scope. No record declares any otherdata-astryx-*attribute or a rule for private ones.data-astryx-*names acrosspackages/core/srcandpackages/lab/src, plus one inpackages/richtext/src, written by hand at their sites. The press selector is copied in 14 files, one selector is read but never written, two names are each declared in two files, and the attributes current records promise were never listed together. No lint rule covers them, andnaming.ts'sdataAttr()is used by only four names.Decision
architecture:public-component-apigains INV23, a verification row, and a known-gaps bullet:packages/<package>/src/privateAttributes/<name>.stylex.ts. It holds the name and values and writes each selector once, as a literal in its ownstylex.createcall.closest/matcheshelper or a getter), never the raw name or a selector. Callers in that package spread those exports and never write the attribute or its selector. No package imports another package's owner module through an internal path.data-astryx-string, template, or JSX attribute name, or adataAttr()call that names a private attribute, fails@astryx/no-raw-private-attribute. Today's sites sit in the rule's baseline, which only shrinks, so main stays green. Tests may name private attributes because they assert the DOM..doc.mjs, and Changesets, carry no compatibility promise, and may change in any release.data-astryx-themeanddata-astryx-media(theme and media-surface scopes),data-astryx-aspect-ratio-override(AspectRatio FR3),data-astryx-tokenanddata-astryx-token-value(ChatComposerTokenElement FR1),data-astryx-menu-press(the useMenuPress module),data-astryx-pressable(SegmentedControlItem FR7), anddata-astryx-edge-comp(exported asEDGE_COMP_ATTR). Their owning code writes them at its own sites, and the lint allows their names.applies_toaddspackages/lab/src/andpackages/richtext/src/.Representative caller, before and after:
Rejected alternatives
stylex.defineConstsvalue for callers to use as a key. Compiled with StyleX 0.19 and Core's options, it emits a nested rule that matches a pressed ancestor rather than the element. Insidestylex.when.ancestorandwhen.descendant, it fails withPseudo selector must start with ":" or "[".Claim scope and non-goals
Evidence and implementation relationship
when.ancestorwith a marker imported from another.stylex.ts, compile to correct CSS. Callers that spread the exported styles contain no selector.transformconditions are replaced by an owner style that also setstransform.Writing rubric results
defineConstsalternative is described only here.Scope
Validation
pnpm check:knowledge: Knowledge templates and records are aligned.git diff --check: clean.