Skip to content

Add feature-flagged operation event adapter - #5996

Merged
Sean Larkin (TheLarkInn) merged 9 commits into
copilot/reporter-r3c-shadow-parityfrom
copilot/reporter-r5a-operation-adapter
Sep 11, 2026
Merged

Add feature-flagged operation event adapter#5996
Sean Larkin (TheLarkInn) merged 9 commits into
copilot/reporter-r3c-shadow-parityfrom
copilot/reporter-r5a-operation-adapter

Conversation

@TheLarkInn

Copy link
Copy Markdown
Member

Part of #5978

Stack

Parent: #5992 (copilot/reporter-r3c-shadow-parity)

#5985 -> #5986 -> #5987 -> #5989 -> #5988 -> #5991 -> #5992 -> this PR

R6 #5993 remains a parallel fork from #5989 and is not included here. Keep auto-merge disabled while stack ancestors are open.

Architecture

  • pass the frontend-owned reporter sink, session identity, and operation-stream opt-in to the selected Rush engine without exposing reporter instances or selection state
  • adapt the existing phase-aware OperationGraph.eventSink and OperationExecutionRecord hooks into the existing OperationStreamEmitter; scheduling and operation identity remain project x phase
  • emit registration (including silent metadata), previous/current status transitions, bounded ordered stdout/stderr chunks, authoritative stream close, and final operation outcome
  • retain the existing parser-owned aggregate commandResult hook instead of emitting a competing result path
  • bump the additive reporter protocol minor and update the beta API reviews/changefiles

Flag-off and presentation guarantee

When the reporter opt-in is disabled, the adapter does not expose a raw chunk callback, so OperationChunkTap is not installed. The existing StreamCollator, problem-matcher, stdout, and stderr pipeline remains byte-identical and authoritative.

When opted in, raw events flow to the manager, full-log file reporter, and explicit output sinks. The primary terminal reporter temporarily filters operation registration/status/output/close/completion events, so this slice cannot duplicate or suppress operation output while legacy collation still owns presentation.

Validation

  • rush test --only @rushstack/rush-reporter --only @microsoft/rush-lib --only @microsoft/rush --verbose (6 operations; reporter 295 tests, rush-lib 766 tests, apps/rush 19 tests)
  • rush build --to @rushstack/rush-reporter --to @microsoft/rush-lib --to @microsoft/rush --verbose (8 operations)
  • rush check
  • rush change --verify --no-fetch

Focused coverage includes event ordering, stdout/stderr separation, 64 KiB chunk boundaries, no duplicated/lost chunks, previous/current status and outcome mapping, phase-aware identity, repeated watch iteration identity, silent operations, no-sink behavior, disabled-tap behavior, and byte-identical flag-off output.

R5B non-goals

  • no compact spinner/activity/result UI
  • no plaintext/AI/legacy rendering parity ownership
  • no full-log demo fixture or documentation
  • no disabling of the legacy terminal destination
  • no removal of StreamCollator or duplicate-output cutover

@TheLarkInn Sean Larkin (TheLarkInn) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent R5A review completed against #5978 and RFC phase 4.

Fixed in ac92280:

  • collapsed sharded implementation records now feed one project x phase identity without losing shard output/failure state;
  • raw stdout/stderr is tapped before newline normalization, including CR and unterminated chunks;
  • cache-path terminal output now reaches the semantic stream;
  • scheduling/pre-execution hook failures cannot leave registered operations without close/completion events.

Validation: focused OperationGraphEventSink suite (12/12), plus the inherited full reporter/rush-lib/apps-rush matrix on #5997 (304/773/28). No unresolved review threads. Auto-merge remains disabled because #5992 and earlier ancestors are open.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Combined deep review of current head ac92280377.

  1. HIGH operation stream close and completion are delayed until the entire graph ends. Per-operation consumers retain output and cannot finalize promptly. Emit from each record terminal path, with the graph-end loop only as a backstop.
  2. MEDIUM protocol minor additions are marked required by default. Older same-major peers can accept the handshake and then discard the stream on an unknown event. Make new minor events optional through an explicit required set.
  3. LOW OperationGraph.ts:679-680 duplicates executionRecords.set.

@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r5a-operation-adapter branch from ac92280 to 11a7f84 Compare August 28, 2026 17:32
@TheLarkInn

Copy link
Copy Markdown
Member Author

Combined review findings fixed at 11a7f8462dd40b1d3c0d83ffafc5f0b748a80394.

  • Operation close and completion now emit exactly once from each terminal record path, after final output and runner cleanup. The graph-end loop is an idempotent backstop for unfinished records.
  • Protocol 1.1 operation terminal events are optional for 1.0 consumers. Unknown optional 1.1 events are skipped while the stream continues.
  • The duplicate execution-record insertion was removed.
  • Sharded mapping and aggregate status ownership remain inherited from Emit shadow Rush lifecycle events #5991 and are absent from the R5A delta.

Validation: reporter 298, rush-lib 782, apps/rush 47; focused operation tests 15; all three builds; API Extractor; rush check; stacked change verification. #5996 is CLEAN and auto-merge remains disabled pending fresh review.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Final combined review of 11a7f8462d found no critical, high, medium, or useful low issues. Per-operation finalization, exactly-once terminal events, runner cleanup ordering, graph backstops, additive minor compatibility, feature-off behavior, cache, and watch paths are review-clean.

@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r5a-operation-adapter branch from 11a7f84 to 2f2cab8 Compare September 3, 2026 17:25
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r5a-operation-adapter branch from 2f2cab8 to f1c8124 Compare September 3, 2026 18:15
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r5a-operation-adapter branch from f1c8124 to 3542fd9 Compare September 3, 2026 18:44
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r5a-operation-adapter branch from 3542fd9 to d1889d3 Compare September 3, 2026 20:01
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r5a-operation-adapter branch 2 times, most recently from 6a493da to 7db76c9 Compare September 3, 2026 20:15
Preserve operation stream/callback corrections and the owning forwarding consumer; reconcile native record/graph fields without changing scheduling or public contracts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The primary reporter currently suppresses unscoped external output in addition to operation-scoped chunks.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity apps/​rush/​src/​RushReporterHost.ts — This filters every externalOutput event from the primary reporter, not just the operation chunks…
What changed in this PR

Adds a feature-flagged adapter that publishes phase-aware operation streams while retaining legacy terminal presentation.

Changes:

  • Emits raw operation output, lifecycle transitions, stream closure, and completion events.
  • Adds protocol 1.1 event contracts and compatibility handling.
  • Forwards operation events through Rush frontend and daemon integrations.
File Description
libraries/​rush-lib/​src/​pluginFramework/​RushSession.ts Gates operation-stream emitters.
libraries/​rush-lib/​src/​logic/​operations/​test/​OperationGraphEventSink.test.ts Tests ordering, output, and outcomes.
libraries/​rush-lib/​src/​logic/​operations/​ReporterOperationEventSink.ts Adapts graph events to reporter events.
libraries/​rush-lib/​src/​logic/​operations/​OperationGraph.ts Registers and finalizes operation records.
libraries/​rush-lib/​src/​logic/​operations/​OperationExecutionRecord.ts Taps output and emits finalization.
libraries/​rush-lib/​src/​logic/​operations/​OperationEventSink.ts Extends operation sink callbacks.
libraries/​rush-lib/​src/​logic/​operations/​CacheableOperationPlugin.ts Taps cache-related output.
libraries/​rush-daemon/​src/​test/​PhasedRequestEventMultiplexer.test.ts Tests event forwarding.
libraries/​rush-daemon/​src/​PhasedRequestEventMultiplexer.ts Multiplexes completion and identity.
libraries/​reporter/​src/​test/​Telemetry.test.ts Updates protocol expectation.
libraries/​reporter/​src/​test/​ReporterHost.test.ts Tests minor-version replay.
libraries/​reporter/​src/​test/​Protocol.test.ts Tests protocol 1.1 policy.
libraries/​reporter/​src/​test/​OperationStreamEmitter.test.ts Tests new stream events.
libraries/​reporter/​src/​test/​Manager.test.ts Tests required flags.
libraries/​reporter/​src/​test/​LogLevelFilter.test.ts Tests new event levels.
libraries/​reporter/​src/​test/​IReporterEventEnvelope.test.ts Updates event-type coverage.
libraries/​reporter/​src/​test/​HeftIntegration.test.ts Tests optional-event compatibility.
libraries/​reporter/​src/​test/​__snapshots__/​Goldens.test.ts.snap Updates protocol golden.
libraries/​reporter/​src/​scheduler/​OperationStreamEmitter.ts Emits enriched operation streams.
libraries/​reporter/​src/​protocol/​ReporterProtocol.ts Bumps protocol minor version.
libraries/​reporter/​src/​lifecycle/​LifecycleEvents.ts Defines new payload contracts.
libraries/​reporter/​src/​index.ts Exports new payload types.
libraries/​reporter/​src/​frontend/​ReporterHost.ts Supports configurable protocol compatibility.
libraries/​reporter/​src/​events/​ReporterEventType.ts Adds optional 1.1 event types.
libraries/​reporter/​src/​events/​IReporterEventEnvelope.ts Clarifies required-event semantics.
libraries/​reporter/​src/​config/​LogLevelFilter.ts Classifies new events.
libraries/​reporter/​src/​bootstrap/​BootstrapEventBuffer.ts Applies centralized required policy.
common/​reviews/​api/​rush-reporter.api.md Updates reporter API review.
common/​reviews/​api/​rush-lib.api.md Updates Rush library API review.
common/​changes/​@rushstack/​rush-reporter/​copilot-reporter-r5a-operation-adapter_2026-08-28-06-35.json Records reporter change.
common/​changes/​@rushstack/​rush-daemon/​reporter-operation-forwarding_2026-09-07.json Records daemon change.
common/​changes/​@microsoft/​rush/​copilot-reporter-r5a-operation-adapter_2026-08-28-06-35.json Records Rush change.
apps/​rush/​src/​test/​RushReporterHost.test.ts Tests deferred primary presentation.
apps/​rush/​src/​test/​RushFrontend.test.ts Tests frontend stream flag.
apps/​rush/​src/​RushReporterHost.ts Defers operation presentation.
apps/​rush/​src/​RushFrontend.ts Passes operation-stream opt-in.

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

Comment thread apps/rush/src/RushReporterHost.ts Outdated
Address #5996 comment 3981270424 by deferring only operation-scoped external chunks. Cover real adapter stdout/stderr and command-scoped output in JSON and detailed plaintext without duplicating collated operation output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
Preserve the R5A post-configuration registration helper and NoOp/finalization paths instead of adding a duplicate ancestor callback. Combine terminal test imports without weakening raw output coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
Combine command-aware controls with R5A's scoped deferral rule while preserving final configured registration, lifetime completion, and all owning regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
Preserve the existing slice and current parent histories; only capture successful fixture setup diagnostics, without changing production behavior, warning policy, or watch assertions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
Preserve the existing slice and parent histories while carrying the validated test-helper correction.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
The newly landed parent tree is byte-identical to the already integrated parent. Preserve the entire reviewed slice tree and both parent histories while correcting ancestry after the protected stack-prefix squash landing. For R3C, exclude the 300 lines of duplicated old graph tests introduced by automatic merge; the final source, test, dependency and API trees are exactly unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
@TheLarkInn
Sean Larkin (TheLarkInn) merged commit 9aab11c into main Sep 11, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from Needs triage to Closed in Bug Triage Sep 11, 2026
@TheLarkInn
Sean Larkin (TheLarkInn) deleted the copilot/reporter-r5a-operation-adapter branch September 11, 2026 05:30
Sean Larkin (TheLarkInn) added a commit that referenced this pull request Sep 11, 2026
Land the four remaining reviewed Reporter core slices (#5992, #5996, #5997, #5998) together after exact-head approval, zero unresolved discussions, and all six current CI runs with 36 complete platform workflows were verified. Preserve opt-in behavior and existing quality gates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
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