Skip to content

Conversation

@MaxKless
Copy link
Collaborator

No description provided.

@MaxKless MaxKless force-pushed the compress-project-details-tool-more branch from bb17622 to 0ba631b Compare November 20, 2025 02:32
@nx-cloud
Copy link
Contributor

nx-cloud bot commented Nov 20, 2025

View your CI Pipeline Execution ↗ for commit f859ffb

Command Status Duration Result
nx affected --targets=lint,test,build,e2e-ci,ty... ❌ Failed 5m View ↗
nx-cloud record -- yarn nx sync:check ✅ Succeeded 4s View ↗
nx-cloud record -- yarn nx run-many -t ktfmtFormat ✅ Succeeded 3m 59s View ↗
nx run-many -t ktfmtFormat ✅ Succeeded 3m 55s View ↗
nx-cloud record -- yarn nx format:check --verbose ✅ Succeeded 7s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-25 16:05:47 UTC

Comment on lines 32 to 41
for (const target of targets) {
if (targets.some((t) => t !== target && t.startsWith(target))) {
rootTargets.add(target);

const atomizedTargets = targets.filter(
(t) => t.startsWith(target) && t !== target,
);
atomizedTargetsMap.set(target, atomizedTargets);
targetsToExclude.push(...atomizedTargets);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic incorrectly identifies root targets when target names overlap. If a targetGroup contains ['test', 'test-ci', 'test-ci--Test1'], the code will:

  1. Mark test as a root target with ['test-ci', 'test-ci--Test1'] as atomized targets
  2. Also mark test-ci as a root target with ['test-ci--Test1'] as atomized target
  3. Add test-ci--Test1 to targetsToExclude twice

This causes incorrect filtering and display. Fix by enforcing the double-dash pattern:

for (const target of targets) {
  const atomizedTargets = targets.filter(
    (t) => t !== target && t.startsWith(`${target}--`)
  );
  
  if (atomizedTargets.length > 0) {
    rootTargets.add(target);
    atomizedTargetsMap.set(target, atomizedTargets);
    targetsToExclude.push(...atomizedTargets);
  }
}
Suggested change
for (const target of targets) {
if (targets.some((t) => t !== target && t.startsWith(target))) {
rootTargets.add(target);
const atomizedTargets = targets.filter(
(t) => t.startsWith(target) && t !== target,
);
atomizedTargetsMap.set(target, atomizedTargets);
targetsToExclude.push(...atomizedTargets);
}
for (const target of targets) {
const atomizedTargets = targets.filter(
(t) => t !== target && t.startsWith(`${target}--`),
);
if (atomizedTargets.length > 0) {
rootTargets.add(target);
atomizedTargetsMap.set(target, atomizedTargets);
targetsToExclude.push(...atomizedTargets);
}
}

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

nx-cloud[bot]

This comment was marked as outdated.

Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Nx Cloud is proposing a fix for your failed CI:

This change fixes the detectAtomizedTargets function to only exclude targets that actually follow the atomized naming pattern (rootTarget--*). The previous implementation incorrectly filtered out all targets in a targetGroup except the root, which caused nx:run-script targets like deploy and custom-hello (from package.json scripts) to disappear from the compressed output. With this fix, only true atomized targets are excluded while maintaining the PR's token-efficiency improvements.

We verified this fix by re-running nx-mcp-e2e:e2e-ci--src/nx-project-details-compressed-targets.test.ts.

diff --git a/libs/shared/llm-context/src/lib/project-graph.ts b/libs/shared/llm-context/src/lib/project-graph.ts
index db0802ae..dc370c7b 100644
--- a/libs/shared/llm-context/src/lib/project-graph.ts
+++ b/libs/shared/llm-context/src/lib/project-graph.ts
@@ -31,7 +31,10 @@ export function detectAtomizedTargets(targetGroups: Record<string, string[]>): {
 
     // The group name is the root target name (from metadata)
     const rootTarget = groupName;
-    const atomizedTargets = targets.filter((t) => t !== rootTarget);
+    // Only consider targets atomized if they follow the pattern: rootTarget--*
+    const atomizedTargets = targets.filter(
+      (t) => t !== rootTarget && t.startsWith(`${rootTarget}--`),
+    );
 
     if (atomizedTargets.length > 0) {
       rootTargets.add(rootTarget);

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally Pi6Q-3USi

Apply fix locally with your editor ↗   View interactive diff ↗


🎓 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants