mathlib-fetch
The groupant beside tools/mathlib/src/fetch.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 | model.md |
| ast | partial | syntax.json |
| composition | partial | Composition |
| cost | partial | invariant-and-cost |
| descriptant | present | descriptant |
| invariant | partial | invariant-and-cost |
| tests | bounded checks | tests |
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 |
resource_admission | resource_admission | partial source derived model | resource_admission |
license_admission | license_admission | partial source derived model | license_admission |
effect_order | effect_order | partial source derived model | effect_order |
existing_wildcard_selection | existing_wildcard_selection | partial source derived model | existing_wildcard_selection |
Parts
Model text
descriptant
mathlib-fetch
read_list validates columns and rows; run checks free space, then for each row creates slug directory and hashes existing file before STOP/cap. Fresh path checks blocked host, space, robots, bounded download, extension/signature, optional text compaction, then records Done. write_manifest groups Done by sorted slug and writes JSONL then TSV.
Epoch 2026-10-31
Prospective model retained before changes. Existing production bytes are preserved; additions are bounded inline tests. Nine source groupants expose ingestion and routing boundaries; typed children bind exact source bytes and reuse their parent syntax projection. Native tests run twice per profile; behavior mutants run as compiled source changes and exact bytes are restored before positive checks.
Important retained observation: network-looking helpers are not all pure (DNS inside github_host and books build); selection deliberately excludes those effects. Mixed-format manifest order is not deterministic, and error paths do not imply rollback.
No network/DNS/download, real catalog/corpus/model/teacher or database execution. Effect paths are source-derived; finite helper tests are not universal verification. No executable percentage surrogate or speed claim; future caps require metric/domain/reference and remain 1/2/5/10%.
approximant
Forward relation
read_list validates columns and rows; run checks free space, then for each row creates slug directory and hashes existing file before STOP/cap. Fresh path checks blocked host, space, robots, bounded download, extension/signature, optional text compaction, then records Done. write_manifest groups Done by sorted slug and writes JSONL then TSV.
Model observations include returns, retained state and ordered partial effects; on external failures the successful-prefix relation replaces a total-function claim.
Composition
read_list validates columns and rows; run checks free space, then for each row creates slug directory and hashes existing file before STOP/cap. Fresh path checks blocked host, space, robots, bounded download, extension/signature, optional text compaction, then records Done. write_manifest groups Done by sorted slug and writes JSONL then TSV.
Scoped children isolate the declared contiguous source intervals. Their operations compose only where the source calls them; costs of overlapping parent/child descriptions are not added twice. Remaining effect paths retain explicit gaps.
catalog
behavior_complement
Subject: mathlib-fetch, source SHA-256 9a892fd61299338f640f9d8d08471ef7f09cac19235ad80b90d894a12489996d; finite transition observation.
Invalid required columns or disallowed license prevent run from reaching free-space or network setup. Unknown response extension and bad signature delete the candidate and do not append Done. These exclusions do not apply to already existing files.
Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.
Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.
reverse_reconstruction
Subject: mathlib-fetch, source SHA-256 9a892fd61299338f640f9d8d08471ef7f09cac19235ad80b90d894a12489996d; finite transition observation.
Manifest file record admits any Item/Done pair matching retained fields and valid item_idx; original tar contents dropped by compaction are unrecoverable. Hash equality is an observation, not a unique byte inverse. JSON groups preserve per-group order but not original cross-group interleaving.
Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.
Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.
resource_admission
Subject: mathlib-fetch, source SHA-256 9a892fd61299338f640f9d8d08471ef7f09cac19235ad80b90d894a12489996d; finite transition observation.
Fresh bound=min(file_max,max(max_bytes-total,1)) after total<max_bytes. Existing-file accounting can exceed cap before fresh checks. free-space rechecks occur at fresh multiples of ten; first check happens before row directory creation.
Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.
Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.
license_admission
Subject: mathlib-fetch, source SHA-256 9a892fd61299338f640f9d8d08471ef7f09cac19235ad80b90d894a12489996d; finite transition observation.
allowed is an exact finite code set including open catalog and explicitly configured software licenses; empty, NC, ND and arxiv-1.0 reject. read_list trims cells, permits missing optional cells, requires slug/url/save_as and no slash in save_as; slug containment is not checked.
Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.
Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.
effect_order
Subject: mathlib-fetch, source SHA-256 9a892fd61299338f640f9d8d08471ef7f09cac19235ad80b90d894a12489996d; finite transition observation.
Download staged .dl is renamed before signature validation, then optionally repacked; manifest is rewritten after loop or periodic checkpoints. Failures can leave partial artifacts and previously downloaded files; this is not a transaction.
Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.
Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.
existing_wildcard_selection
For save_as stem.*, existing enumerates directory entries and returns the first prefix stem. candidate excluding .part/.dl; it neither sorts nor requires a regular file. Exact-name existence also accepts directories. Therefore unique file identity requires at most one eligible regular candidate in the admitted filesystem.
Subject and source identity: manifest.json. Domain: scoped forward/invariant; relation is source-derived and partial. Evidence: tests.md distinguishes actual checks from unexecuted effect paths; finite fixtures do not prove all inputs.
tests
Bounded evidence
Selected actual source checks:
- mathlib::fetch::tests::compacts_sources
- mathlib::fetch::tests::ext_and_licenses
- mathlib::fetch::wave33::list_signature_hash_and_existing
These checks are file-level evidence; fragment branches not reached by these names remain source-derived.
External wave33 mathlib receipt retains native-commands.json, numeric statuses, raw debug/release logs, sorted exact outcomes, mutation logs and original/restored hashes. Seventeen named checks pass twice per profile; six production behavior mutants reject in both profiles, with restored positives. Source syntax is regenerated twice after formatting and compared byte-for-byte. Structural validation tests bindings, not Rust semantics.
No network/DNS/download, real catalog/corpus/model/teacher or database execution. Effect paths are source-derived; finite helper tests are not universal verification. No executable percentage surrogate or speed claim; future caps require metric/domain/reference and remain 1/2/5/10%.
invariant-and-cost
Invariant and cost
Invariant
All rows are license-validated before download setup. Existing wildcard choice is filesystem-order dependent and bypasses signature/STOP/cap checks. Done item_idx must be in range. Aggregate format uses HashSet iteration; do not claim byte-deterministic mixed-format JSON.
Cost
List O(B); hashing O(file bytes) with 1 MiB buffer. Archive filtering O(uncompressed bytes) plus gzip cost; max kept entry 5 MiB but total input has no cap. Manifest O(D log S) plus serialized bytes; effects and delays are external costs.
Domain and gaps
No network/DNS/download, real catalog/corpus/model/teacher or database execution. Effect paths are source-derived; finite helper tests are not universal verification. No executable percentage surrogate or speed claim; future caps require metric/domain/reference and remain 1/2/5/10%.
This page in Markdown â https://md.groupants.elamur.ai/free/en/mova/tools/mathlib/src/fetch.rs.groupant/