Skip to content

[heft] heft watch mode always logs the re-run requestor task as unknown #4467

@bartvandenende-wm

Description

@bartvandenende-wm

Summary

When using the heft watch mode using heft start a re-run triggered by a heft-plugin is not properly logged as requestor in the console.

Repro steps

  1. cd 'rushstack/build-tests-samples/heft-webpack-basic-tutorial'
  2. rush build --to .
  3. rushx start
  4. Make a file change in the src folder
  5. Observe the console print ````New run requested by unknown task```

Expected result:
I would expect heft to print the name of the task operation that triggered to re-run, for example if the heft-typescript-plugin triggers runOptions.requestRun it should print something along the below lines:

New run requested by typescript

Actual result:

The operation task is always undefined

New run requested by undefined task

Details

Heft logs the message with the requestor here:

terminal.writeLine(Colors.bold(`New run requested by ${requestor || 'unknown task'}`));

which uses the Operation name value here:

return requestRun(this.name);

but the name value is never set for the operation when heft initialises it:

groupName: task.parentPhase.phaseName,

Adding the task name explicitly to the Operation initialisation in HeftActionRunner.ts solves this:

      groupName: task.parentPhase.phaseName,
      name: task.taskName,

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@rushstack/heft version? 0.63.5
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? v18.16.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as intendedrepro confirmedThe issue comments included repro instructions, and the maintainers reproduced the problem

    Type

    No type

    Projects

    Status

    General Discussions

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions