Skip to content

fix(genui): order a2ui-catalog-extractor build before a2ui api-extractor#2751

Merged
upupming merged 1 commit into
mainfrom
fix/genui-a2ui-catalog-build-order
May 29, 2026
Merged

fix(genui): order a2ui-catalog-extractor build before a2ui api-extractor#2751
upupming merged 1 commit into
mainfrom
fix/genui-a2ui-catalog-build-order

Conversation

@upupming
Copy link
Copy Markdown
Collaborator

@upupming upupming commented May 28, 2026

Summary

@lynx-js/genui-a2ui's api-extractor task runs pnpm run build, whose build:catalog step invokes the genui CLI and dynamically imports @lynx-js/genui-a2ui-catalog-extractor/dist/cli.js.

The shared api-extractor task only declared dependsOn: ["//#build"], so turbo never guaranteed @lynx-js/genui-a2ui-catalog-extractor was built before genui-a2ui's api-extractor ran. The genui packages run run-api-extractor.mjs under a shared lock that serializes them but does not order them, so whichever genui package's api-extractor happened to run first decided the outcome. When genui-a2ui won the race, its build:catalog failed with:

Cannot find module '.../packages/genui/a2ui-catalog-extractor/dist/cli.js'
  imported from .../packages/genui/cli/bin/cli.js

This intermittently broke code-style-check and test-api on unrelated PRs.

Fix

Give genui-a2ui's api-extractor task an explicit @lynx-js/genui-a2ui-catalog-extractor#build dependency (in addition to the existing //#build), so turbo always builds the catalog extractor — producing dist/cli.js — before the catalog generation step runs.

No dependency cycle: @lynx-js/genui-a2ui-catalog-extractor only depends on typedoc.

Failing CI (before this fix)

Verification that the fix works

Test plan

  • code-style-check passes in CI.

`@lynx-js/genui-a2ui`'s `api-extractor` task runs `build:catalog`, which
invokes the genui CLI and dynamically imports
`@lynx-js/genui-a2ui-catalog-extractor/dist/cli.js`. The `api-extractor`
task only depended on `//#build`, so turbo never guaranteed the catalog
extractor was built first — whichever genui package's api-extractor won
the (lock-serialized but unordered) race decided pass/fail, intermittently
failing CI with "Cannot find module .../a2ui-catalog-extractor/dist/cli.js".

Add an explicit `@lynx-js/genui-a2ui-catalog-extractor#build` dependency to
genui-a2ui's `api-extractor` task so the CLI is always present.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

🦋 Changeset detected

Latest commit: 3a4dcea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

The PR adds a build ordering constraint to prevent a race condition: Turbo's api-extractor task in @lynx-js/genui-a2ui now depends on @lynx-js/genui-a2ui-catalog-extractor#build, ensuring the catalog extractor CLI is built before the api-extractor task runs.

Changes

API Extractor Build Ordering

Layer / File(s) Summary
Turbo task dependency and changeset
.changeset/fix-genui-a2ui-catalog-build-order.md, packages/genui/a2ui/turbo.json
Changeset documents the build-order fix, and turbo.json adds the api-extractor task with dependsOn entries linking to root #build and genui-a2ui-catalog-extractor#build, with caching disabled to ensure fresh runs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • lynx-family/lynx-stack#2742: Both PRs address the api-extractor build race for @lynx-js/genui-a2ui — this PR wires Turbo task dependencies on genui-a2ui-catalog-extractor, while the related PR adjusts the run-api-extractor.mjs entry point startup flow.

Suggested reviewers

  • HuJean
  • PupilTong
  • gaoachao
  • Sherry-hue

Poem

🐰 A race condition hops away,
Build order comes to save the day,
Catalog extractor runs first now,
Then api-extractor takes a bow,

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing build order so the a2ui-catalog-extractor is built before the a2ui api-extractor task runs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/genui-a2ui-catalog-build-order

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/genui/a2ui/turbo.json (1)

24-24: ⚖️ Poor tradeoff

Verify the necessity of disabling cache for the api-extractor task.

Setting cache: false means every run will execute this task, which could impact CI performance. While this might be intentional to ensure correctness given the serialization lock in run-api-extractor.mjs (per relevant snippet 2), consider whether caching with properly declared inputs and outputs would be safe and faster.

Based on relevant code snippets, the api-extractor task runs pnpm run build and then api-extractor run --verbose, likely producing API documentation. If these outputs are deterministic given the same inputs, caching could be enabled.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/genui/a2ui/turbo.json` at line 24, The turbo.json entry sets
"cache": false for the api-extractor task which forces every run to execute and
may slow CI; inspect the api-extractor task and the run-api-extractor.mjs script
(look for the serialization lock and the sequence that runs "pnpm run build" and
"api-extractor run --verbose") and either document why caching must remain
disabled or enable caching by setting "cache": true and declaring deterministic
inputs/outputs (e.g., source files, package.json, tsconfig, built artifacts) so
Turbo can safely cache results; if the serialization lock truly requires
serialized runs, keep cache:false but add a comment referencing
run-api-extractor.mjs to justify the decision.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/genui/a2ui/turbo.json`:
- Line 24: The turbo.json entry sets "cache": false for the api-extractor task
which forces every run to execute and may slow CI; inspect the api-extractor
task and the run-api-extractor.mjs script (look for the serialization lock and
the sequence that runs "pnpm run build" and "api-extractor run --verbose") and
either document why caching must remain disabled or enable caching by setting
"cache": true and declaring deterministic inputs/outputs (e.g., source files,
package.json, tsconfig, built artifacts) so Turbo can safely cache results; if
the serialization lock truly requires serialized runs, keep cache:false but add
a comment referencing run-api-extractor.mjs to justify the decision.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1f752c30-bfe1-4c06-bf43-8fe629f19047

📥 Commits

Reviewing files that changed from the base of the PR and between d62b8b2 and 3a4dcea.

📒 Files selected for processing (2)
  • .changeset/fix-genui-a2ui-catalog-build-order.md
  • packages/genui/a2ui/turbo.json

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 28, 2026

Merging this PR will not alter performance

✅ 81 untouched benchmarks
⏩ 26 skipped benchmarks1


Comparing fix/genui-a2ui-catalog-build-order (3a4dcea) with main (d62b8b2)

Open in CodSpeed

Footnotes

  1. 26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link
Copy Markdown
Contributor

UI Judge

GEQI weighted score: 58.6 / 100 across 8 examples.
Average visual-correctness score: 3.4 / 5.

Dimension Weight Average Results Status
Usability & Interaction 30% 2.9 / 5 8 OK
Visual & Aesthetics 25% 2.9 / 5 8 OK
Consistency & Standards 15% 3 / 5 8 OK
Architecture & UX Writing 15% 3 / 5 8 OK
Accessibility & Performance 15% 3 / 5 8 OK
# Example Visual Correctness Usability & Interaction (30%) Visual & Aesthetics (25%) Consistency & Standards (15%) Architecture & UX Writing (15%) Accessibility & Performance (15%) GEQI Page Status
1 recs 2 / 5 2 / 5 2 / 5 2 / 5 2 / 5 2 / 5 40 / 100 preview OK
2 cast-grid 5 / 5 3 / 5 3 / 5 4 / 5 5 / 5 4 / 5 72 / 100 preview OK
3 citywalk-list 2 / 5 2 / 5 3 / 5 2 / 5 2 / 5 3 / 5 48 / 100 preview OK
4 fridge-search 4 / 5 3 / 5 2 / 5 4 / 5 3 / 5 3 / 5 58 / 100 preview OK
5 trip-planner 2 / 5 2 / 5 3 / 5 2 / 5 2 / 5 2 / 5 45 / 100 preview OK
6 weather-current 5 / 5 5 / 5 4 / 5 4 / 5 4 / 5 4 / 5 86 / 100 preview OK
7 product-card 5 / 5 4 / 5 4 / 5 4 / 5 4 / 5 4 / 5 80 / 100 preview OK
8 workout-plan 2 / 5 2 / 5 2 / 5 2 / 5 2 / 5 2 / 5 40 / 100 preview OK
Details

Result 1

  • Example: recs
  • Dimension: visual-correctness
  • Visual correctness: 2 / 5
  • GEQI dimensions:
    • Usability & Interaction: 2 / 5 (30%)
    • Visual & Aesthetics: 2 / 5 (25%)
    • Consistency & Standards: 2 / 5 (15%)
    • Architecture & UX Writing: 2 / 5 (15%)
    • Accessibility & Performance: 2 / 5 (15%)
  • Task: The A2UI playground preview should show date-night dining recommendations for Moonlight Terrace, Pinewood Bistro, and Sea Breeze Kitchen.

Result 2

  • Example: cast-grid
  • Dimension: visual-correctness
  • Visual correctness: 5 / 5
  • GEQI dimensions:
    • Usability & Interaction: 3 / 5 (30%)
    • Visual & Aesthetics: 3 / 5 (25%)
    • Consistency & Standards: 4 / 5 (15%)
    • Architecture & UX Writing: 5 / 5 (15%)
    • Accessibility & Performance: 4 / 5 (15%)
  • Task: The A2UI playground preview should show a cast grid for the short film Night Notes, including Lin Xia and Zhou Ning cast cards.

Result 3

  • Example: citywalk-list
  • Dimension: visual-correctness
  • Visual correctness: 2 / 5
  • GEQI dimensions:
    • Usability & Interaction: 2 / 5 (30%)
    • Visual & Aesthetics: 3 / 5 (25%)
    • Consistency & Standards: 2 / 5 (15%)
    • Architecture & UX Writing: 2 / 5 (15%)
    • Accessibility & Performance: 3 / 5 (15%)
  • Task: The A2UI playground preview should show weekend citywalk coffee picks with Rooftop Brew Room, Corner Canvas Lab, and Late Sun Roastery.

Result 4

  • Example: fridge-search
  • Dimension: visual-correctness
  • Visual correctness: 4 / 5
  • GEQI dimensions:
    • Usability & Interaction: 3 / 5 (30%)
    • Visual & Aesthetics: 2 / 5 (25%)
    • Consistency & Standards: 4 / 5 (15%)
    • Architecture & UX Writing: 3 / 5 (15%)
    • Accessibility & Performance: 3 / 5 (15%)
  • Task: The A2UI playground preview should show refrigerator search results with Siemens, Hualing, Haier, and Midea product cards.

Result 5

  • Example: trip-planner
  • Dimension: visual-correctness
  • Visual correctness: 2 / 5
  • GEQI dimensions:
    • Usability & Interaction: 2 / 5 (30%)
    • Visual & Aesthetics: 3 / 5 (25%)
    • Consistency & Standards: 2 / 5 (15%)
    • Architecture & UX Writing: 2 / 5 (15%)
    • Accessibility & Performance: 2 / 5 (15%)
  • Task: The A2UI playground preview should show a Kyoto 48-hour trip planner with Day 1 and Day 2 itinerary sections, including Monkey Park Viewpoint.

Result 6

  • Example: weather-current
  • Dimension: visual-correctness
  • Visual correctness: 5 / 5
  • GEQI dimensions:
    • Usability & Interaction: 5 / 5 (30%)
    • Visual & Aesthetics: 4 / 5 (25%)
    • Consistency & Standards: 4 / 5 (15%)
    • Architecture & UX Writing: 4 / 5 (15%)
    • Accessibility & Performance: 4 / 5 (15%)
  • Task: The A2UI playground preview should show the current weather for Austin, TX, including clear skies with light breeze.

Result 7

  • Example: product-card
  • Dimension: visual-correctness
  • Visual correctness: 5 / 5
  • GEQI dimensions:
    • Usability & Interaction: 4 / 5 (30%)
    • Visual & Aesthetics: 4 / 5 (25%)
    • Consistency & Standards: 4 / 5 (15%)
    • Architecture & UX Writing: 4 / 5 (15%)
    • Accessibility & Performance: 4 / 5 (15%)
  • Task: The A2UI playground preview should show a Wireless Headphones Pro product card with a visible Add to Cart action.

Result 8

  • Example: workout-plan
  • Dimension: visual-correctness
  • Visual correctness: 2 / 5
  • GEQI dimensions:
    • Usability & Interaction: 2 / 5 (30%)
    • Visual & Aesthetics: 2 / 5 (25%)
    • Consistency & Standards: 2 / 5 (15%)
    • Architecture & UX Writing: 2 / 5 (15%)
    • Accessibility & Performance: 2 / 5 (15%)
  • Task: The A2UI playground preview should show a weekly workout plan with five days from Monday Ramp-Up through Friday Conditioning.

Workflow run

@upupming upupming enabled auto-merge (squash) May 29, 2026 02:39
@upupming upupming merged commit 9b1792c into main May 29, 2026
108 of 112 checks passed
@upupming upupming deleted the fix/genui-a2ui-catalog-build-order branch May 29, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants