Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(guards): report an unappliable proof fixture instead of aborting the run

nirholasa6d38f0ce2a0
diff --git a/data/guards.json b/data/guards.json
index 689cf8796..d65af2422 100644
--- a/data/guards.json
+++ b/data/guards.json
@@ -873,18 +873,11 @@
"proof": {
"summary": "An event window whose end has already passed, which every surface reads as 'no event' and mounts nothing.",
"violation": {
- "json": [
- {
- "file": "public/event.json",
- "pointer": "",
- "set": {
- "startsAt": "2020-01-01T00:00:00.000Z",
- "endsAt": "2020-01-01T02:00:00.000Z"
- }
- }
- ]
+ "write": {
+ "public/event.json": "{\n\t\"id\": \"guard-proof-expired\",\n\t\"name\": \"Guard proof expired event\",\n\t\"startsAt\": \"2020-01-01T00:00:00.000Z\",\n\t\"endsAt\": \"2020-01-01T02:00:00.000Z\"\n}\n"
+ }
},
- "expect": "event.json"
+ "expect": "the event window ENDED"
}
},
{
diff --git a/public/guard-proofs.json b/public/guard-proofs.json
index 8d025b67f..63c228d27 100644
--- a/public/guard-proofs.json
+++ b/public/guard-proofs.json
@@ -1,13 +1,13 @@
{
"$comment": "Generated by scripts/prove-guards.mjs. Each result is the outcome of running the guard twice in a sandbox: once on a clean baseline, once after a declared violation. The fixtures live in data/guards.json.",
"generator": "scripts/prove-guards.mjs",
- "commit": "ffa434ca0dba2d57c8f2d137d659ce583e11879c",
- "guardCount": 34,
+ "commit": "5e48db848c993d809bc23affff3e0ae97d8c6ba6",
+ "guardCount": 45,
"summary": {
- "proven": 23,
- "liveOnly": 10,
- "failing": 1,
- "redBaseline": 12
+ "proven": 28,
+ "liveOnly": 17,
+ "failing": 0,
+ "redBaseline": 6
},
"results": [
{
@@ -18,7 +18,7 @@
"summary": "A staged source file carrying an unresolved conflict marker.",
"reason": null,
"evidence": "src/guard-proof-conflict.js (line 2)",
- "ms": 29889
+ "ms": 39900
},
{
"id": "check-claude-md",
@@ -28,17 +28,37 @@
"summary": "CLAUDE.md telling an agent to run an npm script that does not exist.",
"reason": null,
"evidence": "[check-claude] npm script `guard-proof-nonexistent` is referenced but missing from package.json",
- "ms": 787
+ "ms": 865
+ },
+ {
+ "id": "sync-studio-openapi",
+ "npm": "check:studio-openapi",
+ "verdict": "proven",
+ "baseline": "clean",
+ "summary": "The submission kit shipping an Actions contract that no longer matches the schema the site serves.",
+ "reason": null,
+ "evidence": "3D Studio OpenAPI drift: prompts/store-submissions/_generated/openai-actions.yaml does not match public/.well-known/3d-studio-openapi.yaml.",
+ "ms": 494
},
{
"id": "check-rules",
"npm": "check:rules",
"verdict": "proven",
- "baseline": "clean",
+ "baseline": "red",
"summary": "A new source file whose added lines break a CLAUDE.md hard rule.",
"reason": null,
"evidence": "[check-rules] src/guard-proof-rule.js:1 [todo]",
- "ms": 1888
+ "ms": 42385
+ },
+ {
+ "id": "check-secrets",
+ "npm": "check:secrets",
+ "verdict": "proven",
+ "baseline": "clean",
+ "summary": "An SSH private key staged as a tracked file.",
+ "reason": null,
+ "evidence": "[check-secrets] id_ed25519:1 [ssh-key]",
+ "ms": 22354
},
{
"id": "check-cron-drift",
@@ -54,11 +74,11 @@
"id": "audit-page-index",
"npm": "audit:pages",
"verdict": "proven",
- "baseline": "red",
+ "baseline": "clean",
"summary": "A public page route in vercel.json that no data/pages.json entry documents.",
"reason": null,
"evidence": "/guard-proof-orphan",
- "ms": 752
+ "ms": 393
},
{
"id": "check-pages",
@@ -68,7 +88,7 @@
"summary": "A page advertised in data/pages.json with no built file behind it.",
"reason": null,
"evidence": "[check-pages] /guards : not built into dist/ (missing vite input entry?)",
- "ms": 373
+ "ms": 439
},
{
"id": "verify-routes",
@@ -78,7 +98,7 @@
"summary": "Deleting the route that serves a catalogued page, so its pretty URL 404s.",
"reason": null,
"evidence": "COVERAGE /guards canonical → notfound (404) /404.html",
- "ms": 7361
+ "ms": 3364
},
{
"id": "audit-empty-handlers",
@@ -88,37 +108,57 @@
"summary": "An API file that is routable but exports nothing, so it can never serve a response.",
"reason": null,
"evidence": "api/guard-proof-empty.js: empty file",
- "ms": 1261
+ "ms": 1675
},
{
"id": "audit-hidden-guard",
"npm": "audit:hidden-guard",
"verdict": "proven",
- "baseline": "red",
+ "baseline": "clean",
"summary": "A product page that links no shared stylesheet, so [hidden] never hides anything.",
"reason": null,
"evidence": "pages/guard-proof-unguarded.html",
- "ms": 1092
+ "ms": 1133
+ },
+ {
+ "id": "audit-inline-handlers",
+ "npm": "audit:inline-handlers",
+ "verdict": "proven",
+ "baseline": "clean",
+ "summary": "A page wiring a click through an onclick attribute, which no script hash can cover.",
+ "reason": null,
+ "evidence": "pages/guard-proof-inline-handler.html:4 inline event handler",
+ "ms": 3914
+ },
+ {
+ "id": "audit-csp",
+ "npm": "audit:csp",
+ "verdict": "declared-live",
+ "baseline": null,
+ "summary": null,
+ "reason": "Needs Playwright plus a server serving dist/, because the thing under test is the browser's own policy evaluation against a real response. A static fixture cannot produce a securitypolicyviolation event.",
+ "evidence": null,
+ "ms": 0
},
{
"id": "audit-docs",
"npm": "audit:docs",
"verdict": "proven",
- "baseline": "red",
+ "baseline": "clean",
"summary": "A doc whose relative link points at a file that does not exist.",
"reason": null,
"evidence": "docs/guard-proof-dead-link.md:3 ./guard-proof-nowhere.md",
- "ms": 7397
+ "ms": 5637
},
{
"id": "sync-tutorial-pages",
"npm": "check:tutorials",
"verdict": "proven",
- "baseline": "red",
+ "baseline": "clean",
"summary": "A tutorial markdown file that no manifest entry points at, so nothing can reach it.",
"reason": null,
- "evidence": "markdown with no manifest entry (unreachable): find-a-better-exit-policy, guard-proof-orphan",
- "ms": 634
+ "evidence": "markdown with no manifest entry (unreachable): guard-proof-orphan",
+ "ms": 532
},
{
"id": "audit-mcp-catalog",
@@ -128,17 +168,17 @@
"summary": "A new MCP tool landing without regenerating the public catalog.",
"reason": null,
"evidence": "[audit:mcp-catalog] public/mcp-catalog.json is stale.",
- "ms": 10652
+ "ms": 8832
},
{
"id": "audit-x402-catalog",
"npm": "audit:x402-catalog",
"verdict": "proven",
- "baseline": "red",
+ "baseline": "clean",
"summary": "A paid x402 endpoint that no buyer can find, because the catalog never mentions it.",
"reason": null,
"evidence": "/api/x402/guard-proof-endpoint",
- "ms": 462
+ "ms": 167
},
{
"id": "audit-mcp-manifests",
@@ -148,7 +188,7 @@
"summary": "A registry manifest whose description exceeds the 100-character schema limit.",
"reason": null,
"evidence": "[audit:mcp] server.json: description is 150 chars (registry max is 100)",
- "ms": 342
+ "ms": 321
},
{
"id": "audit-mcp-golden",
@@ -158,7 +198,7 @@
"summary": "A tool contract appearing on the wire without being declared in the golden fixture.",
"reason": null,
"evidence": "[audit:mcp-golden] api/_mcp/tools/guard-proof-golden.js: tool ADDED: guard_proof_golden",
- "ms": 3106
+ "ms": 2598
},
{
"id": "audit-mcp-safety",
@@ -168,17 +208,17 @@
"summary": "A tool shipping with no safety annotations at all, so a client cannot judge it.",
"reason": null,
"evidence": "[audit:mcp-safety] api/_mcp/tools/guard-proof-safety.js: guard_proof_safety: no annotations. destructiveHint defaults to TRUE when omitted, so this tool is advertised as destructive. Declare them explicitly.",
- "ms": 7528
+ "ms": 4689
},
{
"id": "audit-token-drift",
"npm": "audit:tokens",
- "verdict": "control-failed",
- "baseline": "red",
+ "verdict": "proven",
+ "baseline": "clean",
"summary": "A token-covered page hardcoding a hex that is literally a design token.",
"reason": null,
- "evidence": null,
- "ms": 961
+ "evidence": "✗ design-token drift increased: 2 hardcoded token-hexes (baseline 0).",
+ "ms": 501
},
{
"id": "check-browser-graph",
@@ -188,7 +228,7 @@
"summary": "A Node built-in reaching the browser bundle through a real import chain.",
"reason": null,
"evidence": "src/solana/sns.js imports \"node:util\"",
- "ms": 3308
+ "ms": 3748
},
{
"id": "check-dist",
@@ -198,7 +238,7 @@
"summary": "A build that finished without producing the published embed bundle.",
"reason": null,
"evidence": "[check-dist] MISSING: dist/dist-lib/agent-3d.umd.cjs",
- "ms": 594
+ "ms": 338
},
{
"id": "audit-deploy-artifacts",
@@ -208,7 +248,7 @@
"summary": "A symlink committed to the index, which the deploy bundler cannot resolve.",
"reason": null,
"evidence": "data/guard-proof-link.md → replace with a real copy of the target",
- "ms": 5704
+ "ms": 3467
},
{
"id": "check-gcloudignore",
@@ -217,8 +257,8 @@
"baseline": "clean",
"summary": "A missing .gcloudignore, which silently hands the upload set back to .gitignore.",
"reason": null,
- "evidence": "FAIL: ignore file not found: /workspaces/.guard-proof-wt/.gcloudignore",
- "ms": 1004
+ "evidence": "FAIL: ignore file not found: /workspaces/.guard-proof-wt-48699/.gcloudignore",
+ "ms": 572
},
{
"id": "audit-links",
@@ -228,7 +268,7 @@
"summary": "A route in vercel.json whose destination file was never created.",
"reason": null,
"evidence": "✗ /guard-proof-dangling → /guard-proof-dangling.html",
- "ms": 21355
+ "ms": 21979
},
{
"id": "audit-console",
@@ -244,11 +284,11 @@
"id": "audit-image-loading",
"npm": "check:images",
"verdict": "proven",
- "baseline": "red",
+ "baseline": "clean",
"summary": "A JS-rendered image with no loading attribute, which fetches eagerly off-screen.",
"reason": null,
"evidence": "src/guard-proof-img.js:2",
- "ms": 1386
+ "ms": 5193
},
{
"id": "audit-garments",
@@ -290,6 +330,16 @@
"evidence": null,
"ms": 0
},
+ {
+ "id": "audit-llm-metering",
+ "npm": "audit:llm-metering",
+ "verdict": "declared-live",
+ "baseline": null,
+ "summary": null,
+ "reason": "Aggregates the usage_events ledger over a time window, so it has no offline input. The rule it applies is unit-tested without a database in tests/llm-metering-rule.test.js.",
+ "evidence": null,
+ "ms": 0
+ },
{
"id": "check-relayer-balances",
"npm": "check:relayer-balances",
@@ -308,7 +358,7 @@
"summary": "A registry entry naming a guard script that is not in the repository.",
"reason": null,
"evidence": "[audit-guards] guard `check-merge-conflicts` names script `scripts/guard-proof-missing.mjs`, which does not exist",
- "ms": 473
+ "ms": 292
},
{
"id": "check-erc7710-addresses",
@@ -348,7 +398,67 @@
"summary": "A doc figure whose image file does not exist on disk.",
"reason": null,
"evidence": "FAIL /docs/img/guard-proof-missing.png is referenced by docs/guard-proof-media.md but does not exist. Run: node scripts/capture-doc-media.mjs --only guard-proof-missing",
- "ms": 1206
+ "ms": 828
+ },
+ {
+ "id": "check-event-window",
+ "npm": "check:event",
+ "verdict": "proven",
+ "baseline": "clean",
+ "summary": "An event window whose end has already passed, which every surface reads as 'no event' and mounts nothing.",
+ "reason": null,
+ "evidence": "[check-event] the event window ENDED 57991h ago (2020-01-01T02:00:00Z UTC), so the countdown, agenda, fireworks, souvenir grant and event leaderboard are all silently dormant. Reschedule with `npm run event:schedule -- --start <ISO> --dur",
+ "ms": 444
+ },
+ {
+ "id": "audit-tour-atlas",
+ "npm": "audit:tour-atlas",
+ "verdict": "declared-live",
+ "baseline": null,
+ "summary": null,
+ "reason": "The check re-renders the committed atlas from data/tour-atlas.json and verifies 160 captured screenshots exist on disk; a sandbox proof would need the full media tree copied per run, so it is exercised by the real gate instead.",
+ "evidence": null,
+ "ms": 0
+ },
+ {
+ "id": "audit-route-shadowing",
+ "npm": "audit:route-shadowing",
+ "verdict": "declared-live",
+ "baseline": null,
+ "summary": null,
+ "reason": "The audit currently reports a real backlog of 46 shadowed handlers, so it exits non-zero against the live repo and cannot yet pass the control half of a sandboxed proof. It stays a manual audit until that backlog is cleared, at which point it can move into the gate with a two-sided proof.",
+ "evidence": null,
+ "ms": 0
+ },
+ {
+ "id": "audit-cron-liveness",
+ "npm": "audit:cron-liveness",
+ "verdict": "declared-live",
+ "baseline": null,
+ "summary": null,
+ "reason": "The run stage boots the real server on a free port and probes every cron URL, so the check is inherently live. The probe is deliberately unauthenticated and every handler fails closed on CRON_SECRET, so no job body executes: nothing is paid, swapped, minted, transferred, or written. `--static` skips the boot for a route-and-load-only pass.",
+ "evidence": null,
+ "ms": 0
+ },
+ {
+ "id": "audit-custodial-key-health",
+ "npm": "audit:custodial-keys",
+ "verdict": "declared-live",
+ "baseline": null,
+ "summary": null,
+ "reason": "It reads the production wallet table and the live encryption key, then decrypts in memory to test each secret against the current key. There is no offline fixture for 'this ciphertext no longer opens' that would prove anything about the real fleet. Read-only: it never writes, signs, or broadcasts.",
+ "evidence": null,
+ "ms": 0
+ },
+ {
+ "id": "audit-play-failure-modes",
+ "npm": "audit:play-failures",
+ "verdict": "declared-live",
+ "baseline": null,
+ "summary": null,
+ "reason": "Needs Playwright plus a running server, because the thing under test is how the page behaves when a specific request is aborted or rewritten mid-load. A static fixture cannot fail a fetch the page has not made yet.",
+ "evidence": null,
+ "ms": 0
}
]
}
diff --git a/public/guards.json b/public/guards.json
index 689cf8796..d65af2422 100644
--- a/public/guards.json
+++ b/public/guards.json
@@ -873,18 +873,11 @@
"proof": {
"summary": "An event window whose end has already passed, which every surface reads as 'no event' and mounts nothing.",
"violation": {
- "json": [
- {
- "file": "public/event.json",
- "pointer": "",
- "set": {
- "startsAt": "2020-01-01T00:00:00.000Z",
- "endsAt": "2020-01-01T02:00:00.000Z"
- }
- }
- ]
+ "write": {
+ "public/event.json": "{\n\t\"id\": \"guard-proof-expired\",\n\t\"name\": \"Guard proof expired event\",\n\t\"startsAt\": \"2020-01-01T00:00:00.000Z\",\n\t\"endsAt\": \"2020-01-01T02:00:00.000Z\"\n}\n"
+ }
},
- "expect": "event.json"
+ "expect": "the event window ENDED"
}
},
{
diff --git a/scripts/audit-guards.mjs b/scripts/audit-guards.mjs
index 5246e9ebb..1f8b07cd7 100644
--- a/scripts/audit-guards.mjs
+++ b/scripts/audit-guards.mjs
@@ -116,6 +116,20 @@ for (const g of registry.guards || []) {
try {
const proof = normalizeProof(g);
prose.push([`${where} proof ${proof.kind === 'live' ? 'reason' : 'summary'}`, proof.summary ?? proof.reason]);
+ // A json op edits a file in place, so the file must exist in the working
+ // tree the proof sandbox mirrors. A deleted target turns the proof into a
+ // crash at apply time (public/event.json was retired and its proof kept
+ // editing it), and nothing else catches that before a prove run.
+ if (proof.kind === 'mutation') {
+ for (const op of proof.violation.json) {
+ if (!existsSync(path.join(root, op.file))) {
+ note(
+ `${where} proof edits ${op.file} in place, but that file does not exist, so the fixture can never apply. ` +
+ 'Rewrite the violation as a `write` of a complete file, or restore the target.',
+ );
+ }
+ }
+ }
} catch (err) {
note(`${where}: ${err.message}. Every guard must declare the violation it rejects (see docs/guards.md).`);
}
diff --git a/scripts/lib/guard-proofs.mjs b/scripts/lib/guard-proofs.mjs
index 19f2daa08..5f115a278 100644
--- a/scripts/lib/guard-proofs.mjs
+++ b/scripts/lib/guard-proofs.mjs
@@ -390,6 +390,21 @@ export function proveGuard(guard, proof, sandbox, options = {}) {
evidence: firstMatchingLine(violated.output, proof.expect),
ms,
};
+ } catch (err) {
+ // A fixture that cannot even be applied (its target file was deleted, its
+ // pointer resolves to nothing) is a broken DECLARATION, not a broken
+ // guard. It must surface as a failing verdict rather than an uncaught
+ // throw, because a throw here aborts the entire run and silently skips
+ // every guard after this one, which already happened once when a proof
+ // kept editing public/event.json after the tree retired that file.
+ return {
+ id: guard.id,
+ verdict: VERDICTS.CONTROL_FAILED,
+ summary: proof.summary,
+ output: String(err?.message ?? err),
+ ms: 0,
+ note: 'the proof fixture could not be applied, so the guard was never exercised; fix this proof in data/guards.json',
+ };
} finally {
if (proof.stage) unstage(sandbox);
restore(sandbox, saved);
diff --git a/tests/audit-guards.test.js b/tests/audit-guards.test.js
index 906a01b4e..7fc16fd6f 100644
--- a/tests/audit-guards.test.js
+++ b/tests/audit-guards.test.js
@@ -1,9 +1,10 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { execFileSync } from 'node:child_process';
-import { mkdtempSync, rmSync, writeFileSync, mkdirSync, copyFileSync, readFileSync } from 'node:fs';
+import { mkdtempSync, rmSync, writeFileSync, mkdirSync, copyFileSync, readFileSync, existsSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
+import { proveGuard, normalizeProof, VERDICTS } from '../scripts/lib/guard-proofs.mjs';
// Guards the guard. audit-guards is the only thing standing between
// data/guards.json and quiet fiction, and it is rendered in two public places
@@ -101,7 +102,7 @@ const goodGuard = {
stages: ['gate'],
needs: 'none',
// The auditor requires every guard to declare a proof; the sandboxed
- // two-sided kind is exercised by tests/prove-guards.test.js, so fixtures
+ // two-sided kind is exercised by the 'guard proofs' block below, so fixtures
// here use the declared-live escape hatch.
proof: { kind: 'live', reason: 'fixture guard, proven elsewhere' },
};
@@ -316,6 +317,53 @@ describe('audit-guards', () => {
expect(code).toBe(1);
expect(out).toContain('never describes it for readers');
});
+
+ it('fails when a json-op proof edits a file that does not exist', () => {
+ // The rot that motivated this: public/event.json was deliberately retired
+ // while its guard's proof kept editing it in place, which crashed every
+ // prove run at apply time. The auditor must catch the dead target first.
+ const jsonOpGuard = {
+ ...goodGuard,
+ proof: {
+ summary: 'fixture violation via json op',
+ violation: { json: [{ file: 'public/gone.json', pointer: 'items', insert: { a: 1 } }] },
+ expect: 'gone',
+ },
+ };
+ const dir = makeRepo('json-op-dead-target', { guards: [jsonOpGuard], scripts: goodScripts });
+ const { code, out } = run(dir);
+ expect(code).toBe(1);
+ expect(out).toContain('the fixture can never apply');
+
+ const okDir = makeRepo('json-op-live-target', { guards: [jsonOpGuard], scripts: goodScripts });
+ writeFileSync(join(okDir, 'public', 'gone.json'), '{"items": []}\n');
+ expect(run(okDir).code).toBe(0);
+ });
+});
+
+describe('guard proofs', () => {
+ it('reports an unappliable fixture as a failing verdict instead of throwing', () => {
+ // A throw here would abort the whole prove run and silently skip every
+ // guard after the broken one, so the runner depends on this contract.
+ const dir = join(sandbox, 'proof-apply-error');
+ mkdirSync(dir, { recursive: true });
+ const proof = normalizeProof({
+ id: 'check-thing',
+ proof: {
+ summary: 'edits a file that is not there',
+ violation: { json: [{ file: 'public/gone.json', pointer: 'items', insert: { a: 1 } }] },
+ expect: 'gone',
+ },
+ });
+ const result = proveGuard({ id: 'check-thing', command: 'true' }, proof, dir, {
+ run: () => ({ code: 0, output: '', timedOut: false, ms: 1 }),
+ });
+ expect(result.verdict).toBe(VERDICTS.CONTROL_FAILED);
+ expect(result.note).toContain('could not be applied');
+ expect(result.output).toContain('gone.json');
+ // The sandbox is left exactly as it was found.
+ expect(existsSync(join(dir, 'public', 'gone.json'))).toBe(false);
+ });
});
describe('this repository', () => {