Skip to content

feat(tools): add --json output and expand invariant coverage in gauntlet.py#17

Merged
abtonmoy merged 1 commit into
tiliondev:mainfrom
abtonmoy:feat/gauntlet-json-invariants
Jul 4, 2026
Merged

feat(tools): add --json output and expand invariant coverage in gauntlet.py#17
abtonmoy merged 1 commit into
tiliondev:mainfrom
abtonmoy:feat/gauntlet-json-invariants

Conversation

@abtonmoy

@abtonmoy abtonmoy commented Jul 4, 2026

Copy link
Copy Markdown
Member

Summary

tools/gauntlet.py verifies a running Fortress bundle over raw CDP, but it only checked a small set of surfaces and emitted human-readable text — so it couldn't serve as a CI gate or feed a dashboard. This PR keeps the zero-deps, raw-CDP design and adds machine-readable output plus broader coverage of surfaces the engine already spoofs.

Changes

--json output

A new --json flag emits a single JSON object on stdout and sets the exit code from ok:

{ "surfaces": { ... }, "invariants": { "name": true/false, ... }, "ok": true }

Without --json, the human-readable report is unchanged (same structure, just more lines). Documented in --help and the module header.

Seven new invariants

All are already spoofed by the default persona the bundle launcher injects (packaging/tilion):

Invariant Check
hardwareConcurrency plausible present and 1 <= n <= 128
deviceMemory present a positive number
languages well-formed a real list, length ≥ 2
timezone is an IANA zone Intl…resolvedOptions().timeZone contains /
canvas 2D noise present a flat grey fill reads back perturbed
WebGPU adapter present navigator.gpu.requestAdapter() returns an adapter
plugins non-empty navigator.plugins.length > 0

The surface-collection expression becomes an async IIFE so it can await navigator.gpu.requestAdapter(); ws_eval already awaits the returned promise.

Reference sample

docs/gauntlet-sample.json — a passing report for reference (CI/dashboard consumers).

Verification

Running end-to-end needs a compiled bundle via --bundle (see docs/BUILD_NATIVE.md), but the report-assembly logic and JSON shaping were validated against a representative default-persona payload:

  • --help lists --json.
  • The assembled report is valid JSON with the {surfaces, invariants, ok} shape.
  • 7 new invariants added (≥ 6 required); the six existing checks and the default text output are unchanged.
  • docs/gauntlet-sample.json parses and has the documented shape.

Closes #12

…let.py

gauntlet.py verified a running bundle over raw CDP but only checked a
small set of surfaces and emitted human-readable text, so it could not be
consumed by CI or a dashboard. Keep the zero-deps, raw-CDP design and add:

- A --json flag that emits {surfaces, invariants, ok} on stdout and sets
  the exit code accordingly. Without it the text report is unchanged.
- Seven new invariants, all already spoofed by the default persona the
  bundle launcher injects:
  - navigator.hardwareConcurrency present and plausible (1-128)
  - navigator.deviceMemory present
  - navigator.languages well-formed (a real list, length >= 2)
  - Intl.DateTimeFormat().resolvedOptions().timeZone is an IANA zone
  - canvas 2D noise present (a flat grey fill reads back perturbed)
  - navigator.gpu adapter present (WebGPU, via the swiftshader adapter)
  - navigator.plugins non-empty

The surface-collection expression becomes an async IIFE so it can await
navigator.gpu.requestAdapter(); ws_eval already awaits the promise.

Document --json in --help and the module header, and commit a reference
docs/gauntlet-sample.json showing a passing report.

Closes tiliondev#12
@abtonmoy abtonmoy merged commit c33bb1e into tiliondev:main Jul 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tools): add --json output and expand invariant coverage in gauntlet.py

1 participant