Engine reference — generated from the canonical engineering source. Do not edit this page by hand.
Testing Guide
Test Statistics
| Suite | Current values | Source | Runner | Status |
|---|---|---|---|---|
| Sol (server) | sol_eunit_total=10499 eunit / sol_eunit_baseline_failures=0 env-baseline failures (see §Env baseline below; the filtered make test-unit battery is a SEPARATE, smaller population — never conflate) + CT suites (CI-gated) | AGENTS.counts (sol_eunit_total, sol_eunit_baseline_failures); server/test/env_baseline.derived is the machine artifact — re-derive with cd server && make eunit-baseline | rebar3 eunit + CT | Stable |
| Luna (client) | luna_test_functions=691 / luna_test_assertions=22038; luna_tests_pinned_total=865 with luna_tests_pinned_skipped=8 documented skips on a dev host — session-3 skip-truth: the 2026-11-04 full battery reports 905 passed / 0 failed / 8 skipped (913-row corpus; the pinned total 865 is the floor) (test_git_snapshots UN-SKIPPED — in-file git probe, runs 40/40 wherever git exists; test_profiles DELETED — stale pre-merge suite; the three test_ioloop* files and test_safety_wiring UN-SKIPPED; all of the 12 exact-match allowlist rows carry owner+expiry annotations); the pinned counters re-derive at the next counts ring | AGENTS.counts (luna_test_functions, luna_test_assertions, luna_tests_pinned_total, luna_tests_pinned_skipped); test-file count = ls client/tests/test_*.lua | wc -l (grows as tests land); runtime re-measured per run (client/run_tests.sh, whose executed-test floor = pinned_total − allowlist rows − 2 structural; --floor-check prints it) | LuaJIT | Stable |
| Mango | mango_tests_pinned_total=2457 collected; mango_tests_pinned_skipped=31 is the default/offline reverse-leg pin and mango_tests_pinned_skipped_offline=42 is the measured offline reverse-order cap — the 2026-11-12 offline runner is 2,230 passed / 36 skipped (every skip is PostgreSQL-gated, enumerated by class in ci/generate-agents-counts.sh); the two-run PostgreSQL leg on the same database is GREEN — 2,236 passed / 1 skipped then 2,237 passed / 0 skipped | pytest --collect-only -q | tail -1 for the corpus; runtime pass/fail re-measured per run — see the root AGENTS.md Tests row | pytest | Stable |
| ZERG CLI | cli_tests_pinned_total=100 suites (cli_tests_pinned_passed=99 passed / cli_tests_pinned_skipped=1 skipped — bash zerg-cli/tests/run_all.sh reports 99/100 passed, 1 skipped, 0 failed; the env-gated integration suite reports SKIP, not passed) | file listing + tests/run_all.sh (empty corpus fails loudly); the suite count is machine-gated by ci/truth_counts_lint.py | LuaJIT | 0 failures |
| Limon | limon_tests_pinned_total=1291 pinned; the release-candidate battery measured 1178 passed / 1 skipped (floor pin 1179; 2026-11-06, local run, no committed raw log) | AGENTS.counts (limon_tests_pinned_total, limon_tests_pinned_skipped) | vitest | 0 failures |
| Lint battery | lint_contract_tests=3543 machine-derived | AGENTS.counts (lint_contract_tests) + the required lint-suite CI job | python3 | 0 failures |
Structural counts are machine-generated in
AGENTS.counts(ci/generate-agents-counts.sh) and gate on drift. Runtime battery numbers (pass/skip per run) shift as tests are added — re-measure via the runners above or read the latest gate table rather than trusting any hard-coded runtime integer.
Mango skip matrix
All Mango skips are classified and owned (owner: Mango maintainers; re-audit at the 2026-08-31 baseline expiry):
| Skip | Class | Why | Runs when |
|---|---|---|---|
test_add_org_pg_atomicity.py ×1, test_audit_anchor_schema_drills.py ×2, test_audit_anchor_table_mismatch.py ×1, test_audit_checkpoint_failure.py ×1, test_audit_checkpoint_retention.py ×1, test_audit_in_txn_concurrency.py ×1, test_audit_key_rotation.py ×1, test_audit_seam_savepoint.py ×2, test_ldap_federated_login_pg.py ×5, test_pg_cas_live.py ×7, test_pg_writer_persistence.py ×2, test_postgresql_backend.py ×4, test_revocation_retention.py ×2, test_revocation_watermark.py ×1, test_storage_parity.py ×1, test_token_cap_pg_ordering.py ×2, test_audit_durability_drills.py ×1, test_identity_durability_drills.py ×1 (36 total, machine-enumerated in ci/generate-agents-counts.sh) | PG-CONDITIONAL | need a real PostgreSQL (pool mode) | MANGO_PG_TEST_URL/MANGO_PG_TEST_DSN set — the mango-tests CI job provisions pgvector/pg17 and sets both; locally the documented throwaway container (podman run -d --name mango-pg-798 -p 127.0.0.1:15433:5432 -e POSTGRES_USER=zerg -e POSTGRES_PASSWORD=zerg -e POSTGRES_DB=zerg docker.io/pgvector/pgvector:pg17) makes the full battery run with 0 skips |
test_ldap_auth.py ×1 (pytest.skip, only when openssl cannot mint a self-signed certificate) | ENV-GATED | openssl unavailable on the host | when a usable openssl is on PATH; the measured reference battery has no openssl skip, so the offline cap stays 36 |
Session-3 skip-truth (2026-10-16): the test_loopback_parity_fixture.py
×9 STRUCTURAL rows are GONE — the per-predicate parametrizations now FILTER
at collection (same assertions, no runtime skips; the two grant rows retired
from ci/python_skip_allowlist.txt). The PG row is corrected from the stale
18 to the real 25 (the audit-seam ×2 + ldap-pg ×5 sites were never
folded in).
The retired-feature rows (test_auth.py refresh-token, test_plugins.py
Azure/LDAP, the old v63 token-type stubs) are GONE — the deleted contracts
and their unconditional skips were removed with the features
and the -era matrix naming them was stale
. Offline battery:
1627 passed / 27 skipped; PG-up battery 1653 passed / 1 environment skip
.
Fixes that made the PG suites runnable: psycopg_pool added to
mango’s main deps + requirements.txt; the fake-psycopg stub in
test_postgresql_backend.py is installed only in offline mode (it poisoned
sys.modules and broke psycopg_pool imports); the missing pg_harness
fixture in test_add_org_pg_atomicity.py is real now (pool backend +
setup_db + idempotent teardown) and the test’s impossible FK-violation
trigger was rewritten as an injected-statement-failure rollback test
(the v0001 schema has no FK on user_orgs); the source-inspection paths
in test_pg_writer_persistence.py are __file__-anchored.
Env baseline — ZERO ENTRIES since then
cd server && make eunit-baseline (the UNFILTERED corpus, including
infra-requiring modules excluded from the CI unit corpus) fails on a fixed,
documented set of environment-dependent tests, recorded one-per-line in
server/test/env_baseline.txt with the 0-new policy (a change may never
ADD a failing test there). : all 42 entries were
root-caused and FIXED — the corpus has since grown through the
Windows; the current derived truth is sol_eunit_total=10499
tests / sol_eunit_baseline_failures=0 failures, re-derived from the live
tree (the artifact server/test/env_baseline.derived is authoritative and
the generator refuses a header that disagrees with it,; the
historical 3-cancelled plugin-executor class is recorded in the baseline
header). The
Filtered CI battery (cd server && bash scripts/test-unit.sh, cd server && make test-unit) is a
SEPARATE population — last recorded 8177/0 at the 2026-10-23
closeout (verdict artifact ac2fd5bcb); the unfiltered derivation corpus
is 8715/0. The two numbers must never be conflated: the derivation corpus
includes the suite-re-homed/family modules the filtered battery excludes.
The file now carries the # intentional-empty: marker (the
lint’s sanctioned zero-entry state, -aware) and the fix record.
ci/env_baseline_lint.py (wired into lint-suite) enforces the file’s
invariants: every entry must match a real test in server/test/; an empty
corpus fails unless the intentional-empty marker is present; a git diff
that adds an entry fails; the header expiry (re-audit trigger) fails the
lint once passed.
Root-cause record (the 42, fixed in place): the failures were genuine
TEST defects — stale mocks returning wrong shapes (sol_memory_pg:store
→ {ok, <<"stored">>} vs the handler’s ok; sol_scheduler mocks not
matching handler contracts), ghost assertions of contracts production
never had (the x-user-uuid response header — grep-verified nowhere; the
slack challenge echo; the 429 SSE-limit reply — production is 503),
wrong route action names ([sync_events] vs [sync_events_stream]),
missing app-owned ETS bootstraps (sol_channels, skill_reports,
sol_sse_connections owner, session-map shapes), a double meck:unload
raising in cleanup, non-integer schedule ids, and missing prompt/tasks
body fields. THREE PRODUCTION DEFECTS the tests exposed and fixed:
sol_http_chat:get_history crashed every request via
cowboy_req:match_qs (missing/unknown query keys throw); sol_memory_pg
stored entries without their own key, so key-based search never matched;
the sync-events SSE relay gap (the handler subscribes the dying request
process — D-noted for a follow-up phase).
Count reconciliation (historical): the gate verdict’s “52-entry
baseline” lived only in the gate machine’s /tmp; AGENTS.md’s “59” was a
stale previous count; plan/README’s “4782 tests, 0 failures” describes
the FILTERED CI corpus (a different population — those modules excluded).
In-repo truth: 3566/44/5 at → 3544/44/5 after ’s CT
migration → 3538/0/5 after ’s root-cause repair → 6354/0/3
(2026-09-04, env_baseline.derived — corpus growth through the
Windows + documented derivation exclusions) → 7085/0/0
(2026-09-14, — the – batch grew the corpus;
the record regression, handler order-dependence and missing-WAL
fixture were FIXED in place) → sol_eunit_total=10499 (current, re-derived
per the freshness protocol — re-run make eunit-baseline
after any test-function census change).
Derivation protocol: the baseline is derived, never
guessed — cd server && make eunit-baseline (scripts/eunit-baseline.sh:
clean compile → UNFILTERED rebar3 eunit → fail-set vs the committed
file). Any phase that claims a baseline change runs it FIRST; a new
failing module is a regression (0-new policy), a shrink is a justified
removal to commit. This kills the C16(c) class: gate-time run-vs-file
diffs assumed a warm stale build (a cold-build run once aborted at 2388
tests / 19 non-baseline failures).
Sol flake ledger
Owned observations of run-to-run variance in the Sol suites. Every entry: observation → root cause / characterization → disposition. A new observation gets a row here in the phase that sees it (the register’s C16/C35 rows closed when this table exists with both dispositions filled).
| Observation | Root cause / characterization | Disposition |
|---|---|---|
e2e inference: first-post-CT run failed 6× incl. undefined function sol_provider_registry:lookup/1 (C16(a)) | eunit VM: the provider-registry module was unloaded by another suite’s meck:unload; the [non_strict] mock intercepted only list, so lookup raised undef in the request process; in eunit the registry/catalog gen_servers do not run either (noproc EXITs) | **FIXED **: sol_http_e2e_inference_tests mocks the full resolve boundary (sol_provider_registry:lookup, sol_catalog:lookup, sol_registry:find_by_name) → every request resolves to the graceful 503. Stress bar: 4× isolated runs, 0 failures, 0 CRASH REPORTs (the register’s 3× isolated 12/12 baseline exceeded) |
sol_pipeline_stream_SUITE:streaming_429_retries_once_then_succeeds — intermittent failure_count 1 vs 0 after the retry-succeed path (~1 in 3 full-suite runs; isolated runs pass) | Timing: the success-reset of the {Host,Port} circuit counters is a CAST and raced the direct get_state assert (a second 429-classified frame from the same run’s earlier cases can land after the reset); pre-existing — the testcase predates | **FIXED **: the assert now polls with sol_assert_eventually (mirrors interleaved_success_resets_circuit). Sibling case non_streaming_cap_enforced_loudly had the same direct-read race after the failure cast (the CI server-ct failure this phase) — same fix. Stress bar: 3 consecutive full-suite runs, 14/14 each |
sol_pipeline_connect_SUITE:tls_verification_failure_permanent_single_attempt — {error, nofile} from the pkix material in full-suite runs (C35) | public_key:pkix_test_data/1 flaked under load in full-suite runs (file-backed material collision) | **FIXED **: one deterministic retry with a 100ms backoff in tls_test_material/0 (the justified sleep: comment carries the ledger reference); failure mode now bounded |
| Cold/stale-build full eunit run aborted at 2388 tests / 19 non-baseline failures (C16(c)) | The gate-time run-vs-file diff assumed a warm clean build; a cold build instantiates differently | **FIXED **: derivation protocol + make eunit-baseline (above) — the diff is one command on a clean build |
sol_zmq_handler_worker_test:adoption_worker_mismatch_refused_under_provisioned_binding — the labeled_refused(<<"worker_mismatch">>) +1 delta read 0 in 2 of 3 full-corpus derivations on the merged tree (module isolated 26/26; adjacent-module batches pass) | counter-delta read of the shared sol_metrics ETS; sol_metrics:bump swallows a missing/recreated table (metrics_table_missing) by design, so a corpus-order window where the table is absent makes the delta read 0 even though the refusal arm fired — a corpus-order race, not a code-path defect | FIXED record (2026-09-23): the test now asserts the typed refusal at the mecked sol_zmq_sender boundary (exactly one send/2 with a frame carrying worker_mismatch) plus the no-adoption state — order-independent and behavioral; re-derived clean. The same audit exposed + fixed a derivation gate hole: the 0-new failure-enum regex only matched *_tests modules, so this *_test failure passed the baseline policy silently |
sol_scheduler_attribution_tests:plugin_delivery_classification_matrix_test — bare_ok_drift settled consecutive_errors=2 vs expected 1 | Test-spec race, not a product defect: the case’s every job was immediately due at create (sol_scheduler.erl:561-564 anchor + :1166-1169 ceil(0/IM)), the 1 s-clamped tick re-dispatched it through the designed error-backoff ladder (:1103-1137, :1157-1160) — every settlement legitimately increments consecutive_errors — and the settle predicate only checked not currently_running, so an under-load read could land after a retry settled (2) | **FIXED **: the matrix now creates at jobs with a FUTURE at_ms; run_job’s one-shot enabled=false latch (one_shot_barrier/1, :1080-1084) precedes dispatch, so the error ladder can never re-fire the case’s job — exactly one settlement per case. Bar met: 20× isolated runs green + the full-corpus derivation at the phase landing |
sol_scheduler_attribution_tests:zmq_await_timeout_does_not_touch_the_error_ledger_test — the run-close read saw next_run_ms <= the captured Now in one full-corpus derivation (repro run 8278; module green isolated) | Advance arithmetic, not test-spec: the mocked await makes the whole dispatch→timeout→advance path sub-millisecond, and compute_next_run(every, Anchor)’s at-or-after-now boundary at zero elapsed is the job’s own anchor (the create instant) — so next_run landed at-or-behind the advance moment and the job was instantly re-due; the run-close read samples whichever side | **FIXED **: the advance path clamps through strictly_future_next_run/2 — only the anchor boundary bumps one interval (integer-only, no clock read); create’s immediate-first-fire semantics unchanged. RED-first pin zero_elapsed_advance_is_strictly_future_test; the run-close case is deterministic post-fix |
sol_usage_chunk_tests gun assertions — pump_held_reject_pre_stream_no_gun_test read gun:open num_calls 2 vs expected 0, then pump_held_go_arms_connect_once_test read 3 vs expected 1, in two consecutive unfiltered full-corpus rebar3 eunit runs at the closeout (24 other tests in the module + the module in isolation: 25/25 green both ways) | Global meck:new(gun, [unstick]) counts calls from every live process in the suite VM; a pre-existing periodic probe (provider-health / leftover gen_server from an earlier module) calls gun:open inside the test’s window — a timing/order-dependent test-isolation race, source-identical to base (the closeout diff touches no Erlang/Lua/Python source) | RECORDED: a pre-existing full-corpus flake, module-green in isolation; owner: next Sol test-hygiene window — scope the meck (passthrough/meck:reset boundary) or assert the pump’s own call path (meck:history filtered to the pump pid), then run 3 clean full derivations before closing the row |
xfail & skip inventory
The “zero xfail markers anywhere” claim was FALSE — the grep
covered tests/ pytest markers but not tests/integration/ (4 live
markers). This dated table is the repo-wide inventory; every marker
carries strictness + dated reason + disposition.
| Marker | Where | Strictness | Dated reason | Disposition (2026-08-18) |
|---|---|---|---|---|
@pytest.mark.xfail | tests/integration/test_zmq_task_dispatch.py (bg task) | strict | : mock provider in –connect ZMQ mode crashes during agent setup (task ends failed, line_count=0) | **RE-DATED ** — re-run confirms the documented mode; stays strict |
@pytest.mark.xfail | tests/integration/test_ws_chat_roundtrip.py (WS roundtrip) | strict | : WS path returns 404 — session-scoped WS route needs investigation | **RE-DATED ** — re-run confirms the documented mode (upgrade 404); stays strict |
@pytest.mark.xfail | tests/integration/test_mango_sol_event_bridge.py (RBAC downgrade propagation) | was non-strict | : residual failure mode is the 5s propagation window, not a crash | **CONVERTED to strict + RE-DATED ** — the never-re-dated class polices; an unexpected pass must XPASS loudly |
@pytest.mark.xfail | tests/integration/test_workflow_e2e.py | strict | : workflow /start 500 — Sol crashes on step dispatch | **REMOVED ** — the masked crash was fixed (3 production bugs: manager case_clause on unknown workflow, stale boot-defined tuple steps → badrecord, detail/stream bare-record 500); replaced by 2 real boundary tests (unknown name → 404, boot-registered start → 200 + visible) |
| Luna runner skips | client/run_tests.sh SKIP_TESTS (7 files) + 2 support modules | n/a | env-gated / infra-unavailable (owned; expiry 2026-08-31 re-audit) | inventory owned since then; count truthful 7+2=9 |
| CT runtime skips | server/test/*_SUITE.erl init_per_suite {skip,...} / tc_user_skip | n/a | infra-bound: full OTP supervision tree / cluster peer nodes / PG containers unavailable | last full run: 6 skipped, all infra-bound (documented per-suite) |
| Limon runtime skips | limon/src/integration/e2e-live.test.ts (REAL transport) | n/a | VITE_TEST_REAL_API=1 + a seeded identity; never armed in CI — skipped by default, fail-loud when armed without credentials | renamed the old mock-echo suite to api-mock.test.ts; the live gate is the counted limon_tests_pinned_skipped=1 |
| eunit | — | — | — | no skip markers; env-baseline failures are FAILURES, not skips |
Polling assertions
Fixed timer:sleep(N) guesses are the flakiness engine — new ones are
lint-gated (ci/timer_sleep_lint.py, shrink-only ratchet). Use the shared
polling helper instead:
%% waits up to 2s (25ms interval) for the predicate
sol_assert_eventually:assert(fun() -> condition() end),
sol_assert_eventually:assert(fun() -> ... end, 5000) %% custom timeout
A %% justified sleep: <why> trailing comment exempts a line whose test
subject IS the timing.
Integration harness
tests/integration/harness.py boots Mango + Sol + Luna (the fixture lane)
for the HTTP/RBAC/chat/system-boundary tests. The required
tri-service-integration CI job invokes:
python3 -m pytest tests/integration/ -v --tb=short
python3 -m pytest tests/smoke/ -v --tb=short # same harness, smoke matrix
Port policy: ephemeral by default — every TriServiceHarness instance
allocates free ports (_pick_free_port), so two concurrent runs on one
host cannot collide (the fixed 5800/21434/5555/5556/5598 constants are the
opt-in debug lever ZERG_HARNESS_FIXED_PORTS=1; the legacy
ZERG_HARNESS_EPHEMERAL_PORTS lever still selects both modes). Tests
address the stack through harness.mango_url / harness.sol_url — never a
hardcoded 127.0.0.1:<port>. Waits bound the real post-condition with the
harness poll helpers (poll_until / poll_until_sync) — no fixed sleeps
encoding a cache/TTL/expiry window.
CI event matrix
Forgejo schedule triggers are workflow-wide. ci.yml therefore carries
exactly ONE cron (the nightly full battery + the eunit-baseline
derivation); the env-baseline expiry scan owns its own workflow so the
second cron never wakes the 44-job battery. ci/ci_event_matrix_lint.py
(required lint-suite) machine-checks this table — edit the YAML and this
section together.
| Trigger | Workflow | Jobs | Notes |
|---|---|---|---|
| push / pull_request to main | ci.yml | the full required battery (server-*, client/Mango/CLI/Limon, lint-suite, web-tests, tri-service) | cancel-in-progress: false: a source push queues behind the in-flight release battery (the C7 status-race lesson) |
workflow_dispatch | ci.yml | operator re-run; eunit-baseline runs ONLY on a main-ref dispatch | the release procedure dispatches the derivation on the release SHA before tagging |
schedule 17 3 * * * | ci.yml | full battery + eunit-baseline | nightly derivation is schedule/dispatch-only (never a push) |
schedule 23 4 * * * | expiry-tripwire.yml | expiry-tripwire only | T-14 warn / T-3 red scan of every # expiry: header |
| schedule (same crons) | ci.yml | nightly-kill-drills, nightly-heartbeat-probe, required-checks-mirror-diff, runner-image-mirror | schedule-guarded inside the workflow (never on push/PR) |
| schedule + push/dispatch to main | ci.yml | nightly-deadman | fails when the newest scheduled battery run is older than 30h — a stopped cron reds the merge lane (BVI-079) |
tag v* / dispatch | kill-proofs.yml | kill-proofs-regression | release-boundary battery; consumed by Crow’s kill-proofs-check before deploy |
Local lint battery
The required lint-suite job is reproducible locally without copying the CI body:
python3 ci/run_all_lints.py # every manifest lint-suite row, in order
python3 ci/run_all_lints.py --list # the planned legs (arguments included)
python3 ci/run_all_lints.py --only tools_taxonomy_parity_lint
python3 ci/run_all_lints.py --skip pr_runner_isolation_probe
The runner reads ci/lint_manifest.yaml, resolves each row’s invocation from
the real lint-suite job body (so arguments cannot drift), applies
lint_suite.default_timeout_seconds (or --timeout), and fails loud on a
missing tool, an unknown wiring, an EMPTY CORPUS message, or a non-zero leg.
case_exhaustiveness_lint is ratcheted against the CASE_CAP/NARROW_CAP
constants in the job body. The wall time is printed on success.
Test-honesty gates
The required lint-contract-tests job runs the WHOLE tests/test_*.py
corpus — the doc-truth contracts were red on main
while only six files ran there. lint_contract_tests in AGENTS.counts
is derived from that corpus (pytest --collect-only).
ci/vacuous_assert_lint.py --corpus lua is the Lua counterpart
of ci/vacuous_assert_lint.py: a literal-true assert_eq(..., true, true) / assert_true(..., true) in client/tests/** fails the
lint-suite battery. Replace it with the real post-condition, or annotate
the line with vacuous-ok: <reason> (the Erlang assert-true-ok:
shape).
ci/docs_counts_lint.py + ci/render-docs-counts.py --check cover the
counts corpus and every pinned key (the live count prints on each run); ci/truth_counts_lint.py live-derives the
Limon view count (router.ts), the CT shard count (ct_plan.txt), the
skip-allowlist row count and the Sol /metrics posture, so the prose
cannot drift from the implementation.
Endpoint exercise gate
ci/endpoint_exercise_lint.py is the behavioral complement to
api_reference_parity_lint.py (which proves spec↔doc↔route EXISTENCE, not
EXERCISE). It builds a machine inventory mapping every OpenAPI operation in
docs/fixtures/openapi_spec.json to at least one real-dispatch citation:
Citations come from tests/smoke|integration|e2e
pytest AST (harness.request / harness.sol_request, parametrize rows,
WebSocket .../ws paths) and server/test/*.erl (shared gun helpers,
direct gun: calls, route/3 segment+verb calls, and direct
dispatch-map handler calls). Source-inspection greps are not evidence and
are never counted. Method-exact citations cover one operation; a direct
handler citation (Module:handle(Action, Req)) covers a path only when
the spec documents a single method — multi-method paths need
method-specific evidence.
Exemptions live in docs/fixtures/endpoint_exercise_exemptions.json.
Every row requires class, reason, owner and an ISO expiry; expired
rows fail. The CT-9 six catch-all route prefixes are listed there
(class: ct9-catch-all-prefix) and the lint derives the same set from
sol_http_routes.erl, so the prefix cover is counted, audited and never
invisible. citations rows are a manual escape hatch: file/line, path,
method and test name are verified; phantom, stale, skip-only and
uncollected citations fail.
Fail-closed: an unreadable/empty spec, an empty behavioral corpus
zero extracted citations, or a missing fixture fails the gate.
At the real tree derives 184 spec operations / 169 paths / 169
router rows, 630 citations, 184/184 covered, 0 route exemptions
and 6 audited CT-9 catch-all prefixes. The exercising corpus includes
server/test/sol_endpoint_exercise_tests.erl, which drives the previously
uncited routes through a real Cowboy listener. Run:
python3 ci/endpoint_exercise_lint.py
python3 -m pytest tests/test_endpoint_exercise_lint.py -q
The gate is owned by the Sol HTTP surface (sol-http-surface); the CT-9
rows expire 2027-04-30 and must be re-reviewed (or retired by enumerating
concrete route rows) before then.
CT hermetic harness
The Sol Common Test battery runs through server/scripts/test-ct.sh, which
now hands every rebar3 ct invocation its own per-VM data root
(SOL_CT_DATA_ROOT → _build/test/tmp/ct-roots/<run>-s<N>): the scheduler
store, lane pidfiles, CURVE keyfile, audit JSONL and Mnesia live there and a
fresh VM can never read a previous run’s durable state (the persisted
fixture_sse every-5s job class). sol_ct_hermetic_hook (registered in
server/rebar.config) applies the root, runs the app-lifecycle barrier, and
enforces leak detection at end_per_suite:
Gate — SOL_CT_HERMETIC_GATE (test-ct.sh exports baseline):
a leak outside server/test/ct_leaks.baseline.tsv fails a suite in the
measured corpus (server/test/ct_leaks.measured); all fails any leak;
ad-hoc rebar3 ct runs default to off (report only). Leaks are appended
to _build/test/logs/ct-leaks.tsv.
Baseline ratchet — python3 ci/ct_leaks_baseline.py --seed after a
battery, --update to shrink (never grow), --check is required in
lint-suite. The remediation sweep works this list down.
Owners — every suite-infra owner goes through sol_ct_session
(start_owner/2 + await_owner/2, or the legacy-protocol
spawn_owner/1 + await_ready/2): an owner crash reports
{infra_failed, Class, Reason, Stack}, a DOWN reports owner_down, and
the bounded timeout fires only for a live-but-silent owner.
Adopt-or-start — sol_ct_session:ensure_started/2,3 for app-owned
registered names (never gen_server:stop + start_link against a live
supervisor), app_up/0 / app_down/0 + await_app_stopped/1 for the
lifecycle barrier.
Ports — sol_ct_ports:ephemeral (bind 0, read the port back) for
ZMQ/HTTP fixtures; ci/ct_suite_hygiene_lint.py --check port rejects fixed
service-port binds.
Manifest — server/test/ct_suites.manifest is generated by
python3 ci/ct_suites_manifest.py --update (--check is required):
per-suite app_lifecycle / destructive / ports / dist /
cost_seconds / isolation / leaks. Costs refresh with --measure
(parses CT =elapsed_time).
Smoke subsets: CT_SUITES=sol_foo_SUITE MIN_CT_TESTS=1 bash server/scripts/test-ct.sh runs exactly those suites (skips the isolated
invocations). server/test/sol_ct_hermetic_SUITE.erl self-tests the
harness (owner reporting, adopt-or-start, metrics-table shape, data root,
ports, leak detection, erlexec policy).
Measured CT floors (canonical closeout)
server/scripts/test-ct.sh writes _build/test/logs/ct-battery-start at
battery start and runs ci/ct_measured_census.py --check --since <battery>
at the end. The canonical standalone closeout is:
python3 ci/ct_measured_census.py --check
It reads the battery marker (never --since 0), requires every planned
suite’s newest log to be from that battery, and enforces the per-suite and
battery totals in server/test/ct_measured.tsv (shrink-only). Group suites
expand groups/0, so all -> [{group, g},...] is counted as its real
case count, not the number of group tuples. --generate re-seeds the pins
from real logs; --since 0 is refused.
Test-side JSON convention (2026-10-16, the jiffy drain)
The Erlang test corpus runs on the OTP stdlib json module (jiffy was
removed tree-wide — see ci/no_prod_jiffy_lint.py). Three shaping rules
keep tests honest under the stdlib semantics:
json:encode/1returns IODATA, not a flat binary (jiffy returned binaries). Wrap the result:iolist_to_binary(json:encode(Term))— this is also the house prod facade shape (sol_http_json:encode/1).json:decode/1takes a BINARY (jiffy tolerated iolists). Wrap the input when it comes from an encoder/list builder:json:decode(iolist_to_binary(X)).- Never compare serialized bytes. Assert on the DECODED term
(
json:decode(...)→ map/list compare), or on a hand-rolled lexicographic canonical encoding when two independently-built bodies must be compared (map iteration order is key-hash order, and atom- vs binary-keyed maps with equal content iterate DIFFERENTLY — seesol_provider_wire_openai_tools_tests:canonical/1for the reference encoder).json:encodehas no pretty/sort options.
EJSON one-tuples ({[{K, V},...]} — jiffy’s object wrapper) are retired:
use maps (#{K => V}).
Mock discipline (meck) — 2026-10-16
The meck README’s caveats are our recurring test-flake classes. Rules:
- Lifecycle. A mock is created and unloaded inside ONE testcase (or
init_per_testcase/end_per_testcasepair). A suite-scoped mock needsno_linkAND an unload inend_per_testcasethat runs on every outcome — meck’s CT note:init_per_suiteruns in its own process, so a linked mock dies (or worse, survives as a stale global) before the testcases. - Never assert GLOBAL call counts on shared modules.
meck:num_calls/3counts every process in the VM; gun has independent background callers (provider-health probes), which is the flake. Usesol_test_meck:calls_from/3(meck:history filtered by the caller pid) ormeck:wait/4for a bounded wait. The shrink-only ratchetci/meck_global_count_lint.pygates newmeck:num_calls(gun,...)sites; a reviewed%% meck-global-ok: <reason>marker is the escape hatch. - Never mock NIF/gen_*/
erlangmodules — recompiling them in the global namespace breaks live processes (the meck README’s list). Put a seam behind our own module instead. - Local calls bypass mocks — an expectation on
f/1does not intercept a module-localfcall; assert the externally reachable path. passthroughfor partial overrides —meck:expect(M, F, fun(...) -> meck:passthrough([...]) end)keeps the original behavior for the cases the test does not own.
Failure-time event dump (CT)
The hermetic CT hook implements on_tc_fail/4 and appends the newest sync
events (default 200, SOL_TEST_EVENT_DUMP=N to widen) to the failed
testcase’s CT log via sol_test_events:dump_tail_to_ct/2. The run/check
helpers live in sol_test_events (composable specs) and sol_test_watch
(watcher-before-action waits).
Running Tests
Server (Sol)
cd server && make test-unit # CANONICAL filtered unit gate (EUNIT_TIMEOUT=10; measured 8177 at the 2026-10-23 closeout)
cd server && ERL_AFLAGS='-eunit_timeout 10s' rebar3 eunit --module=sol_inference_tests # Single module (timeout REQUIRED)
cd server && ERL_AFLAGS='-eunit_timeout 10s' rebar3 eunit --module=sol_provider_fallback_tests # one file per battery
cd server && ERL_AFLAGS='-eunit_timeout 10s' rebar3 eunit --module=sol_outbox_journal_tests # the
# retired s92/s93 names
# no longer exist)
cd server && make test-ct # CANONICAL CT battery (32 shards + isolated)
python3 ci/ct_measured_census.py --check # per-suite measured floor (reads the battery marker)
Verification-honesty gates:
python3 ci/mock_parity_lint.py # mock signatures + multiline store-shape mocks
python3 ci/test_effectiveness_lint.py # can't-fail scan: mango, tests/**, example/**, Erlang/Lua/TS
python3 -m pytest tests/test_*.py # contract tests for the gates above
cd server && ERL_AFLAGS='-eunit_timeout 10s' rebar3 eunit --module=sol_endpoint_exercise_tests
sh example/vim/test/run.sh # editor suite (incl. the loopback-only air-gap transcript)
bash benchmarks/run_ev5_bounded_read_bench.sh # EV-5 bounded-read artifact (see benchmarks/ev5-bounded-read-bench.md)
Client (Luna)
Per-file test counts shift constantly — client/run_tests.sh prints the
authoritative aggregate (functions/assertions; machine totals in
AGENTS.counts).
cd client && ./run_tests.sh # full battery: functions/assertions + skips
cd client && luajit tests/test_core.lua # Core + agent + regression
cd client && luajit tests/test_ffi.lua # FFI + security
cd client && luajit tests/test_sse.lua # SSE parser
cd client && luajit tests/test_provider.lua # Provider + retry + OpenAI
cd client && luajit tests/test_config_providers.lua # Settings providers (load validation + URL path)
cd client && luajit tests/test_main_stdio_persistent.lua # Sol-less persistent --stdio (history across prompts)
cd client && luajit tests/test_mcp.lua # MCP with mock server
cd client && luajit tests/test_e2e_zmq.lua # ZMQ E2E tests
cd client && luajit tests/test_ai_classifier.lua # AI permission classifier
cd client && luajit tests/test_sub_agent.lua # Specialist sub-agent tests
cd client && luajit tests/test_prompt_prefix_stability.lua # Canonical layout + prefix hash
cd client && luajit tests/test_prompt_prefix_fork.lua # Frozen-prefix forks + cache context
cd client && luajit tests/test_hooks.lua # Hook system tests
cd client && luajit tests/test_permission_ruleset.lua # Permission ruleset tests
cd client && luajit tests/test_hidden_agents.lua # Hidden utility agent tests
# Run all client tests
cd client && for f in tests/test_*.lua; do echo "=== $f ===" && luajit "$f"; done
Standalone completion is file-scoped and network-free:
cd client && RUN_TESTS_STRESS=0 bash run_tests.sh \
tests/test_completion.lua tests/test_completion_standalone.lua
Engine bundles
The bundle consumer’s fixture battery builds real fixture-class bundles
through scripts/engines/build.sh and exercises verification, host-class
refusal, install/canary, upgrade and rollback:
python3 -m pytest -q tests/test_engine_bundle_consumer.py
bash scripts/engine-bundle-consumer.sh verify --bundle-dir <dir> --allow-unsigned
sh example/vim/test/run.sh # editor surface (read-only here)
python3 ci/egress_assert_lint.py # zero-egress discipline
Stress / flake bars — MANUAL-ONLY
client/run_tests.sh implements RUN_TESTS_STRESS=<n> (,
): the selected files run n times in isolation and the final line
reports STRESS: <n> runs, X failures, Y panics with a non-zero exit on
any failure/panic. As of 2026-10-17 it has zero CI callers — no
workflow invokes it, so it is a manual flake bar, not a gate.
Owner: Luna maintainers · Check date: 2027-03-29 · Status: MANUAL-ONLY (recorded, not a silent gap). The CI wiring (a scheduled leg) is integrator-owned; when it lands, replace this row. When to run: before landing a change that touches provider/streaming, the ioloop pump, sub-agent/sub-process lifecycle, or any file named in the Sol flake ledger above.
cd client && RUN_TESTS_STRESS=20 bash run_tests.sh tests/test_<name>.lua
cd client && RUN_TESTS_STRESS=5 bash run_tests.sh tests/a.lua tests/b.lua
Mango
cd mango && python3 -m pytest --collect-only -q | tail -1 # live corpus count
cd mango && python3 -m pytest test/ -v # full suite
cd mango && python3 -m pytest test/test_auth.py -v # Auth pipeline only
Limon
cd limon && npx vitest run # limon_tests_pinned_total=1291 / limon_tests_pinned_skipped=1 (AGENTS.counts)
cd limon && npx vitest run src/integration/ # Integration tests only
Test Structure
Historical section. The per-category counts and file totals below were true when measured and are kept for orientation only; they are NOT maintained. Current machine-derived totals live in
AGENTS.countsand the statistics table above.
Server (429 files)
| Category | Tests | Key Files |
|---|---|---|
| Inference | 42 | sol_inference_tests |
| Pipeline | 7 | sol_pipeline_tests |
| Registry | 44 | sol_registry_tests |
| HTTP | 36 | sol_http_tests |
| Worker | 20 | sol_worker_tests |
| Task Store | 10 | sol_task_store_tests |
| Anthropic API | 15 | sol_anthropic_api_tests |
| Anthropic Stream | 10 | sol_anthropic_stream_tests |
| Thinking Passthrough | 17 | sol_s41_tests |
| ZMQ Gateway | 8 | sol_zmq_gateway_tests |
| ZMQ Protocol | 12 | sol_zmq_protocol_tests |
| ZMQ Handlers | 22 | sol_wf1_tests |
| Cron | 30 | sol_cron_tests |
| Scheduler | 36 | sol_s22_scheduler_tests |
| Scheduler Validation | 32 | sol_s33_tests |
| Scheduler Hardening | 14 | sol_s22_1_hardening_tests |
| Circuit Breaker | 21 | sol_s25_tests |
| Provider Registry | 15 | sol_s46_tests |
| Provider Adapters | 56 | sol_s47_tests, sol_s84_tests, sol_s85_*_tests, sol_s85_tests |
| Plugin System | 48 | sol_s38_tests |
| Workflow Engine | 21 | sol_s44_tests |
| Workflow Instance | 21 | sol_workflow_instance_tests |
| Workflow Bridge | 14 | sol_integ1_tests |
| Events | 4 | sol_events_tests |
| Metrics | 13 | sol_metrics_tests |
| Cluster | 4 | sol_cluster_tests |
| Catalog | 9 | sol_catalog_tests |
| Auth + Rate Limiter | 14 | sol_s34_tests |
| Keyring | 4 | sol_keyring_tests |
| OAuth PKCE | 18 | sol_s81_tests, sol_s83_1_tests, sol_l67_oauth_refresh_tests |
| Memory PG | 29 | sol_l55_memory_pg_tests |
| Memory Consolidation | 28 | sol_e3_consolidation_tests |
| Embeddings | 28 | sol_e1_embedding_tests |
| Teams/Swarm | 50 | sol_s92_swarm_tests |
| Container Pool | 33 | sol_s93_container_tests |
| E2E Protocol | 117 | sl1_e2e_tests, sl1_protocol_tests |
| E2E Live Process | 14 | SL5 scenarios |
| E2E Stress | 4 | SL6 scenarios |
| Deep E2E | 27 | sl7_deep_e2e_tests |
| Integration | 11 | sol_integration_tests |
| Production | 25 | sol_s97_tests |
| Mnesia/Prometheus | 22 | sol_s98_tests |
| Health/Shutdown/Latency | 25 | sol_s97_tests |
Client (481 files)
| Category | Key Files |
|---|---|
| Core | test_core, test_sse, test_provider, test_stream_state, test_openai_stream_state, test_config_providers (settings providers + mock-HTTP final URL), test_main_stdio_persistent (spawned Sol-less stdio continuity) |
| Session | test_session_backend, test_session_branching, test_session_mode, test_sqlite_session |
| Tools | test_parallel_tools, test_loop_detector, test_mutation_queue, test_fuzzy_match, test_tool_validation, test_todo |
| Agent | test_agent_steering, test_agent_modes, test_ai_classifier, test_sub_agent, test_hidden_agents |
| ZMQ | test_zmq, test_e2e_zmq, test_event_bridge |
| TUI | test_chatpane, test_inputbar, test_theme, test_markdown, test_highlight, test_diff_view, test_screenbuf, test_visual_patterns |
| Context | test_l23_context_management, test_l24_safety, test_l25_intelligence, test_l26_wiring, test_l27_permissions |
| Hook/Permission | test_hooks, test_permission_ruleset |
| MCP | test_mcp, test_mcp_server, test_mcp_http, test_mcp_depth |
| LSP | test_lsp |
| Vision/Image | test_image, test_image_transform, test_l62_vision, test_l72_sixel |
| Memory | test_l55_memory_providers, test_e3_consolidation |
| Compaction | test_l56_compactor |
| Phase tests | test_l58_tool_depth through test_l76_*, test_s87_* through test_s99_* |
| Infrastructure | test_injection_detector, test_tool_discovery, test_truncate, test_config_validation, test_keyring, test_web_search |
| Desktop | test_computer_use, test_l53_computer_use, test_l66_desktop_integration |
Mango (49 files)
| Category | Coverage |
|---|---|
| Auth | Token lifecycle, RBAC, rate limiting, session management |
| Handlers | Accounts, teams, sessions, REST CRUD |
| Systems | Auth, accounts, teams, tasks, audit |
| Storage | SQLite backend |
| Tools | Rate limiter |
| Events | ZMQ transport |
| Plugins | Plugin lifecycle |
| PostgreSQL | Backend operations, cascade deletes |
Limon (71 files)
| Category | Tests | Files |
|---|---|---|
| Stores | 27 | auth (7), chat (5), connection (4), infra (11) |
| API Clients | 16 | sol-client (4), mango-client (4), sse-client (8) |
| Components | 16 | header, sidebar, worker grid, workflow, audit, infra |
| Integration | 13 | auth-flow, dashboard-flow, maintenance-flow |
| Composables | 5 | usePagination |
| Utilities | 5 | Various helpers |
Writing Tests
Erlang (Server)
Use eunit ?_test and ?_assert patterns. Phase-based test files follow test/sol_s<phase>_tests.erl naming. Test pure functions directly; use meck for mocking gen_servers when needed.
-module(sol_my_feature_tests).
-include_lib("eunit/include/eunit.hrl").
basic_case_test() ->
Result = sol_my_feature:do_something(#{key => value}),
?assertEqual({ok, expected}, Result).
Lua (Client)
Use assert for assertions. Return passed/failed counts at end. Mock provider available via core/mock_provider.lua; mock MCP server at tests/mcp_mock_server.lua.
local passed = 0
local failed = 0
local function test(name, fn)
local ok, err = pcall(fn)
if ok then
passed = passed + 1
else
failed = failed + 1
print("FAIL: " .. name .. " - " .. tostring(err))
end
end
test("basic math", function()
assert(1 + 1 == 2)
end)
print(string.format("\n%d passed, %d failed", passed, failed))
os.exit(failed > 0 and 1 or 0)
Python (Mango)
Use pytest with fixtures. Tests follow test/test_<module>.py naming.
import pytest
def test_authenticate_valid_token(auth_system):
result = auth_system.authenticate("valid_token")
assert result is True
TypeScript (Limon)
Use Vitest with happy-dom environment. Co-located test files: Component.test.ts.
import { describe, it, expect } from 'vitest'
import { useAuthStore } from '../stores/auth'
describe('auth store', () => {
it('initializes with no user', () => {
const store = useAuthStore()
expect(store.user).toBeNull()
})
})
Test Coverage
| Component | Approximate Coverage |
|---|---|
| Sol server | ~70% (pure functions well-covered, gen_server state machines partially covered) |
| Luna client | ~70% (core agent fully covered, UI modules partially covered) |
| Mango | ~65% (auth pipeline well-covered, storage handlers partially covered) |
| Limon | ~60% (stores well-covered, components partially covered) |
Coverage was raised from ~35% to ~70% during Phase VI (hardening) and maintained through subsequent phases.
CT sharding, retries and hermeticity
Retries are budgeted (CT_RETRY_BUDGET=1) and leak-free-aware: a shard
whose plan row is leak_free=1 has no harness interference to blame; a
passed retry there is a P1 signal and fails the run
(CT_LEAKFREE_RETRY_BUDGET=0). Shard membership comes from
server/test/ct_plan.txt (ci/ct_shard_plan.py; test-ct.sh --check-plan);
CT_USE_PLAN=0 falls back to glob order. Every rebar3 invocation is bounded
(CT_SHARD_TIMEOUT=600) and classified from CT’s per-case truth when the
tool’s own teardown crash eats the summary. The CT hermeticity ratchet
gates app-stop placement, silent timeouts,
meck hygiene, owner kills, port literals, zombie-arity mocks and fixture
posture; wide assert_eventually windows are dispositioned per-row in
plan/fixtures/ct_wide_window_dispositions.md. Battery: 32 planned shards
(~34 s each, ~8–10 min quiet-host; per-unit wall times in
_build/test/logs/ct-shard-times.tsv).