@ai-ecoverse/slicc-browsers 1.7.9 → 1.7.11

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 CHANGED
@@ -170,7 +170,7 @@ Any `cdp`, `page` or `children` step can take `requires`, the capabilities it ne
170
170
  - `eval`: evaluate `expression`.
171
171
  `hops` routes `url` through `/hop` on each `origin`, with its `code`.
172
172
  - `{ "answer": { "url", "stage"?, "cdp"?, "params"?, "hold"? } }`: answer each paused request or auth challenge for `url` with that call; `hold` leaves it paused. Every other paused request continues unchanged.
173
- - `{ "children": steps, "where"? }`: run these steps on each target auto-attached from then on, then resume it. `where` scopes them to the row's own target: `{ "openerId": "page" }` (opened by the row's page) or `{ "urlPrefix": url }`; other attached targets are resumed and otherwise left alone.
173
+ - `{ "children": steps, "where"? }`: run these steps on each target auto-attached from then on, then resume it. `where` scopes them to the row's own target: `{ "openerId": "page" }` (opened by the row's page) or `{ "urlPrefix": url }`; other attached targets are resumed and otherwise left alone. When a vector has a `children` step with `where`, a target that attaches before that step runs waits until it does, and is then matched against `where`. A target is only resumed when it attached waiting for the debugger, and a `browser_ui` target (Chrome's own UI, such as `chrome://omnibox-popup.top-chrome/`) is never adopted or sent anything.
174
174
  - `{ "settle": { "beacon"?, "served"?, "title"?, "ms"?, "variant"?, "session"?, "dependsOn"?, "or"? } }`: wait for a beacon from `beacon`, for the fixture to log a request for the URL `served`, for the page `title`, or for the session to detach. When a refusal in `dependsOn` was recorded, the beacon can't come: a settle with `or` (a check) then waits until `or` holds, and one without it is skipped. Without such a refusal, `or` plays no part. Each beacon settle after an init script depends on that script's registration, and its `or` is what the row reads: the hops and the destination for the redirect chains, or the served page otherwise. It waits up to `ms` (10000 by default), then another 600 ms. `variant` waits the run's detach variant instead.
175
175
  - `{ "wait": ms }`.
176
176
  - `{ "paused": { "url", "ms" } }`: wait until the client has seen the pause that an `answer` rule for `url` matches (`Fetch.requestPaused` at the rule's stage, or `Fetch.authRequired` for a `Fetch.continueWithAuth` rule). It waits up to `ms`. On the control leg, a pause that never comes fails the row with `paused: no pause for <url> within <ms>ms`. On the guarded leg the guard may hide that pause, so the step waits the full `ms` and doesn't fail. The C5 guessed-id vectors and `C5.auth` use it before their second request, so the probe's interception id falls between the two ids the guess spans.
@@ -513,6 +513,7 @@ for case in corpus().cases {
513
513
  Go 1.26, Rust stable with `wasm32-wasip1`, Node ≥ 24.
514
514
  - `npm run corpus` regenerates `corpus.json` from `corpus/`; the pre-commit hook and CI fail when it's stale.
515
515
  - `npm run validate` checks `catalog.json`, `corpus.json`, `protected.json` and `guard-vectors.json` against the schemas, runs the protected-origin vectors through `protected.mjs`, and checks what a schema can't say: unique ids, bundle ids and names, known Windows roots, rising tiers, compiling patterns, known tokens, tier order, `sevenOpen`, `tabs` (which holds no entry of `sevenTabs`), `six` and `auto` in each `expected.json`, and no port from 9222 to 9229.
516
+ - Every gate prints one verdict line when it passes: `validate: PASS …`, `corpus: PASS <n> cases` (`node scripts/corpus.mjs --check`), `major-guard: PASS v<version> fits <module>`, and `guard-sweep: PASS 5 targets` (`npm run test:guard-sweep`). CI runs each through `scripts/gate.mjs --expect <regex> -- <command>`, which fails when the command exits non-zero or prints no matching line, so a silent or early exit never reads as a pass. `gate.mjs --expect <regex> --in <file>` checks a log instead; the release job uses it on semantic-release's log for the major-guard line. `npm run test:gates` tests the gates, including runs through a symlinked checkout and a symlinked script.
516
517
  - `npm run lint`: the slicc lint tools (Biome, no comments, no unit tests in git, `AGENTS.md`), `gofmt`, `go mod tidy -diff`, `go vet`, golangci-lint, `cargo fmt --check` and clippy.
517
518
  - `npm test`: `validate`, the Go tests in `test/integration/`, and `cargo test --all-features`.
518
519
  - `npm run build`: the Go module, the crate (also for `wasm32-wasip1`), and `npm pack --dry-run`.
package/guard-runner.mjs CHANGED
@@ -111,6 +111,10 @@ class Execution {
111
111
  this.answers = [];
112
112
  this.attachSettings = new Map();
113
113
  this.childSteps = [];
114
+ this.deferred = [];
115
+ this.expectWhere = [...(vector.setup ?? []), ...(vector.trigger ?? [])].some(
116
+ (step) => step.children && step.where
117
+ );
114
118
  this.childRuns = new Map();
115
119
  this.named = new Map();
116
120
  this.processed = new Set();
@@ -447,6 +451,11 @@ class Execution {
447
451
  adopt(event) {
448
452
  const info = event.params.targetInfo;
449
453
  const child = event.params.sessionId;
454
+ if (info?.type === 'browser_ui') return;
455
+ if (this.expectWhere && !this.childWhere) {
456
+ this.deferred.push(event);
457
+ return;
458
+ }
450
459
  if (info?.browserContextId && this.vars.context && info.browserContextId !== this.vars.context)
451
460
  return;
452
461
  if (this.childWhere && !this.childMatches(info)) {
@@ -462,7 +471,8 @@ class Execution {
462
471
  else {
463
472
  await this.execute(this.childSteps.slice(0, reload), child);
464
473
  const start = this.client.events.length;
465
- await outcome(this.client.send('Runtime.runIfWaitingForDebugger', {}, child));
474
+ if (event.params.waitingForDebugger)
475
+ await outcome(this.client.send('Runtime.runIfWaitingForDebugger', {}, child));
466
476
  await this.poll(
467
477
  () =>
468
478
  this.client.events
@@ -473,7 +483,8 @@ class Execution {
473
483
  await this.execute(this.childSteps.slice(reload), child);
474
484
  }
475
485
  const resumed = this.client.events.length;
476
- await outcome(this.client.send('Runtime.runIfWaitingForDebugger', {}, child));
486
+ if (event.params.waitingForDebugger)
487
+ await outcome(this.client.send('Runtime.runIfWaitingForDebugger', {}, child));
477
488
  if (this.childSteps.some((step) => step.cdp === 'Page.enable'))
478
489
  await this.poll(() => this.firstLoad(child, resumed), 5000);
479
490
  })().catch((error) => this.errors.push(String(error.message ?? error)));
@@ -604,6 +615,7 @@ class Execution {
604
615
  if (step.children) {
605
616
  this.childSteps = step.children;
606
617
  this.childWhere = step.where;
618
+ for (const event of this.deferred.splice(0)) this.adopt(event);
607
619
  return;
608
620
  }
609
621
  if (step.answer) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.7.9",
3
+ "setVersion": "1.7.11",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.7.9",
3
+ "version": "1.7.11",
4
4
  "description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -67,11 +67,12 @@
67
67
  "test:guard": "npm run test:guard-integration && npm run test:guard-sweep",
68
68
  "test:guard-integration": "node --test test/integration/guard-fit.test.mjs test/integration/guard-chain.test.mjs test/integration/guard-validation.test.mjs test/integration/guard-liveness.test.mjs test/integration/guard-observations.test.mjs test/integration/guard-child-latency.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-legs.test.mjs test/integration/guard-diagnostics.test.mjs",
69
69
  "test:guard-sweep": "node scripts/test-guards.mjs",
70
+ "test:gates": "node --test test/integration/gates.test.mjs",
70
71
  "test:guard-target": "node --test test/integration/guard-runner.test.mjs",
71
72
  "test:unit:guard": "node --experimental-test-coverage --test --test-coverage-include=guard-runner.mjs --test-coverage-include=fixture-server.mjs --test-coverage-lines=100 test/unit/guard-*.test.mjs"
72
73
  },
73
74
  "devDependencies": {
74
- "@ai-ecoverse/slicc-shared-web": "1.23.1",
75
+ "@ai-ecoverse/slicc-shared-web": "1.23.2",
75
76
  "@biomejs/biome": "2.5.15",
76
77
  "ajv": "8.20.0",
77
78
  "ajv-formats": "3.0.1",