Skip to content

fix(core): ensure batch tasks always have hash for DTE#34764

Merged
FrozenPandaz merged 15 commits intomasterfrom
fix-dte-hash
Mar 11, 2026
Merged

fix(core): ensure batch tasks always have hash for DTE#34764
FrozenPandaz merged 15 commits intomasterfrom
fix-dte-hash

Conversation

@FrozenPandaz
Copy link
Collaborator

Current Behavior

After #34446, batch tasks with depsOutputs inputs had their hashing deferred until after execution. This meant the streaming endTasks callback fired with task.hash = undefined, which Cloud/DTE rejects.

Expected Behavior

All batch tasks always have a valid hash when endTasks is called. Tasks with depsOutputs get a preliminary hash upfront (based on whatever outputs are on disk), then are re-hashed after execution with fresh outputs for correct cache storage.

How it works

  1. Phase 1 now hashes ALL root tasks at each level (not just cache-eligible ones). Ineligible tasks get a preliminary hash so the streaming callback always has something valid to send.
  2. Phase 2 runs the batch, then clears and re-hashes all tasks that ran — outputs are fresh on disk, so depsOutputs tasks get correct final hashes.
  3. The re-hash logic is consolidated into a single block after both code paths (cache-enabled and cache-skipped).

Related Issue(s)

Fixes the undefined hash regression from #34446

@netlify
Copy link

netlify bot commented Mar 9, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 7b2587f
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69b09b2458128e000706957d
😎 Deploy Preview https://deploy-preview-34764--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.

@netlify
Copy link

netlify bot commented Mar 9, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 7b2587f
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69b09b24d3c219000841967c
😎 Deploy Preview https://deploy-preview-34764--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.

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Mar 9, 2026

View your CI Pipeline Execution ↗ for commit 7b2587f

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 48m 18s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 22s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-10 23:25:46 UTC

@FrozenPandaz FrozenPandaz force-pushed the fix-dte-hash branch 3 times, most recently from 3c776e5 to 30776d5 Compare March 9, 2026 20:41
nx-cloud[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

🐳 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.34764.868a863 my-workspace

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

22.6.0-pr.34764.868a863
Release details 📑
Published version 22.6.0-pr.34764.868a863
Triggered by @FrozenPandaz
Branch fix-dte-hash
Commit 868a863
Workflow run 22877160599

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.

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.34764.c1c3b27 my-workspace

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

22.6.0-pr.34764.c1c3b27
Release details 📑
Published version 22.6.0-pr.34764.c1c3b27
Triggered by @FrozenPandaz
Branch fix-dte-hash
Commit c1c3b27
Workflow run 22903892842

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

@github-actions
Copy link
Contributor

Failed to publish a PR release of this pull request, triggered by @FrozenPandaz.
See the failed workflow run at: https://github.com/nrwl/nx/actions/runs/22912189086

@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.34764.a957296 my-workspace

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

22.6.0-pr.34764.a957296
Release details 📑
Published version 22.6.0-pr.34764.a957296
Triggered by @FrozenPandaz
Branch fix-dte-hash
Commit a957296
Workflow run 22912189086

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.

nx-cloud[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

Failed to publish a PR release of this pull request, triggered by @AgentEnder.
See the failed workflow run at: https://github.com/nrwl/nx/actions/runs/22920895243

@github-actions
Copy link
Contributor

Failed to publish a PR release of this pull request, triggered by @FrozenPandaz.
See the failed workflow run at: https://github.com/nrwl/nx/actions/runs/22920895243

@github-actions
Copy link
Contributor

Failed to publish a PR release of this pull request, triggered by @FrozenPandaz.
See the failed workflow run at: https://github.com/nrwl/nx/actions/runs/22919722522

@github-actions
Copy link
Contributor

Failed to publish a PR release of this pull request, triggered by @FrozenPandaz.
See the failed workflow run at: https://github.com/nrwl/nx/actions/runs/22920895243

In batch mode, Phase 2 tasks (those with depsOutputs and non-cached
deps) are hashed after execution, not before. The streaming callback
was calling endTasks for these tasks before they had a hash, sending
undefined to Cloud which rejects null hashes on runs/end.

Remove endTasks from the streaming callback entirely and let
postRunSteps handle it for all batch tasks. This ensures every task
has its correct final hash when Cloud/DTE receives the completion
event. Also removes the now-unnecessary batchTaskResultsStreamed set.
Split streaming callback concerns: setTaskTiming + setTaskStatus for
real-time TUI updates, endTasks fires once from postRunSteps after
hashing so Cloud always receives correct hash values.
The tui-summary lifecycle didn't need to change for the batch hash fix.
Reverting to master restores the working endTasks counting logic.
Instead of deferring hashing for ineligible tasks, hash all tasks at
each level (preliminary hash). Only skip cache lookup for depsOutputs
tasks with non-cached deps. After execution, re-hash only those tasks
so they get correct hashes based on fresh outputs on disk.
…Batches

Move scheduleTask calls to after applyBatchCachedResults so tasks
have valid hashes when the cloud lifecycle reads scheduledTasks.
Remove the now-unused processedBatches map.
@github-actions
Copy link
Contributor

Failed to publish a PR release of this pull request, triggered by @AgentEnder.
See the failed workflow run at: https://github.com/nrwl/nx/actions/runs/22920895243

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.34764.07d8b15 my-workspace

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

22.6.0-pr.34764.07d8b15
Release details 📑
Published version 22.6.0-pr.34764.07d8b15
Triggered by @AgentEnder
Branch fix-dte-hash
Commit 07d8b15
Workflow run 22923371008

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

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 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

@FrozenPandaz FrozenPandaz marked this pull request as ready for review March 10, 2026 22:08
@FrozenPandaz FrozenPandaz requested review from a team as code owners March 10, 2026 22:08
@FrozenPandaz FrozenPandaz requested a review from AgentEnder March 10, 2026 22:08
@FrozenPandaz FrozenPandaz enabled auto-merge (squash) March 10, 2026 22:42
@FrozenPandaz FrozenPandaz merged commit dcba2bf into master Mar 11, 2026
24 checks passed
@FrozenPandaz FrozenPandaz deleted the fix-dte-hash branch March 11, 2026 09:51
@github-actions
Copy link
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants