Skip to content

Comments

feat(core): add commands for debugging cache inputs / outputs#34414

Merged
FrozenPandaz merged 12 commits intomasterfrom
show-target
Feb 20, 2026
Merged

feat(core): add commands for debugging cache inputs / outputs#34414
FrozenPandaz merged 12 commits intomasterfrom
show-target

Conversation

@AgentEnder
Copy link
Member

@AgentEnder AgentEnder commented Feb 11, 2026

Current Behavior

There's not a great way to troubleshoot or test inputs and outputs configurations on tasks.

Expected Behavior

Adds nx show target to enable users to debug inputs and outputs. It has flags --inputs, --check-input, --outputs, and --check-output to list or test specific file patterns.

image image image image image image
image

@netlify
Copy link

netlify bot commented Feb 11, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit e8eb696
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6998cd2deacf8a0008db774c
😎 Deploy Preview https://deploy-preview-34414--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
Copy link

netlify bot commented Feb 11, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit e8eb696
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6998cd2d7e4a3b0008c4f2c6
😎 Deploy Preview https://deploy-preview-34414--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
Copy link
Contributor

nx-cloud bot commented Feb 11, 2026

View your CI Pipeline Execution ↗ for commit e8eb696

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 17m 49s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 15s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-20 22:26:47 UTC

@AgentEnder AgentEnder force-pushed the show-target branch 2 times, most recently from e227453 to 689f62b Compare February 12, 2026 14:58
@AgentEnder AgentEnder marked this pull request as ready for review February 12, 2026 20:41
@AgentEnder AgentEnder requested a review from a team as a code owner February 12, 2026 20:41
Copy link
Collaborator

@FrozenPandaz FrozenPandaz left a comment

Choose a reason for hiding this comment

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

Can we make this...

nx show target nx:build
nx show target inputs nx:build
nx show target inputs nx:build --check path/to/blah
nx show target outputs nx:build
nx show target outputs nx:build --check path/to/blah

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.


it('should check a matching input file and exit 0', () => {
// Get the list of inputs first
const inputs = JSON.parse(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's check for the main.ts.. this seems like cheating


it('should check a matching output path and exit 0', () => {
const outputs = JSON.parse(
runCLI(`show target outputs ${app}:build --json`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check the main.js

`show target inputs ${app}:build --check apps/${app}/src --json`
)
);
expect(result.isInput).toBe(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is awkward and not well thought out yet.. let's remove this functionality for now.

expect(output).toMatchSnapshot();
});

it('should render output paths', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Build it first

description:
'The target to inspect, in the format project:target or just target.',
})
.option('configuration', {
Copy link
Collaborator

Choose a reason for hiding this comment

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

rm

String(uniquePaths.size)
)} output path(s) for ${c.cyan(data.project)}:${c.green(data.target)}`
);
printList('Configured outputs', data.containedOutputPaths, '\n');
Copy link
Collaborator

Choose a reason for hiding this comment

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

drop the configured outputs from check..

Comment on lines 141 to 144
HashInstruction::TaskOutput(_glob, dep_outputs) => HashInputsBuilder {
dep_outputs: dep_outputs.iter().cloned().collect(),
..Default::default()
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

This probably needs the glob?

Comment on lines 155 to 164
let files: HashSet<String> = self
.all_workspace_files
.iter()
.filter(|f| {
!f.file.contains('/')
&& f.file.starts_with("tsconfig")
&& f.file.ends_with(".json")
})
.map(|f| f.file.clone())
.collect();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should only be 1 of tsconfig.json or tsconfig.base.json

Comment on lines 172 to 193
let mut files = HashSet::new();
if let Some(project) = self.project_graph.nodes.get(project_name) {
let project_json = format!("{}/project.json", project.root);
let package_json = format!("{}/package.json", project.root);
if self
.all_workspace_files
.iter()
.any(|f| f.file == project_json)
{
files.insert(project_json);
} else if self
.all_workspace_files
.iter()
.any(|f| f.file == package_json)
{
files.insert(package_json);
}
}
HashInputsBuilder {
files,
..Default::default()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove these files... for now.... we'll need to work out how to utilize the source map... to get a full list of files considered to create the project configuration

@@ -49,6 +49,13 @@ export declare class FileLock {
export declare class HashPlanInspector {
constructor(allWorkspaceFiles: ExternalObject<Array<FileData>>, projectGraph: ExternalObject<ProjectGraph>, projectFileMap: ExternalObject<Record<string, Array<FileData>>>)
inspect(hashPlans: ExternalObject<Record<string, Array<HashInstruction>>>): Record<string, string[]>

This comment was marked as resolved.

@AgentEnder AgentEnder requested a review from a team as a code owner February 16, 2026 19:21
],
"nx": {
"addTypecheckTarget": false
// "addTypecheckTarget": false
Copy link
Collaborator

Choose a reason for hiding this comment

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

Undo this

printList('Configured outputs', data.outputPaths);
}
const extraExpanded = data.expandedOutputs.filter(
(o) => !data.outputPaths.includes(o)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't filter this

}
await showTargetInfoHandler(args);
});
process.exit(exitCode);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
process.exit(exitCode);
process.exit(process.exitCode || exitCode);

nx-cloud[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

🐳 We have a release for that!

This PR has a release associated with it. You can try it out using this command:

npx create-nx-workspace@22.6.0-pr.34414.d0fddb9 my-workspace

Or just copy this version and use it in your own command:

22.6.0-pr.34414.d0fddb9
Release details 📑
Published version 22.6.0-pr.34414.d0fddb9
Triggered by @AgentEnder
Branch show-target
Commit d0fddb9
Workflow run 22184156260

To request a new release for this pull request, mention someone from the Nx team or the @nrwl/nx-pipelines-reviewers.

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.

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

These changes complete the deterministic rendering fix for the nx show target command. The previous commit added sorting to renderInputs() but missed the expandInputsForDisplay() function, causing snapshot test failures due to non-deterministic input ordering when named inputs were expanded.

Note

We are verifying this fix by re-running a subset of the 2 failed tasks that were analyzed.

Suggested Fix changes
diff --git a/e2e/nx/src/__snapshots__/misc.test.ts.snap b/e2e/nx/src/__snapshots__/misc.test.ts.snap
index a4205b32c8..c41689f0d7 100644
--- a/e2e/nx/src/__snapshots__/misc.test.ts.snap
+++ b/e2e/nx/src/__snapshots__/misc.test.ts.snap
@@ -73,11 +73,12 @@ Options:
   args: ["--node-env=production"]
   command: "webpack-cli build"
 Inputs:
-  - default
+  - !{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)
   - !{projectRoot}/.eslintrc.json
   - !{projectRoot}/eslint.config.mjs
-  - !{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)
+  - !{projectRoot}/src/test-setup.[jt]s
   - !{projectRoot}/tsconfig.spec.json
+  - default
   - ^production
   - {"externalDependencies":["webpack-cli"]}
 Outputs:
diff --git a/packages/nx/src/command-line/show/target.ts b/packages/nx/src/command-line/show/target.ts
index 61d6e82583..7070d659dd 100644
--- a/packages/nx/src/command-line/show/target.ts
+++ b/packages/nx/src/command-line/show/target.ts
@@ -828,7 +828,31 @@ function expandInputsForDisplay(
     }
   }
 
-  return result;
+  // Sort for deterministic rendering: group by type, then sort within each group
+  return result.sort((a, b) => {
+    const aIsString = typeof a === 'string';
+    const bIsString = typeof b === 'string';
+
+    // Objects come after strings
+    if (!aIsString && bIsString) return 1;
+    if (aIsString && !bIsString) return -1;
+
+    // Both are strings
+    if (aIsString && bIsString) {
+      const aIsDep = a.startsWith('^');
+      const bIsDep = b.startsWith('^');
+
+      // Dependency inputs (^) come after regular inputs
+      if (aIsDep && !bIsDep) return 1;
+      if (!aIsDep && bIsDep) return -1;
+
+      // Sort within the same category
+      return a.localeCompare(b);
+    }
+
+    // Both are objects - maintain order (stable sort)
+    return 0;
+  });
 }
 
 /**

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally F8XB-L6os

Apply fix locally with your editor ↗   View interactive diff ↗



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

Sort inputs by category (regular strings → dependency inputs → objects)
to avoid locale-dependent ordering of ^ prefix vs letters.
localeCompare produces different orderings for special characters
like * vs . across different locales/environments.
@FrozenPandaz FrozenPandaz merged commit 3e5df30 into master Feb 20, 2026
25 of 26 checks passed
@FrozenPandaz FrozenPandaz deleted the show-target branch February 20, 2026 22:35
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