Skip to content

[rush] Design Proposal: Phased Command Hook Rework #5129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dmichon-msft opened this issue Feb 25, 2025 · 2 comments
Open

[rush] Design Proposal: Phased Command Hook Rework #5129

dmichon-msft opened this issue Feb 25, 2025 · 2 comments

Comments

@dmichon-msft
Copy link
Contributor

dmichon-msft commented Feb 25, 2025

Summary

For future extensions of phased commands and more optimal interaction with long-running watch sessions, it would be useful to build on the recent change that gives Operation the enabled: boolean property to split createOperations into createOperations and configureOperations, where the job of the latter is purely to set enabled to true or false depending on scoping parameters, and createOperations builds the graph of all operations that might be in scope.

This then would tie into having the control flow be:

createOperations();
while (!terminated) {
  executeOperationsAsync(...);
  if (isWatch) {
    waitForChanges()
  } else {
    return reportErrorsAndSetExitCode()
  }
}

Where

// `operations` passed via instance property so that plugins can invoke this method
executeOperationsAsync(snapshot) {
  configureOperations(this.operations, snapshot)
  beforeExecuteOperations(...)
  async parallel for (const operation of operationQueue) {
    beforeExecuteOperation(op);
    execute(op);
    afterExecuteOperation(op);
  }
  afterExecuteOperations(...)
}
@github-project-automation github-project-automation bot moved this to Needs triage in Bug Triage Feb 25, 2025
@iclanton iclanton moved this from Needs triage to General Discussions in Bug Triage Mar 3, 2025
@dmichon-msft
Copy link
Contributor Author

@aramissennyeydd , @elliot-nelson , @chengcyber , in particular I'm interested to know if only generating the graph once is likely to break any of your workflows/custom plugins.
The motivation here is that I want to start moving Rush into a world where the build engine can be orchestrated via interactive UX, and to do that, I need to have some persistent objects that I can associate with their "most recent status", for which the Operation instances are a natural fit.

One effect of this will end up being that they will decide at execution time whether they are running "clean" or "incremental", rather than during graph definition.

@aramissennyeydd
Copy link
Contributor

I think this makes sense, would this impact the set of operations that createOperations would return for various selectors, ie

  1. --from: would createOperations return the full build graph and then configureOperations would only turn on the specific sub-graph corresponding to the selector?
  2. --to-except: would this be the --to graph with the final node turned off?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: General Discussions
Development

No branches or pull requests

2 participants