---
title: "qagen-main-parsing — Mova code model"
description: "Mova code model of qagen/src/main.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/qagen/src/main.rs.groupant/parsing.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/qagen/src/main.rs.groupant/parsing.groupant/>

# qagen-main-parsing

The groupant beside qagen/src/main.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_fragment
- **status:** partial source bound model
- **source:** [`qagen/src/main.rs`](https://github.com/ElamurAI/mova-free/blob/main/qagen/src/main.rs)
- **source SHA-256:** `7d4410bf5d85e04c…`
- **covers:** opts consumes interleaved positionals and --key value pairs; num parses optional typed values; batches_opt parses comma-separated usize; validate_options applies command/subcommand whitelist. (bytes 2652–4820)
- **part of:** [qagen-main](https://md.groupants.elamur.ai/free/en/mova/qagen/src/main.rs.groupant/)
- **repository folder:** [`qagen/src/main.rs.groupant/parsing.groupant`](https://github.com/ElamurAI/mova-free/tree/main/qagen/src/main.rs.groupant/parsing.groupant)
- **repository commit:** `855da7bd4a7b`

> **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 source model | [forward](#forward) |
| **ast** | partial | `../syntax.json` |
| **composition** | partial source model | [composition](#composition) |
| **cost** | partial source model | [cost](#cost) |
| **descriptant** | partial source model | [epoch-memory](#epoch-memory) |
| **invariant** | partial source model | [invariant](#invariant) |
| **tests** | partial source model | [checks](#checks) |

## 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 |
|---|---|---|---|
| `qagen-main-parsing-behavior-complement` | behavior_complement | partial source model | [behavior-complement](#behavior-complement) |
| `qagen-main-parsing-reverse-reconstruction` | reverse_reconstruction | partial source model | [reverse-reconstruction](#reverse-reconstruction) |
| `qagen-main-parsing-missing-value` | missing_value | partial source model | [missing-value](#missing-value) |
| `qagen-main-parsing-typed-domain` | typed_domain | partial source model | [typed-domain](#typed-domain) |
| `qagen-main-parsing-whitelist` | whitelist | partial source model | [whitelist](#whitelist) |
| `qagen-main-parsing-precedence` | precedence | partial source model | [precedence](#precedence) |

## Model text


### forward
opts consumes interleaved positionals and --key value pairs; num parses optional typed values; batches_opt parses comma-separated usize; validate_options applies command/subcommand whitelist.

### invariant
Successful opts never accepts missing value or consumes another option as value. Unknown keys error before main dispatch.

### behavior-complement
No key=value grammar, no abbreviation matching, no duplicate rejection; negative numeric tokens are values and typed parser decides validity.

### reverse-reconstruction
A parsed map has multiple preimages differing in option order and overwritten duplicates. Defaults erase distinction between absence and explicit default value at num output.

### cost
O(argument bytes + K log K) parsing with owned clones; batches list allocates one usize per comma component.

### composition
Whitelist includes batches for both run branches and replaces only fix gate; command arity remains validated by existing match.

### missing-value
Both last option without next token and option followed by --token error.

### typed-domain
num delegates FromStr; unsigned negatives/overflow reject, float NaN remains permitted by existing downstream contract.

### whitelist
Selection, run, sample, fix-select and fix-gate get separate allowed key sets; prompt/gate accept no options.

### precedence
Lexical parse errors precede whitelist errors; whitelist precedes command arity and typed conversion.

### checks
Synthetic embedded Rust tests, 1024 independent coverage cases, preflight sentinel artifacts, callback trace and compiled branch/arithmetic controls; debug and release twice, model-loading test explicitly skipped. See parent evidence.md for observed outcomes, not proof.

### epoch-memory
Prospective model was saved before repair on 2026-10-30. Old source failed four library witnesses and one CLI witness. The tie control initially survived because [2,1,2] selects 2 for both first and last ties; the corrected [2,1] witness distinguishes them. Preserve this observation: duplicate-endpoint fixtures can hide tie regressions.

### references
Original project implementation and rule v2: docs/context.md, qagen/src/gate.rs and qagen/src/run.rs. Model conventions: docs/groupants.md, docs/mathematical-modeling.md and docs/mathematical-modeling.md. No external solution code copied.

### limitations
Finite local tests and partial syntax projections, no semantic AST or universal proof. Allocation failure and callback panic are outside successful-return model; filesystem races and write failures can interrupt publication. No live model/teacher/database/corpus used. No useful certified numeric surrogate is attached to these categorical/effectful interfaces; no invented error budget, substitution or speed claim.
