fix(genui): order a2ui-catalog-extractor build before a2ui api-extractor#2751
Conversation
`@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 detectedLatest commit: 3a4dcea The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
📝 WalkthroughWalkthroughThe PR adds a build ordering constraint to prevent a race condition: Turbo's ChangesAPI Extractor Build Ordering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/genui/a2ui/turbo.json (1)
24-24: ⚖️ Poor tradeoffVerify the necessity of disabling cache for the api-extractor task.
Setting
cache: falsemeans every run will execute this task, which could impact CI performance. While this might be intentional to ensure correctness given the serialization lock inrun-api-extractor.mjs(per relevant snippet 2), consider whether caching with properly declaredinputsandoutputswould be safe and faster.Based on relevant code snippets, the api-extractor task runs
pnpm run buildand thenapi-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
📒 Files selected for processing (2)
.changeset/fix-genui-a2ui-catalog-build-order.mdpackages/genui/a2ui/turbo.json
Merging this PR will not alter performance
Comparing Footnotes
|
UI JudgeGEQI weighted score: 58.6 / 100 across 8 examples.
DetailsResult 1
Result 2
Result 3
Result 4
Result 5
Result 6
Result 7
Result 8
|
Summary
@lynx-js/genui-a2ui'sapi-extractortask runspnpm run build, whosebuild:catalogstep invokes thegenuiCLI and dynamically imports@lynx-js/genui-a2ui-catalog-extractor/dist/cli.js.The shared
api-extractortask only declareddependsOn: ["//#build"], so turbo never guaranteed@lynx-js/genui-a2ui-catalog-extractorwas built beforegenui-a2ui's api-extractor ran. The genui packages runrun-api-extractor.mjsunder 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. Whengenui-a2uiwon the race, itsbuild:catalogfailed with:This intermittently broke
code-style-checkandtest-apion unrelated PRs.Fix
Give
genui-a2ui'sapi-extractortask an explicit@lynx-js/genui-a2ui-catalog-extractor#builddependency (in addition to the existing//#build), so turbo always builds the catalog extractor — producingdist/cli.js— before the catalog generation step runs.No dependency cycle:
@lynx-js/genui-a2ui-catalog-extractoronly depends ontypedoc.Failing CI (before this fix)
code-style-checkon feat(rspeedy): express SWC baseline via env instead of jsc.target #2748 (after merging main, without this fix): https://github.com/lynx-family/lynx-stack/actions/runs/26581640592/job/78316111246 — fails withCannot find module .../a2ui-catalog-extractor/dist/cli.js.Verification that the fix works
turbo api-extractor --filter=@lynx-js/genui-a2ui --dry-run=jsonnow reports@lynx-js/genui-a2ui#api-extractor -> ['//#build', '@lynx-js/genui-a2ui-catalog-extractor#build'](previously-> ['//#build']).code-style-checkpasses: https://github.com/lynx-family/lynx-stack/actions/runs/26584778467/job/78327588583code-style-checkjob goes from red to green: https://github.com/lynx-family/lynx-stack/actions/runs/26584934732/job/78328149767Test plan
code-style-checkpasses in CI.