Section 6: Production

The runtime works. This section decides whether anyone should depend on it.

"Production-ready" is not a feeling and it is not "the tests pass". It is a checklist plus a scope statement, and this section builds both: diagnostics a human can act on, tooling that makes the runtime inspectable, a test matrix with six distinct kinds of test, metrics a service can alert on, a benchmark suite with a committed baseline, and an honest limitations document.

It completes Milestone M13 and the first half of M14.


What You Build

DeliverableChapterLab
Source spans, carets, tracebacks, error recoveryDiagnostics24
ember run/repl/tokens/ast/disassemble/trace/compileThe CLI and the REPL25
Unit, golden, differential, property, fuzz, compatibilityTesting Strategy26
Stats, tracing spans, the heap census, GC pause histogramsObservability27
Criterion benchmarks, a committed baseline, the measurement protocolPerformance Engineering27
The audit: panics, unsafe, dependencies, semver, CIThe Hardening Checklist24–27

The Labs


The Production-Readiness Bar

From the introduction, made concrete. Every row is a checkbox with a place it lives.

#RequirementWhere
1Documented public API#![deny(missing_docs)], cargo doc, doc examples run in CI
2Strong error handlingSeven ErrorKinds, each routed differently by a host
3Source-level diagnosticsLab 24: file, line, column, caret, traceback
4No panics from ordinary script inputLab 26: fuzzing, and a #[deny] on unwrap in the VM
5Bytecode validationLab 9's validator, exercised by Lab 22's cache
6Instruction, memory, recursion limitsLab 23, fifteen tests
7Safe default capabilitiesLab 21, golden surface file
8Fuzz testingLab 26, five targets, corpora committed
9Deterministic testsNo clock, no RNG, no hash-order dependence
10Benchmarks with a baselineLab 27, committed and diffed in CI
11Dependency auditcargo audit, cargo deny, and an empty default [dependencies]
12unsafe audit#![forbid(unsafe_code)] in the default build
13Documented threat modelLab 23, docs/sandboxing.md
14Explicit compatibility scopeappendix/lua-differences.md
15Documented limitationsdocs/limitations.md
16Examplesexamples/, each one a test
17CIfmt, clippy -D warnings, test, doc, audit, deny, boundary audit
18Semver policydocs/releasing.md, and cargo semver-checks in CI
19Release documentationCHANGELOG.md, and a release checklist
20A stated production profileREADME, above the fold

Row 20 is not the last row; it is the first one. Everything above it is only meaningful relative to a stated scope. A runtime that says "production-ready" without saying for what has made a claim nobody can check.


The Command That Gates the Section

cargo fmt --check \
  && cargo clippy --workspace --all-targets --all-features -- -D warnings \
  && cargo test --workspace --all-features \
  && cargo test --doc \
  && cargo doc --workspace --no-deps \
  && cargo audit \
  && cargo deny check \
  && ./scripts/boundary-audit.sh \
  && cargo bench -- --save-baseline current \
  && cargo criterion --baseline main

Nine commands. If any of them is not in your CI by the end of Lab 27, that row of the table is aspirational.


Common Mistakes in This Section

MistakeSymptomCorrection
"Production-ready because it works"A claim nobody can evaluateThe bar is a checklist plus a scope statement. Both.
Diagnostics added at the endA rewrite, because spans were not threadedThey were threaded, from Lab 1. Lab 24 is rendering, not retrofitting.
A REPL that can panicOne bad input kills the sessionThe REPL is the most hostile input source you have; it is Results all the way.
Benchmarks without a committed baseline"It feels faster"git show the baseline or you do not have one.
Fuzzing without committed corporaEvery CI run starts from zeroCommit the corpus; a crash reproducer is a regression test.
unwrap() in the VMA host process aborts on malformed input#[deny(clippy::unwrap_used)] on vm.rs, heap.rs, table.rs.
Metrics that only report failuresYou cannot tune what you cannot seeReport utilization, not just violations. Alert at 80%.
A limitations document written lastIt reads like an apologyWrite it as you go. Each lab adds a line.

Section Profile: What a Section 6 Graduate Can Do

  • Render a diagnostic with a source span and a caret, and explain which earlier decision made each part possible.
  • Build a REPL that cannot be crashed by its user.
  • Name six kinds of test, say what each catches that the others do not, and build all six.
  • Instrument a runtime so a service can alert on it before it fails, not after.
  • Run a benchmark suite with a committed baseline and refuse an optimization without one.
  • Audit a crate for panics, unsafe, dependencies, and API stability.
  • Write a limitations document that a reader trusts, and explain why the honesty is the point.

Next: Diagnostics.