Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Engine reference — generated from the canonical engineering source. Do not edit this page by hand.

Boundary option contracts — the vendored-library truth chain

Class: Sol calls vendored libraries (erlexec, gun, msgpack, chumak, epgsql) with literal option tuples. Every gate this repo ran could pass a permanently broken boundary call:

GateWhat it checksWhy it missed G77
xrefcalls exist with that arityoption contents are data
mock_parity_lintmock function/arity vs productionfun(_Cmd, _Opts) -> … is parity-perfect and content-blind
pin testswhat WE passpins the bug as the contract when the knowledge is wrong
dialyzer (absent)success typingwould flag the exec class, NOT the gun class (map types admit extra keys)

The concrete 2026-09 event: the closeout “fixed” the registry rsync leg by moving {timeout, …} into exec:run/3’s third argument — a real but non-throwing option — while element 1 of the same list, {stdout, stderr_to_stdout}, threw Invalid stdout option stderr_to_stdout on every call. The fix was written from the memory of the correct sol_gpu_probe.erl lesson (“{timeout, Ms} is NOT a valid erlexec 2.3.4 cmd option — verified”, ) without executing the boundary once. Five siblings shipped the same way: gun transport_opts in the OAuth store and plugin-bridge https paths (gun 2.x refuses with {error, {options, …}} — the open failed CLOSED, an availability defect, not a silent TLS downgrade), the bare stderr_stdout atom in the offsite backup ({invalid_option, stderr_stdout} on every invocation), {stdin, [Data]} in the keyring (the tuple value is a FILENAME; data-at-spawn does not exist), and {stdout, ""} in the container paths ("" is an empty redirect FILENAME — the port answers “stdout - atom or string value in tuple required”).

Two further properties of the same boundary, both now machine-pinned:

Sync-mode erlexec timeouts do not bound the child. run/3’s Timeout bounds only the spawn RPC; wait_for_ospid_exit/4 is a receive with no after. A “timeout” rsync ran until it finished. Killing the Erlang worker does not kill the OS child either (no link/monitor ⇒ no caller-death cleanup) — the proven orphaned-rsync case behind the registry prepare staging reappearing after cleanup. The exec port’s list-form argv is execve(2) — no PATH lookup. A bare "rsync"/"secret-tool" argv head answers {error, [{exit_status, 256}]} (“cannot execute”) on every host even with a valid option list; binaries must be resolved (os:find_executable/1) before the call. Also: a single-element list of one string IS that string, and erlexec routes printable-string commands differently from true argv lists. And wait_for_ospid_exit reports the RAW waitpid status (exit(1) arrives as {exit_status, 256}, exit(3) as 768).

The three-mechanism prevention chain

  1. Golden option-spec lint — ci/boundary_option_golden.json (accepted option sets extracted from the vendored check_cmd_options / gun check_options / msgpack options / epgsql connect_option sources, sha256-tripped to the vendored files) + ci/boundary_option_lint.py: every literal option list at exec:* / gun:open / msgpack:* / chumak:set_socket_option / epgsql:connect call sites in server/src must be in the golden for that library+version. The epgsql leg ( ) validates BOTH connect_opts shapes with one key set — the list-form connect(Host, User, Pass, [{Key, …}]) arms and the flat map-form connect(#{Key => …}) probe — and value-checks ssl to boolean | required. A vendored bump without a golden refresh fails loudly; --refresh re-pins (review the sets in the same change). This is the machine-checked-constants doctrine: the library truth lives in an artifact the linter executes, never in prose or memory.
  2. Boundary-truth CT — server/test/sol_boundary_contract_SUITE.erl: one case per boundary asserting LIBRARY ACCEPTANCE against the real compiled libraries (never a mock), including a real rsync transfer through sol_registry:do_rsync/2, real gun opens for the OAuth and plugin-bridge maps, the real stdin-data path, and a container drill on no-op runtimes. Re-introducing any pre-fix shape reds the suite (the mutation proof is in the phase record). This is the only mechanism that catches “key accepted but not consumed” and version drift that slips a golden refresh.
  3. exec chokepoint — sol_exec:run/2,3 (+ run_watch/5, run_with_stdin/4, stop/1): non-sync spawn with the monitor option, a receive-after TOTAL timeout, a guaranteed exec:stop on expiry (bounded mailbox drain), flat-binary output, stdin data via post-spawn exec:send, and a watch protocol that reports the exec child handle so a backstop killer can take the OS child down with its Erlang worker (sol_registry’s prepare leg). Enforced by ci/exec_chokepoint_lint.py + ci/exec_run_sites_baseline.txt (shrink-only): the remaining raw sites are the non-sync long-lived streaming spawns where a sync chokepoint does not apply.

Rules for the next boundary fix

  1. Do not fix from memory or prose — run the boundary once (the boundary CT is the harness; sol_test_helpers:ensure_erlexec_root_user/0 already solved the exec-port root shim).
  2. New literal option shapes must land in the golden in the same commit (--refresh re-pins hashes; sets are reviewed by hand against the new vendored source).
  3. New bounded OS command → sol_exec:run/2,3, never a raw exec:run (the chokepoint lint rejects new raw sites).
  4. Data to a child’s stdin → sol_exec:run_with_stdin/4 (post-spawn exec:send); there is no data-at-spawn option in erlexec.
  5. Resolve binaries (os:find_executable/1) before list-form exec calls; argv heads are execved verbatim.

Owners: the golden + lints live in ci/ (required lint-suite battery), the boundary CT in server/test (required server-ct battery), the chokepoint in server/src/sol_exec.erl. See plan/archive/v0748-v0763-post-release-truth-hardening/phase--boundary-option-truth.md for the implementation record and D-numbers.