Repository navigation
fix(nx): stop the root project re-invoking nx, which raced docs-site against itself - #697
Merged
Merged
Conversation
…against itself
`Lint, typecheck & build` has been red on main with two failed tasks:
- docs-site:build
- scaffald:build
They are one bug, and it is not in either docs site.
`scaffald` is the workspace root, and it is a real nx project. `project.json`
already neutralises `lint`, `test` and `typecheck` with echo no-ops so the root
does not recurse — but `build` was never given the same treatment. With no
`build` target declared, nx infers one from the root `package.json` script:
"build": "pnpm locales:validate && nx run-many -t build --exclude=@scaffald/ui-docs,scaffald"
So CI's `nx run-many -t build` schedules 10 projects, one of which shells out to
a second `nx run-many -t build` over 8 of the same projects. Both nx runs build
`docs-site` into the same directory at the same time. Whichever one is mid-SSG
when the other clears `build/` fails on the artifact it was about to read:
ENOENT: no such file or directory,
open 'packages/sdk/docs-site/build/__server/server.bundle.js'
The evidence it is a race rather than a config problem is in the CI log itself —
one run contains BOTH outcomes for the same task, plus nx's own verdict:
##[group]✅ > nx run docs-site:build [SUCCESS] Generated static files
NX Nx detected a flaky task
##[group]❌ > nx run docs-site:build ENOENT … server.bundle.js
`docs-site` builds cleanly on its own, on a clean tree, with `future.v4: true`
left exactly as it is.
This adds the missing `build` no-op, matching the three targets beside it. The
nested `nx run-many` disappears, `docs-site:build` runs once instead of twice,
and every one of the 10 projects still builds — both docs sites still emit their
`build/index.html`. Verified before and after on a cold cache (`nx reset`); the
build log drops from 445 lines to 185 because half of it was the duplicate run.
Two notes for whoever reads this next:
* `pnpm build` is untouched. Only the nx *target* for the root project changed;
the npm script is still there and still works as a developer alias.
* `locales:validate` no longer runs as part of the build target, but it has not
been lost — `pnpm check` runs it first, in the same job, before lint.
A first pass at this blamed `future.v4: true` in the sdk docs config, because
flipping that flag to false does make the failure go away. That was a red
herring: v4 is simply what makes docusaurus route SSG through
`build/__server/server.bundle.js`, so turning it off hides the race instead of
fixing it. Left enabled on purpose.
Closes #693
Co-Authored-By: Claude Opus 5 <[email protected]>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lint, typecheck & buildhas been red on main with two failed tasks:They are one bug, and it is not in either docs site.
scaffaldis the workspace root, and it is a real nx project.project.jsonalready neutralises
lint,testandtypecheckwith echo no-ops so the rootdoes not recurse — but
buildwas never given the same treatment. With nobuildtarget declared, nx infers one from the rootpackage.jsonscript:So CI's
nx run-many -t buildschedules 10 projects, one of which shells out toa second
nx run-many -t buildover 8 of the same projects. Both nx runs builddocs-siteinto the same directory at the same time. Whichever one is mid-SSGwhen the other clears
build/fails on the artifact it was about to read:The evidence it is a race rather than a config problem is in the CI log itself —
one run contains BOTH outcomes for the same task, plus nx's own verdict:
docs-sitebuilds cleanly on its own, on a clean tree, withfuture.v4: trueleft exactly as it is.
This adds the missing
buildno-op, matching the three targets beside it. Thenested
nx run-manydisappears,docs-site:buildruns once instead of twice,and every one of the 10 projects still builds — both docs sites still emit their
build/index.html. Verified before and after on a cold cache (nx reset); thebuild log drops from 445 lines to 185 because half of it was the duplicate run.
Two notes for whoever reads this next:
pnpm buildis untouched. Only the nx target for the root project changed;the npm script is still there and still works as a developer alias.
locales:validateno longer runs as part of the build target, but it has notbeen lost —
pnpm checkruns it first, in the same job, before lint.A first pass at this blamed
future.v4: truein the sdk docs config, becauseflipping that flag to false does make the failure go away. That was a red
herring: v4 is simply what makes docusaurus route SSG through
build/__server/server.bundle.js, so turning it off hides the race instead offixing it. Left enabled on purpose.
Closes #693
🤖 Generated with Claude Code