@ai-ecoverse/slicc-browsers 1.14.9 → 1.14.10
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/README.md +3 -3
- package/guard-driver.mjs +9 -7
- package/guard-runner.mjs +4 -1
- package/guard-vectors.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -226,7 +226,7 @@ A client may register `Fetch.enable` patterns naming a protected origin in eithe
|
|
|
226
226
|
- `observe?`: each observed name, as `{ "means", "dependsOn"?, "requires"?, "eitherWhen"? }`. `requires` gates only that observation when it is not also a whole-vector requirement: unavailable evidence is recorded as `"not-supported"`, excluded from that field's expectations, and reported in the row's `notSupported` list. `dependsOn` lists the refusals the observation depends on (see Refusals). `eitherWhen` is a check: when it holds on the guarded leg, that observation's expectation becomes `"either"` there (see Design-dependent outcomes);
|
|
227
227
|
- `live`: the liveness check;
|
|
228
228
|
- `control` (`origin: "ordinary"`, `via`, `expected`) and `expected`: an object of names and booleans, or text;
|
|
229
|
-
- `skip?` (`target`, `reason`): `reason` starts with a code, as in `not-applicable: …`.
|
|
229
|
+
- `skip?` (`target`, `reason`): `reason` starts with a code, as in `not-applicable: …`. A runner reports the row on `target` as `skip` with this `reason`, unless a capability is missing.
|
|
230
230
|
|
|
231
231
|
**Steps** are declarative and transport-neutral. Any step can take `on` (`control` or `guarded`), which runs it on that leg only.
|
|
232
232
|
Any `cdp`, `page` or `children` step can take `requires`, the capabilities it needs: `autoAttach` for `Target.setAutoAttach`, `children` and `session: "child"`, `browserSession` for `session: "browser"`, `browserContexts` for `Target.createBrowserContext` and `Target.disposeBrowserContext`, and `chromeUrlsAttach` for a step that must attach to a `chrome://` page to pass.
|
|
@@ -309,11 +309,11 @@ It exports:
|
|
|
309
309
|
- `waitFor(check, ms, step?)`: polls `check` every `step` ms (default 25) until it holds, checking once more after the bound. A timer heartbeat every `step` runs for the whole wait, including while `check` is awaiting a reply, and any gap between beats longer than a second (or four steps, if longer) extends the bound by that gap, so a synchronous event-loop stall elsewhere in the process does not consume it. The extensions add up to at most `max(4 × ms, 30000)` ms, so a throttled page cannot stretch a wait without limit. `load`, the runner's waits and the error-page and redirect-body probes use it;
|
|
310
310
|
- `judge(vector, side, observed)`: `{ pass, refused, skipped, mismatches }`, where `refused` lists the leg's refusals and `skipped` the observations that depend on them or explicitly record unavailable observation capabilities;
|
|
311
311
|
- `result(vector, run)`: a report row from `{ target, variant, transport, via?, capabilities?, control, guarded, live }`. `capabilities` is the transport's; without it, the transport has them all;
|
|
312
|
-
- `
|
|
312
|
+
- `skipReason(vector, target, scope)`: the reason the runner skips the row with when it has every capability: the vector's `skip.reason` when its `skip.target` is `target`, `not-applicable` when its `observable[target]` is `false` or its `scope` is neither `any` nor `scope`, otherwise `null`; `inapplicable(vector, target, scope)` is whether it isn't `null`;
|
|
313
313
|
- `knownOrigins` and `originDefaults`: the origin names a runner can miss, and the origins `plain`, `cross`, `log` and `own` fall back to when unset;
|
|
314
314
|
- `parseURL(value, base?)`: a `URL`, or `null` for anything `new URL` rejects or a non-string; every parse of a fixture log entry or a Chrome-reported URL in the runner and the fixture goes through it (`protected.mjs` keeps its own copy, since it imports nothing), so an unparseable entry never throws;
|
|
315
315
|
- `owned(entries, tag)`: the fixture log entries whose raw URL contains `tag`, the row's attribution through its `n=`, `tag=` or `to=` query;
|
|
316
|
-
- `summary({ guard, sha, set, results })`: `set` is the parsed `guard-vectors.json`. It returns `{ set, schemaVersion, guard, sha, variants, targets, transports, results, skipped, notRun, missing, forged, pass, line }`. `missing` lists each `{ id, target, variant, transport }` without a row, for every vector whose `scope` is `any` or the guard, every target it lists, every variant in `variants` or `results`, and every transport in `results`; `pass` needs it empty, where `line` is `GUARD-PASS <guard>@<sha> (vectors @ai-ecoverse/slicc-browsers@X.Y.Z)` or `GUARD-FAIL …`. `forged` lists each `{ id, target, variant, transport, why }` that is `not-run` on a vector that isn't `kind: "text"`, or `skip` without a reason the runner gives (`
|
|
316
|
+
- `summary({ guard, sha, set, results })`: `set` is the parsed `guard-vectors.json`. It returns `{ set, schemaVersion, guard, sha, variants, targets, transports, results, skipped, notRun, missing, forged, pass, line }`. `missing` lists each `{ id, target, variant, transport }` without a row, for every vector whose `scope` is `any` or the guard, every target it lists, every variant in `variants` or `results`, and every transport in `results`; `pass` needs it empty, where `line` is `GUARD-PASS <guard>@<sha> (vectors @ai-ecoverse/slicc-browsers@X.Y.Z)` or `GUARD-FAIL …`. `forged` lists each `{ id, target, variant, transport, why }` that is `not-run` on a vector that isn't `kind: "text"`, or `skip` without a reason the runner gives (`skipReason(vector, target, guard)`, the reason the runner gives: the vector's own `skip.reason` on its `skip.target`, or `not-applicable` for a target it marks unobservable or a `scope` other than `any` and the guard; `not-applicable:no-<origin>-origin` for an origin in `knownOrigins` that the row's target, `plain`, the control's origin, the steps or a check names, directly or through `originDefaults`, where only the first branch of an `any` counts, or `not-supported:<capability>` for a capability the set requires, `browserSession` or `unguarded-observer`); `pass` needs it empty too, and `line` then ends in `forged <n>`.
|
|
317
317
|
|
|
318
318
|
**`npm run validate`** checks that:
|
|
319
319
|
- the file matches the schema, and ids are unique;
|
package/guard-driver.mjs
CHANGED
|
@@ -336,18 +336,20 @@ function originReason(vector, row, reason) {
|
|
|
336
336
|
].includes(origin);
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
export const
|
|
340
|
-
|
|
341
|
-
(vector.skip?.target === target
|
|
342
|
-
|
|
343
|
-
|
|
339
|
+
export const skipReason = (vector, target, scope) => {
|
|
340
|
+
if (!vector) return null;
|
|
341
|
+
if (vector.skip?.target === target) return vector.skip.reason;
|
|
342
|
+
if (vector.observable?.[target] === false) return 'not-applicable';
|
|
343
|
+
return vector.scope !== 'any' && vector.scope !== scope ? 'not-applicable' : null;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
export const inapplicable = (vector, target, scope) => skipReason(vector, target, scope) !== null;
|
|
344
347
|
|
|
345
348
|
function skipWhy(vector, row, known, guard) {
|
|
346
349
|
const { reason } = row;
|
|
347
350
|
if (typeof reason !== 'string' || reason === '') return 'skip without a reason';
|
|
348
|
-
if (reason ===
|
|
351
|
+
if (reason === skipReason(vector, row.target, guard)) return null;
|
|
349
352
|
if (originReason(vector, row, reason)) return null;
|
|
350
|
-
if (vector?.skip?.target === row.target && vector.skip.reason === reason) return null;
|
|
351
353
|
if (reason.startsWith('not-supported:') && known.has(reason.slice('not-supported:'.length)))
|
|
352
354
|
return null;
|
|
353
355
|
return `skip with a reason the runner never gives: ${reason}`;
|
package/guard-runner.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
parseURL,
|
|
19
19
|
summary as report,
|
|
20
20
|
result,
|
|
21
|
+
skipReason,
|
|
21
22
|
steps,
|
|
22
23
|
waitFor,
|
|
23
24
|
} from './guard-driver.mjs';
|
|
@@ -1493,7 +1494,9 @@ async function executeRow(job, opts, made, set, slot, index, flights) {
|
|
|
1493
1494
|
control: 'skip',
|
|
1494
1495
|
guarded: 'skip',
|
|
1495
1496
|
live: 'skip',
|
|
1496
|
-
reason: missing
|
|
1497
|
+
reason: missing
|
|
1498
|
+
? `not-supported:${missing}`
|
|
1499
|
+
: skipReason(vector, target, opts.capabilities.scope),
|
|
1497
1500
|
};
|
|
1498
1501
|
}
|
|
1499
1502
|
if (
|
package/guard-vectors.json
CHANGED