playwright-performance-regression 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -89,6 +89,10 @@ interface PackageConfig {
89
89
  * @minItems 1
90
90
  */
91
91
  successStatuses?: [string, ...string[]];
92
+ /**
93
+ * The first N timed samples of every key in each pass are cold (first call after the start of the application, which webServer starts again in every pass): they stay out of the evaluated time statistics when at least checks.time.median.minSamples warm samples are left (08-REQ-41, 08-REQ-42). 0 turns it off.
94
+ */
95
+ coldSamples?: number;
92
96
  /**
93
97
  * Durations of test.step steps as keys of kind 'step' (06). true (default) enables with defaults, false disables, an object enables with settings (03-REQ-18).
94
98
  */
@@ -204,6 +208,22 @@ interface PackageConfig {
204
208
  * Query parameter names always removed from the key (e.g. cache busters with fixed names).
205
209
  */
206
210
  dropQueryParams?: string[];
211
+ /**
212
+ * Endpoints that get a key per operation (18): GraphQL ('graphql': operationName or the first named operation, batches by the sorted names) and tRPC ('trpc': procedure names from the path), e.g. [{"type": "graphql", "match": "/graphql"}] gives 'POST /graphql#GetTickets'. match is tested against the URL path without the query; the first matching entry wins. The request body is read only for POST requests matching a graphql entry, up to 64 KB, in the worker, and never written anywhere.
213
+ */
214
+ operations?: {
215
+ /**
216
+ * Built-in operation extractor.
217
+ */
218
+ type: 'graphql' | 'trpc';
219
+ /**
220
+ * A string matches as a case-sensitive substring of the full URL; {regex, flags} is a JavaScript regular expression.
221
+ */
222
+ match: string | {
223
+ regex: string;
224
+ flags?: string;
225
+ };
226
+ }[];
207
227
  /**
208
228
  * Snapshot only: "[function]" when a custom keyBuilder function was configured (TypeScript/JavaScript config).
209
229
  */
@@ -526,6 +546,45 @@ interface PackageConfig {
526
546
  min?: number;
527
547
  };
528
548
  };
549
+ /**
550
+ * Share of responses outside measure.successStatuses (e.g. fast 401s) must not exceed the limit; lower Wilson bound compared (09-REQ-38). Endpoint keys only.
551
+ */
552
+ nonSuccess?: {
553
+ /**
554
+ * Run this rule.
555
+ */
556
+ enabled?: boolean;
557
+ /**
558
+ * Minimum samples for the rule to run (09-REQ-07).
559
+ */
560
+ minSamples?: number;
561
+ /**
562
+ * Limit for keys without an entry in the thresholds file. null (default): the rule runs only for keys whose entry has maxNonSuccessRate.
563
+ */
564
+ limit?: {
565
+ /**
566
+ * Endpoint keys: maximum share of responses outside measure.successStatuses, or null.
567
+ */
568
+ api?: number | null;
569
+ };
570
+ /**
571
+ * Headroom added to the source run value when deriving this limit (10, chapter 5).
572
+ */
573
+ margin?: {
574
+ /**
575
+ * Multiplier of the source non-success rate.
576
+ */
577
+ factor?: number;
578
+ /**
579
+ * Added after multiplying.
580
+ */
581
+ add?: number;
582
+ /**
583
+ * Minimum derived limit.
584
+ */
585
+ min?: number;
586
+ };
587
+ };
529
588
  };
530
589
  /**
531
590
  * Gate policy: when violations fail the run (09, D-16, D-17).
@@ -589,6 +648,15 @@ interface PackageConfig {
589
648
  * Warn (THRESHOLDS_LOOSENED_MUCH) when a derived time limit grows by more than this share (10-REQ-20).
590
649
  */
591
650
  loosenWarnRelative?: number;
651
+ /**
652
+ * Warning THRESHOLDS_WORKLOAD_SHIFT when a key gets a different number of samples per pass than in the thresholds run (09-REQ-41).
653
+ */
654
+ workloadShift?: {
655
+ /**
656
+ * Warn when samples per pass change by this factor or more in either direction; null turns the warning off.
657
+ */
658
+ factor?: number | null;
659
+ };
592
660
  };
593
661
  /**
594
662
  * Run outputs (02, 11).
@@ -669,6 +737,15 @@ interface KeyBuilderInput {
669
737
  /** Raw URL. */
670
738
  url: string;
671
739
  resourceType: string;
740
+ /** Operation names read by keys.operations, in request order, or null. Never the request body (18-REQ-10). */
741
+ operation: readonly string[] | null;
742
+ }
743
+ /** Built-in operation extractors of keys.operations (18-REQ-02). */
744
+ type OperationType = 'graphql' | 'trpc';
745
+ /** An entry of keys.operations (18-REQ-01): match is tested against the URL path without the query. */
746
+ interface OperationEntryInput {
747
+ type: OperationType;
748
+ match: UrlPattern;
672
749
  }
673
750
  /** Return a key, or undefined to fall back to the built-in normalization (07). */
674
751
  type KeyBuilder = (req: KeyBuilderInput) => string | undefined;
@@ -682,6 +759,7 @@ type PerfConfigInput = DeepPartial<Override<PerfConfigJson, {
682
759
  keys: {
683
760
  extraIdPatterns: UrlPattern[];
684
761
  keyBuilder: KeyBuilder;
762
+ operations: OperationEntryInput[];
685
763
  };
686
764
  }>>;
687
765
  interface StepPatternsInput {
@@ -714,11 +792,17 @@ type ResolvedConfig = Omit<ResolvedConfigJson, 'measure' | 'keys'> & {
714
792
  exclude: ResolvedUrlPattern[];
715
793
  steps: ResolvedStepsSettings;
716
794
  };
717
- keys: Omit<ResolvedConfigJson['keys'], 'extraIdPatterns' | 'keyBuilder'> & {
795
+ keys: Omit<ResolvedConfigJson['keys'], 'extraIdPatterns' | 'keyBuilder' | 'operations'> & {
718
796
  extraIdPatterns: ResolvedUrlPattern[];
719
797
  keyBuilder: KeyBuilder | undefined;
798
+ operations: ResolvedOperationEntry[];
720
799
  };
721
800
  };
801
+ /** keys.operations entry after resolution: the pattern compiled (18-REQ-01). */
802
+ interface ResolvedOperationEntry {
803
+ type: OperationType;
804
+ match: ResolvedUrlPattern;
805
+ }
722
806
  /** measure.steps after resolution: full object, patterns compiled (03-REQ-18). */
723
807
  type ResolvedStepsSettings = Omit<StepsSettingsJson, 'include' | 'exclude'> & {
724
808
  include: ResolvedUrlPattern[];
package/dist/index.d.ts CHANGED
@@ -89,6 +89,10 @@ interface PackageConfig {
89
89
  * @minItems 1
90
90
  */
91
91
  successStatuses?: [string, ...string[]];
92
+ /**
93
+ * The first N timed samples of every key in each pass are cold (first call after the start of the application, which webServer starts again in every pass): they stay out of the evaluated time statistics when at least checks.time.median.minSamples warm samples are left (08-REQ-41, 08-REQ-42). 0 turns it off.
94
+ */
95
+ coldSamples?: number;
92
96
  /**
93
97
  * Durations of test.step steps as keys of kind 'step' (06). true (default) enables with defaults, false disables, an object enables with settings (03-REQ-18).
94
98
  */
@@ -204,6 +208,22 @@ interface PackageConfig {
204
208
  * Query parameter names always removed from the key (e.g. cache busters with fixed names).
205
209
  */
206
210
  dropQueryParams?: string[];
211
+ /**
212
+ * Endpoints that get a key per operation (18): GraphQL ('graphql': operationName or the first named operation, batches by the sorted names) and tRPC ('trpc': procedure names from the path), e.g. [{"type": "graphql", "match": "/graphql"}] gives 'POST /graphql#GetTickets'. match is tested against the URL path without the query; the first matching entry wins. The request body is read only for POST requests matching a graphql entry, up to 64 KB, in the worker, and never written anywhere.
213
+ */
214
+ operations?: {
215
+ /**
216
+ * Built-in operation extractor.
217
+ */
218
+ type: 'graphql' | 'trpc';
219
+ /**
220
+ * A string matches as a case-sensitive substring of the full URL; {regex, flags} is a JavaScript regular expression.
221
+ */
222
+ match: string | {
223
+ regex: string;
224
+ flags?: string;
225
+ };
226
+ }[];
207
227
  /**
208
228
  * Snapshot only: "[function]" when a custom keyBuilder function was configured (TypeScript/JavaScript config).
209
229
  */
@@ -526,6 +546,45 @@ interface PackageConfig {
526
546
  min?: number;
527
547
  };
528
548
  };
549
+ /**
550
+ * Share of responses outside measure.successStatuses (e.g. fast 401s) must not exceed the limit; lower Wilson bound compared (09-REQ-38). Endpoint keys only.
551
+ */
552
+ nonSuccess?: {
553
+ /**
554
+ * Run this rule.
555
+ */
556
+ enabled?: boolean;
557
+ /**
558
+ * Minimum samples for the rule to run (09-REQ-07).
559
+ */
560
+ minSamples?: number;
561
+ /**
562
+ * Limit for keys without an entry in the thresholds file. null (default): the rule runs only for keys whose entry has maxNonSuccessRate.
563
+ */
564
+ limit?: {
565
+ /**
566
+ * Endpoint keys: maximum share of responses outside measure.successStatuses, or null.
567
+ */
568
+ api?: number | null;
569
+ };
570
+ /**
571
+ * Headroom added to the source run value when deriving this limit (10, chapter 5).
572
+ */
573
+ margin?: {
574
+ /**
575
+ * Multiplier of the source non-success rate.
576
+ */
577
+ factor?: number;
578
+ /**
579
+ * Added after multiplying.
580
+ */
581
+ add?: number;
582
+ /**
583
+ * Minimum derived limit.
584
+ */
585
+ min?: number;
586
+ };
587
+ };
529
588
  };
530
589
  /**
531
590
  * Gate policy: when violations fail the run (09, D-16, D-17).
@@ -589,6 +648,15 @@ interface PackageConfig {
589
648
  * Warn (THRESHOLDS_LOOSENED_MUCH) when a derived time limit grows by more than this share (10-REQ-20).
590
649
  */
591
650
  loosenWarnRelative?: number;
651
+ /**
652
+ * Warning THRESHOLDS_WORKLOAD_SHIFT when a key gets a different number of samples per pass than in the thresholds run (09-REQ-41).
653
+ */
654
+ workloadShift?: {
655
+ /**
656
+ * Warn when samples per pass change by this factor or more in either direction; null turns the warning off.
657
+ */
658
+ factor?: number | null;
659
+ };
592
660
  };
593
661
  /**
594
662
  * Run outputs (02, 11).
@@ -669,6 +737,15 @@ interface KeyBuilderInput {
669
737
  /** Raw URL. */
670
738
  url: string;
671
739
  resourceType: string;
740
+ /** Operation names read by keys.operations, in request order, or null. Never the request body (18-REQ-10). */
741
+ operation: readonly string[] | null;
742
+ }
743
+ /** Built-in operation extractors of keys.operations (18-REQ-02). */
744
+ type OperationType = 'graphql' | 'trpc';
745
+ /** An entry of keys.operations (18-REQ-01): match is tested against the URL path without the query. */
746
+ interface OperationEntryInput {
747
+ type: OperationType;
748
+ match: UrlPattern;
672
749
  }
673
750
  /** Return a key, or undefined to fall back to the built-in normalization (07). */
674
751
  type KeyBuilder = (req: KeyBuilderInput) => string | undefined;
@@ -682,6 +759,7 @@ type PerfConfigInput = DeepPartial<Override<PerfConfigJson, {
682
759
  keys: {
683
760
  extraIdPatterns: UrlPattern[];
684
761
  keyBuilder: KeyBuilder;
762
+ operations: OperationEntryInput[];
685
763
  };
686
764
  }>>;
687
765
  interface StepPatternsInput {
@@ -714,11 +792,17 @@ type ResolvedConfig = Omit<ResolvedConfigJson, 'measure' | 'keys'> & {
714
792
  exclude: ResolvedUrlPattern[];
715
793
  steps: ResolvedStepsSettings;
716
794
  };
717
- keys: Omit<ResolvedConfigJson['keys'], 'extraIdPatterns' | 'keyBuilder'> & {
795
+ keys: Omit<ResolvedConfigJson['keys'], 'extraIdPatterns' | 'keyBuilder' | 'operations'> & {
718
796
  extraIdPatterns: ResolvedUrlPattern[];
719
797
  keyBuilder: KeyBuilder | undefined;
798
+ operations: ResolvedOperationEntry[];
720
799
  };
721
800
  };
801
+ /** keys.operations entry after resolution: the pattern compiled (18-REQ-01). */
802
+ interface ResolvedOperationEntry {
803
+ type: OperationType;
804
+ match: ResolvedUrlPattern;
805
+ }
722
806
  /** measure.steps after resolution: full object, patterns compiled (03-REQ-18). */
723
807
  type ResolvedStepsSettings = Omit<StepsSettingsJson, 'include' | 'exclude'> & {
724
808
  include: ResolvedUrlPattern[];
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { definePerfConfig, perfDefaults } from './chunk-5Y34Q4DR.js';
1
+ export { definePerfConfig, perfDefaults } from './chunk-Q73KMM6D.js';