CONFORMANCE HARNESS & EDGE PROBE

Web + AI Spec Polyfill Testbed

Executable 15-assertion conformance suite, polyfill registry, and PerformanceObserver timing harness for navigator.modelContext (WebMCP), capability-scoped <web-island> Custom Elements with ElementInternals, and declarative Connection-Allowlist egress enforcement.

Problem & Hypothesis

Draft browser proposals look coherent in explainers, but naming conflicts, validation edge cases, and security gaps surface earlier when executed in live polyfill conformance suites.

Confirm Signal

All 15 structured assertions execute reproducibly with PerformanceObserver timing across engines and verify live HTTP Connection-Allowlist: () iframe blocking.

Falsify Signal

Polyfills diverge on engine-level semantics (pre-connection DNS blocking for Connection-Allowlist or cross-origin paint isolation for <web-island>) that JavaScript cannot replicate.

Run Conformance & Overhead Checks

Interactive verification steps
01

Run All 3 Spec Conformance Suites

Probes native browser APIs against polyfill contracts and refreshes the live /probe/connection-allowlist header verification iframe.

02

Register & Execute Live Tool + <web-island>

Registers a JSON-Schema-validated tool on navigator.modelContext, binds its capability token to <web-island>, and invokes it end-to-end.

03

Measure Polyfill & Policy Overhead

Executes 25 setup, schema-validation, and policy-evaluation iterations using performance.mark and opens the duration measures in the Wire Inspector.

Specs Evaluated 3
Assertions Passed 0 / 15
Conformance Overhead — ms
Connection-Allowlist Probe Pending

Native vs Polyfill Conformance Matrix

Running initial check…

Interactive Polyfill Workbench

Pure DOM node updates & live edge probe

navigator.modelContext + <web-island>

Register a tool on the active navigator.modelContext polyfill, declare capabilities on the live <web-island> element, and inspect ElementInternals form participation.

Shadow-isolated island slot participating in host FormData and capability checks.
Tool Status
Not registered yet
Capability Gate
—
ElementInternals Validity
—
FormData("island_contract")
—

Connection-Allowlist Header & Egress Guard

Test RFC 9651 Structured Field parsing (including fail-closed empty () and malformed policies) alongside the real /probe/connection-allowlist HTTP response iframe.

Policy not evaluated yet.
Live Edge Probe: GET /probe/connection-allowlist (Connection-Allowlist: ())

Spec Conformance & Timing Wire Inspector

Mutually exclusive <details name="wire"> panes
1. Conformance Trace, Tool Registry & Egress Decisions
Running conformance suite...
2. HTTP Probe Headers (/api/specs & /probe/connection-allowlist)
Fetching worker endpoint headers...
3. PerformanceObserver Marks & Measures
Collecting PerformanceObserver entries...
How This Is Set Up

Conformance & Polyfill Harness Architecture

Draft specifications such as navigator.modelContext, capability-scoped <web-island> elements, and Connection-Allowlist headers ship on separate engine timelines. This harness feature-detects each surface, installs deterministic polyfills where native APIs are absent, and records PerformanceObserver marks alongside a live Cloudflare Worker probe.

Unverified explainer glue (drift risk)
// Calling draft APIs without feature detection, schema validation, or egress bounds
async function invokePageTool(name, args, container) {
  // Assumes navigator.modelContext exists without schema or AbortSignal guards
  const result = await navigator.modelContext.callTool(name, args);
  // Unscoped iframe + permissive connect-src permits unlisted outbound fetches
  const frame = document.createElement("iframe");
  frame.src = "https://third-party.example/widget";
  container.replaceChildren(frame);
  // No PerformanceObserver marks or conformance assertions for native vs shim
  return result;
}
Conformance-tested polyfill (this lab)
// public/app.js — feature-detected polyfills + 15-assertion conformance suite
import {
  defineWebIslandElement, installModelContextPolyfill, runSpecConformanceSuite
} from "/lib/spec-polyfills.js";

defineWebIslandElement(window); // Attaches ElementInternals + FormData contract
installModelContextPolyfill(navigator, { performance });

navigator.modelContext.registerTool({
  name: "lookup_spec",
  inputSchema: { type: "object", required: ["query"], properties: { query: { type: "string", minLength: 2 } } },
  execute: ({ query }) => ({ query, specs: ["webmcp", "connection-allowlists"] })
}, { signal: abortController.signal });

const report = await runSpecConformanceSuite({ navigator, window, performance, PerformanceObserver });
Complete Page Setup: Verbatim Assertions, Custom Element & Worker Probe Wiring

Mount elements in public/index.html, the 15-assertion SPEC_PROPOSALS check list, <web-island> ElementInternals contract, navigator.modelContext tool descriptor, PerformanceObserver collection, and Worker /probe/connection-allowlist response headers.

<!-- 1. Page HTML Setup (public/index.html) -->
<form id="island-demo-form" class="island-form">
  <web-island id="live-island" name="island_contract" island-id="sandbox-1"
    capabilities="theme resize tool:lookup_spec tool:search" sandbox-policy="allow-scripts"></web-island>
</form>
<div id="suites-container" class="suites-grid"></div>
<iframe id="allowlist-probe-frame" class="probe-frame" title="Connection-Allowlist HTTP Header Probe"></iframe>
<script type="module" src="/app.js"></script>

// 2. 15-Assertion Conformance Suite, Tool Descriptor & ElementInternals Contract (public/lib/spec-polyfills.js)
// SPEC_PROPOSALS declares 3 specs x 5 assertions = 15 checks:
// - navigator-modelcontext: mc-surface-detect, mc-register-and-list, mc-schema-valid-exec,
//   mc-schema-invalid-reject, mc-lifecycle-abort-and-provide
// - web-island-element: wi-registry-define, wi-element-internals, wi-capability-parse,
//   wi-form-participation, wi-frame-contract-serialize
// - declarative-egress-guard: egress-empty-fail-closed, egress-malformed-fail-closed,
//   egress-response-origin-match, egress-csp-connect-src, egress-guarded-fetch-block
class WebIslandElement extends env.HTMLElement {
  static formAssociated = true;
  static observedAttributes = ["capabilities", "island-id", "src", "sandbox-policy", "name"];
  _syncInternals() {
    this._internals.role = "region";
    this._internals.setFormValue(JSON.stringify({ islandId, sandboxPolicy, capabilities: parsed.tokens }));
    this._internals.setValidity(parsed.valid ? {} : { customError: true }, "Invalid capability token(s)");
  }
}
const lookupToolDescriptor = {
  name: "lookup_spec",
  description: "Query matching spec proposal metadata via <web-island> capability tool:lookup_spec.",
  inputSchema: {
    type: "object",
    properties: { query: { type: "string", minLength: 2 } },
    required: ["query"],
    additionalProperties: false
  },
  execute: async ({ query }) => ({
    toolName: "lookup_spec",
    query,
    islandCapabilityGranted: getLiveIsland().allows("tool:lookup_spec")
  })
};

// 3. Page Bootstrap, PerformanceObserver Runner & Edge Probe Headers (public/app.js + src/worker.ts)
defineWebIslandElement(window);
state.modelContextInstall = installModelContextPolyfill(navigator, { performance });
navigator.modelContext.registerTool(lookupToolDescriptor, { signal: controller.signal });
const globalPerfObserver = new PerformanceObserver((list) => {
  for (const entry of list.getEntries()) {
    state.perfHistory.push({ entryType: entry.entryType, name: entry.name, startTime: entry.startTime, duration: entry.duration });
  }
});
globalPerfObserver.observe({ entryTypes: ["mark", "measure"] });
const result = await runSpecConformanceSuite({ navigator, window, document, customElements: window.customElements, HTMLElement: window.HTMLElement, performance, PerformanceObserver: window.PerformanceObserver, ReportingObserver: window.ReportingObserver, origin: window.location.origin, probeResult: state.lastProbePayload || undefined });
// src/worker.ts GET /probe/connection-allowlist headers:
// "Connection-Allowlist": "()"
// "Reporting-Endpoints": `allowlist="${url.origin}/api/egress-report"`
// "Content-Security-Policy": `default-src 'none'; connect-src 'self'; script-src 'sha256-${scriptHash}'; style-src 'sha256-${styleHash}'; frame-ancestors 'self' https://aifoc.us https://*.aifoc.us`
Browser + Edge Egress Contract (RFC 9651 Allowlist, CSP Intersection & Marks)
// src/worker.ts (/probe/connection-allowlist) & public/lib/spec-polyfills.js
// Worker emits fail-closed RFC 9651 empty allowlist + Reporting-Endpoints:
headers.set("Connection-Allowlist", "()");
headers.set("Reporting-Endpoints", `allowlist="${url.origin}/api/egress-report"`);

// public/lib/spec-polyfills.js: runSpecConformanceSuite() + createEgressGuard()
const guard = createEgressGuard({
  responseOrigin: url.origin,
  headerValue: "()", // Denies unlisted outbound fetch() when native enforcement is absent
  cspHeader: "connect-src 'self'",
  enforce: true
});
const obs = new PerformanceObserver((list) => list.getEntries());
obs.observe({ entryTypes: ["mark", "measure"] });
performance.mark("spec:suite:start"); // Measured across 15 deterministic assertions
Eliminated assumptions

Unchecked feature assumptions from draft explainers, global shims lacking AbortSignal cleanup, and unverified cross-origin iframe message bridges.

Explicit runtime contracts

JSON-Schema-validated navigator.modelContext tools, ElementInternals form participation on <web-island>, fail-closed Connection-Allowlist: () parsing, and PerformanceObserver latency deltas.

Current engine gaps

Native Connection-Allowlist: () pre-connect blocking and ReportingObserver delivery for "connection-allowlist" are absent in standard browsers, requiring guardedFetch() and the live Worker probe until engines ship.

01 / PROPOSAL EXPLAINER GET /api/specs & Contracts • navigator.modelContext • <web-island> + Internals • Connection-Allowlist: () 02 / POLYFILL & EDGE PROBE spec-polyfills.js + Worker • Schema & AbortSignal guard • FormData + origin postMessage • /probe/connection-allowlist 03 / MATRIX & TELEMETRY Conformance & Marks • Native vs Polyfill badges • ReportingObserver events • PerformanceObserver deltas
Architecture boundary: Worker endpoints emit live Connection-Allowlist: () and spec metadata while spec-polyfills.js runs isolated conformance assertions and measures latency overhead.