Skip to content

ci(native): typecheck the native package and every platform type it emits - #8024

Merged
cixzhang merged 1 commit into
mainfrom
ci/native-typecheck
Oct 24, 2026
Merged

cixzhang merged 1 commit into
mainfrom
ci/native-typecheck

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Maintainer impact

No CI job runs tsc over @astryxdesign/native. The package is outside the root pnpm build, and Vitest strips types without checking them, so a type error in its source or tests merges green. Its build also emits one declaration file per type-resolution condition (ios, android, macos, windows, shared), and nothing compiles those: the Vitest contract test loads only the ios, android, and shared entries, and the root config's skipLibCheck would skip them anyway. A generator change can therefore ship platform types a consumer cannot compile, and the macos and windows types are never loaded at all.

Intended invariant

AST-082: one contract generates the TypeScript types for every platform condition. Every emitted platform type compiles under strict, and the package's own source and tests typecheck, on every pull request and merge-queue run that reaches the typecheck job.

Change

  • Three steps at the end of the existing typecheck job (no new job, same specialized-lane skips): pnpm -F @astryxdesign/native typecheck, then build, then a new typecheck:types script.
  • packages/native/tsconfig.types.json compiles dist/types/*.d.ts with skipLibCheck: false.
  • ci-native-typecheck.test.mjs pins the three steps, their order after pnpm build, and the declaration-only config.
  • The native README lists the two typecheck commands.

The three steps add about 10 seconds to the job (7 s, 2 s, and under 1 s locally).

Evidence

  • Failure before the change: no workflow runs tsc over packages/native (search .github/workflows for @astryxdesign/native). After injecting export type Broken = Missing; into the emitted dist/types/macos.d.ts, typecheck:types fails with TS2304: Cannot find name 'Missing'. Every existing check stays green with that error.
  • Success after the change: this PR's own typecheck run.
  • Product/runtime behavior verified unchanged: only CI, a test, a package script, a tsconfig, and a README line change. No published file changes (tsconfig.types.json is not in files).

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm -F @astryxdesign/native typecheck, build, and typecheck:types pass locally.
  • pnpm vitest run --project node .github/scripts/ci-native-typecheck.test.mjs .github/scripts/ci-tooling-routing.test.mjs .github/scripts/ci-test-routing.test.mjs .github/scripts/release-check-workflow.test.mjs .github/scripts/ci-native-swift.test.mjs packages/native: 10 files, 144 tests pass.
  • Native Vitest tests, including the generated-Swift drift test, already run in test-node. This PR does not change that.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026
@vercel

vercel Bot commented Oct 24, 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 Oct 24, 2026 12:55am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 24, 2026, 1:18 AM UTC

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

46 of 494 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 26 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@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.

This looks ready to merge. The three steps join the existing typecheck job without a new lane or required check, this head's CI ran all three green, and a generator fault confined to macos.d.ts passes every existing check but fails the new typecheck:types step, so the gate closes a real gap. One optional follow-up: .github/workflows/deploy.yml describes its typecheck job as mirroring this one, so adding the same three steps there would keep the main push gate in step.

[Automated review]

@cixzhang
cixzhang merged commit 563dc53 into main Oct 24, 2026
69 checks passed
@github-actions
github-actions Bot deleted the ci/native-typecheck branch October 24, 2026 06:20
cixzhang pushed a commit that referenced this pull request Oct 25, 2026
… it (#7308)

## User impact

On a phone, a `ContextMenu` a long press opens closes at once: as the finger lifts, Chromium sends the held element a compatibility `mousedown`, read as a press outside.

## Problem and solution fit

- Why it occurs: the menu closes on any document `mousedown` outside it, and a touch's compatibility events target the held trigger.
- Why it harms: no touch path.
- Why it matters: iOS opens one only by a long press.

## Expected behavior and authority

`spec:AST-094` (current) FR33: with a finger or pen, "the long press that opens a ContextMenu MUST NOT close it at the lift". `component:ContextMenu` FR5 routes the long-press lift there, and `architecture:interaction-modality` (current) INV4 asks for an operable path per modality. This PR implements that clause only; FR33's outside press (FR32), lift and handoff stay with their own work, and it changes no record row. #7303 proposes FR10 (focus on open); #7840, FR12. Overlap search over open PRs and records (`component:ContextMenu`, `layer-runtime.md`; "outside press", "long press", "compatibility"): #7303 and #7840 touch the same listener.

## Smallest restoration

`main`'s outside `mousedown` listener stays, shadow-root handling included. It skips the compatibility mouse events of the finger press that opened the menu: the long press, or a touch `contextmenu` where Chromium sends one, recorded by the shared gesture counter (`Layer/gestureCounter`), which advances on every `pointerdown` and `keydown`. Any later press is a new gesture, so every other outside press keeps its outcome: a mouse or pen closes at the press, a tap on its compatibility `mousedown`, while a scroll, a cancelled or stopped `pointerdown`, an unpanned drag or a second finger leaves it open. A mouse or keyboard open records no gesture. No listener, API or default is added; `architecture:layer-runtime` names the skip.

## Evidence

- Before, in real Chromium (CDP touch): the menu opens at about 510 ms; on lift come `pointerup`, `touchend`, then trusted `mousedown`, `mouseup` and `click` on the trigger, and it closes.
- After: the menu stays open through that `click`, in a shadow root too; a tap or mouse click outside still closes it.
- iOS Safari reportedly sends the `mousedown` mid-hold; the same gesture is skipped, but WebKit was not run here.
- Regression proof: the long-press, touch `contextmenu` and moved-menu unit cases and both Chromium long-press cases fail on `main`; the mouse, pen and no-`mousedown` cases fail on the previous head and pass on `main`.

## Writing rubric results

R1 narration: the layer-runtime line is present tense.
R2 research: none.
R3 evidence: none in the record; the tests below verify the line.
R4 rejected alternatives: none.
R5 change references: none.
R6 open questions: none.

## Scope

- [x] One defect is restored.
- [x] Separable contradictory or unsettled tagalongs were removed or split.
- [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
- [x] Public text and artifacts contain no internal Meta context.

## Testing

- Maintainer merge 690291d brought in `main`: `ContextMenu.spec.md` takes `main`'s table, whose FR5 already routes the long-press lift to `spec:AST-094` FR33, so this PR no longer proposes FR11; the changeset names only the Chromium lift the tests show. The code, tests and `layer-runtime.md` line are unchanged.
- Review round (163af16, rebased onto `main` 8b74911): narrowed to the long-press lift per the owner's requested change. `main`'s outside `mousedown` listener returns with one skip, the opening finger press's compatibility events (shared gesture counter); the pointer listeners, the nested-root levels and the five other outcome changes are gone. FR11, `layer-runtime.md` and the changeset say only that. ContextMenu, DropdownMenu, hooks, Layer and CLI suites: 1422 tests; long-press, shadow-root and ContextMenu audit Chromium specs: 23; native types, typecheck, `eslint` (strict), `check:knowledge` and the Storybook build pass.
- Rebased onto `main` 39b5981 (486cec8), patch unchanged: the `typecheck` job's native platform types step runs a script `main` added in #8024, which 1fe5329's older base lacked. ContextMenu, DropdownMenu, hooks and CLI suites: 1216 tests; the long-press and shadow-root Chromium specs: 5; the native typecheck, build and platform-types steps, typecheck, `eslint` (strict), `check:knowledge` and the Storybook build pass.
- Review round (1fe5329): the document `pointerup`/`pointercancel` listeners come on with an outside finger or pen press and off once none is live, instead of staying for the whole open menu (`architecture:react-component-runtime` INV5); `layer-runtime.md` says so. A new case shows none attached while the menu is open at rest and none after the lift; it fails on the previous head. ContextMenu, DropdownMenu, hooks and CLI suites: 1151 tests; the long-press and shadow-root Chromium specs: 5; typecheck, `eslint` (strict), `check:knowledge` and the Storybook build pass.

```
Rebased onto main 9f3ab05 (a5784a5, one commit): #7914 judged presses inside a shadow root with a `mousedown` listener on the menu's root, run before the document's. Capture reaches the document first, so each root from the document down to the menu's own now listens in the capture phase and defers a press on the host of the next root down; a press on such a host itself is judged by that host, whatever the host's own listeners do. #7914's open, closed and nested cases fire pointer events and also lift a finger on the menu; a new case stops presses in each root and on a host. They fail with the document judging every press (#7914's cases), with roots listening as the press bubbles, and with only the menu's own root listening (the new case). The `a11y/Menu press in a shadow root` stories gain a ContextMenu; the shadow-root spec checks in Chromium that a clicked item is picked (red with the document judging every press), that a press or a tap on the host closes the menu, and that its opening long press does not. `layer-runtime.md` names the extra listeners.
  vitest ContextMenu, DropdownMenu, Selector, hooks, Breadcrumbs   Tests 1193 passed
  playwright MenuPressShadowRoot, ContextMenuLongPress, ContextMenuAudit --project=chromium   23 passed
  typecheck, lint:strict, check:knowledge, storybook:build   ✓

Review round 3: rebased onto main 95e1674 as one commit; the rule is FR11, since #7303 proposes FR10 in the same record:
  vitest ContextMenu, DropdownMenu, useLongPress, docProp*   Tests 376 passed
  playwright ContextMenu/__tests__ --project=chromium   23 passed
  typecheck, lint:strict, check:knowledge, storybook:build   ✓

Review round 2: the listeners run in the capture phase, so a control that stops the press (ResizeHandle, Table's column-resize handle) still closes the menu; new case "closes on a press whose control stops it" fails with bubble-phase listeners:
  vitest ContextMenu, DropdownMenu, useLongPress, docProp*   Tests 374 passed (DropdownMenuLazySheet's import hook timed out at 10 s under load; 2 passed alone)
  playwright ContextMenu/__tests__ --project=chromium   23 passed
  typecheck, lint:strict, check:knowledge, storybook:build   ✓

Review round: the three changed presses are named (changeset, body, commit message), a new case pins the cancelled press, the unpanned drag and a second finger's tap (it fails on `main`), and docs/architecture/layer-runtime.md names the new listeners:
  vitest ContextMenu, DropdownMenu, useLongPress, docProp*   Tests 375 passed
  playwright ContextMenu/__tests__ --project=chromium   23 passed
  typecheck, lint:strict, check:knowledge, storybook:build   ✓

Rebased onto main 22c592a as one commit. Main's record now has FR9 (overlay dismissal), so this rule was proposed FR10 (now FR11, beside #7303's FR10):
  vitest ContextMenu, DropdownMenu, hooks, docProp*   Tests 854 passed
  playwright ContextMenu/__tests__ --project=chromium   23 passed
  typecheck, lint:strict, check:knowledge, storybook:build   ✓
  red on main: `ContextMenuLongPress.a11y.chromium.spec.ts` against a `main` build: 1 failed (the long press and lift), 1 passed (the guard)

pnpm exec vitest run packages/core/src/ContextMenu/ContextMenu.test.tsx -t "ContextMenu outside dismissal"
  main's ContextMenu.tsx: 3 failed, 3 passed (tap/scroll, mouse and mid-tap re-render guards) · with the change: 6 passed
  (the pen case fails on main, where a pen closes it at once; the re-render case failed on an earlier head)

pnpm exec vitest run packages/core/src/ContextMenu packages/core/src/DropdownMenu packages/core/src/hooks/useLongPress.test.tsx \
  packages/core/src/hooks/useMenuPress.test.tsx packages/core/src/docPropLiterals.test.ts \
  packages/core/src/docPropReferences.test.ts --maxWorkers=8
  Test Files  9 passed (9)   Tests  324 passed (324)

pnpm storybook:build   (this branch; main for the red arm)
ASTRYX_STORYBOOK_DIR=<main build> pnpm exec playwright test \
  packages/core/src/ContextMenu/__tests__/ContextMenuLongPress.a11y.chromium.spec.ts --project=chromium
  1 failed, 1 passed   (long press: the menu is gone after the lift's click; mouse guard passes)
pnpm exec playwright test packages/core/src/ContextMenu/__tests__/ContextMenuLongPress.a11y.chromium.spec.ts --project=chromium
  2 passed · --repeat-each=2: 4 passed

pnpm -F @astryxdesign/core typecheck, pnpm lint:strict, check:knowledge   ✓
```

This branch was successfully deployed

1 active deployment
Preview — dfe8270f Deployed Oct 24, 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