playwright-performance-regression 0.0.0-stage → 0.1.0-next.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.
@@ -0,0 +1,169 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://pkg.invalid/schemas/samples.schema.json",
4
+ "title": "Sample batch",
5
+ "description": "Raw samples collected during one test execution, attached to the test result as the 'playwright-performance-regression-samples' attachment (ADR-0003). In perf mode every test in a measured project gets this attachment, even when it is empty (05-REQ-15). Written by the collector, read by the reporter. Test metadata is not included; the reporter adds it from TestCase/TestResult.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schemaVersion", "collector", "requests", "custom", "diagnostics"],
9
+ "properties": {
10
+ "schemaVersion": {"const": 1},
11
+ "collector": {
12
+ "description": "Collector that produced the batch.",
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["name", "version", "browserName"],
16
+ "properties": {
17
+ "name": {
18
+ "description": "Collector identifier. 'playwright-js' in MVP; other ecosystems use their own (14).",
19
+ "type": "string",
20
+ "pattern": "^[a-z0-9-]+$"
21
+ },
22
+ "version": {"description": "Package version of the collector.", "type": "string", "minLength": 1},
23
+ "browserName": {
24
+ "description": "Browser engine (chromium, firefox, webkit), or null when the test used no browser.",
25
+ "oneOf": [{"type": "string", "minLength": 1}, {"type": "null"}]
26
+ }
27
+ }
28
+ },
29
+ "requests": {
30
+ "description": "Request samples in the order they finished; requests still in flight when the end-of-test wait ran out come last, with status PENDING (05).",
31
+ "type": "array",
32
+ "items": {"$ref": "#/$defs/requestSample"}
33
+ },
34
+ "custom": {
35
+ "description": "Custom measurement samples in the order they finished.",
36
+ "type": "array",
37
+ "items": {"$ref": "#/$defs/customSample"}
38
+ },
39
+ "diagnostics": {
40
+ "description": "Collector and custom-measurement diagnostics caught during the test (01-REQ-13, 05 §9, 06 §9). Repeated issues are collapsed using 'count'. The reporter turns every diagnostic into an entry in 'warnings' (09-REQ-23); none of them is a tool error.",
41
+ "type": "array",
42
+ "items": {"$ref": "common.schema.json#/$defs/issue"}
43
+ }
44
+ },
45
+ "$defs": {
46
+ "requestSample": {
47
+ "description": "One backend request observed in a tracked browser context, after collector filters (05).",
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "required": [
51
+ "method",
52
+ "url",
53
+ "resourceType",
54
+ "status",
55
+ "startTime",
56
+ "duration",
57
+ "requestStart",
58
+ "ttfb",
59
+ "timeSource",
60
+ "fromServiceWorker"
61
+ ],
62
+ "properties": {
63
+ "method": {"description": "HTTP method, uppercase.", "type": "string", "pattern": "^[A-Z]+$"},
64
+ "url": {
65
+ "description": "Full raw URL as reported by the browser. Never written to thresholds files (P-07).",
66
+ "type": "string",
67
+ "minLength": 1
68
+ },
69
+ "resourceType": {
70
+ "description": "Playwright Request.resourceType(), e.g. document, xhr, fetch.",
71
+ "type": "string",
72
+ "minLength": 1
73
+ },
74
+ "status": {
75
+ "description": "HTTP status code; FAILED when the request failed without a response; PENDING when it was still in flight after the end-of-test wait (05-REQ-13).",
76
+ "oneOf": [{"type": "integer", "minimum": 100, "maximum": 599}, {"const": "FAILED"}, {"const": "PENDING"}]
77
+ },
78
+ "failureText": {
79
+ "description": "Request.failure().errorText; an empty text is recorded as 'unknown' (05-REQ-11). For requests still in flight when their page or context was closed by the test, the collector's CONTEXT_CLOSED_FAILURE_TEXT ('pw-perf: context closed', 05-REQ-30). Present only when status is FAILED. 08-REQ-30 relabels abort texts (e.g. net::ERR_ABORTED and CONTEXT_CLOSED_FAILURE_TEXT) as ABORTED.",
80
+ "type": "string",
81
+ "minLength": 1
82
+ },
83
+ "startTime": {
84
+ "description": "Request start (Request.timing().startTime), rounded to whole ms.",
85
+ "$ref": "common.schema.json#/$defs/epochMs"
86
+ },
87
+ "duration": {
88
+ "description": "From request start to the last response byte (timing.responseEnd). Includes browser queueing, DNS, connection setup, TLS and a CORS preflight (see requestStart; 05-REQ-26). Null when unknown: FAILED, PENDING, or a response whose requestfinished event never came, e.g. a body the page did not read (05-REQ-31); such a sample keeps its HTTP status and counts in statuses but not in time statistics.",
89
+ "$ref": "common.schema.json#/$defs/msOrNull"
90
+ },
91
+ "requestStart": {
92
+ "description": "timing.requestStart: time from request start until the browser began sending the request, i.e. queueing, DNS, connection and TLS (05-REQ-26). Does not include a CORS preflight: for preflighted requests the browser measures requestStart and responseStart from the start of the actual request, so the preflight shows only in duration (05-REQ-26). Informational; not evaluated. Null when the browser did not report it or for FAILED/PENDING.",
93
+ "$ref": "common.schema.json#/$defs/msOrNull"
94
+ },
95
+ "ttfb": {
96
+ "description": "timing.responseStart - timing.requestStart; never includes a CORS preflight (05-REQ-26). Null when the browser did not report both values.",
97
+ "$ref": "common.schema.json#/$defs/msOrNull"
98
+ },
99
+ "timeSource": {
100
+ "description": "browser: timings from Request.timing(); node: fallback measured in the worker when browser timing was unavailable (05).",
101
+ "enum": ["browser", "node"]
102
+ },
103
+ "fromServiceWorker": {
104
+ "description": "True when Response.fromServiceWorker() reported that a service worker produced the response; such samples are excluded from time statistics (05-REQ-05). False for FAILED and PENDING.",
105
+ "type": "boolean"
106
+ }
107
+ },
108
+ "if": {"properties": {"status": {"const": "FAILED"}}},
109
+ "then": {"required": ["failureText"]},
110
+ "else": {"not": {"required": ["failureText"]}},
111
+ "allOf": [
112
+ {
113
+ "if": {"properties": {"status": {"const": "PENDING"}}},
114
+ "then": {
115
+ "properties": {
116
+ "duration": {"type": "null"},
117
+ "requestStart": {"type": "null"},
118
+ "ttfb": {"type": "null"},
119
+ "timeSource": {"const": "browser"},
120
+ "fromServiceWorker": {"const": false}
121
+ }
122
+ }
123
+ },
124
+ {
125
+ "if": {"properties": {"status": {"const": "FAILED"}}},
126
+ "then": {
127
+ "properties": {
128
+ "duration": {"type": "null"},
129
+ "requestStart": {"type": "null"},
130
+ "ttfb": {"type": "null"},
131
+ "timeSource": {"const": "browser"},
132
+ "fromServiceWorker": {"const": false}
133
+ }
134
+ }
135
+ }
136
+ ]
137
+ },
138
+ "customSample": {
139
+ "description": "One custom measurement (06).",
140
+ "type": "object",
141
+ "additionalProperties": false,
142
+ "required": ["name", "outcome", "duration", "endTime"],
143
+ "properties": {
144
+ "name": {
145
+ "description": "Measurement name given by the user (06-REQ-03): 1–200 characters, no leading or trailing whitespace, no control characters.",
146
+ "type": "string",
147
+ "minLength": 1,
148
+ "maxLength": 200,
149
+ "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$"
150
+ },
151
+ "outcome": {
152
+ "description": "ok: finished normally; error: the measured function threw; unfinished: started but never ended before test end. Meaning of each outcome for statistics: 06, 08.",
153
+ "enum": ["ok", "error", "unfinished"]
154
+ },
155
+ "duration": {
156
+ "description": "Measured duration (performance.now()). Null for unfinished.",
157
+ "$ref": "common.schema.json#/$defs/msOrNull"
158
+ },
159
+ "endTime": {
160
+ "description": "Wall-clock end time. Null for unfinished.",
161
+ "oneOf": [{"$ref": "common.schema.json#/$defs/epochMs"}, {"type": "null"}]
162
+ }
163
+ },
164
+ "if": {"properties": {"outcome": {"const": "unfinished"}}},
165
+ "then": {"properties": {"duration": {"type": "null"}, "endTime": {"type": "null"}}},
166
+ "else": {"properties": {"duration": {"type": "number"}, "endTime": {"type": "integer"}}}
167
+ }
168
+ }
169
+ }
@@ -0,0 +1,138 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://pkg.invalid/schemas/thresholds.schema.json",
4
+ "title": "Thresholds file",
5
+ "description": "Committed thresholds for one category (kind) and optionally one environment. Written by the thresholds generator (10) or by hand; read by the reporter and the CLI.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schemaVersion", "kind", "generated", "entries"],
9
+ "properties": {
10
+ "schemaVersion": {"const": 1},
11
+ "kind": {"$ref": "common.schema.json#/$defs/kind"},
12
+ "generated": {
13
+ "description": "How the file was derived. Null for a file written entirely by hand. Contains no wall-clock time of generation, so deriving twice from the same report gives identical files (S-04).",
14
+ "oneOf": [{"$ref": "#/$defs/generated"}, {"type": "null"}]
15
+ },
16
+ "entries": {
17
+ "description": "Thresholds per key. Object keys are aggregate keys and are written sorted (P-09).",
18
+ "type": "object",
19
+ "propertyNames": {"$ref": "common.schema.json#/$defs/key"},
20
+ "additionalProperties": {"$ref": "#/$defs/entry"}
21
+ }
22
+ },
23
+ "$defs": {
24
+ "generated": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": [
28
+ "tool",
29
+ "env",
30
+ "sourceRunId",
31
+ "sourceRunStartedAt",
32
+ "sourceSampleCount",
33
+ "evaluatedPercentile",
34
+ "derivation",
35
+ "browsers",
36
+ "playwrightVersion",
37
+ "host",
38
+ "normalization"
39
+ ],
40
+ "properties": {
41
+ "tool": {"$ref": "common.schema.json#/$defs/tool"},
42
+ "env": {"$ref": "common.schema.json#/$defs/envLabelOrNull"},
43
+ "sourceRunId": {
44
+ "description": "runId of the report the thresholds were derived from.",
45
+ "$ref": "common.schema.json#/$defs/runId"
46
+ },
47
+ "sourceRunStartedAt": {"description": "startedAt of that report.", "$ref": "common.schema.json#/$defs/timestamp"},
48
+ "sourceSampleCount": {
49
+ "description": "Successful samples of this kind in the source report.",
50
+ "$ref": "common.schema.json#/$defs/count"
51
+ },
52
+ "evaluatedPercentile": {
53
+ "description": "Percentile the 'percentile' limits refer to. The reporter warns when the current config evaluates a different one (00, 4.4).",
54
+ "$ref": "common.schema.json#/$defs/percentileName"
55
+ },
56
+ "derivation": {
57
+ "description": "Derivation settings used for this kind (config checks.slowShare.t.<kind>, thresholds.smallSampleN, checks.*.margin; 03, 10).",
58
+ "$ref": "config.schema.json#/$defs/derivationSettings"
59
+ },
60
+ "browsers": {
61
+ "description": "browserName of the measured projects of the source run (runConditions.projects with role measured), sorted, unique. Compared with the evaluated run (09-REQ-04).",
62
+ "type": "array",
63
+ "uniqueItems": true,
64
+ "items": {"type": "string", "minLength": 1}
65
+ },
66
+ "playwrightVersion": {
67
+ "description": "Playwright version of the source run (FullConfig.version). The reporter compares major.minor (09-REQ-04).",
68
+ "type": "string",
69
+ "minLength": 1
70
+ },
71
+ "host": {
72
+ "description": "Machine of the source run (copy of the run report host fingerprint).",
73
+ "$ref": "common.schema.json#/$defs/hostFingerprint"
74
+ },
75
+ "normalization": {
76
+ "description": "Fingerprint of the normalization that produced the keys: built-in rules version, effective keys config and base origins (07-REQ-21). A different value means the keys may not match.",
77
+ "$ref": "common.schema.json#/$defs/fingerprint"
78
+ }
79
+ }
80
+ },
81
+ "entry": {
82
+ "description": "Limits for one key. A complete entry has all seven limit fields; the generator always writes complete entries. t, minApdex and maxWilson may be null: the apdex and wilson rules do not apply to this key (10-REQ-06). Hand-written entries may omit fields (02-REQ-21): missing median, percentile, p99 and maxErrorRate come from checks.<group>.<rule>.limit of the current config; without t the apdex and wilson rules are off; with t, a missing minApdex or maxWilson comes from checks.slowShare.apdex.limit / wilson.limit. An entry may contain only muting (gate, note, until) without any limit (02-REQ-29). An entry with a missing field is never overwritten by the generator (10-REQ-08).",
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "properties": {
86
+ "t": {
87
+ "description": "Apdex T and slow-sample threshold for the wilson rule, or null.",
88
+ "oneOf": [{"$ref": "common.schema.json#/$defs/msLimit"}, {"type": "null"}]
89
+ },
90
+ "median": {"description": "Limit for the median (p50).", "$ref": "common.schema.json#/$defs/msLimit"},
91
+ "percentile": {"description": "Limit for the evaluated percentile.", "$ref": "common.schema.json#/$defs/msLimit"},
92
+ "p99": {"description": "Limit for p99.", "$ref": "common.schema.json#/$defs/msLimit"},
93
+ "minApdex": {
94
+ "description": "Minimum Apdex(T), compared with the upper bound of its 95% interval (09-REQ-09), or null.",
95
+ "oneOf": [{"$ref": "common.schema.json#/$defs/ratio"}, {"type": "null"}]
96
+ },
97
+ "maxWilson": {
98
+ "description": "Maximum share of samples slower than T, compared with the lower bound of its 95% Wilson interval (09-REQ-09), or null.",
99
+ "oneOf": [{"$ref": "common.schema.json#/$defs/ratio"}, {"type": "null"}]
100
+ },
101
+ "maxErrorRate": {
102
+ "description": "Maximum error rate (checks.errors.statuses), compared with the lower bound of its 95% Wilson interval (09-REQ-09).",
103
+ "$ref": "common.schema.json#/$defs/ratio"
104
+ },
105
+ "locked": {
106
+ "description": "Pinned by hand: the generator never changes or removes this entry (D-19). Omitted when not locked.",
107
+ "const": true
108
+ },
109
+ "note": {
110
+ "description": "Free-text comment, e.g. why the entry is locked or muted. Kept by the generator. Required when gate is set.",
111
+ "type": "string",
112
+ "minLength": 1,
113
+ "maxLength": 500
114
+ },
115
+ "gate": {
116
+ "description": "Mute this key until the date in 'until': violations are reported as warnings and never block (09-REQ-26), also above the hard limit. Requires note and until (D-25).",
117
+ "const": "warn"
118
+ },
119
+ "until": {
120
+ "description": "Last day (UTC, inclusive) of muting. From the next day the key blocks again (09-REQ-26).",
121
+ "type": "string",
122
+ "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$"
123
+ }
124
+ },
125
+ "anyOf": [
126
+ {"required": ["t"]},
127
+ {"required": ["median"]},
128
+ {"required": ["percentile"]},
129
+ {"required": ["p99"]},
130
+ {"required": ["minApdex"]},
131
+ {"required": ["maxWilson"]},
132
+ {"required": ["maxErrorRate"]},
133
+ {"required": ["gate"]}
134
+ ],
135
+ "dependentRequired": {"gate": ["note", "until"], "until": ["gate"]}
136
+ }
137
+ }
138
+ }