Skip to content

[rush-daemon][WS2.9][8/9] Merge shared builds - #8

Closed
mojaza wants to merge 1 commit into
mojazayeri-microsoft-rushd-ws2-request-admissionfrom
mojazayeri-microsoft-rushd-ws2-shared-build-merge
Closed

[rush-daemon][WS2.9][8/9] Merge shared builds#8
mojaza wants to merge 1 commit into
mojazayeri-microsoft-rushd-ws2-request-admissionfrom
mojazayeri-microsoft-rushd-ws2-shared-build-merge

Conversation

@mojaza

@mojaza mojaza commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary

Merge compatible concurrent phased SHARED-BUILD requests into one warm operation-graph iteration while preserving client-scoped output and results.

Depends on #7. This stack follows merged microsoft#5949 and advances microsoft#5897. Azure PBI: https://onedrive.visualstudio.com/EFun/_workitems/edit/3216025

Details

  • Adds a graph-owned coordinator with deterministic event-loop-turn batch boundaries for admitted shared builds.
  • Reconciles retained workspace invalidations once per batch, unions each client's dependency closure, and performs one setEnabledStates/schedule/execute cycle.
  • Fans raw streams and structured events out only to each client's retained operation subset with independent ordered backpressure.
  • Derives exit semantics from each client's subset, so disjoint failures remain isolated and shared failures propagate only to clients containing the failed operation.
  • Removes pre-start cancellations, unsubscribes mid-run cancellations without stopping work needed by live clients, and aborts only when the batch has no live client.
  • Preserves FIFO/exclusive admission gating, warm retained results, late-arrival batching, exact-once cleanup, and recovery after failed iterations.

Limitations

This remains opt-in and dead-code-safe. It uses the existing injected real graph/shape seam and does not integrate with apps/rush or construct PhasedScriptAction. Command-independent graph/plugin construction and complete per-iteration runner lifetime remain blocked by open microsoft#5895.

How it was tested

  • rushx build in libraries/rush-daemon (TypeScript, ESLint, API Extractor)
  • Direct Jest execution of PhasedRequestBatching.test.js, PhasedRequestRouter.test.js, and RequestAdmissionIntegration.test.js: 30 tests passed
  • rush change --verify
  • Focused read-only correctness review after implementation and after timing/cancellation fixes

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It substantially refactors core phased graph-execution concurrency, batching, and cancellation behavior, which warrants final human validation beyond automated review.

Pull request overview

This PR enhances the @rushstack/rush-daemon phased request routing so that compatible concurrent SHARED-BUILD requests can be coalesced into a single warm operation-graph iteration, while still delivering per-client scoped output/events/results and preserving FIFO/exclusive admission semantics.

Changes:

  • Introduces a graph-owned batching coordinator that merges admitted SHARED-BUILD phased requests at deterministic event-loop-turn boundaries and executes a single unioned graph iteration.
  • Updates event fan-out to support multiple simultaneous per-client sinks with independent ordered backpressure, plus refined cancellation behavior (unsubscribe a client without aborting shared work unless no live clients remain).
  • Adds/updates Jest coverage for batching/coalescing behavior and the exclusive FIFO gating between shared-build batches.
File summaries
File Description
libraries/rush-daemon/src/test/RequestAdmissionIntegration.test.ts Adds an integration test asserting exclusive FIFO gating between shared-build batches.
libraries/rush-daemon/src/test/PhasedRequestRouterTestUtilities.ts Extends the test phased client to allow distinct sessionId values for multi-client scenarios.
libraries/rush-daemon/src/test/PhasedRequestBatching.test.ts New test suite covering shared-build batching/coalescing, isolation of streams/events/results, and cancellation semantics.
libraries/rush-daemon/src/PhasedRequestRouter.ts Implements shared-build batching via a graph-owned coordinator; unions selections per batch; refactors result derivation per client subset.
libraries/rush-daemon/src/PhasedRequestEventSink.ts Threads write-failure errors through the sink writer so the router can deactivate a client with error context.
libraries/rush-daemon/src/PhasedRequestEventMultiplexer.ts Expands from a single request sink to a set of concurrent request sinks for multi-client fan-out.
libraries/rush-daemon/README.md Updates documentation to describe shared-build coalescing, batching boundaries, and cancellation semantics.
common/changes/@rushstack/rush-daemon/mojazayeri-shared-build-merging_2026-08-22-00-11.json Records a minor change note for shared-build request merging behavior.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mojaza
mojaza force-pushed the mojazayeri-microsoft-rushd-ws2-shared-build-merge branch from 4275840 to 4ada182 Compare August 24, 2026 01:54
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mojaza
mojaza force-pushed the mojazayeri-microsoft-rushd-ws2-shared-build-merge branch from 4ada182 to 52025b3 Compare August 24, 2026 20:47
@mojaza mojaza closed this Aug 26, 2026
@mojaza mojaza reopened this Aug 26, 2026
@mojaza mojaza closed this Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants