Skip to content

fix(devkit): add timing guidance to TaskResult and remove unintentional spread#34996

Merged
llwt merged 2 commits into
masterfrom
fix/task-result-add-timing-properties
Mar 24, 2026
Merged

fix(devkit): add timing guidance to TaskResult and remove unintentional spread#34996
llwt merged 2 commits into
masterfrom
fix/task-result-add-timing-properties

Conversation

@llwt
Copy link
Copy Markdown
Member

@llwt llwt commented Mar 24, 2026

Current Behavior

The TaskResult interface has no JSDoc guidance about where to find task timing information. Users looking at the TaskResult reference docs don't see startTime/endTime and have no indication that timing is available on the nested Task object.

Additionally, the batch execution path in task-orchestrator.ts uses ...result to spread the batch TaskResult (from misc-interfaces.ts) onto the lifecycle TaskResult, which unintentionally leaks startTime, endTime, and success properties onto the object. This only happens for batch tasks, not for regular tasks, making the behavior inconsistent.

Expected Behavior

  • The TaskResult JSDoc now points users to Task.startTime and Task.endTime for timing information, which will surface on the generated reference docs
  • The ...result spread is removed from the batch path so that only the intended TaskResult properties (code, task, status, terminalOutput) are set — timing stays on the Task object where it belongs (already copied via task.startTime = result.startTime / task.endTime = result.endTime on the lines above)

Related Issue(s)

N/A

@llwt llwt requested a review from a team as a code owner March 24, 2026 18:57
@llwt llwt requested a review from leosvelperez March 24, 2026 18:57
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 24, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 03df73e
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69c2fe8d025701000821c8d8
😎 Deploy Preview https://deploy-preview-34996--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
Copy Markdown

netlify Bot commented Mar 24, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 03df73e
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69c2fe8daae4af00086d6059
😎 Deploy Preview https://deploy-preview-34996--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
Copy Markdown
Contributor

nx-cloud Bot commented Mar 24, 2026

View your CI Pipeline Execution ↗ for commit 03df73e

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 18m 51s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 8s View ↗
nx-cloud record -- pnpm nx conformance:check ✅ Succeeded 7s View ↗
nx build workspace-plugin ✅ Succeeded 1m 57s 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-03-24 21:58:12 UTC

@llwt llwt enabled auto-merge (squash) March 24, 2026 19:33
Copy link
Copy Markdown
Contributor

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

That's because it's on Task so the numbers are there 👀

https://nx.dev/docs/reference/devkit/Task#endtime

…al spread

The TaskResult interface's JSDoc now points users to Task.startTime and
Task.endTime for timing information. Also removes the ...result spread
in the batch execution path that was unintentionally leaking batch-only
properties (startTime, endTime) onto the TaskResult object.
@llwt llwt force-pushed the fix/task-result-add-timing-properties branch from a3f48ac to 434ced2 Compare March 24, 2026 20:07
@llwt llwt changed the title fix(devkit): add startTime and endTime to TaskResult interface fix(devkit): add timing guidance to TaskResult and remove unintentional spread Mar 24, 2026
@llwt llwt requested a review from FrozenPandaz March 24, 2026 20:18
Copy link
Copy Markdown
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

…al spread

The TaskResult interface's JSDoc now points users to Task.startTime and
Task.endTime for timing information. Also removes the ...result spread
in the batch execution path that was unintentionally leaking batch-only
properties (startTime, endTime) onto the TaskResult object. [Self-Healing CI Rerun]
@llwt llwt merged commit 6cc8735 into master Mar 24, 2026
23 checks passed
@llwt llwt deleted the fix/task-result-add-timing-properties branch March 24, 2026 21:58
FrozenPandaz pushed a commit that referenced this pull request Mar 26, 2026
## Current Behavior

The `TaskResult` interface exported from the devkit is missing
`startTime` and `endTime` properties. At runtime, these properties are
present on `TaskResult` objects — set by the task orchestrator during
execution and consumed by multiple lifecycle implementations (profiling,
timings, history, store-run-information) — but the public type does not
declare them. This means the [TaskResult reference
docs](https://nx.dev/docs/reference/devkit/TaskResult) don't show these
fields.

## Expected Behavior

The `TaskResult` interface includes optional `startTime` and `endTime`
properties (Unix timestamps) matching what is actually present on
runtime objects. The generated devkit reference docs will now include
these fields.

## Related Issue(s)

N/A

(cherry picked from commit 6cc8735)
@github-actions
Copy link
Copy Markdown
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 30, 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.

4 participants