Skip to content

v0.22.0 — Slice 22: Engine Contract v19 & Box Contract v22 (Popular TS Web Frameworks in tts-box)

Pre-release
Pre-release

Choose a tag to compare

@robertguss robertguss released this 28 Nov 01:02
· 21 commits to main since this release
37ed1e3

Pre-1.0 Pre-Release — Slice 22: Engine Contract v19 & Box Contract v22 (Popular TS Web Frameworks in tts-box)

trusted-ts v0.22.0 adds zero-dependency web encoding built-ins and linear-time, ReDoS-proof RegExp to tts (Engine Contract v19) and multi-dependency boxes, local <source>/app/** TypeScript/ESM source trees, binary HTTP (parse: "base64" + bodyBase64), preserved repeated response headers (Set-Cookie), and two sandboxed web-framework reference services (examples/hono-api/ and examples/express-app/) to tts-box (Box Contract v22) — while keeping 41 VM opcodes, 0 new Cargo dependencies, 0 .config/architecture.toml cap increases, and 0 runtime/ edits.

Highlights & Merged PRs

  • Engine Contract v19 (#79):
    • Added 8 Builtin variants (argc <= 2, 41 VM opcodes preserved): encodeURIComponent, decodeURIComponent, btoa, atob, and pure-Rust Thompson NFA / PikeVM RegExp (.test, .match, .replace, .split).
    • Exact ECMA-262 UTF-16 URI encoding/decoding and WHATWG Latin-1 Base64 with byte-for-byte Node 24 parity and catchable End::Error on invalid inputs.
    • Linear-time O(|pattern| * |input|) Thompson NFA (<= 256 UTF-16 code units, <= 256 states) with /pattern/flags literals, top-level/imported & local const regex folding, i/g/m/s flags (g refused on .test() at compile time), up to 9 capture groups, compile-time refusal of backtracking/unsupported features (lookarounds, backreferences, named captures, octal escapes, \p{...}, new RegExp(...), escaping regex values), __label taint propagation, Z3 symbolic semantics, and proof cache tts-prove-cache-v9.
  • Box Contract v22 (#80):
    • Multi-dependency boxes (1..=64 lockfile-pinned deps when adapter.mjs is present; exact-1 preserved without adapter.mjs), multi-spec tts-box add <source> <spec1> [<spec2> ...], and <source>/app/** regular non-symlink .ts/.mts/.js/.mjs/.json trees (1..=64 files, max depth 8, max 4 MiB) validated by audit, copied by install, and bound into canonical .stamp digests.
    • Binary HTTP fidelity: listen[].parse: "base64" / listen[].routes[].parse: "base64", actor reply bodyBase64 (502 Bad Gateway on malformed or conflicting body + bodyBase64), and preserved repeated response headers (e.g., multiple Set-Cookie).
    • Two sandboxed reference services (examples/hono-api/ Fetch bridge & examples/express-app/ Node stream bridge) plus live Shai-Hulud compromised-middleware confinement tests (tests/slice22_frameworks_and_box_v22.rs), locally smoke-verified with real npm hono+zod (2 pkgs) and express (65 transitive pkgs) inside Landlock v6 + 64-bit seccomp (net: false, zero sockets).
  • Contract Sync, Architecture Budget, Benchmarks & CI (#81, trusted-ts-checks #44 & #45 @ 667a5622):
    • Verbatim sync of contract/contract.md (v19) and contract/boxes.md (v22).
    • Unified regex NFA compiler into crates/tts-kernel/src/regex_nfa.rs keeping every crate strictly under .config/architecture.toml caps (50,086 / 50,500 core token-lines, 414 headroom).
    • Full reproducible benchmarks in docs/benchmarks-v0.22.0.md.

Measured Benchmark Highlights (--release --locked)

Workload tts / tts-box v0.22.0 Reference / Notes
ReDoS /^(a+)+$/ (N = 26) 0.098 ms 2,955.27 ms Node V8 (30,194× faster)
ReDoS /^(a+)+$/ (N = 28) 0.157 ms 11,911.43 ms Node V8 (75,945× faster)
ReDoS /^(a+)+$/ (N = 100) 0.093 ms Linear O(N) PikeVM immunity
URI & Base64 (50× ops/turn) 0.078 ms p50 / 0.180 ms p99 3.5× tighter p99 than Node (0.627 ms), 100% parity
Linear RegExp (20× ops/turn) 0.399 ms p50 / 0.656 ms p99 10.2× tighter p99 than Node (6.713 ms), 100% parity
Sandboxed Hono Fetch Bridge (net: false) 0.395 ms p50 / 1,465.0 req/s 200 OK + 2× Set-Cookie, zero sockets in box
Sandboxed Express Stream Bridge (net: false) 0.302 ms p50 / 2,429.6 req/s 200 OK + 2× Set-Cookie, zero sockets in box
Binary 4 KiB HTTP (base64 + bodyBase64) 0.243 ms p50 / 3,067.2 req/s Exact 0x00..0xFF round-trip + 2× Set-Cookie

Verification Scorecard (37ed1e3d)

  • External Conformance (trusted-ts-checks@667a5622, slices/22/conformance.mjs): 42 / 42 PASS on v0.22.0 (negative control on v0.21.0: 39 / 42, exit 1, failing 2l, 6r, 6s).
  • Workspace Line Coverage (cargo llvm-cov): 91.53% lines (91.16% functions, 88.94% regions; gate >= 90%).
  • Architecture & Structural Lint: cargo atlas policy & stages 0 violations (50,086 / 50,500 core token-lines, 414 headroom); deslop-please --allow .deslop-please.allow ok.
  • Formal Verification: Verus 143 verified (0 errors) · Lean 4 0 sorryAx · Kani 15 / 15 harnesses · @tsmodel 6 / 6 specs (0 stale anchors).