Skip to content

Conversation

@aramissennyeydd
Copy link
Contributor

@aramissennyeydd aramissennyeydd commented Jun 11, 2025

Summary

Alternative to #5232 that exposes Operation lifecycle events directly instead of through a metrics interface.

Details

We're trying to measure the duration of specific Heft tasks similar to the duration of specific Rush phases. Specifically, I'm trying to understand the impact of migrating from Webpack to Rspack beyond manual benchmarking. This also opens up visibility into sync/blocking tasks and how to improve Heft parallelism.

How it was tested

Added new project that verified that output had the correct information,

 ---- build started ---- 
[lifecycle:example-lifecycle-plugin] --- build started ---
[build:clean] Deleted 0 files and 5 folders
[lifecycle:example-lifecycle-plugin] --- typescript started ---
[build:typescript] Using TypeScript version 5.8.2
[build:lint] Using ESLint version 8.57.0
[build:lint] Using TSLint version 5.20.1
[build:typescript] Copied 3 files and linked 0 files
[lifecycle:example-lifecycle-plugin] --- typescript finished in 1.25s ---
[lifecycle:example-lifecycle-plugin] --- lint started ---
[lifecycle:example-lifecycle-plugin] --- metadata-test started ---
[lifecycle:example-lifecycle-plugin] --- api-extractor started ---
[lifecycle:example-lifecycle-plugin] --- lint finished in 0.00s ---
[build:api-extractor] Using API Extractor version 7.52.8
[build:api-extractor] Analysis will use the bundled TypeScript version 5.8.2
[lifecycle:example-lifecycle-plugin] --- api-extractor finished in 0.61s ---
[lifecycle:example-lifecycle-plugin] --- metadata-test finished in 0.61s ---
 ---- build finished (1.878s) ---- 
-------------------- Finished (1.88s) --------------------

Impacted documentation

Signed-off-by: Aramis Sennyey <[email protected]>
Signed-off-by: Aramis Sennyey <[email protected]>
Signed-off-by: Aramis Sennyey <[email protected]>
Signed-off-by: Aramis Sennyey <[email protected]>
Signed-off-by: Aramis Sennyey <[email protected]>
@aramissennyeydd aramissennyeydd changed the title [heft] feat: add lifecycle events for Heft operations [heft] feat: add lifecycle events for Heft tasks + phases Jun 11, 2025
Signed-off-by: Aramis Sennyey <[email protected]>
Signed-off-by: Aramis Sennyey <[email protected]>
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

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

This is definitely getting really close. It feels a lot cleaner now than the initial approach and gets us closer to being able to converge the runner stacks between Rush and Heft.

@aramissennyeydd
Copy link
Contributor Author

@dmichon-msft Should be ready for another round - basically updated the events to treat the phase operation more like a silent architectural node. It is no longer part of the input types to OperationExecutionManager, has no metadata, was already not being consumed by the beforeExecute/afterExecute hooks, but now gets explicitly skipped.

Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

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

Little bit of cleanup left from old casts and type checks

aramissennyeydd and others added 3 commits June 12, 2025 22:02
Signed-off-by: Aramis Sennyey <[email protected]>
Signed-off-by: Aramis Sennyey <[email protected]>
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

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

Just a minor nit left, otherwise looks good.

@aramissennyeydd
Copy link
Contributor Author

aramissennyeydd commented Jun 13, 2025

@dmichon-msft Updated 🙂

@iclanton iclanton moved this from Needs triage to In Progress in Bug Triage Jun 18, 2025
@aramissennyeydd
Copy link
Contributor Author

@dmichon-msft Anything else that I need to do for this PR?

@dmichon-msft dmichon-msft merged commit df5971f into microsoft:main Jun 20, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Closed in Bug Triage Jun 20, 2025
@aramissennyeydd aramissennyeydd deleted the sennyeya/heft-lifecycle branch June 23, 2025 15:31
@dmichon-msft
Copy link
Contributor

@aramissennyeydd , looking at this again since I'm doing some work on @rushstack/operation-graph; was it a deliberate choice to make these hooks Async or was that purely due to copying the existing hooks?

@aramissennyeydd
Copy link
Contributor Author

@dmichon-msft I believe it was to copy the existing hooks, the plugin I wrote that uses this does all async work during recordMetrics or toolFinish.

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

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

3 participants