Skip to content

Add Rush reporter frontend controls - #5989

Merged
Sean Larkin (TheLarkInn) merged 3 commits into
mainfrom
copilot/reporter-r2b-frontend-host-controls
Sep 11, 2026
Merged

Add Rush reporter frontend controls#5989
Sean Larkin (TheLarkInn) merged 3 commits into
mainfrom
copilot/reporter-r2b-frontend-host-controls

Conversation

@TheLarkInn

@TheLarkInn Sean Larkin (TheLarkInn) commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

  • create the authoritative ReporterHost/ReporterManager in apps/rush before Rush version selection and pass selected rush-lib only an IReporterEventSink
  • register and parse global --reporter, --output, --log-level, --quiet, --verbose, and --debug controls while preserving command-specific --json
  • keep the pre-major default on the legacy path; explicit non-legacy --reporter or the repository useRushReporter experiment enables reporters, agent auto-selection remains disabled, and RUSH_REPORTER=legacy strips reporter-only controls before legacy-engine handoff
  • retain existing -v meanings for rush list, rush change, and phased build commands

Stack

This is the R2B child of #5987. Keep auto-merge disabled while any ancestor is open. Merge and retarget #5985, #5986, and #5987 in order; only after #5987 merges should this PR be retargeted to main and considered for auto-merge.

Validation

  • rush build --to @microsoft/rush --verbose
  • rush test --only @microsoft/rush --only @microsoft/rush-lib --only @rushstack/rush-reporter --verbose
  • node libraries/reporter/scripts/generateBootstrapProtocol.js --check
  • rush check
  • rush change --verify --no-fetch
  • gh pr diff 5989 contains only the 18-file R2B frontend/control slice

Legacy safety

  • frontend-owned --reporter, --output, and --log-level controls are removed before every Rush engine handoff, including repository-pinned older engines
  • no opt-in registers a visible reporter, including TTY, non-TTY, CI, and agent environments
  • RUSH_REPORTER=legacy remains the emergency override even when non-legacy or contradictory reporter controls are present
  • legacy combinations such as --quiet --debug remain valid when the reporter path is disabled
  • rush-pnpm --reporter and rushx arguments remain outside Rush reporter parsing

Repository opt-in

  • useRushReporter is read before version selection
  • TTY selects the interactive reporter; CI and generic non-TTY select plaintext
  • agent detection is deliberately excluded from repository opt-in selection until R8

Non-goals

  • no bootstrap handoff replay or prelude work (R6)
  • no operation stream rendering or StreamCollator replacement (R5)

Part of #5975

@TheLarkInn

Copy link
Copy Markdown
Member Author

Stack integration review found and fixed three actionable issues in 42b0fae: frontend-only value flags no longer leak to repository-pinned engines; legacy verbosity combinations remain compatible, including under RUSH_REPORTER=legacy; and the repository useRushReporter opt-in is consumed before version selection with deterministic TTY/CI/non-TTY behavior while agent auto-selection stays disabled. Ordering gate: after #5985 merges and both PRs move to main, #5987 must merge before #5989 because #5987 owns the schema/API for the experiment that #5989 consumes.

@TheLarkInn
Sean Larkin (TheLarkInn) changed the base branch from copilot/reporter-r1a-package-wiring to copilot/reporter-r2a-experiment-config August 28, 2026 04:33
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r2b-frontend-host-controls branch from 42b0fae to c54a29b Compare August 28, 2026 04:33
@TheLarkInn

Copy link
Copy Markdown
Member Author

Linearized stack update: rebased the two R2B-only commits onto fresh origin/copilot/reporter-r2a-experiment-config and force-pushed with lease. New head is c54a29b; base is now copilot/reporter-r2a-experiment-config. The GitHub diff exactly matches the local R2A-to-R2B file list, with no R2A schema/API files included. Combined targeted tests, rush check, and changefile verification pass. Auto-merge remains disabled while #5985 and #5987 are open.

@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r2b-frontend-host-controls branch from c54a29b to 732e704 Compare August 28, 2026 04:37
@TheLarkInn

Copy link
Copy Markdown
Member Author

Linear stack update: R2B is now head 732e704 based on #5987. Its GitHub diff is exactly the 18-file frontend/control slice. Final-tip build/tests, generation check, rush check, and change verification pass; auto-merge remains disabled while ancestors are open.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Combined deep review of current head 732e7048f7.

  1. HIGH RushReporterHost.ts:184-244 parses and strips reporter-shaped arguments after the -- separator. Pass-through tool arguments can be consumed or rejected. Stop both scans at --.
  2. MEDIUM RushFrontend.ts:37-66 initializes frontend-owned reporters without an exactly-once success close path. Files, descriptors, and latest.log can remain incomplete until process exit. Add an awaitable close contract for success, failure, parser rejection, and termination.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Fixed both deep-review findings in 709357f. Reporter control scans and stripping now stop at the first standalone --, preserving all pass-through arguments. Frontend-owned reporters now use one awaitable close promise across normal success, engine and parser failures, selector failures, explicit exits, older-engine beforeExit, and bounded signal termination. Tests passed: reporter 295, rush-lib 752, apps/rush 27, rush check, and stacked-base change verification.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Four-review rerun on 709357fced confirms the original separator and normal close fixes. Five actionable findings remain:

  1. CRITICAL Global --verbose collides with existing action flags. rush build --verbose, rush rebuild --verbose, and rush check --verbose can fail as ambiguous. Preserve existing action syntax.
  2. HIGH Global reporter parameter names can collide with repository custom command parameters. Detect conflicts early or avoid parser-level collisions.
  3. HIGH An older selected engine can still initialize reporters, strip an explicit request, and never close on process.exit(). Reject unsupported explicit requests and keep old engines on a closed legacy path.
  4. MEDIUM A signal can join an existing longer close and miss the advertised two-second wall-clock deadline.
  5. MEDIUM Signal and beforeExit handlers are installed even when reporting is disabled, changing the no-opt-in legacy path.

Useful low follow-ons: close errors should not replace the command result, and current -- preservation is frontend-only because Rush actions do not yet consume a remainder. Descendant remediation stays paused.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Round two fixed in 5f8ef5e. Reporter options are no longer ts-command-line globals, so existing build, rebuild, check, and repository custom parameters retain their action-owned behavior. Explicit non-legacy reporter requests reserve reporter value controls; implicit opt-in preserves custom output and log-level parameters. Incompatible engines now reject explicit reporters before initialization and otherwise stay on disabled legacy behavior. Lifecycle handlers are installed only when enabled, signals use one two-second wall-clock deadline, and close errors set failure state without replacing command errors. Tests passed: reporter 295, rush-lib 757, apps/rush 38, regenerated snapshots, rush check, and stacked-base change verification.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Four-review rerun on 5f8ef5e948 confirms all prior compatibility and lifecycle fixes. Two related flag-ownership gaps remain:

  1. HIGH An unsupported --reporter value is still claimed by the frontend, breaking custom commands that historically own --reporter, including common test reporter values. Preserve it unless the frontend has an explicit supported reporter request or repository opt-in ownership.
  2. MEDIUM RUSH_REPORTER=legacy plus explicit --reporter=legacy can strip valid custom --output and --log-level parameters. Strip only the reporter selection flag in that case.

Auto-merge remains disabled. Descendant remediation stays paused.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Final focused ownership fix is in c732e19. Unsupported custom --reporter values such as junit now pass through unchanged until repository opt-in, a supported reporter name, or a reporter-shaped output establishes frontend ownership. RUSH_REPORTER=legacy with explicit --reporter=legacy strips only the selection flag, preserving custom output, log-level, and verbose parameters. Incompatible engines retain the explicit failure and legacy-safe escape paths with clearer contract wording. Tests passed: reporter 295, rush-lib 757, apps/rush 44, parser snapshots, rush check, and stacked-base change verification.

@TheLarkInn

Copy link
Copy Markdown
Member Author

Four-review gate on c732e195b5 confirms the prior findings are fixed. One MEDIUM compatibility gap remains: a repository custom command that owns a value-less --reporter flag still fails during the frontend ownership probe before Rush loads the command definition.

Required fix: make the probe tolerant of missing values and raise requires a value only after frontend ownership is established. Add a custom flag fixture.

One dismissible low follow-on remains: repository opt-in currently rejects contradictory legacy verbosity aliases that the legacy path accepts.

@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r2b-frontend-host-controls branch from d5af039 to 6490831 Compare September 3, 2026 18:43
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r2b-frontend-host-controls branch from 544110e to 1cef79b Compare September 3, 2026 20:14
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r2b-frontend-host-controls branch from 1cef79b to 1f4a982 Compare September 3, 2026 20:15
@TheLarkInn

Copy link
Copy Markdown
Member Author

Deep review of current head 1f4a982 found no critical, high, or medium actionable issues. Initialization failures now force a nonzero exit before reporter completion and close exactly once. Merge remains gated by #5987 and maintainer approval.

@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r2b-frontend-host-controls branch from 1f4a982 to 61a3e54 Compare September 4, 2026 18:49
@TheLarkInn

Copy link
Copy Markdown
Member Author

Deep review found three high actionable issues on current head 61a3e54c73:

  1. High: apps/rush/src/MinimalRushConfiguration.ts, loadFromDefaultLocation(). Configuration discovery can write plaintext before JSON or AI output. This corrupts machine stdout and remains present on the [rush reporter][R6A] Add bootstrap handoff and compatibility adapters #5993 fork. Suppress discovery output before reporter selection and emit it only on the legacy path.
  2. High: libraries/rush-lib/src/cli/actions/ListAction.ts:128-193 and similar non-phased actions. Direct console and terminal writes bypass reporter ownership, corrupt machine output, and omit visible text from file logs. Add reporter-aware current-engine stream observation with safe passthrough for already-rendered human or command JSON output.
  3. High: libraries/rush-lib/src/api/EnvironmentConfiguration.ts, EnvironmentVariableNames and validate(). RUSH_REPORTER and RUSH_LOG_LEVEL are rejected by the strict environment allowlist. The emergency rollback can therefore break rushx and rush-pnpm. Register both as frontend-owned controls and add regression coverage.

@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.

R2 acceptance review against #5975 and the documented emergency fallback/output-ownership contracts.

Comment thread apps/rush/src/RushReporterHost.ts
Comment thread apps/rush/src/RushReporterHost.ts
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r2b-frontend-host-controls branch from 28e30b0 to ebbb477 Compare September 10, 2026 01:30
@TheLarkInn

Copy link
Copy Markdown
Member Author

Stack6007 refresh completion: the eight core layers and three dependent side branches are published with their reviewed scopes, public API deltas and side-branch histories preserved. All11 current heads passed all66 complete platform workflows, including package-manager and repeated-cache stages; the trunk conflict at this PR is cleared and GitHub now reports it mergeable. Current R2B head is ebbb477, CI34425756818. The isolated unchanged benchmark failure passed one evidence-backed failed-job retry; no source assertion or performance threshold was altered. Original23 review findings remain resolved. Independent approvals and dependency-ordered landing are still required; no PR was merged or package released.

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

Repository opt-in controls, global verbose handling, rollback stripping, and file log-level behavior have unresolved correctness issues.

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

Review tier: Balanced
Findings: 4 Medium severity

New issues introduced by this change (4)
Severity Finding
Medium severity apps/​rush/​src/​RushFrontend.ts — Only value controls are removed here, but --verbose is also interpreted as a reporter log-level…
Medium severity apps/​rush/​src/​RushReporterHost.ts — When rollback bypasses strict parsing, a value-less control can consume the following legacy flag.…
Medium severity apps/​rush/​src/​RushReporterHost.ts — Repository opt-in does not actually support the new value controls unless --reporter is also…
Medium severity apps/​rush/​src/​RushReporterHost.ts — The primary file reporter is wrapped at the selection's default normal level, which drops…
What changed in this PR

Adds frontend-owned reporter selection, lifecycle management, controls, and legacy compatibility before Rush engine selection.

Changes:

  • Introduces reporter host selection, output routing, and deterministic cleanup.
  • Passes reporter sink/close hooks into rush-lib.
  • Adds experiment loading, pass-through handling, documentation, and tests.
File Description
specs/​2026-07-12-rush-reporter-overhaul.md Documents stream targets and legacy override.
libraries/​rush-lib/​src/​cli/​test/​RushCommandLineParserReporterClose.test.ts Tests parser cleanup and controls.
libraries/​rush-lib/​src/​cli/​test/​RushCommandLineParser.test.ts Tests custom parameter preservation.
libraries/​rush-lib/​src/​cli/​test/​basicAndRunRebuildActionRepo/​custom-reporter-flag.js Captures custom flag arguments.
libraries/​rush-lib/​src/​cli/​test/​basicAndRunRebuildActionRepo/​common/​config/​rush/​command-line.json Defines custom reporter flag fixture.
libraries/​rush-lib/​src/​cli/​test/​basicAndRunBuildActionRepo/​custom-output.js Captures custom output arguments.
libraries/​rush-lib/​src/​cli/​test/​basicAndRunBuildActionRepo/​common/​config/​rush/​command-line.json Defines overlapping custom controls.
libraries/​rush-lib/​src/​cli/​RushCommandLineParser.ts Integrates reporter finalization.
libraries/​rush-lib/​src/​api/​Rush.ts Forwards the frontend close hook.
libraries/​reporter/​src/​test/​ExitStatus.test.ts Tests pass-through JSON handling.
libraries/​reporter/​src/​exit/​CommandJson.ts Stops control scanning at --.
common/​changes/​@rushstack/​rush-reporter/​reporter-r2b-json-controls_2026-09-07.json Records reporter package change.
common/​changes/​@microsoft/​rush/​reporter-foundation-controls_2026-09-09.json Records control compatibility change.
common/​changes/​@microsoft/​rush/​copilot-reporter-r2b-frontend-host-controls_2026-08-28-03-00.json Records frontend integration change.
apps/​rush/​src/​test/​sandbox/​repo/​common/​config/​rush/​experiments.json Enables reporter fixture experiment.
apps/​rush/​src/​test/​RushReporterHost.test.ts Tests reporter selection and outputs.
apps/​rush/​src/​test/​RushFrontend.test.ts Tests frontend lifecycle and handoff.
apps/​rush/​src/​test/​MinimalRushConfiguration.test.ts Tests experiment loading.
apps/​rush/​src/​start.ts Launches through the new frontend.
apps/​rush/​src/​start-dev.ts Uses the frontend in development.
apps/​rush/​src/​RushVersionSelector.ts Carries frontend launch options.
apps/​rush/​src/​RushReporterHost.ts Implements controls and reporter host.
apps/​rush/​src/​RushFrontend.ts Coordinates selection, handoff, and cleanup.
apps/​rush/​src/​RushCommandSelector.ts Uses the frontend launch contract.
apps/​rush/​src/​MinimalRushConfiguration.ts Reads repository reporter opt-in.
apps/​rush/​src/​IRushFrontendLaunchOptions.ts Defines the cross-version contract.

💡 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/RushFrontend.ts
Comment thread apps/rush/src/RushReporterHost.ts Outdated
Comment thread apps/rush/src/RushReporterHost.ts Outdated
Comment thread apps/rush/src/RushReporterHost.ts
Base automatically changed from copilot/reporter-r2a-experiment-config to main September 10, 2026 20:23
Preserve the exact published R2B slice and review corrections while reconciling native private members and replacing unbranded parser test objects with real execution paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
Share separated-value recognition with stripping so valueless controls cannot consume legacy flags, and use debug only as the unrequested primary file log-level default.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
Consume --verbose only for known actions that do not define it and parse repository opt-in value controls only when they are not command-owned. Preserve native aliases, declared custom values, unresolved plugin namespaces, and pass-through arguments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4747f826-8c83-495d-80df-3d1168662e10
@TheLarkInn
Sean Larkin (TheLarkInn) force-pushed the copilot/reporter-r2b-frontend-host-controls branch from 68cab2b to 55e4328 Compare September 10, 2026 20:23
@TheLarkInn
Sean Larkin (TheLarkInn) merged commit bd9a9ad into main Sep 11, 2026
10 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-r2b-frontend-host-controls branch September 11, 2026 00:29
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