Skip to content

fix(js): do not report non-composite projects as missing root references - #36559

Draft
FrozenPandaz wants to merge 2 commits into
masterfrom
fix/typescript-sync-composite-in-first-pass
Draft

fix(js): do not report non-composite projects as missing root references#36559
FrozenPandaz wants to merge 2 commits into
masterfrom
fix/typescript-sync-composite-in-first-pass

Conversation

@FrozenPandaz

Copy link
Copy Markdown
Contributor

Current Behavior

The root tsconfig.json's project references are filtered by composite only when the generator decides what to write:

if (changedFiles.size > 0) {
  const updatedReferences = Array.from(referencesSet)
    // Check composite is true in the internal reference before proceeding
    .filter((ref) => hasCompositeEnabled(...))

But changedFiles — which drives both the out-of-sync verdict and the user-facing message — is populated in an earlier pass with no composite filter:

if (node.data.root !== '.' && !referencesSet.has(normalizedPath)) {
  referencesSet.add(normalizedPath);
  addChangedFile(changedFiles, rootTsconfigPath, ..., 'missing');
}

A non-composite project can therefore be named as a missing root reference that sync would never actually add. The message asks for something it will not do, and there is no way to satisfy it.

This is visible in this repo. Adding "composite": true to examples/react/basic/tsconfig.base.json and running sync:check reports 13 missing references, but only examples/react/basic was ever a real candidate — the other 12 are angular-rspack examples that are not composite and would have been dropped before writing.

Expected Behavior

The composite check runs in the first pass, so changedFiles only ever contains references that could really be written. A non-composite project is no longer named as a reason the workspace is out of sync.

Pre-existing references still skip that pass, so the filter at write time stays.

Verification

One new test, which fails on master and passes here:

- "  - Missing references: packages/a/tsconfig.json, packages/b/tsconfig.json",
+ "  - Missing references: packages/a/tsconfig.json, packages/b/tsconfig.json, packages/not-composite/tsconfig.json",

nx run-many -t test,lint -p js passes (830 tests).

Related Issue(s)

Split out of NXC-4734. This half is independent of the approach discussion on that ticket and stands on its own.


Polygraph View session ↗

The root tsconfig's project references are filtered by `composite` only when
deciding what to write, but `changedFiles` — which drives both the out-of-sync
verdict and the user-facing message — is populated before that filter runs.

A non-composite project could therefore be named as a missing reference that
sync would never actually add, leaving no way to satisfy the message. Moving
the check into the first pass keeps `changedFiles` limited to references that
can really be written.
@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 442d5c8
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6a7225287b60310007737e00
😎 Deploy Preview https://deploy-preview-36559--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 442d5c8
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6a7225283fba860008fb651f
😎 Deploy Preview https://deploy-preview-36559--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 10e1cb0

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 11m 36s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 4s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 1m View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 18s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-04 18:01:24 UTC

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

Nx Cloud has identified a flaky task in your failed CI:

🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.

Nx Cloud View detailed reasoning in Nx Cloud ↗

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.


🎓 Learn more about Self-Healing CI on nx.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant