Codebase development standards

Good compiler work should be easy to read, easy to test and hard to misinterpret. These references cover implementation style, test design and the validation gates.

All of these must be followed by all contributors to meet the criteria for an acceptable PR.

Codebase style guide

This document owns implementation style for new and refactored compiler code.

Test strategy and test construction guide.

Final technical gates and completion checks guide.

Priorities:

  1. Readability
  2. Modularity
  3. Correctness and diagnostics

No user-input panics

Diagnostics

Implicit-failure, catch and error-boundary diagnostics show this evidence:

Report the original cause once with enough call context to explain the closed boundary, not a cascade at every private hop. Invalid exports are diagnosed even when no entry executes them.

For test assertion policy, see testing.mtf.

Naming

format! and printing

Use the saying library macro say!() for user-facing stdout that may need colour styling. Capture variables directly in format! strings whenever possible.

Imports

Import long paths at module scope, including types used only in signatures. Use short qualified paths where they improve local reasoning.

// ACCEPTABLE: terse and locally clear.
let type_id = builtin_type_ids::BOOL

// BAD: import this long path at the top.
let type_id = crate::compiler_frontend::datatypes::ids::builtin_type_ids::BOOL

Avoid aliasing unless it clearly improves readability.

Code style and organisation

For test-file placement, see testing.mtf.

Copies and cloning

Readable Rust style

This codebase should optimise for fast and easy review. Dense and verbose code is harder to scan and easier to extend badly.

Prefer code that reads as a sequence of named steps and makes data flow obvious before every detail is understood. The main function for a module or pass should also read as a sequence of named steps.

Use named intermediate values, short single-purpose functions, explicit multi-step control flow, context/input structs, enums for meaningful states, comments as landmarks and visible spacing. Avoid dense expression chains, large inline matches and logic compressed into one expression. Brevity is less important than clarity and maintainability.

Comments as reading landmarks

Comments must explain non-local intent, not restate the code. Write for programmers reading the codebase for the first time so they can understand local code without first reading distant owners.

Be comment-positive, but not noisy. Comments should be grammatical and readable. Do not narrate syntax, repeat a descriptive name or paraphrase a clear signature.

// Register same-file declarations before dependencies so aliases cannot shadow local names.
for declaration in same_file_declarations {
    visible_names.register_same_file_declaration(declaration)?;
}

// Prelude names are registered as reserved names first, then inserted only if not shadowed.
for symbol in external_package_registry.prelude_symbols() {
    visible_names.reserve_prelude_symbol(symbol)?;
}

Production layering and stage ownership

Stage separation is a dependency rule, not only a naming preference. Production code must respect these directions.

Prefer narrowed Rust visibility for these rules wherever the module tree can express them. Use a repository source check only for dependency directions Rust visibility cannot encode.

Tests may target stage-local APIs from their owning module. Later build, link and backend code may still consume completed HIR, function IDs, link facts and borrow results where the architecture documents that handoff. The rule bans external orchestration of the stages, not legitimate consumption of their final data.

Refactor moves

When moving code across compiler stages, do not copy the old module shape unchanged. Use the move to correct ownership, names, APIs, comments and data flow.

Moved code must:

Do not preserve a bad API shape because it already exists.

API breakage

Type ordering

Order types in a file from higher-level abstractions to lower-level supporting types.

Iterators versus loops

Function size

Functions should usually stay under ~200 lines. Longer functions are fine when they still represent one coherent operation, such as a compiler transformation, state machine or tightly coupled sequential process.

Split functions when they mix unrelated responsibilities, are hard to test or no longer match their name.

Match readability

Large matches should be grouped by meaning.

Use blank lines and short comments to make each group obvious. If a match grows too large, extract branch handling into named helpers.

Prefer:

match resolution {
    // Constants create dependency edges.
    ConstantReference::SourceConstant { path, source_file } => {
        add_constant_dependency(header, path, source_file)?;
    }

    // Type names are valid to resolve but do not create value dependency edges.
    ConstantReference::SourceTypeAlias { .. } => {}

    // These are structurally invalid in constant initializers.
    ConstantReference::SourceNonConstant { path }
    | ConstantReference::ExternalNonConstant { .. } => {
        errors.push(non_constant_reference_error(path, location.clone()));
    }

    // Unknown names may produce better diagnostics during AST expression parsing.
    ConstantReference::Unknown => {}
}

Avoid long ungrouped matches where every branch looks equally important.

Avoid clever Rust

Don't use advanced Rust features just to make code shorter.

Avoid:

Prefer named types and straightforward flow:

pub(crate) struct DependencyResolution {
    pub(crate) target: ResolvedDependencyTarget,
    pub(crate) local_name: StringId,
    pub(crate) span: Option<SourceSpan>,
}

Instead of:

Result<(ResolvedDependencyTarget, StringId, SourceSpan), DiagnosticDraft>

A few more lines are fine when the result is easier to inspect and harder to misuse.

Macros

Prefer functions and types. Introduce declarative macros only where they remove meaningful repeated structure or move possible runtime work into compiletime. Avoid creating procedural macros unless they measurably improve performance and don't harm readability.

Warnings and lints

Returning errors

The diagnostic lane rules above apply to every local error boundary.

// Typed diagnostic family constructor.
return Err(names_declarations::invalid_assignment_target(
    InvalidAssignmentTargetReason::ImmutableBinding,
    Some(variable_name),
    None,
    None,
    Some(location),
));

// Proven compiler invariant.
compiler_bug!(CompilerStage::AstConstruction, "Unsupported AST node type: {:?}", node_type);

Codebase documentation

This section covers codebase doc comments and small requested documentation edits. For substantial documentation work, follow the task's dedicated writing guidance and the surrounding source.

For small edits:

Testing standards

This document owns test selection, ownership, structure, assertions, fixture design and conservative pruning. validation.mtf owns completion gates and commands.

The goal is high-confidence language and artifact correctness with the smallest maintainable test footprint. Tests must protect distinct, credible failures, not increase counts or cover syntax for its own sake. Rich Moth integration programs stress interactions through the real compiler and runtime. Focused Rust unit tests protect local invariants, individual failure paths and diagnostics that a large program cannot isolate reliably. Neither test level replaces the other.

Task-reading guide for testing

Read this document in full for test infrastructure, suite policy and broad audits. Otherwise read the relevant sections through the next heading of the same or higher level, including subsections.

Task

Read

Choosing, adding, or locating tests

Admission and ownership, Unit tests, Integration cases and Test location and module layout

New compiler or backend behavior

Rich integration scenarios, Successful backend intent, Runtime output assertions and Backend matrices and artifact assertions

Diagnostics or hidden IR facts

Diagnostics assertions and HIR and internal-IR assertions

Runner inventory, selection or suite policy

Successful backend intent and Focused integration selection and inventory

Feature, platform or timing behavior

Feature and platform lanes and Concurrency and repetition

Source audits, fixtures or performance

Source-text assertions, Fixtures and temporary files and Benchmarks are not correctness tests

Review or removal of existing tests

Pruning and duplicate coverage and Testing checklist

Admission and ownership

Before writing a test, inspect nearby unit tests, related subsystems and the canonical tests/cases/ inventory. Identify the existing primary owner and ask whether extending it would expose the same failure. Prefer, in order:

  1. Extend an existing test or scenario with a meaningful new interaction or assertion.
  2. Consolidate overlapping tests into one clearer test with all distinct failure paths retained.
  3. Add a new test only for a credible regression that neither option can protect well.

A proposed test must have a clear answer to what realistic bug would fail this test, which assertion would catch it and why existing tests would miss it. Reject cases that merely vary literals, names, syntax spelling or setup without changing a semantic boundary or failure path. A new test should add enough regression value to justify its source, setup, maintenance and execution cost. Keep tests understandable and deterministic. Do not build fixture frameworks or shared helpers for a few callers. Do not widen the suite solely to raise a coverage metric.

Choose the primary owner by the contract being protected:

Contract

Primary owner

Pure algorithms, parser decisions, diagnostic reasons, impossible states and side-table invariants

Focused unit test close to the owning subsystem

Language semantics, multi-feature behavior and user-visible project results

Real Moth scenario in tests/cases/

Compiler-stage orchestration

Minimal pipeline/build test when the boundary itself is not already exercised

Backend-specific artifact structure or target validation

Narrow artifact assertion or contractual golden

Cross-backend parity

One Moth input with distinct backend assertions

A contract may be exercised incidentally by many integration scenarios without making each scenario its primary owner. Keep secondary tests only when they protect a different stage, failure mechanism, diagnostic, target or observable interaction. Check the actual assertions, not just matching feature names.

Test location and module layout

MON and shared lexical coverage

crates/moth-lexical/src/tests/ and crates/moth-lexical/src/numeric/tests/ own shared identifier, word and numeric leaf invariants. crates/moth-mon/src/tests/ owns codec-local invariants. crates/moth-mon/tests/ owns the public standalone API, exact numeric schemas, raw numeric data, limits and errors. The compiler keeps only focused convenience re-export identity coverage rather than a second copy of the public codec suite.

src/compiler_tests/mon_syntax_parity/ compares real Moth source parsing with independently decoded MON using equivalent types/schemas. Accepted cases assert typed values before comparison. Invalid cases assert each parser's own rejection reason and span. Never compare fabricated tokens or helper outputs. gaps.rs documents and independently checks framing, nominal identity, literal-data/expression differences, quoted text and resource limits. Keep undelivered {=}, Unicode escapes and contextual ::Variant linked to the roadmap and progress matrix. Moth-native $mon, automatic schemas and the static builder remain separate future work.

Use package-scoped commands so standalone tests don't depend on compiler feature unification:

cargo test -p moth-lexical
cargo test -p moth-mon
cargo test -p moth-mon --doc
cargo test -p moth-lexical --doc
cargo test -p moth --lib mon_syntax_parity

Unit tests

Use focused Rust tests for behavior best isolated at the subsystem boundary: pure algorithms, tokenization and parsing distinctions, precise diagnostics, negative and overflow boundaries, malformed HIR, borrow/ownership proofs, side-table facts, property tests and oracle or differential checks. These can protect edge cases a successful end-to-end program cannot reach or distinguish.

A good unit test names one invariant, exercises its relevant success and failure boundaries and asserts facts at the layer that owns them. Use compact table-driven cases for closely related inputs when each row remains identifiable on failure. Reuse local fixtures, but avoid large construction scaffolds and tests that assert incidental representation or call order. Preserve focused regression tests for real bugs even when a rich integration scenario also touches the feature. Prune implementation-specific tests only after proving their contract is obsolete or protected at the same required boundary elsewhere.

Integration cases

moth tests runs the manifest-driven integration runner. Each canonical case is one self-contained scenario under tests/cases/, with all helper source files inside its input/ directory. Helpers must not become standalone cases.

Integration tests should favor richness over specificity. Write real, purposeful mini programs or deliberately adversarial Moth programs that exercise several related language features together through parsing, typing, lowering, borrow validation, target selection and execution. Stress surprising interactions rather than repeating the simplest legal syntax form. A basic if belongs in a focused unit test; a nested decision that calls functions, mutates data, joins control flow and returns or handles an error belongs in a larger scenario.

Protect observable results, not merely successful compilation. Prefer deterministic state transitions, exact outputs, ordered events, error outcomes and invariants that fail when the computed result is wrong. Use top-level templates for output. Use io.line(...) only when console behavior matters. Avoid goldens or emitted-code snapshots when runtime behavior is the contract.

Rich integration scenarios

Useful scenarios include a small inventory/checkout engine, route planner, record processor, task scheduler, parser for a tiny data format or deterministic game simulation. They should have a purpose and deliberately combine:

For example, a logistics simulation can validate conservation across several mutating functions rather than merely checking that each function compiles:

-- Excerpt from a larger scenario, not a standalone fixture.
validate_state |game Simulation|:
    carried ~= 0
    loop game.agents |agent|:
        if agent.health > 0:
            assert(agent.tile >= 0 and agent.tile < board_cells)
        ;
        ~carried += agent.cargo
    ;
    mined = counter_value(game.counters, "mined")
    delivered = counter_value(game.counters, "delivered")
    lost = counter_value(game.counters, "lost")
    assert(mined is delivered + lost + carried)
;

A good scenario has multiple independently observable outcomes and a few meaningful invariant checks, so a compiler bug is likely to produce a visible mismatch even if execution completes. Include at least one path that is not the trivial happy path. Negative compile-time diagnostics need separate focused failure cases because a rejected program cannot execute the rest of its intended scenario.

Aim for a cohesive mini program, not an exhaustive language sampler. The attached Ember Relay simulation is an exceptional upper bound: it demonstrates how realistic interacting logic finds bugs missed by shallow tests, but its scale, canvas presentation and feature breadth are not targets for ordinary new cases. Prefer smaller scenarios with identifiable failure surfaces. When a scenario becomes difficult to diagnose, split it by coherent behavior, not by individual syntax construct. Favor enriching an existing relevant scenario over adding another trivial standalone fixture.

For new language syntax, verify that the suite as a whole covers applicable positive use, negative type/namespace/visibility cases, duplicates, cross-file behavior and target rejection. Add only missing distinct contracts, and place precise negative cases near their existing owners.

Successful backend intent

Every successful HTML and HTML-Wasm backend run applies its universal backend baseline. The baseline protects harness and target invariants. It is not the case's authored semantic contract.

Use success_contract = "acceptance_only" only when that backend has no stronger case-specific semantic, artifact, golden, absence or expected-warning assertion.

[backends.html]
mode = "success"
warnings = "forbid"
success_contract = "acceptance_only"

Acceptance-only intent does not disable the baseline. The audit records both baseline_applied = true and acceptance_only = true, with backend_baseline and acceptance_only in assertion_kinds.

Do not combine acceptance-only intent with artifact assertions, golden mode, rendered-output assertions, artifact-absence assertions or an authored expected-warning contract. A whole case whose backends are all acceptance-only uses role = "smoke". A mixed-backend case may use a boundary or backend role when another backend owns a stronger contract.

A successful backend with only the universal baseline is invalid. Typed fixture loading rejects it before policy evaluation, listing, audit, or execution.

Canonical fixture shape:

tests/cases/
+-- manifest.toml
+-- case_name/
    +-- input/
    |   +-- main.moth
    |   +-- helper.moth
    +-- expect.toml
    +-- golden/
        +-- html/
        +-- html_wasm/

Manifest entry shape:

[[case]]
id = "borrow_conflict_resolved_by_reordering"
path = "borrow_conflict_resolved_by_reordering"
tags = ["integration", "borrows"]
contract = "language.bindings.alias_final_use_allows_mutable_rebinding"
role = "primary"

Focused integration selection and inventory

Use the canonical case ID and retained metadata for local iteration:

cargo run --quiet -- tests --case arithmetic_operator_precedence --backend html
cargo run --quiet -- tests --tag borrows --tag diagnostics --backend html
cargo run --quiet -- tests --contract <contract-id>
cargo run --quiet -- tests --list --tag borrows

Use the audit mode to validate and inventory the complete canonical suite without compiling cases:

cargo run --quiet -- tests --audit

Audit writes its JSON inventory before returning hard-policy failure. Normal listing and execution use the same policy evaluator and reject hard findings before compiling a case. Missing roles, missing contracts on non-smoke cases, primary cases without contracts and duplicate primary owners are hard findings. Contractless whole-case acceptance-only smoke cases are valid.

Audit cannot be combined with filters or --list. It writes the reporting-owned JSON inventory to target/test-reports/integration_suite_inventory.json, including canonical metadata, backend expectation facts, hard-policy violations and primary-less contract-family advisories. The report is review input only; it never deletes, merges or rewrites fixtures.

The current inventory reports acceptance-only, rendered-output, artifact, golden, absence, expected-warning, Wasm trap and uncaught Moth Error contracts, including per-backend assertion kinds and the zero baseline-only invariant. It distinguishes exact, ordered and exactly-once output, warning codes, diagnostic match modes and any contains-mode justification. Weak-contract review fields identify smoke roles, ignored warnings and contains-mode diagnostics; they are review signals, not automatic rejection. A new weak contract must be justified rather than inherited by accident.

Every report records the command, run ID, host OS/architecture, compiled features, runner thread count, completion state and repository revision (or a reason it is unavailable). Reports use atomic replacement. An interrupted run leaves completed = false, not an old success. Audit output is evidence for review, never permission to delete, merge or rewrite fixtures automatically.

Runtime output assertions

Runtime assertions use one Node harness. It records console output and HTML fragment inserts in one event array when each event happens, then joins their text with newlines in that same order. Channel views are derived from the event array. They never reconstruct chronology after execution.

The harness runs only when a backend declares a rendered-output assertion. It executes the emitted page scripts, captures pending page microtasks, and waits for Node to report unhandled Promise rejections before emitting its summary. Do not make scheduler turns or incidental microtask counts contractual.

Choose the narrowest field that owns the behaviour:

[backends.html]
mode = "success"
warnings = "forbid"
rendered_output_contains = ["active-root"]
rendered_output_not_contains = ["imported-root"]
rendered_output_contains_in_order = ["before-loop", "after-loop"]
rendered_output_contains_exactly_once = ["active-root", "mounted"]

Use a returned-entry contract for an unchecked numeric failure propagated to start. Exact empty output also protects success-only runtime fragment publication:

[backends.html]
mode = "success"
warnings = "forbid"
entry_error_code = 301
rendered_output_exact = ""

Use runtime_error_contains = assertion failed for fatal Moth Error conditions. Use runtime_trap_contains = unreachable on html_wasm for an intended Wasm trap. Keep traps and Moth Errors distinct from unrelated host exceptions or Wasm memory faults.

Use exact output for small deterministic behaviours such as loop or map operation results. Use ordered and exact-once fragments when unrelated output may coexist. Prefer these runtime contracts over generated JavaScript text or a whole-page golden when execution is the real owner.

An exact mismatch is reported escaped, post-normalization, with the byte offset of the first difference, so a whitespace-only difference does not print as two identical lines.

What the harness will execute

The harness parses the emitted page for a supported script shape and rejects everything else rather than guessing:

Harness failure classes

A harness problem is never reported as a case failure. RenderHarnessError names which boundary broke: Artifact, Workspace, Spawn, Timeout, ExitStatus, OutputDecoding, OutputProtocol, ScriptShape or Cleanup. Execution is bounded by a 30-second deadline with kill-and-reap, stdout and stderr are drained on their own threads under a 4 MiB bound, and a stderr decode failure never replaces the boundary that actually failed.

Goldens carry their own artifact kind

A golden file's extension decides the artifact kind it expects, and a cross-kind match is rejected before content is read. Identical bytes emitted as a different artifact kind do not satisfy a golden. Text goldens require strict UTF-8; invalid UTF-8 is a harness failure, not a rewrite.

Concurrency and repetition

A test that waits for a thread to reach a state must observe that state, not guess how long reaching it takes.

Stateful owners - the timing collector, the frontend counter stores, output writes, current-directory guards and the Node harness - only misbehave under a thread schedule or a repeat that one default-parallelism run never produces. That schedule has an owned command:

just stress

It repeats the unit and integration suites at one thread, default parallelism and sixteen threads, and keeps running after a failing lane so the whole matrix is visible.

Diagnostics assertions

[backends.html]
mode = "failure"
warnings = "forbid"
diagnostic_codes = ["MOTH-RULE-0033", "MOTH-RULE-0033"]

Use diagnostic_assertions when a broad code needs a compiler-owned reason or when source remapping is part of the contract. Each table selects one diagnostic by stable code and one-based occurrence. A unique code may omit occurrence. Repeat the code in diagnostic_codes to preserve its exact multiplicity.

[[backends.html.diagnostic_assertions]]
code = "MOTH-RULE-0057"
reason = "invalid_generic_instantiation.recursive_function_instantiation"
path = "input/@entry.moth"
line = 3
count = 1

[[backends.html.diagnostic_assertions.secondary_labels]]
occurrence = 1
path = "input/helpers.moth"
line = 2

Use diagnostic_match = "contains" only when intentional independent recovery or cascades make additional diagnostics part of the accepted current behaviour. Every contains-mode block needs a substantive diagnostic_match_reason. The suite audit reports the reason and treats a missing or blank reason as a hard policy finding.

diagnostic_match = "contains"
diagnostic_match_reason = "Independent recovery may emit additional diagnostics from another source unit."

Warnings use a separate backend-local contract:

[backends.html]
mode = "success"
warnings = "exact"
warning_codes = ["MOTH-RULE-0022", "MOTH-RULE-0022"]
rendered_output_contains = ["warning-contract result=one"]

Backend matrices and artifact assertions

Use one expect.toml per case with backend-specific assertion blocks.

entry = "."

[backends.html]
mode = "success"
warnings = "forbid"
artifacts_must_not_exist = ["unexpected.html"]

[backends.html_wasm]
mode = "success"
warnings = "forbid"

[[backends.html_wasm.artifact_assertions]]
path = "page.wasm"
kind = "wasm"
validate_wasm = true
must_export = ["memory", "moth_str_ptr", "moth_str_len", "moth_release"]

Pair HTML-JS and html_wasm cases for supported exact scalar values, comparisons and casts. Use Numeric types and Operators for semantic expectations, not a profile matrix or a minimum arithmetic width. Keep numeric failures within the ordinary diagnostic, recovered-output or returned-entry assertion contracts. Assert the intended target rejection for unsupported paths. The Progress matrix owns current backend support, including the remaining Wasm gates.

golden/<backend>/

HIR and internal-IR assertions

Compact scalar-memory coverage lives in the Wasm emitter tests. It instantiates the normal emitter's module in Node and inspects stored bytes, adjacent scalar slots, signed and unsigned narrow reloads, and floating-point signed zero. This is evidence for the LIR memory-access contract, not source-level aggregate layout, allocation or field/index support.

Feature and platform lanes

A feature-gated test that no command runs is not a test. Every declared Cargo feature belongs to a lane. Standard lanes run in the feature matrix. Deliberately expensive developer systems may use an opt-in lane with its own named command:

just test-feature-matrix

Lane

Features

Only this lane covers

default

none

the shipped configuration and every cfg(not(feature = ...)) branch

timers

timers

the timing collector, boundary identities and command/build timing tests

detailed-timers

detailed_timers

AST substage timings and the detailed-only summary shape

counters

benchmark_counters

counter-only builds, where counters record without a timing collector

timers-counters

timers, benchmark_counters, data_layout_memory_probe

the collector-backed counters and the retained-layout allocator probe

scoped-blocks

checked_blocks, async_blocks

the deferred-feature diagnostics for $checked: and $async: blocks

dev-output

every show_* feature

the developer stage-dump branches, which no other lane compiles

xtask

none

the benchmark, profiling and process-runner tests in the xtask package

moth-lexical

none

standalone shared lexical and numeric-text tests without compiler feature unification

moth-mon

none

standalone codec unit, public consumer and documentation tests

boracle

boracle

the reference-solver developer gate, owned by just boracle and excluded from the standard matrix

boracle-campaign

boracle, boracle_campaign

the measured generated differential campaign, owned by just boracle-campaign: 2048 deterministic generated shapes per cyclic mode, 4096 problems and 8192 comparisons, classified through the same differential comparison the boracle lane uses

Lanes are package-scoped, and that is not a stylistic choice. Cargo unifies features across one resolve graph, and xtask depends on moth with features = timers, so cargo test --workspace always builds the compiler with timers enabled. It can never run the default configuration, and --features benchmark_counters on a workspace command is really timers plus counters. Only cargo test -p moth with an explicit feature list configures the crate the way a lane claims.

Each compiler lane also has a matching moth-cli lane, named cli- followed by the compiler lane name, with the same feature selection. Those lanes execute command parsing, scaffolding and subprocess contracts against the CLI's forwarded configuration. They do not replace compiler unit tests. The CLI's Boracle and campaign lanes remain opt-in through the same named recipes as their compiler counterparts.

Feature coverage is checked mechanically, without running a lane:

just feature-lane-check

just feature-lane-check checks the compiler, CLI, lexical, MON and xtask manifests against cfg references in their source and test directories. It fails on uncovered or unknown features and missing roots. Its report at target/test-reports/feature_lane_coverage.json maps features to lanes and files, not outcomes. just test-feature-matrix records executed standard lanes in target/test-reports/feature_matrix_results.json; boracle and boracle-campaign run only through their named opt-in commands.

Adding a Cargo feature means adding it to a standard or opt-in lane in the same change. The gate fails otherwise.

Platform-gated tests are owned by the platform that has the API:

Gate

Runs on

Owns

cfg(unix)

Linux and macOS

symlink identity and retargeting, non-regular nodes, unreadable paths and non-UTF-8 names

cfg(windows)

Windows

extended-length path prefixes, Windows canonicalisation and hard-link inspection

cfg(any(unix, windows))

all three

the portable policy shared by both families, asserted on each

cfg(target_os = "linux")

Linux

non-UTF-8 filesystem identity, which macOS rejects at the filesystem boundary

CI runs every gate on Linux, macOS and Windows, so a platform-gated owner executes wherever its API exists. A platform-specific test may be absent only when the underlying API does not exist there; an equivalent portable policy test should still run everywhere. Windows results are currently non-blocking - validation.mtf owns that status and the conditions that end it.

Source-text assertions

A test that reads source text and asserts on it proves what the text says, not what the code does. An alias, a reformat or an equivalent reimplementation all pass it.

Fixtures and temporary files

Pruning and duplicate coverage

Pruning is an evidence-based behavior audit, not a line-count exercise. Similar source text, repeated setup and a feature appearing in both suites do not by themselves establish redundancy. For each candidate cluster:

  1. Inventory its actual assertions and failure paths. Check related unit tests, tests/cases/, the suite inventory and test_honesty_inventory.json.
  2. Mark each contract keep, extend, merge, promote or remove. State the retained owner and why it can still catch each distinct regression.
  3. Consolidate equivalent local cases with a table or a small existing helper. Extend a meaningful integration scenario when the missing risk is an interaction visible through the full compiler.
  4. Remove a unit test only when its behavior is obsolete or the surviving tests cover the same important boundary and failure paths. Preserve exact diagnostic, malformed-IR, algorithmic, property, oracle, borrow and numeric corner cases unless equivalent protection is demonstrated.
  5. Change small clusters at a time. Record affected files, contracts, surviving test IDs, before/after test counts and noncomment LOC, plus any uncovered gaps. Run the focused tests and the relevant full integration, feature, platform and benchmark/CI lanes. Investigate regressions instead of weakening assertions.

Prefer deletion to new infrastructure. Keep small, clear duplicates when their separate failure localization or boundary protection is valuable. There is no mandatory LOC or test-count reduction target and no assumption that a longer integration program supersedes focused units. The desired outcome is less maintenance for stronger distinct regression protection.

Benchmarks are not correctness tests

Benchmark fixtures are performance evidence, not correctness coverage.

Do not use benchmark coverage as a substitute for unit or integration tests. Negative diagnostics belong in tests/cases, not benchmark fixtures.

Use bench-check to detect broad performance regressions after correctness has already been established by ordinary tests.

Testing checklist

Before accepting a test addition or cleanup, verify:

Validation gates

This document defines validation scope and cadence for compiler and documentation work. Choose checks by branch, checkpoint and changed behaviour. Feature-branch iteration uses targeted checks, important boundaries use routine validation and merge readiness uses the full gate.

Task-reading guide for validation

Start every completion decision with Choose the final gate by scope. Heading paths use > to name nested sections. Read the selected heading through the next heading of the same or higher level, including nested subsections unless the route narrows further. Read this document in full when changing validation infrastructure or auditing the complete gate policy.

Task

Read

Select checks for a branch commit or merge checkpoint

Choose the final gate by scope

Choose direct compiler or Cargo invocation

Compiler invocation and Shared Cargo defaults

Complete or review code-bearing work

  • Code-bearing final gate
  • Formatting
  • Manual architecture audits when its trigger applies
  • Progress-matrix review
  • Benchmark safety
  • Failure handling
  • Code-bearing completion checklist

Complete or review documentation-only work

  • Documentation-only release-build gate
  • Generated documentation
  • Failure handling
  • Documentation-only completion checklist

Add or change a Cargo feature, or a feature-gated test

Feature lanes

Add or change a broad-source architecture ban

Source audit

Add or change the first-party package dependency guard

First-party dependency audit

Read, change or interpret a CI gate

  • CI gates
  • Platform policy

Pick a targeted iteration command

Fast iteration commands

Performance or benchmark validation

  • Benchmark safety
  • Code-bearing final gate when the slice is being completed

Review a failed gate or a validation claim

  • Failure handling
  • the checklist for the selected final gate

Manage build reuse or target disk usage

Shared Cargo defaults and Cache maintenance

Compiler invocation

Use an up-to-date release build of the compiler when one is available. The moth command in PATH is the usual direct form:

moth check docs --terse
moth build docs --release

If a suitable release build is not available, run the same operations through Cargo from the repository root:

cargo run --quiet -p moth-cli --bin moth -- check docs --terse
cargo run --quiet -p moth-cli --bin moth -- build docs --release

Shared Cargo defaults

rust-toolchain.toml selects one exact Rust release with Clippy and rustfmt. Repository-local Rust commands use that pin regardless of the machine's default toolchain, and recipes use plain Cargo commands without a separate toolchain or version check. CI installs the same pin through rustup and never advances it independently, without a setup action injecting a different incremental-compilation policy.

Moth tracks current stable Rust closely during alpha development. Advancing the pin is a deliberate repository change followed by normal validation, and returning to an earlier release is equally an explicit pin change. Environment and explicit rustup overrides remain the caller's responsibility. Record rustc -vV, cargo clippy -V and cargo fmt --version when comparing results.

Cargo.toml owns one dev profile, inherited by test: no debug information, incremental compilation enabled and the normal debug assertions and overflow checks retained. Release and profiling keep their existing settings. The workspace warning policy denies warnings for every member in direct Cargo commands and recipes. It does not change dependency lint policy.

.cargo/config.toml defaults Cargo build jobs and Rust test threads to four. Rayon intentionally keeps its host-selected default unless the caller sets RAYON_NUM_THREADS for a specific command. Environment overrides and explicit Cargo options remain available. For example, bound all three forms of concurrency on a smaller host:

CARGO_BUILD_JOBS=1 RUST_TEST_THREADS=1 RAYON_NUM_THREADS=1 just validate

These controls bound concurrency, not aggregate memory. Preserve one effective configuration during timing comparisons. Changing compiler, features, profile settings or environment flags can require different artifacts. Source edits can reuse dependencies and incremental state from earlier builds.

The root moth package is the compiler library. crates/moth-cli owns the moth executable and is the workspace's default member, so root cargo run continues to launch the CLI. Its matching feature names forward to the compiler. Bare cargo test, check and clippy also select that default member. Use explicit compiler or workspace selectors when library coverage is required. Install the executable from source with cargo install --path crates/moth-cli --locked.

just clippy runs cargo clippy -p moth -p moth-cli -p moth-lexical -p moth-mon. just fmt and just fmt-check select the same four packages with cargo fmt, adding --check for the latter. Routine recipes keep code moved into the two standalone libraries covered without enabling extra features or targets. Broader coverage remains explicit: just clippy-features checks the workspace and all targets under the standard feature set, and just fmt-workspace-check runs cargo fmt --all --check. A bare Cargo command uses Cargo's defaults and does not claim the recipes' explicit package coverage.

Choose the final gate by scope

Use the smallest checks that cover the change at the current checkpoint. A commit or slice on a feature branch is not automatically a merge checkpoint.

Checkpoint

Required validation

Feature-branch iteration or intermediate commit

Targeted Cargo checks, filtered tests, selected integration cases or affected feature lanes

Important feature-branch boundary or broader integration checkpoint

just validate, plus affected checks the routine gate does not cover

Completed plan or feature in final preparation for merge into main, or release readiness

just validate-full on the final integrated tree

Every commit landing on main, including documentation-only commits

Passing just validate-full evidence for the resulting tree

Documentation-only checkpoint on a feature branch

The documentation gate below, without unrelated compiler suites

During branch work, use focused checks after each meaningful slice. Use just validate at important boundaries rather than after every small edit. Reserve just validate-full for final plan or feature merge preparation. Even changes to validation infrastructure, Cargo settings or timer erasure use their affected commands during intermediate work rather than repeatedly running every unrelated gate. An explicit user request for a wider run still takes precedence.

Performance-sensitive changes need relevant non-recording evidence when assessing their effect. Select the affected benchmark or just validate-perf when its coverage is needed, not automatically for every branch commit. Full validation already includes the standard performance checks.

The main-commit rule applies to the tree actually landing, including merge or rebase resolutions. After changes invalidate a passing full run, validate the final integrated tree again before merging. Record the tested revision and build configuration. The same passing run can serve branch closeout and main entry when that tree and configuration are unchanged. Intermediate commits kept only on the feature branch do not each need retrospective full runs.

This cadence governs generic per-slice validation instructions in older plans and agent workflows. Preserve explicitly required behaviour tests, regression checks and evidence for the changed owner without expanding each into a full repository run. Report the selected commands and what they covered. A targeted or routine pass does not claim that unrun families passed.

The justfile owns command contents. ship, release and release CI use validate-full. This policy changes when to run those commands, not their coverage or failure contracts.

Code-bearing final gate

A slice is code-bearing if it changes Rust, compiler or build-system sources, libraries, tests, benchmarks, manifests, scripts, configuration or any other non-documentation implementation file.

JavaScript runtime prerequisite

Two contracts govern the JavaScript runtime. The language and backend requirement is Node 24 or newer, or another JavaScript host providing native Math.f16round, because emitted F16 values call that builtin directly. The repository validation environment is the exact Node release selected by .node-version. GitHub CI installs that release explicitly. For authoritative local validation, select the repository Node version through a version manager rather than relying on whichever node happens to be installed globally.

The integration lane executes the emitted JavaScript with the node executable found on PATH. The integration runner probes the runtime once and reports the executable and version as a fatal infrastructure failure when it lacks native Math.f16round, instead of letting individual F16 fixtures crash with engine errors. The probe enforces the capability requirement, not the exact .node-version release.

Run the probe directly to diagnose PATH or version-manager mistakes before a full gate:

node -p 'process.execPath + " " + process.version + " " + typeof Math.f16round'

Use Fast iteration commands for small feature-branch slices. At an important branch boundary, the routine correctness gate is:

just validate

Full-plan or feature merge preparation uses just validate-full under Choose the final gate by scope. Completing an intermediate slice does not require that full run.

What just validate runs

Gate

Current command

Purpose

Formatting check

just fmt-check

Formatting for moth, moth-cli, moth-lexical and moth-mon, without writing source

Clippy

just clippy

Default features and targets for moth, moth-cli, moth-lexical and moth-mon

Feature lane coverage

just feature-lane-check

Proves every declared Cargo feature has an executing lane, and that no cfg names a feature that does not exist

Rust unit tests

just validate-unit-tests

Rust unit and subsystem tests across the complete workspace, using the shared Cargo defaults and workspace-unified feature configuration

Compiler integration tests

cargo run --quiet -- tests --terse

Canonical suite policy followed by end-to-end compiler cases

Documentation check

cargo run --quiet -p moth-cli --bin moth -- check docs --terse

Moth docs-source checking inside the routine gate

Source audit

just source-audit

The one broad-source architecture audit: cfg! timer checks, direct clocks, collector and runtime calls outside the facade, closure wrappers, unguarded timer-only fields, obsolete timer macros, provisional and hard-coded metric names, and the removed-name tripwires. Reports typed findings and writes source_audit.json

First-party dependency audit

just first-party-deps

Scoped first-party package and runtime roots must contain no package-manager manifests, vendored dependency directories or unapproved lexical JavaScript module-loading forms. Cargo metadata also enforces the extracted Rust libraries' dependency direction. Invalid runtime imports from a registered module are a distinct rule. Host-driven script loading is out of scope. The audit writes first_party_deps.json

Cache maintenance

just cache-maintain

After successful checks, prune old timing reports and report a soft disk budget while preserving build artifacts and current test reports

The workspace test command includes the compiler, CLI, both standalone libraries and xtask. It is not the compiler's default configuration. xtask depends on moth with features = timers, and Cargo unifies features across one resolve graph. The default configuration and each standard feature configuration are covered by just test-feature-matrix, not by just validate.

The integration command loads the complete canonical suite and applies the shared hard-policy evaluator before selection or compilation. This makes missing ownership, duplicate primaries and other hard suite-policy findings part of the normal validation gate.

Performance and full gates

just validate-perf runs bench-ci and bench-scaling, then cache maintenance. bench-ci preflights every standard benchmark case once, then measures the quick CLI and frontend subsets with three iterations. Scaling fits the declared metric against input size and fails on a budget violation or unmeasurable series. Both commands are non-recording. They retain their existing workloads and budgets.

just validate-full runs the routine gate, workspace formatting, standard-feature Clippy, the executing feature matrix, the test honesty audit, performance checks and the exact no-timer release-artifact check. It finishes with cache maintenance. Boracle, its campaign, stress and recording benchmarks remain explicit opt-in work.

Standard-feature Clippy checks every workspace target and deliberately excludes Boracle. Linux, macOS and Windows CI use the same feature selection. The timer erasure gate builds the no-timer release binary and rejects every timer-only marker and every name from the schema-owned metric inventory in its bytes. Routine source audit retains the complementary timer-source rules.

The full gate deliberately covers more than the previous local recipe because it also executes the feature matrix and honesty audit. Compare identical scopes when measuring build improvements. Moving release builds out of routine validation is a scheduling change, not evidence that release compilation got faster.

Cache maintenance

The xtask/src/cache.rs owner queries Cargo metadata for the selected target directory. It prunes only regular cargo-timings/cargo-timing-*.html reports with recognised timestamp spelling. It retains the newest ten, every report less than a day old, future-dated reports, the latest-report alias and unknown files. Symbolic links and Windows reparse points are not followed. A redirected target or timing-report root is rejected before deletion.

Maintenance reports logical file bytes, with hard links counted per path. This can differ from allocated disk space reported by du. The default soft budget is 32 GiB, adjustable with positive integer MOTH_CACHE_BUDGET_GIB. Exceeding it prints advice, not automatic Cargo-artifact deletion or a failed test verdict. Invalid configuration or housekeeping IO errors fail the command. Maintenance after a failed gate is skipped so failure evidence stays intact.

Run maintenance with other Cargo invocations stopped. Preserve compiler artifacts, dependencies, incremental state, benchmark workspaces and test reports. This policy does not impose a hard disk cap or identify every stale Cargo file. Cargo owns its artifact layout and no per-run timestamp proves an artifact is unneeded by a later configuration.

For deliberate eviction, stop editor and agent builds sharing this target, preview the selected files and then apply package-scoped Cargo cleaning:

just cache-evict-preview
just cache-evict

This evicts current dev/test artifacts for moth, moth-cli, moth-lexical, moth-mon and xtask, so the next run pays a rebuild. It preserves unrelated dependencies and release builds. It is never automatically triggered by the size warning and may not bring all target usage under budget. Use a one-time clean for a profile migration, not after each run.

Cargo target overrides apply to maintenance through metadata. Existing benchmark compiler helpers still assume repository-local target/release and target/profiling paths. Use normal per-worktree targets for full validation until those helpers have a separately verified artifact-path change.

Test honesty audit

The campaign that hardened this suite is owned by one command:

just test-honesty-audit

It writes the canonical inventory to target/test-reports/test_honesty_inventory.json, and it is the single owner of what that file says. The inventory has four parts:

The source scan walks src, crates/moth-cli/src, crates/moth-cli/tests, crates/moth-lexical/src, crates/moth-mon/src, crates/moth-mon/tests and xtask/src. Nested subsystem test directories are included recursively. Missing configured roots fail the audit. The console and inventory name the roots scanned by the run.

The tracked durable copy under docs/roadmap/evidence/ is refreshed by the same owner, never by hand:

just test-honesty-evidence

What a report guarantees

Every machine-readable report is written to a sibling temporary file and renamed into place, so a reader never observes a partial file and a failed write leaves the previous report intact.

Every report also carries the identity of the run that produced it: an id unique within the process without depending on the wall clock, the command, the OS and architecture, the features the linked compiler was built with, a thread count where the command owns one, and whether the run finished.

Completion state is what separates the reports, and the distinction is real:

Source audit

An architecture ban whose scope is "no file anywhere may contain this" is not a behaviour claim, and a unit test that reads one file's text and asserts on it is not behaviour evidence. Those bans have one owner:

just source-audit

It walks src, crates/moth-cli/src, crates/moth-cli/tests, crates/moth-lexical/src, crates/moth-mon/src, crates/moth-mon/tests and xtask/src once, including nested subsystem tests, and reports typed findings with the file each was found in. The console and JSON report list those roots. Missing configured roots fail the audit. Only the audit's own implementation files are exempt, because they necessarily contain the fragments the rules search for. Their rules are proved against fixture text instead. A source file that cannot be read is a finding, not a file the audit skips.

Add a broad-source ban here rather than as a test. A ban that lives in a test reads one file, calls that evidence, and stops applying the moment the code moves.

First-party dependency audit

The first-party package promise has one focused owner:

just first-party-deps

It walks only these first-party implementation roots: packages/, src/builder_surface/core_packages/, src/backends/js/package_bindings/ and src/projects/html_project/binding_packages/. It also inspects the compiler-owned JavaScript inventory from moth::first_party_js: Core helper bodies, @core/collections runtime helpers, inline lowering templates and every module registered in RuntimeModuleRegistry. JavaScript module-loading classification is owned by the HTML JS parser scanner. This audit maps those diagnostics onto two rules and does not keep a second lexer. Classification is lexical and covers the forms the scanner parses: static import declarations including a clause-less side-effect import, dynamic import(), CommonJS require() and re-export from clauses.

The only allowed JavaScript module specifier is an exact compiler-owned runtime module registered by RuntimeModuleRegistry. Dynamic import(), require(), relative, absolute, URL and data imports are rejected. Exact package-manager manifest and lockfile basenames, and node_modules, vendor and third_party directory names, are rejected under the scoped roots. Invalid named imports or unsupported import forms from a registered runtime module are reported as a distinct runtime-import rule, not as an unapproved third-party module specifier.

Host-driven script loading is outside this audit: classic-worker importScripts, new Worker(url), an injected script element and specifiers reaching eval, new Function or a fetch response. Those are arbitrary runtime behaviour rather than a declared dependency, so no lexical scan can bound them, and teaching the scanner call-expression semantics would buy a false-positive surface without closing the hole. The promise holds there because first-party JavaScript is compiler-owned either as a physical asset under the audited roots or as an inventoried fragment in compiler sources, generated runtime_glue is emitted from those owned sources, and both routes reach the repository through review.

This source walk does not include generated runtime_glue, user-owned or future dependency packages, documentation, test fixtures, benchmarks or repository-root manifests. Missing roots, unrepresentable paths, non-file/non-directory entries and unreadable JavaScript sources fail closed rather than being treated as clean.

The same command reads cargo metadata --no-deps --format-version 1 for the Rust workspace. Across normal, development and build dependencies, moth-lexical and moth-host may depend on no first-party workspace package and moth-mon may depend only on moth-lexical. None of them may depend on moth or xtask, even when that package is outside workspace membership. Renaming a dependency does not change its package identity or exempt its edge. Missing configured packages and failed metadata queries fail closed. The console and report list the inspected Rust manifests alongside the JavaScript roots.

The same dependency-kind and canonical-name checks keep moth independent of lappet and wasmtime, and prevent lappet from depending on moth-cli or xtask. The CLI may depend on both compiler and Lappet libraries.

Feature lanes

just validate runs one standard feature configuration. The standard lanes run all standard configurations:

just test-feature-matrix

Package-scoped standard lanes cover the compiler's default configuration, timers, detailed_timers, benchmark_counters, timers with benchmark_counters (including the retained-layout memory probe), the scoped-block feature lane, every show_* feature, xtask and feature-free runs of moth-lexical and moth-mon. Matching CLI lanes execute the forwarded configurations independently, retaining the compiler's own unit-test lanes. testing.mtf > Feature and platform lanes owns the lane table and each lane's coverage.

The boracle feature is an opt-in developer lane. just boracle owns its formatting check, feature-enabled Clippy and smoke test. The boracle-campaign lane, using boracle_campaign, is a separate opt-in developer lane owned by just boracle-campaign. It was measured at roughly 61 seconds against roughly 8 seconds for the default lane, so it cannot belong in the default lane. Matching CLI opt-in lanes run through those same recipes. These lanes are intentionally excluded from just validate, just validate-full, just test-feature-matrix and ordinary CI gates.

Lanes use cargo test -p <package> rather than --workspace because Cargo unifies features across one resolve graph. xtask requires moth with timers, so no workspace-wide command can run the default configuration.

just feature-lane-check proves the mapping without running a lane, and is part of just validate. The report distinguishes standard and opt-in lane owners. Adding a Cargo feature means adding it to a standard or opt-in lane in the same change. The check fails otherwise. Run affected executing lanes for feature-gated work even when the routine gate passes. Use the relevant package, feature set and test filter during a branch slice. Run the complete standard matrix at full-validation checkpoints rather than for every intermediate feature-branch commit.

CI gates

just validate is the routine local gate and is deliberately fail-fast: the first failure stops the run. just validate-full provides all standard families as one fail-fast command. The per-main-commit requirement is independent of how frequently CI is triggered. A push containing several main commits does not establish full evidence for each one merely because CI tested its final revision.

CI reports each validation family as its own job, so one failure never stops another from reporting:

Gate

Command

format

just ci-gate-format

clippy

just ci-gate-clippy

unit-tests

just ci-gate-unit-tests

feature-matrix

just ci-gate-feature-matrix

integration

just ci-gate-integration

docs

just ci-gate-docs

benchmarks

just ci-gate-benchmarks

scaling

just ci-gate-scaling

timers-erasure

just ci-gate-timers-erasure

source-audit

just ci-gate-source-audit

first-party-deps

just ci-gate-first-party-deps

honesty-audit

just ci-gate-honesty-audit

Each gate runs on Linux, macOS and Windows. Every gate consumes the Rust release pinned by rust-toolchain.toml. The unit-tests, feature-matrix and integration gates execute rendered JavaScript and also install the Node release pinned by .node-version. The workflow result is still failed when any blocking gate fails. The integration, feature-matrix, first-party-deps and honesty-audit gates upload target/test-reports/ whether they passed or failed, because a failed run's report is the evidence a reviewer needs most.

unit-tests and feature-matrix overlap on purpose. unit-tests runs the workspace-unified command a developer runs locally. feature-matrix runs the configurations that command cannot reach.

The release workflow uses just validate-full. The split gates report on pushes to main and manual workflow dispatch. Creating a PR does not itself trigger this workflow, and no CI result may be claimed without an actual completed run.

Platform policy

Linux and macOS gates are blocking. Windows gates are non-blocking: a Windows failure is reported but does not fail the workflow or hold back deployment.

Windows becomes blocking when both hold:

The change is then removing continue-on-error from the gate job. Until that happens, a Windows result is evidence to act on, not a gate that can be ignored: a Windows-only failure belongs in the ledger like any other.

A platform-specific test may be absent only when the underlying API does not exist on that platform. An equivalent portable policy test should still run everywhere. `testing.mtf > Feature and platform lanes` owns which gate owns which platform behaviour.

Documentation-only release-build gate

A slice is documentation-only only when every modified file is documentation source or generated documentation.

Allowed examples include:

A documentation-only slice must not change Rust, tests, libraries, build configuration, manifests, scripts, benchmark code or fixtures, compiler configuration or other executable project sources.

During documentation-only branch iteration, inspect the changed source, links and examples, using moth check docs --terse when checking Moth docs sources. At a documentation completion checkpoint on that branch, run one documentation release build using a current compiler.

The direct release-binary form is:

moth build docs --release

If no suitable release build is available, use cargo run --quiet -p moth-cli --bin moth -- build docs --release instead.

Then:

This is sufficient for a documentation-only feature-branch checkpoint. Leave unrelated Clippy, unit, integration and benchmark suites for the appropriate wider checkpoint. A Cargo invocation of the compiler is an alternative way to run the same documentation gate, not an extra gate.

Final merge preparation and every commit landing on main still require just validate-full, including documentation-only changes. The branch-only exception does not waive that requirement. If any non-documentation file changed, select code-bearing checks under Choose the final gate by scope.

Fast iteration commands

Prefer the narrowest useful command during feature-branch work. A compile check is useful early feedback but does not replace behaviour tests when behaviour changed. Package and test filters avoid rebuilding or running unrelated targets.

testing.mtf > MON and shared lexical coverage owns standalone codec test locations and the real-source parity harness. Its gaps.rs keeps intentional data/source differences separate from accepted but undelivered source {=}, Unicode escapes and contextual ::Variant. A filtered parity run must execute the intended cases. A pass with zero selected tests proves nothing.

Task

Command

Compile-check one package

cargo check -p <package>

Focused Rust test iteration

cargo test -p <package> <filter>

Shared identifier and numeric-text rules

cargo test -p moth-lexical

Standalone MON codec and public API

cargo test -p moth-mon

MON crate documentation examples

cargo test -p moth-mon --doc

Shared lexical crate documentation examples

cargo test -p moth-lexical --doc

Real-source Moth/MON syntax parity

cargo test -p moth --lib mon_syntax_parity

Focused feature-gated tests

cargo test -p moth --features <features> <filter>

Complete workspace tests when needed

just validate-unit-tests

One integration case

cargo run --quiet -- tests --case <id> --terse

An affected integration family

cargo run --quiet -- tests --tag <tag> --terse

Complete integration suite when needed

moth tests

Clippy iteration

cargo clippy or just clippy

Standard-feature Clippy

just clippy-features

Feature lane coverage

just feature-lane-check

Every standard feature lane

just test-feature-matrix

Boracle feature lane

just boracle

Boracle campaign lane

just boracle-campaign

Broad-source architecture audit

just source-audit

First-party dependency audit

just first-party-deps

Test honesty audit and inventory

just test-honesty-audit

Durable honesty evidence refresh

just test-honesty-evidence

Docs-source iteration

moth check docs --terse

Bounded benchmark sanity

just bench-ci

Benchmark-only preflight

just bench-validate

Full CLI benchmark check

just bench-check

Full frontend benchmark check

just bench-frontend-check

Documentation release-build iteration

moth build docs --release

Important feature-branch boundary

just validate

Final merge preparation or a main commit

just validate-full

Replace placeholders with the affected package, test filter, feature set or canonical case metadata. Record the checks actually run. Passing targeted checks can close a branch slice without implying full merge readiness.

Formatting

The ship recipe formats the workspace before full validation.

Generated documentation

Do not edit files under docs/_release/** directly.

The documentation release build is:

moth build docs --release

A generated diff must result from documentation source changes, not manual HTML edits.

Manual architecture audits

When a code-bearing slice changes stage ownership, frontend boundaries, HIR, diagnostics, types or backend handoff, perform a manual architecture audit in addition to the selected automated checks. This review does not itself require a full validation run for an intermediate feature-branch slice.

Audit that:

This full architecture audit is not required for a prose-only documentation change.

Progress-matrix review

Review the progress matrix whenever behaviour, support, rejection, backend coverage or test coverage changes.

Update it when current status changed. Do not make a meaningless edit for a pure refactor or prose-only correction.

Benchmark safety

Failure handling

Code-bearing completion checklist

Before closing a code-bearing slice or checkpoint, check:

Documentation-only completion checklist

Before declaring a documentation-only branch checkpoint complete, check: