mova-whale-run
The groupant beside tools/whale/src/whale.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| approximant | partial | Forward approximant |
| ast | partial | syntax.json |
| composition | partial | Composition |
| cost | partial | Cost |
| descriptant | present | Descriptant |
| invariant | partial | Invariant |
| tests | finite evidence | tests.md |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| id | type | label | where |
|---|---|---|---|
behavior_complement | behavior_complement | partial source derived model | behavior_complement |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
Model text
Descriptant
One Whale run: pinned task queue, at most one teacher call per task, contract gates and immutable versioned bundles. Source: tools/whale/src/whale.rs. Public, domain-agnostic: concrete prompts, schemas, gate parameters and deployments come from pinned configuration.
Forward approximant
prepare: load Spec and teacher identity, validate items (kind, format, binding rule, metadata), read pinned export rows, compute admission, extract context, render prompt, write per-task prompt/context/metadata and a manifest with disjoint worker indices (index mod workers). run_with: honor STOP/PAUSE and storage floor, take the worker lease, pick the first own task without receipt, refuse unresolved reservations, withhold local-only items when the kind says so, verify source/prompt/context hashes, create the reservation, call the teacher once, store the reply, then admit (identity check, verbatim guard, projection, validate, publish) into a completed or quarantined receipt. publish: originality on the raw reply, status rewrite, artifacts, staged directory renamed into store/<prefix>/<kind>/<sha(id)>/<version>. project_quarantined_lengths: re-gate retained length quarantines without a teacher.
Invariant
Per task: at most one reservation and one teacher call; outcomes in {completed, quarantined, uncertain, local_only_no_remote_teacher}; uncertain or unreceipted reservations stop the worker; a published version directory is never overwritten; identity changes require a new run root; original receipts/replies are never modified by projection.
Cost
Preparation O(sum source bytes + prompts); per task one teacher call plus O(reply) validation and O(corpus) originality; status O(tasks).
Composition
Uses spec, source, contract, originality and util; launched by pool (workers) and swarm survey lanes (one-item runs).
behavior_complement
Excluded: calls without teacher/spec configuration, altered template/spec, changed sources, duplicate leases, unknown receipt outcomes, replies from another model/provider, any contract/originality failure (quarantine, no reprompt). Counterexample: a failed transport records uncertain and a second run makes no call. Evidence status: source-derived model with finite checks, not a proof.
reverse_reconstruction
A bundle manifest pins task, reply, spec and artifact hashes, so its reply and prompt are recoverable from the retained job directory; a receipt alone admits many replies; a quarantine reason partitions the failing gate but not the reply content. No unique inverse is claimed.
tests.md
16 tests with a fake teacher: missing configuration, altered template, word profile measures, disjoint immutable outputs, terminal quarantine, transport uncertainty, local-only withholding, pinned export, EPUB adapter, pause/stop, projection receipts and isolation, binding scope, queue bounds/unknown receipts, originality tail, lease and source changes.
Command: cargo test --manifest-path tools/whale/Cargo.toml --offline --locked (74 tests, fake teachers/executables; two identical runs on 2026-11-03). These are finite fixtures; no live run, model call or deployment was exercised.
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/tools/whale/src/whale.rs.groupant/