On this page

ADR-0311: One-Command Black-Box Binary Certification (tenon validate-app)

Context

Tenon applications expose multiple surfaces simultaneously—CLI, headless Actions API, dual-era MCP stdio (2026-07-28 and 2025-11-25), and Unix-socket live-bus leases (app_bus). Historically, verifying that a compiled Tenon binary obeys every agent-readiness invariant (clean exit codes, ANSI-free piped output, schema validity, secret redaction, MCP framing limits, approval refusal, and signal hygiene) required ad-hoc manual commands or bespoke integration harnesses.

Per ADR-0291 ("Freeze Rust, Grow in Tenon"), new developer workflows should be authored as pure .tn bundled CLI tools in examples/tools/ rather than expanding the Rust compiler binary.

Decision

Introduce tenon validate-app <dir_or_bin> [--json], implemented as a pure Tenon bundled CLI application in examples/tools/validate-app/ (probes.tn, report.tn, main.tn, unit.tn) using edition = "2026" plugins (json, mcp, proc).

12-Point Agent-Readiness Certification Suite

Against a compiled binary (or a project directory containing tenon.toml, built via tenon build --dev), tenon validate-app executes 12 automated black-box probes in < 500 ms:

  1. help_exit_0 — --help exits 0 with non-empty usage text.
  2. invalid_flag_exit_2 — --tenon-invalid-flag-probe exits 2 with non-empty stderr.
  3. piped_no_ansi — Piped stdout (!is_tty) emits 0 raw CSI (\x1b[) or OSC (\x1b]) ANSI escape sequences.
  4. no_color_term_dumb — NO_COLOR=1 and TERM=dumb emit 0 ANSI escape sequences.
  5. actions_state_valid — state (or MCP app_state fallback for plain-text CLI hosts) returns valid app.actions/v1* JSON with rev >= 0 (state_rev >= 0).
  6. actions_schema_valid — actions (or MCP app_actions fallback) returns valid ActionSpec entries whose input_schema_json / input_schema all pass mcp.wire.schema_supported.
  7. canary_secret_redacted — Canary secret (sk-live-CANARY-9f8e7d6c5b4a) injected via environment never leaks unredacted in stdout, stderr, or projected state.
  8. mcp_2026_roundtrip — MCP 2026-07-28 (server/discover + tools/list + tools/call app_state) round-trip passes.
  9. mcp_2025_roundtrip — MCP 2025-11-25 (initialize + ping + tools/list) round-trip passes.
  10. mcp_oversize_rejected — A > 1 MiB single NDJSON line over --mcp is rejected cleanly with JSON-RPC -32600 without crashing.
  11. headless_approval_refused — Headless invocation (act <name> {}) of any requires_approval: true action refuses execution and exits 3.
  12. sigterm_clean_shutdown — SIGTERM against a live --mcp child exits cleanly with 0 orphan child processes (proc.lib.group_alive == false) and 0 stale .sock leases in an isolated XDG_RUNTIME_DIR.

Output & Exit Contract

Bundled Launcher Wiring

crates/tenon/src/validate_app.rs defines a standard BundledAppSpec (exec_replace: true, embedding examples/tools/validate-app/{README.md,main.tn,probes.tn,report.tn,tenon.toml}) wired as a passthrough subcommand in crates/tenon/src/main.rs, keeping zero Rust logic beyond the cached launcher.

Consequences