open-standards/scripts/check-wai-ops-doors-selftest.sh
Transaction Science ef6dda46ee
Some checks failed
joule-moq-web browser client / joule-moq-web · does this change touch it (pull_request) Successful in 5s
joule-moq-remote host agent / joule-moq-remote · does this change touch it (pull_request) Successful in 6s
joule-moq-room room service / joule-moq-room · does this change touch it (pull_request) Successful in 7s
wai-web reach builds / wai-web reach · does this change touch it (pull_request) Successful in 6s
joule-code conformance gate / Build + round-trip C1-C4 vectors (pull_request) Successful in 3m22s
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Successful in 2m52s
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Successful in 4m4s
joule-code conformance gate / joule-moq-relay, every target (pull_request) Successful in 3m48s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 9s
wai-audit collector and player integration / does this change touch it (pull_request) Successful in 7s
WAI operation catalogue / does this change touch it (pull_request) Successful in 6s
WAI conformance / does this change touch it (pull_request) Successful in 6s
WAI energy receipts / does this change touch it (pull_request) Successful in 9s
WAI examples / WAI examples · does this change touch them (pull_request) Successful in 9s
WAI HTTP delivery / WAI HTTP · does this change touch it (pull_request) Successful in 6s
wai-key-proxy / does this change touch it (pull_request) Successful in 6s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 35s
wai-ledger service / does this change touch it (pull_request) Successful in 6s
wai-ops-gpu integer operators on GPUs / does this change touch it (pull_request) Successful in 6s
wai-audit collector and player integration / collector · linux (pull_request) Successful in 1m8s
wai-pack / wai-pack · does this change touch it (pull_request) Successful in 7s
wai-quantum studio and desktop / does this change touch it (pull_request) Successful in 6s
wai-sink-android native sink library / does this change touch it (pull_request) Successful in 7s
wai-sink-swift native sink package / does this change touch it (pull_request) Successful in 6s
WAI operation catalogue / the catalogue and every door · linux (pull_request) Successful in 1m28s
wai-web wasm32 / does this change touch it (pull_request) Successful in 7s
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 2m47s
WAI conformance / faces from keypoints under wasm32-wasip2 (wasmtime) (pull_request) Successful in 1m44s
wai-key-proxy / proxy · linux (pull_request) Successful in 1m3s
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 2m31s
joule-moq-remote host agent / joule-moq-remote, every target (linux-arm64) (pull_request) Successful in 1m22s
WAI conformance / fast integer kernels, every x86_64 kernel set (AVX-512 silicon) (pull_request) Successful in 3m6s
wai-ledger service / service · linux (pull_request) Successful in 1m36s
joule-code conformance gate / joule-moq-ingest, every target (pull_request) Successful in 5m50s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 18s
joule-moq-room room service / joule-moq-room, every target (pull_request) Successful in 2m38s
wai-pack / wai-pack · linux (pull_request) Successful in 1m48s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 2m53s
wai-ops-gpu integer operators on GPUs / builds · no adapter is not a pass (linux) (pull_request) Successful in 4m35s
WAI examples / WAI examples · portable · linux (pull_request) Successful in 7m36s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 7m4s
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Successful in 14s
joule-code conformance gate / joule-moq-relay, its own energy on a counter (macos) (pull_request) Successful in 37s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 38s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 5m35s
joule-moq-remote host agent / joule-moq-remote, every target (macos) (pull_request) Successful in 1m0s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 10m56s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 1m57s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Successful in 1m34s
WAI conformance / each feature of the independent verifiers' steps compiles alone (pull_request) Successful in 11m5s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 4m24s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 16m33s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 9m22s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 9m23s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 26s
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 1m1s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 18m50s
joule-moq-web browser client / joule-moq-web · browser end-to-end (macos) (pull_request) Has been cancelled
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Has been cancelled
WAI HTTP delivery / HTTP corpus · falsify patches 1/3 (pull_request) Has been cancelled
WAI HTTP delivery / HTTP corpus · falsify patches 2/3 (pull_request) Has been cancelled
WAI HTTP delivery / HTTP corpus · every patch and mutation in exactly one shard (pull_request) Has been cancelled
WAI HTTP delivery / HTTP corpus · verified both ways, and the differential (pull_request) Has been cancelled
WAI HTTP delivery / cache rules · controls and labelled caches (pull_request) Has been cancelled
WAI energy receipts / energy receipts · macos (pull_request) Has been cancelled
wai-ledger service / service · macos (pull_request) Has been cancelled
wai-ops-gpu integer operators on GPUs / Metal GPU and browser WebGPU (macos) (pull_request) Has been cancelled
wai-pack / wai-pack · linux-arm64 (pull_request) Has been cancelled
wai-pack / wai-pack · macos (pull_request) Has been cancelled
wai-pack / wai-pack · independent verifier (Python) (pull_request) Has been cancelled
wai-pack / wai-pack · the floor through a media prober (pull_request) Has been cancelled
wai-pack / wai-pack · dependency licences (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
WAI HTTP delivery / HTTP corpus · falsify patches 0/3 (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
WAI HTTP delivery / HTTP corpus · falsify mutations 0/3 (pull_request) Has been cancelled
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Has been cancelled
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
WAI HTTP delivery / HTTP corpus · falsify mutations 2/3 (pull_request) Has been cancelled
WAI HTTP delivery / HTTP corpus · falsify mutations 1/3 (pull_request) Has been cancelled
wai ops: the command line carries only the operations it implements; the door check reads a tool table by operation
An operation served only over HTTP or MCP has no command line: it does not resolve, help does
not list it as a command, and the dry-run test asks no sample of it. check-wai-ops-doors.py
reads an MCP tool named by its operation (op: "noun.verb") as well as one named outright.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 05:12:08 -04:00

160 lines
7.6 KiB
Shell
Executable file

#!/usr/bin/env bash
#
# check-wai-ops-doors-selftest.sh — check-wai-ops-doors.py can fail.
#
# A check that cannot fail is decoration. This builds a scratch tree shaped like the
# repository (a catalogue export, an MCP tool table, an OpenAPI document, the C header and a
# Swift and a Kotlin source) whose every door names its operations as the catalogue does, and
# asserts that the check passes it and fails each way a door can misname an operation,
# saying which.
set -uo pipefail
here=$(cd "$(dirname "$0")" && pwd)
check="$here/check-wai-ops-doors.py"
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
mk() {
rm -rf "$tmp/wai" "$tmp/joule-code"
mkdir -p "$tmp/wai/catalogue" "$tmp/wai/wai-rs/src/bin/wai_cli/mcp" "$tmp/wai/wai-rs/include" \
"$tmp/joule-code/joule-code-rs/crates/svc" "$tmp/wai/wai-sink-swift/Sources/WaiSink" \
"$tmp/wai/wai-sink-android/core/src/main/kotlin/wai/sink"
cat > "$tmp/wai/catalogue/ops.json" <<'J'
{"format": "wai.ops/1", "operations": [
{"id": "envelope.inspect", "placement": "local", "route": null},
{"id": "receipt.verify", "placement": "local", "route": null},
{"id": "room.grant", "placement": "service", "route": {"method": "POST", "path": "/v1/rooms/{room}/grants"}}
]}
J
cat > "$tmp/wai/wai-rs/src/bin/wai_cli/mcp/tools.rs" <<'R'
pub(crate) const TOOLS: &[Tool] = &[
Tool { name: "envelope_inspect", title: "Inspect", run: inspect },
Tool {
name: "room_grant",
title: "Grant",
run: grant,
},
];
R
cat > "$tmp/joule-code/joule-code-rs/crates/svc/openapi.json" <<'J'
{"openapi": "3.1.0", "paths": {"/v1/rooms/{room}/grants": {"post": {"operationId": "room.grant"}, "parameters": []}}}
J
cat > "$tmp/wai/wai-rs/include/wai.h" <<'H'
int32_t wai_envelope_inspect(const uint8_t *p, size_t n);
int32_t wai_envelope_pack(const uint8_t *p, size_t n);
void wai_buffer_free(struct WaiBuffer b);
int32_t wai_image_png_decode(const uint8_t *p);
H
cat > "$tmp/wai/wai-sink-swift/Sources/WaiSink/Envelope.swift" <<'S'
public final class WaiEnvelope: @unchecked Sendable {
public init() {}
public func inspect(_ path: String) -> String { "{" }
public func pack() {}
private func verifyQuietly() {}
}
public final class WaiSink {
public func info() -> String { "" }
}
S
cat > "$tmp/wai/wai-sink-android/core/src/main/kotlin/wai/sink/WaiReceipt.kt" <<'K'
package wai.sink
class WaiReceipt(
val owner: String,
private val pool: Runnable = Runnable { },
) {
fun verify(bytes: ByteArray): Boolean = bytes.isNotEmpty()
private fun checkQuietly() {}
companion object {
fun verifyAll(list: List<ByteArray>) = list.all { it.isNotEmpty() }
}
}
K
}
fails=0
expect() { # expect <pass|fail> <what> [text the output must hold]
local want=$1 what=$2 needle=${3:-} out rc
out=$(python3 -I "$check" --root "$tmp" 2>&1); rc=$?
if [ "$want" = pass ] && [ $rc -ne 0 ]; then echo "FAIL $what: the check failed"; printf '%s\n' "$out" | sed 's/^/ /'; fails=$((fails+1)); return; fi
if [ "$want" = fail ] && [ $rc -eq 0 ]; then echo "FAIL $what: the check passed"; printf '%s\n' "$out" | sed 's/^/ /'; fails=$((fails+1)); return; fi
if [ -n "$needle" ] && ! grep -qF -- "$needle" <<<"$out"; then echo "FAIL $what: the output does not say '$needle'"; printf '%s\n' "$out" | sed 's/^/ /'; fails=$((fails+1)); return; fi
echo "ok $what"
}
sub() { # sub <file> <from> <to>: one replacement, which must apply
python3 - "$1" "$2" "$3" <<'P' || { echo "FAIL the fixture edit did not apply: $2"; fails=$((fails+1)); }
import sys
p, a, b = sys.argv[1:]
s = open(p).read()
if s.count(a) != 1:
sys.exit(1)
open(p, "w").write(s.replace(a, b))
P
}
mk; expect pass "a tree whose every door names its operations as the catalogue does" "MCP: 2 tools, each an operation"
mk; expect pass "the C door's held names and its library API" "C: 1 functions name operations of the catalogue"
mk; expect pass "a Swift and a Kotlin method that name operations" "Kotlin: 2 methods name operations"
mk; rm "$tmp/wai/wai-rs/src/bin/wai_cli/mcp/tools.rs"
expect pass "a door with no operation yet says so" "no MCP door yet"
mk; sub "$tmp/wai/wai-rs/src/bin/wai_cli/mcp/tools.rs" '"envelope_inspect"' '"inspect_envelope"'
expect fail "an MCP tool misnamed" "tool 'inspect_envelope' names inspect.envelope, which the catalogue does not hold"
mk; sub "$tmp/wai/wai-rs/src/bin/wai_cli/mcp/tools.rs" '"room_grant"' '"dev_room_grant"'
expect fail "an MCP tool that is not noun_verb" "tool 'dev_room_grant' is not noun_verb"
mk; cat > "$tmp/wai/wai-rs/src/bin/wai_cli/mcp/tools.rs" <<'R'
pub(crate) const TOOLS: &[Tool] = &[
Tool { op: "envelope.inspect", toolset: Toolset::Core, effect: Effect::Reads, run: inspect,
description: "What an envelope holds." },
Tool { op: "room.grant", toolset: Toolset::Dev, effect: Effect::DevRoom, run: grant,
description: "A grant." },
];
R
expect pass "a tool table that names each tool by its operation" "MCP: 2 tools, each an operation"
mk; cat > "$tmp/wai/wai-rs/src/bin/wai_cli/mcp/tools.rs" <<'R'
pub(crate) const TOOLS: &[Tool] = &[
Tool { op: "envelope.inspect", toolset: Toolset::Core, run: inspect, description: "x" },
Tool { op: "receipt.check", toolset: Toolset::Core, run: check, description: "y" },
];
R
expect fail "a tool named by an operation the catalogue does not hold" "tool 'receipt_check' names receipt.check"
mk; printf 'pub(crate) const TOOLS: &[Tool] = &[];\n' > "$tmp/wai/wai-rs/src/bin/wai_cli/mcp/tools.rs"
expect fail "an MCP tool table the check cannot read" "no tool name could be read"
mk; sub "$tmp/joule-code/joule-code-rs/crates/svc/openapi.json" '"room.grant"' '"grant"'
expect fail "an OpenAPI operationId misnamed" "operationId 'grant' is not an operation of the catalogue"
mk; sub "$tmp/joule-code/joule-code-rs/crates/svc/openapi.json" '/v1/rooms/{room}/grants' '/grant'
expect fail "an OpenAPI route that is not the catalogue's" "the catalogue routes room.grant to POST /v1/rooms/{room}/grants"
mk; sub "$tmp/joule-code/joule-code-rs/crates/svc/openapi.json" '"room.grant"' '"envelope.inspect"'
expect fail "an OpenAPI operation the catalogue places on this machine" "envelope.inspect is placed local, not on a service"
mk; printf 'int32_t wai_envelope_decode(const uint8_t *p);\n' >> "$tmp/wai/wai-rs/include/wai.h"
expect fail "a C function misnamed" "wai_envelope_decode names envelope.decode, which the catalogue does not hold"
mk; printf 'int32_t wai_receipt_get(const uint8_t *p);\n' >> "$tmp/wai/wai-rs/include/wai.h"
expect fail "a C function with a near-synonym verb" "wai_receipt_get: the verb get is a near-synonym; the operation verb is show"
mk; sub "$tmp/wai/wai-sink-swift/Sources/WaiSink/Envelope.swift" 'public func pack() {}' 'public func verify() {}'
expect fail "a Swift method misnamed" "WaiEnvelope.verify names envelope.verify, which the catalogue does not hold"
mk; sub "$tmp/wai/wai-sink-android/core/src/main/kotlin/wai/sink/WaiReceipt.kt" 'fun verify(bytes' 'fun check(bytes'
expect fail "a Kotlin method misnamed" "WaiReceipt.check names receipt.check, which the catalogue does not hold"
mk; sub "$tmp/wai/wai-sink-android/core/src/main/kotlin/wai/sink/WaiReceipt.kt" 'fun verifyAll(' 'fun describeAll('
expect fail "a Kotlin companion method with a near-synonym verb" "WaiReceipt.describeAll: the verb describe is a near-synonym"
mk; sub "$tmp/wai/wai-sink-android/core/src/main/kotlin/wai/sink/WaiReceipt.kt" 'private fun checkQuietly' 'fun checkQuietly'
expect fail "a private Kotlin method made public under an operation verb" "WaiReceipt.checkQuietly names receipt.check"
if [ "$fails" -ne 0 ]; then
echo "check-wai-ops-doors-selftest: $fails case(s) failed"
exit 1
fi
echo "check-wai-ops-doors-selftest: every case held"