@ai-ecoverse/slicc-browsers 1.14.5 → 1.14.6
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 +1 -1
- package/guard-driver.mjs +46 -2
- package/guard-vectors.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -311,7 +311,7 @@ It exports:
|
|
|
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
|
- `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;
|
|
313
313
|
- `owned(entries, tag)`: the fixture log entries whose raw URL contains `tag`, the row's attribution through its `n=`, `tag=` or `to=` query;
|
|
314
|
-
- `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, 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 …`.
|
|
314
|
+
- `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 (`not-applicable`, `not-applicable:no-<origin>-origin`, the vector's own `skip.reason` on its target, 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>`.
|
|
315
315
|
|
|
316
316
|
**`npm run validate`** checks that:
|
|
317
317
|
- the file matches the schema, and ids are unique;
|
package/guard-driver.mjs
CHANGED
|
@@ -276,6 +276,47 @@ const passed = (r) =>
|
|
|
276
276
|
[r.control, r.guarded, r.live].every((s) => s === 'skip') ||
|
|
277
277
|
[r.control, r.guarded, r.live].every((s) => s === 'not-run');
|
|
278
278
|
|
|
279
|
+
const capabilities = (value) =>
|
|
280
|
+
Array.isArray(value)
|
|
281
|
+
? value.flatMap(capabilities)
|
|
282
|
+
: value && typeof value === 'object'
|
|
283
|
+
? Object.entries(value).flatMap(([key, item]) =>
|
|
284
|
+
key === 'requires' && Array.isArray(item) ? item : capabilities(item)
|
|
285
|
+
)
|
|
286
|
+
: [];
|
|
287
|
+
|
|
288
|
+
function skipWhy(vector, row, known) {
|
|
289
|
+
const { reason } = row;
|
|
290
|
+
if (typeof reason !== 'string' || reason === '') return 'skip without a reason';
|
|
291
|
+
if (reason === 'not-applicable' || /^not-applicable:no-[A-Za-z][A-Za-z-]*-origin$/.test(reason))
|
|
292
|
+
return null;
|
|
293
|
+
if (vector?.skip?.target === row.target && vector.skip.reason === reason) return null;
|
|
294
|
+
if (reason.startsWith('not-supported:') && known.has(reason.slice('not-supported:'.length)))
|
|
295
|
+
return null;
|
|
296
|
+
return `skip with a reason the runner never gives: ${reason}`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function forgeries(set, results) {
|
|
300
|
+
const vectors = new Map(set.vectors.map((v) => [v.id, v]));
|
|
301
|
+
const known = new Set([
|
|
302
|
+
'browserSession',
|
|
303
|
+
'unguarded-observer',
|
|
304
|
+
...capabilities(set.vectors).filter((c) => typeof c === 'string' && c !== ''),
|
|
305
|
+
]);
|
|
306
|
+
return results.flatMap((row) => {
|
|
307
|
+
const legs = [row.control, row.guarded, row.live];
|
|
308
|
+
const vector = vectors.get(row.id);
|
|
309
|
+
const why = [];
|
|
310
|
+
if (legs.includes('not-run') && vector?.kind !== 'text')
|
|
311
|
+
why.push('not-run on a vector that is not kind text');
|
|
312
|
+
if (legs.includes('skip')) why.push(skipWhy(vector, row, known));
|
|
313
|
+
const found = why.filter(Boolean);
|
|
314
|
+
if (!found.length) return [];
|
|
315
|
+
const { id, target, variant, transport } = row;
|
|
316
|
+
return [{ id, target, variant, transport, why: found.join('; ') }];
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
279
320
|
export function summary({ guard, sha, set, results }) {
|
|
280
321
|
const uniq = (k) => [...new Set(results.map((r) => r[k]))].sort();
|
|
281
322
|
const variants = [...new Set([...Object.keys(set.variants ?? {}), ...uniq('variant')])].sort();
|
|
@@ -286,7 +327,9 @@ export function summary({ guard, sha, set, results }) {
|
|
|
286
327
|
.flatMap((row) => variants.map((variant) => ({ ...row, variant })))
|
|
287
328
|
.flatMap((row) => uniq('transport').map((transport) => ({ ...row, transport })))
|
|
288
329
|
.filter((r) => !has.has(q([r.id, r.target, r.variant, r.transport])));
|
|
289
|
-
const
|
|
330
|
+
const forged = forgeries(set, results);
|
|
331
|
+
const pass =
|
|
332
|
+
results.length > 0 && missing.length === 0 && forged.length === 0 && results.every(passed);
|
|
290
333
|
const name = `@ai-ecoverse/slicc-browsers@${set.setVersion}`;
|
|
291
334
|
return {
|
|
292
335
|
set: name,
|
|
@@ -302,8 +345,9 @@ export function summary({ guard, sha, set, results }) {
|
|
|
302
345
|
.map(({ id, target, reason }) => ({ id, target, reason })),
|
|
303
346
|
notRun: [...new Set(results.filter((r) => r.control === 'not-run').map((r) => r.id))],
|
|
304
347
|
missing,
|
|
348
|
+
forged,
|
|
305
349
|
pass,
|
|
306
|
-
line: `${pass ? 'GUARD-PASS' : 'GUARD-FAIL'} ${guard}@${sha} (vectors ${name})`,
|
|
350
|
+
line: `${pass ? 'GUARD-PASS' : 'GUARD-FAIL'} ${guard}@${sha} (vectors ${name})${forged.length ? ` forged ${forged.length}` : ''}`,
|
|
307
351
|
};
|
|
308
352
|
}
|
|
309
353
|
|
package/guard-vectors.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-browsers",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.6",
|
|
4
4
|
"description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"validate": "node scripts/validate.mjs",
|
|
67
67
|
"lint": "slicc-lint && test -z \"$(gofmt -l .)\" && go mod tidy -diff && go vet ./... && golangci-lint run && cargo fmt --check && cargo clippy --all-features --all-targets -- -D warnings",
|
|
68
68
|
"format": "biome check --write . && gofmt -w . && cargo fmt",
|
|
69
|
-
"test": "npm run validate && node --test test/integration/self-contained.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/git-retry.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/dist-tag.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-stall.test.mjs && go test -race -count=1 ./test/integration/... && cargo test --all-features",
|
|
69
|
+
"test": "npm run validate && node --test test/integration/self-contained.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/git-retry.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/dist-tag.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-stall.test.mjs test/integration/guard-forged.test.mjs && go test -race -count=1 ./test/integration/... && cargo test --all-features",
|
|
70
70
|
"test:unit": "go test -race -cover ./...",
|
|
71
71
|
"build": "go build ./... && cargo build --all-features && cargo build --target wasm32-wasip1 --all-features && npm pack --dry-run",
|
|
72
72
|
"trust": "npx fledgling sync -y --skip-publish",
|