Skip to content

Reporter overhaul (4/6): opt-in reporters, selection, StreamCollator replacement#5868

Open
TheLarkInn wants to merge 22 commits into
reporter/3-shadow-emissionfrom
reporter/4-opt-in-reporters
Open

Reporter overhaul (4/6): opt-in reporters, selection, StreamCollator replacement#5868
TheLarkInn wants to merge 22 commits into
reporter/3-shadow-emissionfrom
reporter/4-opt-in-reporters

Conversation

@TheLarkInn

@TheLarkInn TheLarkInn commented Jul 15, 2026

Copy link
Copy Markdown
Member

📚 Reporter Overhaul PR stack (merge bottom-up)

# PR Phase Base
1 #5865 Contracts & baselines (package) main
2 #5866 Bootstrap & compatibility #5865
3 #5867 Shadow structured emission #5866
4 #5868 Opt-in reporters #5867
5 #5869 Heft protocol track #5868
6 #5870 Perf budgets & default flip #5869

Each PR's diff is scoped to its phase; review independently, merge from #5865 upward.

👉 This is PR 4 of 6.

Phase 4 — Opt-in reporters (RFC §8.1)

Adds the actual reporters plus selection/config, and replaces StreamCollator only on the new reporter path.

What's included

  • Selection & config — reporter selection precedence (--reporter/RUSH_REPORTER/agent/CI/TTY), independent per-reporter log levels, and the automatic environment matrix.
  • Reportersdefault interactive (3-row live region), plaintext/non-TTY, json, bounded ai, full-detail file (owner-only perms, retention, OS-temp fallback), and legacy (selectable + emergency fallback).
  • StreamCollator replacement — raw semantic operation events in the primary output path.
  • External output — lossless preservation + diagnostic recovery via problem matchers.
  • Legacy error bridge — prohibit new AlreadyReportedError usage; correlate legacy sentinels with emitted diagnostics.

Validation

  • rush build --to @rushstack/reporterrush test --only @rushstack/reporter ✅ (adds ReporterSelection, LogLevelFilter, AutomaticReporterMatrix, the reporter suites, OperationStreamEmitter, ProblemMatchers, LegacyErrorBridge)
  • All exports @beta.

Scope note

Standalone package; not yet wired into the live CLI. Independently releasable/revertible per RFC §8.1.

TheLarkInn and others added 16 commits July 15, 2026 04:52
Resolve the reporter and log level from controls for @rushstack/reporter (#5858).

- Add the built-in reporter names and log levels with validation guards
- Add agent and CI detection, including COPILOT_CLI and configured agent
  environment variables and the active-value semantics
- Parse the --output control into reporter, target, and params
- Add resolveReporterSelection: the primary reporter runs from explicit CLI
  through RUSH_REPORTER, agent, CI, and TTY down to generic non-TTY plaintext,
  and always pairs with the file reporter
- Resolve the log level independently, mapping --quiet, --verbose, and --debug
  aliases and rejecting contradictions
- Keep command-specific --json distinct from the json reporter and fail explicit
  unsupported reporter or log-level requests
- Cover precedence, aliases, contradictions, outputs, and detection with tests

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Add per-reporter log-level filtering for @rushstack/reporter (#5858).

- Classify each event to a minimum log level and add shouldRenderAtLogLevel and
  filterEventsForLogLevel so each reporter applies quiet, normal, verbose, or
  debug filtering independently
- Keep diagnostic severity separate from the reporter log level: severity sets
  the minimum level while the reporter's configured level gates rendering
- Default the full-detail file reporter to debug
- Cover ranking, classification, per-level rendering, monotonicity, and the
  severity separation with tests

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Resolve the automatic reporter plan by environment for @rushstack/reporter (#5858).

- Add planAutomaticReporters, which pairs ai with file for an agent, detailed
  plaintext with file for CI, default with file for an interactive TTY, and
  concise plaintext with file otherwise
- Give machine reporters (ai, json) exclusive stdout and route human progress to
  stderr, with emergency diagnostics always on stderr
- Add describeReporterPlan to record the selection reason and reporters in the
  detailed log
- Cover the full matrix, machine stdout ownership, and the plan description with
  tests

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Add the concise default reporter for @rushstack/reporter (#5858).

- Add interactive rendering helpers: a spinner, color resolution honoring
  NO_COLOR and FORCE_COLOR, width-aware active projects with +N more, and a
  three-row live region renderer that truncates before coloring
- Add DefaultInteractiveReporter, which paints the live region at no more than
  10 Hz, reacts to terminal width, hides and restores the cursor, leaves at most
  three stable lines on success, appends a bounded diagnostic block and log path
  on failure, and appends one summary per completed watch cycle
- Cover rendering helpers and reporter behavior with an injected terminal and
  clock

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Add the plaintext reporter for @rushstack/reporter (#5858).

- Add PlaintextReporter, an append-only reporter that never moves the cursor and
  disables color by default
- Emit the start line, meaningful operation state changes, diagnostics, and the
  final result
- Add a compact 30-second heartbeat for long non-TTY and CI sessions
- Retain StreamCollator-like operation grouping in the detailed CI variant by
  grouping each operation's output under a header
- Add stable concise and detailed plaintext snapshot tests

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Add the machine reporters for @rushstack/reporter (#5858).

- Add JsonReporter, which emits the complete versioned NDJSON event stream on
  exclusive stdout and replaces an oversized record with a valid marker
- Add AiReporter, a bounded projection that emits a status record and a final
  record with the result, scope, error codes and categories, structured
  remediation, aggregate counts, log reference, and artifact completeness
- Cap the AI record at 64 KiB and 20 detailed diagnostics, represent warnings by
  count when failures exist, and exclude raw output and stacks
- Keep the absolute log path in AI output while telemetry continues to exclude it
- Add stdout-purity tests for both reporters and a telemetry path cross-check

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Add the full-detail file reporter for @rushstack/reporter (#5858).

- Add FileReporter, which writes a debug NDJSON invocation log to
  <commonTempFolder>/rush-logs/<UTC timestamp>-<pid>-<action>.log with
  owner-only permissions and redacts fields classified as secret
- Maintain a latest.log pointer for both successful and failed commands
- Buffer events until the first flush and fall back to the OS temp folder
- Delete logs older than 14 days and cap retention at 20 sessions
- Treat failure at both paths as nonfatal, emitting an emergency warning and
  marking the artifact unavailable
- Cover writing, permissions, redaction, retention, fallback, and failure with
  tests against real temp directories

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Add the legacy reporter for @rushstack/reporter (#5858).

- Add LegacyReporter, which reproduces the current Rush output: the start line,
  the parallelism line, StreamCollator-style operation headers with grouped
  output, and a success or failure summary with durations
- Add isLegacyEmergencyFallbackRequested and confirm RUSH_REPORTER=legacy selects
  the legacy reporter as an emergency fallback
- Validate the reporter against the frozen legacy output snapshots

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
TheLarkInn and others added 6 commits July 15, 2026 04:52
Add the uncollated operation event stream for @rushstack/reporter (#5858).

- Add OperationStreamEmitter so the scheduler emits operation registration,
  status transitions, raw output chunks, and the aggregate command result
- Emit output chunks immediately in call order and never collate them, so the
  concise reporter derives activity without buffering while the detailed and
  file reporters own grouping
- Add iterateExternalOutput and regroupOperationOutput so problem matchers
  consume the uncollated stream and reporters reconstruct StreamCollator-parity
  grouping
- Cover emission, chunking, uncollated ordering, and reporter parity with tests

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Recover diagnostics from raw external output for @rushstack/reporter (#5858).

- Preserve raw stdout and stderr as ordered chunks and run matchers over an
  ANSI-normalized copy so the raw evidence and process status are never modified
- Add a tool- and version-scoped problem matcher registry gated on default
  enablement, routing older Heft versions through the version predicate
- Add runProblemMatchers, which reassembles lines split across chunks, links
  recovered diagnostics to the operation and source location, preserves
  unmatched text, and caps duplicate diagnostics
- Cover ANSI stripping, scoping, recovery, split chunks, the duplicate cap, and a
  representative corpus with tests

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Bridge the legacy sentinel error pattern for @rushstack/reporter (#5858).

- Deprecate AlreadyReportedError so new usage is prohibited now that structured
  diagnostics and RushError are available
- Add LegacyErrorBridge, which observes emitted diagnostics, correlates legacy
  sentinels with them, and suppresses duplicate rendering of failures that are
  already represented
- Document the bridge removal criteria for a later major
- Cover sentinel detection, suppression, correlation, and the removal criteria
  with tests

Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
Assistant-model: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 897dcf7e-e6e8-4a84-85ca-34b93fa29be3
@TheLarkInn TheLarkInn force-pushed the reporter/3-shadow-emission branch from 73b545b to 9a7365d Compare July 15, 2026 04:53
@TheLarkInn TheLarkInn force-pushed the reporter/4-opt-in-reporters branch from beb5166 to 291cbc2 Compare July 15, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

1 participant