---
title: "mova-whale-source — Mova code model"
description: "Mova code model of tools/whale/src/source.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/tools/whale/src/source.rs.groupant/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Research](https://md.research.elamur.ai/free/en/) · **Groupants**

This page as HTML: <https://groupants.elamur.ai/free/en/mova/tools/whale/src/source.rs.groupant/>

# mova-whale-source

The groupant beside tools/whale/src/source.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

- **kind:** groupant
- **status:** partial source bound model
- **source:** [`tools/whale/src/source.rs`](https://github.com/ElamurAI/mova-free/blob/main/tools/whale/src/source.rs)
- **source SHA-256:** `eade8e2a792458db…`
- **repository folder:** [`tools/whale/src/source.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/tools/whale/src/source.rs.groupant)
- **repository commit:** `48f2e6f74146`

> **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](#forward-approximant) |
| **ast** | partial | `syntax.json` |
| **composition** | partial | [Composition](#composition) |
| **cost** | partial | [Cost](#cost) |
| **descriptant** | present | [Descriptant](#descriptant) |
| **invariant** | partial | [Invariant](#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](#behavior-complement) |
| `reverse_reconstruction` | reverse_reconstruction | partial source derived model | [reverse_reconstruction](#reverse-reconstruction) |

## Model text


### Descriptant

Source adapters: bounded teacher context and full comparison text for UTF-8 text and EPUB. Source: `tools/whale/src/source.rs`. Public, domain-agnostic: concrete prompts, schemas, gate parameters and deployments come from pinned configuration.

### Forward approximant

`text`: read at most max+4 bytes, keep the longest valid UTF-8 prefix within max bytes, mark partial when file size exceeds it. `epub`: container.xml rootfile -> OPF manifest/spine; visit spine XHTML members in order, drop script/style, keep entity references literal when unknown, stop at max bytes. `full_primary`: rehash, extract the whole UTF-8 file or all HTML/XHTML members sorted by name, rehash again.

### Invariant

Context length <= max bytes; no member path escapes the archive; no external resource or entity is loaded; full_primary returns text only when the file hash equals the pin before and after extraction.

### Cost

O(min(file, max)) for text context; EPUB O(expanded members) bounded at 64 MiB and 4096 members.

### Composition

Used by whale::prepare (context) and whale::publish (originality primary); the adapter per item format is chosen by the specification kind.

### behavior_complement

Excluded: files above 64 MiB, archives above 4096 members, absolute/percent/backslash/escaping hrefs, non-text spine items, invalid UTF-8 inside the kept prefix. Counterexample: a script element containing instructions never reaches the context (epub test). Evidence status: source-derived model with finite checks, not a proof.

### reverse_reconstruction

From a context one recovers a prefix of the visible text; all sources with the same visible prefix (any tail, any markup, any script content) are compatible antecedents. Partial flags separate complete from truncated observations. No unique inverse is claimed.

### tests.md


3 tests: EPUB spine order/script removal/path refusal/full primary hash, XML references, text prefix on character boundary.

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.
