Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Allow Rush plugin manifests to declare an optional supported Rush version range.",
"type": "patch"
}
],
"packageName": "@microsoft/rush",
"email": "TheLarkInn@users.noreply.github.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"changes": [
{
"packageName": "@rushstack/rush-reporter",
"comment": "Add scoped session reporting (createScopedReporter, RushSessionReporting, IScopedLogger, execution context) and plugin API version compatibility with a migration diagnostic",
"comment": "Add scoped session reporting (createScopedReporter, RushSessionReporting, IScopedLogger, execution context) and Rush version range compatibility with a migration diagnostic",
"type": "minor"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@rushstack/rush-reporter",
"comment": "Add reporter performance and capacity budgets: a perf module encoding the specification blocking budgets with wall-time and memory helpers, plus a ReporterManager.getPendingEventCount observability hook for bounded streaming",
"type": "minor"
}
],
"packageName": "@rushstack/rush-reporter",
"email": "TheLarkInn@users.noreply.github.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@rushstack/rush-reporter",
"comment": "Add the daemon-aligned major default-flip migration model: the reporter migration phases, pre-flip and post-flip major default sets, and a plugin apply gate that fails incompatible plugins before apply() with a structured migration diagnostic",
"type": "minor"
}
],
"packageName": "@rushstack/rush-reporter",
"email": "TheLarkInn@users.noreply.github.com"
}
7 changes: 7 additions & 0 deletions common/config/subspaces/default/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 104 additions & 10 deletions common/reviews/api/rush-reporter.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ export type BootstrapPrivacyClassification = 'public' | 'local-sensitive' | 'sec
// @beta
export function computeEnvelopePrivacyFloor(classifications: Iterable<ReporterPrivacyClassification>): ReporterPrivacyClassification;

// @beta
export function computeWallTimeRegressionPercent(baselineMs: number, candidateMs: number): number;

// @beta
export const COPILOT_CLI_ENV_VAR: 'COPILOT_CLI';

// @beta
export function createBeforeLogAdapter(hooks: readonly LegacyBeforeLogHook[]): (aggregate: ITelemetryAggregate) => void;
export function createBeforeLogAdapter(hooks: readonly LegacyBeforeLogHook[]): (aggregate: ITelemetryAggregate) => Record<string, unknown>;

// @beta
export function createColorizer(enabled: boolean): IColorizer;
Expand All @@ -80,7 +83,7 @@ export function createColorizer(enabled: boolean): IColorizer;
export function createEngineSink(providedSink?: IReporterEventSink): IEngineSinkResolution;

// @beta
export function createPluginApiIncompatibleDiagnostic(manifest: IRushPluginManifest): IRushDiagnostic;
export function createPluginApiIncompatibleDiagnostic(manifest: IRushPluginManifest, rushVersion: string): IRushDiagnostic;

// @beta
export function createRushDiagnostic(code: RushDiagnosticCodes, options?: ICreateRushDiagnosticOptions): IRushDiagnostic;
Expand All @@ -94,6 +97,9 @@ export function createScopedReporter(options: ICreateScopedReporterOptions): ISc
// @beta
export function createTelemetryReporter(subscriber: TelemetrySubscriber): IReporter;

// @beta
export const DAEMON_ALIGNED_MAJOR_REPORTER_DEFAULTS: IReporterMajorDefaults;

// @beta
export const DEFAULT_FLUSH_TIMEOUT_MS: number;

Expand Down Expand Up @@ -133,6 +139,9 @@ export function detectAgent(env: Record<string, string | undefined>, configuredV
// @beta
export function encodeNdjsonRecord(value: unknown, options?: INdjsonOptions): string;

// @beta
export function evaluatePluginApplyGate(manifests: readonly IRushPluginManifest[], options: IPluginApplyGateOptions): IPluginApplyDecision[];

// @beta
export const EXIT_CODE_FAILURE: 1;

Expand Down Expand Up @@ -161,6 +170,9 @@ export class FileReporter implements IReporter {
// @beta
export function filterEventsForLogLevel(logLevel: ReporterLogLevel, events: readonly IReporterEventEnvelope<unknown>[]): IReporterEventEnvelope<unknown>[];

// @beta
export function getBlockedPlugins(decisions: readonly IPluginApplyDecision[]): IPluginApplyDecision[];

// @beta
export function getEventMinimumLogLevel(event: IReporterEventEnvelope<unknown>): ReporterLogLevel;

Expand All @@ -170,6 +182,9 @@ export function getLogLevelRank(level: ReporterLogLevel): number;
// @beta
export function getPrivacyClassificationRank(classification: ReporterPrivacyClassification): number;

// @beta
export function getReporterMigrationPhase(id: ReporterMigrationPhaseId): IReporterMigrationPhase;

// @beta
export function getSignalExitCode(signal: NodeJS.Signals): number;

Expand Down Expand Up @@ -273,6 +288,13 @@ export interface IAutomaticReporterPlan {
readonly stdoutOwner: 'machine' | 'human';
}

// @beta
export interface IAutomaticSelectionContext {
readonly emergencyLegacyFallback?: boolean;
readonly experimentalSettingEnabled?: boolean;
readonly explicitOptIn?: boolean;
}

// @beta
export interface IBootstrapEventBufferOptions {
readonly maxBytes?: number;
Expand Down Expand Up @@ -615,6 +637,19 @@ export interface IPlaintextReporterOptions {
readonly write: (text: string) => void;
}

// @beta
export interface IPluginApplyDecision {
readonly allowed: boolean;
readonly diagnostic?: IRushDiagnostic;
readonly manifest: IRushPluginManifest;
}

// @beta
export interface IPluginApplyGateOptions {
readonly gateEnabled?: boolean;
readonly rushVersion: string;
}

// @beta
export interface IProblemMatch {
readonly code?: string;
Expand Down Expand Up @@ -772,6 +807,18 @@ export interface IReporterHostOptions {
readonly retentionMs?: number;
}

// @beta
export interface IReporterMajorDefaults {
readonly automaticSelectionEnabledByDefault: boolean;
readonly emergencyFallbackEnvVar: string;
readonly emergencyFallbackReporterName: string;
readonly gateIncompatiblePluginsBeforeApply: boolean;
readonly legacyRendererRetained: boolean;
readonly removedTerminalApis: readonly string[];
readonly sentinelBridgeRetained: boolean;
readonly verbosityAliasesRetained: boolean;
}

// @beta
export interface IReporterManagerOptions {
readonly coalesceThreshold?: number;
Expand All @@ -780,6 +827,16 @@ export interface IReporterManagerOptions {
readonly protocolVersion?: IReporterProtocolVersion;
}

// @beta
export interface IReporterMigrationPhase {
readonly id: ReporterMigrationPhaseId;
readonly independentlyReleasable: boolean;
readonly ordinal: number;
readonly revertible: boolean;
readonly summary: string;
readonly title: string;
}

// @beta
export interface IReporterOutputTarget {
readonly params: {
Expand All @@ -789,6 +846,15 @@ export interface IReporterOutputTarget {
readonly target: string;
}

// @beta
export interface IReporterPerformanceBudgets {
readonly maxAdditionalPeakMemoryBytes: number;
readonly maxAiDetailedDiagnostics: number;
readonly maxAiOutputBytes: number;
readonly maxInteractiveRefreshHz: number;
readonly maxWallTimeRegressionPercent: number;
}

// @beta
export interface IReporterPlanEntry {
readonly destination: string;
Expand Down Expand Up @@ -901,8 +967,8 @@ export interface IRushFileDiagnosticSource {

// @beta
export interface IRushPluginManifest {
readonly pluginApiVersion: string;
readonly pluginName: string;
readonly rushVersionRange: string;
}

// @beta
Expand Down Expand Up @@ -933,6 +999,9 @@ export function isAgentVariableActive(value: string | undefined): boolean;
// @beta
export function isAlreadyReportedSentinel(error: unknown): boolean;

// @beta
export function isAutomaticSelectionEnabled(defaults: IReporterMajorDefaults, context?: IAutomaticSelectionContext): boolean;

// @beta
export function isBootstrapHandoffFileName(fileName: string): boolean;

Expand Down Expand Up @@ -961,6 +1030,9 @@ export interface IScopedReporter {
emitMessage(options: IScopedMessageOptions): string;
}

// @beta
export function isEmergencyLegacyFallback(env: Record<string, string | undefined>, defaults?: IReporterMajorDefaults): boolean;

// @beta
export interface ISessionCompletedPayload {
readonly durationMs?: number;
Expand Down Expand Up @@ -989,9 +1061,6 @@ export function isLegacyEmergencyFallbackRequested(env: Record<string, string |
// @beta
export function isMachineReporter(reporter: ReporterName): boolean;

// @beta
export function isPluginApiVersionSupported(declaredApiVersion: string, supportedApiVersion?: string): boolean;

// @beta
export function isReporterEventRequired(type: ReporterEventType): boolean;

Expand All @@ -1001,15 +1070,27 @@ export function isReporterExtensionEventName(name: string): name is ReporterExte
// @beta
export function isReporterProtocolCompatible(consumer: IReporterProtocolVersion, producer: IReporterProtocolVersion): boolean;

// @beta
export function isRushVersionSupported(rushVersionRange: string, rushVersion: string): boolean;

// @beta
export function isSupportedLogLevel(level: string): level is ReporterLogLevel;

// @beta
export function isSupportedReporterName(name: string): name is ReporterName;

// @beta
export function isTerminalApiRemoved(api: string, defaults?: IReporterMajorDefaults): boolean;

// @beta
export function isValidRushDiagnosticCode(code: string): boolean;

// @beta
export function isWithinMemoryBudget(additionalPeakBytes: number, budgets?: IReporterPerformanceBudgets): boolean;

// @beta
export function isWithinWallTimeBudget(baselineMs: number, candidateMs: number, budgets?: IReporterPerformanceBudgets): boolean;

// @beta
export interface ITelemetryAggregate {
readonly commandName?: string;
Expand Down Expand Up @@ -1165,7 +1246,7 @@ export class OldEngineOutputAdapter {
export type OneOrMoreRushDiagnosticCodeSegments<TSegments extends string = string> = string extends TSegments ? `_${Uppercase<string>}` : TSegments extends `_${infer Segments}` ? Segments extends '' ? never : TSegments extends Uppercase<TSegments> ? TSegments : never : never;

// @beta
export type OperationStatus = 'ready' | 'executing' | 'success' | 'successWithWarnings' | 'failure' | 'blocked' | 'skipped' | 'fromCache' | 'noOp';
export type OperationStatus = 'ready' | 'waiting' | 'queued' | 'executing' | 'success' | 'successWithWarnings' | 'failure' | 'blocked' | 'skipped' | 'fromCache' | 'noOp' | 'aborted';

// @beta
export class OperationStreamEmitter {
Expand Down Expand Up @@ -1212,6 +1293,9 @@ export type PlaintextVariant = 'detailed' | 'concise';
// @beta
export function planAutomaticReporters(selection: IReporterSelection): IAutomaticReporterPlan;

// @beta
export const PRE_FLIP_REPORTER_DEFAULTS: IReporterMajorDefaults;

// @beta
export class ProblemMatcherRegistry {
getMatchers(tool: string, options?: IGetMatchersOptions): IProblemMatcher[];
Expand All @@ -1234,6 +1318,9 @@ export function regroupOperationOutput(events: readonly IReporterEventEnvelope<u
// @beta
export function relayHeftChildOutput(child: IHeftChildOutputStreams, targets?: IHeftChildOutputTargets): void;

// @beta
export const REMOVED_TERMINAL_APIS: readonly string[];

// @beta
export function renderActiveProjectsRow(projects: readonly string[], width: number): string;

Expand All @@ -1246,9 +1333,15 @@ export const REPORTER_EVENT_TYPES: readonly ["sessionStarted", "sessionCompleted
// @beta
export const REPORTER_KNOWN_CAPABILITIES: readonly [];

// @beta
export const REPORTER_MIGRATION_PHASES: readonly IReporterMigrationPhase[];

// @beta
export const REPORTER_PACKAGE_NAME: '@rushstack/rush-reporter';

// @beta
export const REPORTER_PERFORMANCE_BUDGETS: IReporterPerformanceBudgets;

// @beta
export const REPORTER_PROTOCOL_LIMITS: IReporterProtocolLimits;

Expand Down Expand Up @@ -1296,6 +1389,7 @@ export class ReporterManager implements IReporterEventSink {
closeAsync(timeoutMs?: number): Promise<void>;
emit<TPayload>(event: IReporterEmitEventInput<TPayload>): string;
flushAsync(timeoutMs?: number): Promise<void>;
getPendingEventCount(): number;
ingestForeignEnvelope(envelope: IReporterEventEnvelope<unknown>): string;
initializeAsync(): Promise<void>;
signalFlushAsync(timeoutMs?: number): Promise<void>;
Expand All @@ -1304,6 +1398,9 @@ export class ReporterManager implements IReporterEventSink {
// @beta
export type ReporterMessageSeverity = 'debug' | 'info' | 'warning' | 'error';

// @beta
export type ReporterMigrationPhaseId = 'contractsAndBaselines' | 'bootstrapAndCompatAdapters' | 'shadowStructuredEmission' | 'optInReporters' | 'heftProtocolTrack' | 'daemonAlignedMajorFlip' | 'laterCleanupMajor';

// @beta
export class ReporterMultiplexer implements IReporter {
constructor(name: string, reporters: readonly IReporter[]);
Expand Down Expand Up @@ -1423,9 +1520,6 @@ export const RUSH_INTERNAL_ERROR_CODE: 'RUSH_INTERNAL_UNEXPECTED';
// @beta
export const RUSH_LOGS_DIR_NAME: 'rush-logs';

// @beta
export const RUSH_PLUGIN_API_VERSION: '1.0.0';

// @beta
export const RUSH_REPORTER_BOOTSTRAP_HANDOFF_ENV_VAR: '_RUSH_REPORTER_BOOTSTRAP_HANDOFF';

Expand Down
8 changes: 6 additions & 2 deletions libraries/reporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"devDependencies": {
"@rushstack/heft": "workspace:*",
"eslint": "~9.37.0",
"local-node-rig": "workspace:*"
"local-node-rig": "workspace:*",
"@types/semver": "7.7.1"
},
"peerDependencies": {
"@types/node": "*"
Expand All @@ -59,5 +60,8 @@
"optional": true
}
},
"sideEffects": false
"sideEffects": false,
"dependencies": {
"semver": "~7.7.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
export const CONFIGURATION_DIAGNOSTIC_TEMPLATES = {
'diagnostic.RUSH_CONFIG_INVALID_JSON.summary': 'The configuration file {file} contains invalid JSON.',
'diagnostic.RUSH_PLUGIN_API_INCOMPATIBLE.summary':
'The plugin {pluginName} declares plugin API version {declaredApiVersion}, which is incompatible with this Rush (supported: {supportedApiVersion}).'
'The plugin {pluginName} supports Rush {rushVersionRange}, which does not include the running Rush version {rushVersion}.'
} as const;
Loading