Skip to content

Commit dfa83df

Browse files
TheLarkInnCopilot
andcommitted
Align performance-budget tests with manager-derived required flag
The coalescing-pressure test now proves protection with operationStatusChanged (protected by type) instead of a producer-set required flag, which the sink no longer accepts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 31fb8d9 commit dfa83df

2 files changed

Lines changed: 177 additions & 45 deletions

File tree

common/reviews/api/rush-reporter.api.md

Lines changed: 167 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## API Report File for "@rushstack/reporter"
1+
## API Report File for "@rushstack/rush-reporter"
22

33
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
44
@@ -83,7 +83,7 @@ export function createEngineSink(providedSink?: IReporterEventSink): IEngineSink
8383
export function createPluginApiIncompatibleDiagnostic(manifest: IRushPluginManifest): IRushDiagnostic;
8484

8585
// @beta
86-
export function createRushDiagnostic(code: string, options?: ICreateRushDiagnosticOptions): IRushDiagnostic;
86+
export function createRushDiagnostic(code: RushDiagnosticCodes, options?: ICreateRushDiagnosticOptions): IRushDiagnostic;
8787

8888
// @beta
8989
export function createScopedLogger(reporter: IScopedReporter): IScopedLogger;
@@ -200,7 +200,12 @@ export type HeftChildReporterMode = 'structured' | 'raw-fallback';
200200
// @beta
201201
export class HeftDescriptorHost {
202202
constructor(options: IHeftDescriptorHostOptions);
203+
createStreamProcessor(): {
204+
write(chunk: string): void;
205+
flush(): IHeftChildResult;
206+
};
203207
processChildNdjson(ndjson: string): IHeftChildResult;
208+
processChildRecord(record: unknown): boolean;
204209
processChildRecords(records: readonly unknown[]): IHeftChildResult;
205210
}
206211

@@ -311,12 +316,25 @@ export interface IBootstrapEventSource {
311316
readonly packageVersion: string;
312317
}
313318

319+
// @beta
320+
export interface IBootstrapHandoffHeader {
321+
readonly kind: 'bootstrapHandoff';
322+
readonly nonce: string;
323+
}
324+
325+
// @beta
326+
export interface IBootstrapHandoffWriteResult {
327+
readonly handoffPath: string;
328+
readonly nonce: string;
329+
}
330+
314331
// @beta
315332
export interface IBootstrapReplayResult {
316333
readonly direct: boolean;
317334
readonly eventCount: number;
318335
readonly handoffPath?: string;
319336
readonly replayed: boolean;
337+
readonly skipReason?: 'unreadable' | 'nonce-mismatch';
320338
}
321339

322340
// @beta
@@ -495,6 +513,7 @@ export interface IHeftChildResult {
495513
// @beta
496514
export interface IHeftDescriptorHostOptions {
497515
readonly forwardEnvelope: (envelope: IReporterEventEnvelope<unknown>) => void;
516+
readonly onNegotiation?: (result: IReporterHandshakeResult) => void;
498517
readonly parentOperationId?: string;
499518
readonly parentSessionId: string;
500519
readonly supportedCapabilities?: readonly string[];
@@ -545,6 +564,13 @@ export interface ILiveRegionState {
545564
readonly totalOperations: number;
546565
}
547566

567+
// @beta
568+
export interface IMessageEmittedPayload {
569+
readonly privacy?: ReporterPrivacyClassification;
570+
readonly severity: ReporterMessageSeverity;
571+
readonly text: string;
572+
}
573+
548574
// @beta
549575
export interface INdjsonOptions {
550576
readonly maxRecordBytes?: number;
@@ -664,7 +690,7 @@ export interface IReporterContext {
664690
}
665691

666692
// @beta
667-
export type IReporterEmitEventInput<TPayload> = Omit<IReporterEventEnvelope<TPayload>, 'eventId' | 'sequence' | 'timestamp'>;
693+
export type IReporterEmitEventInput<TPayload> = Omit<IReporterEventEnvelope<TPayload>, 'eventId' | 'sequence' | 'sourceSequence' | 'timestamp' | 'required'>;
668694

669695
// @beta
670696
export interface IReporterEngineDescriptor {
@@ -724,7 +750,7 @@ export interface IReporterFrontendDescriptor {
724750

725751
// @beta
726752
export interface IReporterHandshakeOptions {
727-
readonly supportedCapabilities?: readonly string[];
753+
readonly supportedCapabilities?: readonly ReporterCapability[];
728754
readonly supportedProtocolVersion: IReporterProtocolVersion;
729755
}
730756

@@ -737,19 +763,19 @@ export interface IReporterHandshakeResult {
737763

738764
// @beta
739765
export interface IReporterHello {
740-
readonly capabilities: string[];
766+
readonly capabilities: readonly string[];
741767
readonly kind: 'hello';
742768
readonly producerVersion: string;
743769
readonly protocolVersion: IReporterProtocolVersion;
744-
readonly requiredFeatures: string[];
770+
readonly requiredFeatures: readonly string[];
745771
}
746772

747773
// @beta
748774
export interface IReporterHelloAck {
749-
readonly acceptedCapabilities: string[];
775+
readonly acceptedCapabilities: readonly string[];
750776
readonly kind: 'helloAck';
751777
readonly protocolVersion: IReporterProtocolVersion;
752-
readonly rejectedRequiredFeatures: string[];
778+
readonly rejectedRequiredFeatures: readonly string[];
753779
}
754780

755781
// @beta
@@ -877,7 +903,7 @@ export interface IRunProblemMatchersOptions {
877903
export interface IRushDiagnostic {
878904
readonly category: RushDiagnosticCategory;
879905
readonly causeDiagnosticIds?: readonly string[];
880-
readonly code: string;
906+
readonly code: RushDiagnosticCode;
881907
readonly detailKey?: string;
882908
readonly diagnosticId: string;
883909
readonly parameters?: {
@@ -894,19 +920,14 @@ export interface IRushDiagnostic {
894920
// @beta
895921
export interface IRushDiagnosticCodeDefinition {
896922
readonly category: RushDiagnosticCategory;
897-
readonly code: string;
923+
readonly code: RushDiagnosticCode;
898924
readonly defaultSeverity: RushDiagnosticSeverity;
899-
readonly detailKey?: string;
900-
readonly summaryKey: string;
925+
readonly detailKey: RushDiagnosticDetailKey | undefined;
926+
readonly summaryKey: RushDiagnosticSummaryKey;
901927
}
902928

903929
// @beta
904-
export interface IRushDiagnosticSource {
905-
readonly column?: number;
906-
readonly file?: string;
907-
readonly line?: number;
908-
readonly toolName?: string;
909-
}
930+
export type IRushDiagnosticSource = IRushFileDiagnosticSource | IRushToolDiagnosticSource;
910931

911932
// @beta
912933
export interface IRushExitStatus {
@@ -915,6 +936,15 @@ export interface IRushExitStatus {
915936
readonly signal?: NodeJS.Signals;
916937
}
917938

939+
// @beta
940+
export interface IRushFileDiagnosticSource {
941+
readonly column?: number;
942+
readonly file: string;
943+
readonly kind: 'file';
944+
readonly line?: number;
945+
readonly toolName?: string;
946+
}
947+
918948
// @beta
919949
export interface IRushPluginManifest {
920950
readonly pluginApiVersion: string;
@@ -937,6 +967,12 @@ export interface IRushSessionReportingOptions {
937967
readonly source: IReporterEventSource;
938968
}
939969

970+
// @beta
971+
export interface IRushToolDiagnosticSource {
972+
readonly kind: 'tool';
973+
readonly toolName: string;
974+
}
975+
940976
// @beta
941977
export function isAgentVariableActive(value: string | undefined): boolean;
942978

@@ -1008,6 +1044,9 @@ export function isMachineReporter(reporter: ReporterName): boolean;
10081044
// @beta
10091045
export function isPluginApiVersionSupported(declaredApiVersion: string, supportedApiVersion?: string): boolean;
10101046

1047+
// @beta
1048+
export function isReporterEventRequired(type: ReporterEventType): boolean;
1049+
10111050
// @beta
10121051
export function isReporterExtensionEventName(name: string): boolean;
10131052

@@ -1083,6 +1122,9 @@ export class JsonReporter implements IReporter {
10831122
// @beta
10841123
export const KNOWN_CI_ENV_VARS: readonly string[];
10851124

1125+
// @beta
1126+
export type KnownRushDiagnosticCategory = 'configuration' | 'input' | 'dependency-tool' | 'environment' | 'network-auth' | 'operation' | 'internal';
1127+
10861128
// @beta
10871129
export const LATEST_LOG_NAME: 'latest.log';
10881130

@@ -1172,6 +1214,9 @@ export class OldEngineOutputAdapter {
11721214
capture(stream: 'stdout' | 'stderr', text: string): string[];
11731215
}
11741216

1217+
// @beta
1218+
export type OneOrMoreRushDiagnosticCodeSegments<S extends string = RushDiagnosticCodeSegment> = S extends string ? S | `${S}${RushDiagnosticCodeSegment}` : never;
1219+
11751220
// @beta
11761221
export type OperationStatus = 'ready' | 'executing' | 'success' | 'successWithWarnings' | 'failure' | 'blocked' | 'skipped' | 'fromCache' | 'noOp';
11771222

@@ -1224,7 +1269,10 @@ export class ProblemMatcherRegistry {
12241269
}
12251270

12261271
// @beta
1227-
export function readBootstrapHandoffFileAsync(filePath: string): Promise<unknown[]>;
1272+
export function readBootstrapHandoffFileAsync(filePath: string): Promise<{
1273+
header: IBootstrapHandoffHeader | undefined;
1274+
events: unknown[];
1275+
}>;
12281276

12291277
// @beta
12301278
export function readChildDescriptorFd(env: Record<string, string | undefined>): number | undefined;
@@ -1242,13 +1290,16 @@ export function renderActiveProjectsRow(projects: readonly string[], width: numb
12421290
export function renderLiveRegion(state: ILiveRegionState, options: IRenderLiveRegionOptions): string[];
12431291

12441292
// @beta
1245-
export const REPORTER_EVENT_TYPES: readonly ReporterEventType[];
1293+
export const REPORTER_EVENT_TYPES: readonly ["sessionStarted", "sessionCompleted", "commandStarted", "commandCompleted", "operationRegistered", "operationStatusChanged", "activityChanged", "watchCycleCompleted", "diagnosticEmitted", "messageEmitted", "externalProcessStarted", "externalOutput", "externalProcessCompleted", "artifactAvailable", "commandResult", "extension"];
1294+
1295+
// @beta
1296+
export const REPORTER_KNOWN_CAPABILITIES: readonly [];
12461297

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

12501301
// @beta
1251-
export const REPORTER_PACKAGE_NAME: '@rushstack/reporter';
1302+
export const REPORTER_PACKAGE_NAME: '@rushstack/rush-reporter';
12521303

12531304
// @beta
12541305
export const REPORTER_PERFORMANCE_BUDGETS: IReporterPerformanceBudgets;
@@ -1259,14 +1310,17 @@ export const REPORTER_PROTOCOL_LIMITS: IReporterProtocolLimits;
12591310
// @beta
12601311
export const REPORTER_PROTOCOL_VERSION: IReporterProtocolVersion;
12611312

1313+
// @beta
1314+
export type ReporterCapability = (typeof REPORTER_KNOWN_CAPABILITIES)[number] | (string & {});
1315+
12621316
// @beta
12631317
export type ReporterCompatibilityMode = 'structured' | 'new-frontend-old-engine' | 'old-frontend-new-engine' | 'legacy';
12641318

12651319
// @beta
1266-
export type ReporterEventType = 'sessionStarted' | 'sessionCompleted' | 'commandStarted' | 'commandCompleted' | 'operationRegistered' | 'operationStatusChanged' | 'activityChanged' | 'watchCycleCompleted' | 'diagnosticEmitted' | 'externalProcessStarted' | 'externalOutput' | 'externalProcessCompleted' | 'artifactAvailable' | 'commandResult' | 'extension';
1320+
export type ReporterEventType = (typeof REPORTER_EVENT_TYPES)[number];
12671321

12681322
// @beta
1269-
export type ReporterExtensionEventName = string;
1323+
export type ReporterExtensionEventName = `${Lowercase<string>}.${Lowercase<string>}`;
12701324

12711325
// @beta
12721326
export class ReporterHost {
@@ -1346,15 +1400,73 @@ export function resolveReporterSelection(input: IReporterSelectionInput): IRepor
13461400
export function runProblemMatchers(events: readonly IReporterEventEnvelope<unknown>[], matchers: readonly IProblemMatcher[], options?: IRunProblemMatchersOptions): IProblemMatcherResult;
13471401

13481402
// @beta
1349-
export const RUSH_DIAGNOSTIC_CODE_DEFINITIONS: readonly IRushDiagnosticCodeDefinition[];
1350-
1351-
// @beta
1352-
export const RUSH_DIAGNOSTIC_CODES: ReadonlyMap<string, IRushDiagnosticCodeDefinition>;
1353-
1354-
// @beta
1355-
export const RUSH_DIAGNOSTIC_TEMPLATES: {
1356-
readonly [resourceKey: string]: string;
1357-
};
1403+
export const RUSH_DIAGNOSTIC_CODE_DEFINITIONS: readonly [{
1404+
readonly code: "RUSH_CONFIG_INVALID_JSON";
1405+
readonly category: "configuration";
1406+
readonly defaultSeverity: "error";
1407+
readonly summaryKey: "diagnostic.RUSH_CONFIG_INVALID_JSON.summary";
1408+
readonly detailKey: undefined;
1409+
}, {
1410+
readonly code: "RUSH_INPUT_UNKNOWN_PROJECT";
1411+
readonly category: "input";
1412+
readonly defaultSeverity: "error";
1413+
readonly summaryKey: "diagnostic.RUSH_INPUT_UNKNOWN_PROJECT.summary";
1414+
readonly detailKey: undefined;
1415+
}, {
1416+
readonly code: "RUSH_DEPENDENCY_TOOL_FAILED";
1417+
readonly category: "dependency-tool";
1418+
readonly defaultSeverity: "error";
1419+
readonly summaryKey: "diagnostic.RUSH_DEPENDENCY_TOOL_FAILED.summary";
1420+
readonly detailKey: "diagnostic.RUSH_DEPENDENCY_TOOL_FAILED.detail";
1421+
}, {
1422+
readonly code: "RUSH_ENVIRONMENT_UNSUPPORTED_NODE";
1423+
readonly category: "environment";
1424+
readonly defaultSeverity: "error";
1425+
readonly summaryKey: "diagnostic.RUSH_ENVIRONMENT_UNSUPPORTED_NODE.summary";
1426+
readonly detailKey: undefined;
1427+
}, {
1428+
readonly code: "RUSH_NETWORK_AUTH_UNAUTHORIZED";
1429+
readonly category: "network-auth";
1430+
readonly defaultSeverity: "error";
1431+
readonly summaryKey: "diagnostic.RUSH_NETWORK_AUTH_UNAUTHORIZED.summary";
1432+
readonly detailKey: undefined;
1433+
}, {
1434+
readonly code: "RUSH_OPERATION_FAILED";
1435+
readonly category: "operation";
1436+
readonly defaultSeverity: "error";
1437+
readonly summaryKey: "diagnostic.RUSH_OPERATION_FAILED.summary";
1438+
readonly detailKey: undefined;
1439+
}, {
1440+
readonly code: "RUSH_PROTOCOL_UPDATE_REQUIRED";
1441+
readonly category: "environment";
1442+
readonly defaultSeverity: "error";
1443+
readonly summaryKey: "diagnostic.RUSH_PROTOCOL_UPDATE_REQUIRED.summary";
1444+
readonly detailKey: "diagnostic.RUSH_PROTOCOL_UPDATE_REQUIRED.detail";
1445+
}, {
1446+
readonly code: "RUSH_INTERNAL_UNEXPECTED";
1447+
readonly category: "internal";
1448+
readonly defaultSeverity: "error";
1449+
readonly summaryKey: "diagnostic.RUSH_INTERNAL_UNEXPECTED.summary";
1450+
readonly detailKey: "diagnostic.RUSH_INTERNAL_UNEXPECTED.detail";
1451+
}, {
1452+
readonly code: "RUSH_PLUGIN_API_INCOMPATIBLE";
1453+
readonly category: "configuration";
1454+
readonly defaultSeverity: "error";
1455+
readonly summaryKey: "diagnostic.RUSH_PLUGIN_API_INCOMPATIBLE.summary";
1456+
readonly detailKey: undefined;
1457+
}, {
1458+
readonly code: "RUSH_EXTERNAL_TOOL_PROBLEM";
1459+
readonly category: "operation";
1460+
readonly defaultSeverity: "error";
1461+
readonly summaryKey: "diagnostic.RUSH_EXTERNAL_TOOL_PROBLEM.summary";
1462+
readonly detailKey: undefined;
1463+
}];
1464+
1465+
// @beta
1466+
export const RUSH_DIAGNOSTIC_CODES: ReadonlyMap<RushDiagnosticCode, IRushDiagnosticCodeDefinition>;
1467+
1468+
// @beta
1469+
export const RUSH_DIAGNOSTIC_TEMPLATES: Readonly<Record<RushDiagnosticTemplateKey, string>>;
13581470

13591471
// @beta
13601472
export const RUSH_INTERNAL_ERROR_CODE: 'RUSH_INTERNAL_UNEXPECTED';
@@ -1368,6 +1480,9 @@ export const RUSH_PLUGIN_API_VERSION: '1.0.0';
13681480
// @beta
13691481
export const RUSH_REPORTER_BOOTSTRAP_HANDOFF_ENV_VAR: '_RUSH_REPORTER_BOOTSTRAP_HANDOFF';
13701482

1483+
// @beta
1484+
export const RUSH_REPORTER_BOOTSTRAP_NONCE_ENV_VAR: '_RUSH_REPORTER_BOOTSTRAP_NONCE';
1485+
13711486
// @beta
13721487
export const RUSH_REPORTER_CHILD_FD_ENV_VAR: '_RUSH_REPORTER_CHILD_FD';
13731488

@@ -1378,11 +1493,29 @@ export const RUSH_REPORTER_ENV_VAR: 'RUSH_REPORTER';
13781493
export type RushCommandOutcome = 'succeeded' | 'failed' | 'cancelled' | 'signal';
13791494

13801495
// @beta
1381-
export type RushDiagnosticCategory = 'configuration' | 'input' | 'dependency-tool' | 'environment' | 'network-auth' | 'operation' | 'internal';
1496+
export type RushDiagnosticCategory = KnownRushDiagnosticCategory | (string & {});
1497+
1498+
// @beta
1499+
export type RushDiagnosticCode = `RUSH${RushDiagnosticCodeSegment}${OneOrMoreRushDiagnosticCodeSegments}`;
1500+
1501+
// @beta
1502+
export type RushDiagnosticCodes = (typeof RUSH_DIAGNOSTIC_CODE_DEFINITIONS)[number]['code'];
1503+
1504+
// @beta
1505+
export type RushDiagnosticCodeSegment = `_${Uppercase<string>}`;
1506+
1507+
// @beta
1508+
export type RushDiagnosticDetailKey = `diagnostic.${RushDiagnosticCode}.detail`;
13821509

13831510
// @beta
13841511
export type RushDiagnosticSeverity = 'warning' | 'error';
13851512

1513+
// @beta
1514+
export type RushDiagnosticSummaryKey = `diagnostic.${RushDiagnosticCode}.summary`;
1515+
1516+
// @beta
1517+
export type RushDiagnosticTemplateKey = NonNullable<(typeof RUSH_DIAGNOSTIC_CODE_DEFINITIONS)[number]['summaryKey' | 'detailKey']>;
1518+
13861519
// @beta
13871520
export class RushError extends Error {
13881521
constructor(diagnostic: IRushDiagnostic, message?: string);
@@ -1441,6 +1574,6 @@ export class TelemetrySubscriber {
14411574
export function truncateToWidth(text: string, width: number): string;
14421575

14431576
// @beta
1444-
export function writeBootstrapHandoffFileAsync(buffer: BootstrapEventBuffer, options?: IWriteBootstrapHandoffOptions): Promise<string>;
1577+
export function writeBootstrapHandoffFileAsync(buffer: BootstrapEventBuffer, options?: IWriteBootstrapHandoffOptions): Promise<IBootstrapHandoffWriteResult>;
14451578

14461579
```

0 commit comments

Comments
 (0)