Skip to content

fix(core,cli): four defects from the Next.js 16 adoption report - #4409

Draft
AKnassa wants to merge 4 commits into
facebook:mainfrom
AKnassa:ak-4276-adoption-fixes
Draft

fix(core,cli): four defects from the Next.js 16 adoption report#4409
AKnassa wants to merge 4 commits into
facebook:mainfrom
AKnassa:ak-4276-adoption-fixes

Conversation

@AKnassa

@AKnassa AKnassa commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Four independent defects from the adoption report, as four separate commits so they can be split or dropped individually.

1. astryx docs --list crashed

It was documented usage, but the command was registered with no options at all, so commander rejected the flag and exited 1 — even though a list branch already existed and the bare docs invocation reached it. Now wired up, and --list wins over a positional topic.

2. theme build --out help text was misleading

It said "Output CSS file path", but all four emitted artifacts follow that path's dirname. Reworded to the phrasing the reporter asked for.

3. The documented install line omitted a required peer

@astryxdesign/core declares @stylexjs/stylex as a required peer with no peerDependenciesMeta, but every documented install line left it out — so following the quick start under pnpm gives you a broken install. Added to each package-manager variant, with a drift guard that stands itself down if StyleX ever moves to dependencies, so it doesn't prejudge the separate open question there.

And a real bug found underneath it. The brief for this said "doctor has no stylex check". That's literally true of a grep, but wrong about behaviour: checkPeerDeps already flags it generically. What it couldn't do is say what to install — missing.map(m => m.split('@')[0]) splits a scoped name on its leading @, so the first segment is empty and the remediation rendered as npm install with no package name, for every scoped peer. Fixed at the source rather than adding a second, redundant check.

Deliberately not done: escalating that check from warn to fail. Missing StyleX is a hard runtime failure under pnpm so there's an argument for it, but it changes astryx doctor's CI exit code and nobody decided that.

4. Banner silently dropped ARIA role on an augmented status

BannerStatus is extensible by module augmentation, but the lookup tables were fixed records over the four built-ins.

This is worse than the report describes. The role going undefined is real — but the icon map has the identical defect, and <Icon icon={undefined}> throws, so an augmented-status Banner didn't render at all. The role bug was unreachable behind the crash. Both maps now fall back, so an augmented status announces as role="status" with the neutral icon.

Trade-off: the four built-ins lose compile-time exhaustiveness. Each keeps a role test to cover that.

What's deliberately left out

The report has ten findings plus seven follow-ups. Three are already dead — finding 4 was never broken (it uses console.error, with a test), and 8 and 9 were fixed by merged #4279 and #4280 within a day of filing. The rest (the build timestamp, accent inversion in dark mode, a --color-focus-ring token, a success Button variant, and every follow-up item) each need a maintainer decision, and several already have one leaning against.

How to check it

pnpm vitest run on the touched areas: docs 9, build-theme 19, install-line guard 5, doctor 27, Banner 36 + 48 consumers — all green. Full repo suite run alone: 382 files / 7755 tests, exit 0.

The zh Banner description is my own translation and hasn't been reviewed.

Refs #4276

AKnassa added 4 commits July 26, 2026 03:08
`astryx docs --list` was documented usage but commander rejected it with
`unknown option '--list'`, exiting 1: the `docs [topic] [section]` command was
registered with no `.option()` calls at all, even though a `docs.list` branch
already existed and the bare `docs` invocation reached it. Wire the flag to
that branch, so `--list` also wins over a positional topic.

Refs facebook#4276
`--out` was described as "Output CSS file path", but every emitted artifact —
the `.js`, the `.d.ts` and the `.variants.d.ts` — is written to that path's
dirname, so the flag is closer to an output directory named by the CSS file.
Use the wording the reporter asked for.

Refs facebook#4276
`@astryxdesign/core` declares `@stylexjs/stylex` as a required peer with no
`peerDependenciesMeta`, but every documented install line omitted it, so
following the quick start under pnpm left a broken install. Name it on each
package-manager variant, and add a drift guard that stands itself down if
StyleX ever moves to `dependencies` — that question is separately contested
and is deliberately untouched here.

`astryx doctor` already flagged the missing peer generically, but could not
say what to install: `missing.map(m => m.split('@')[0])` splits a scoped name
on its leading `@`, so the remediation rendered as `npm install ` with no
package name at all, for every scoped peer. Fixed at the source rather than
adding a second, redundant stylex-specific check.

Refs facebook#4276
`BannerStatus` is extensible through `BannerStatusMap` module augmentation,
but both lookup tables were fixed `Record`s over the four built-in statuses.
A consumer-added status therefore missed on both: the `role` went `undefined`,
dropping the banner's live-region semantics entirely, and — worse — the icon
went `undefined` too, so `<Icon icon={undefined}>` threw and the banner did
not render at all. The role bug was unreachable behind the crash.

Both maps become `Partial` with named fallbacks at the read site, so an
augmented status announces as `role="status"` with the neutral icon. The
trade-off is that the four built-ins lose compile-time exhaustiveness; each
one keeps a role test to cover that.

Refs facebook#4276
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 26, 2026 5:09pm

Request Review

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Jul 26, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Modified Components

Banner
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 346 -
Complexity N/A High (26) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

Banner - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | View full report

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. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant