Elamur GroupantsโŒ•
โ˜ฐ

annot-repair

The groupant beside annot/src/repair.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

componentlabelwhere
approximantpartialapproximant
astpartialsyntax.json
compositionpartialcomposition
descriptantpresentdescriptant
invariantpartialinvariant
testsexecuted bounded checkstests

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.

idtypelabelwhere
behavior_complementbehavior_complementpartial source derived modelbehavior_complement
reverse_reconstructionreverse_reconstructionpartial source derived modelreverse_reconstruction
atomic_shape_gateatomic_shape_gatepartial source derived modelatomic_shape_gate
rule_precedencerule_precedencepartial source derived modelrule_precedence
count_unitscount_unitspartial source derived modelcount_units
newline_projectionnewline_projectionpartial source derived modelnewline_projection

Parts

Model text

descriptant

annot-repair

Deterministic Early Modern English lexical, feature and postverbal-not repairs on selected ten-column word rows, with per-rule changed-word counts. text is a line-oriented normalization wrapper, not a byte-preserving serializer.

Epoch 2026-10-31: source read before tests/models. Prospective notes and numeric receipts retained externally under the annotation wave27 run. Four new inline tests supplement existing bounded tests. Preserve distinctions: compatibility cost is not subscription cost; mock process tests do not establish live teacher behavior; registry presence is partial modeling.

approximant

Forward approximant

sentence selects all-digit first fields, copies their columns, returns unchanged if any selected row lacks exactly10 columns. It parses tag/upos/rel, applies matching emode table/ending before archaic verb lemma before eligible lowercase lemma, counts only changed rows, then postverbal_not updates heads/relations and writes selected rows back. text flushes sentence blocks and preserves comment content while normalizing newlines.

Cost: B row bytes and N selected words: O(B) projection/serialization plus delegated morphology/table lookup and postverbal_not cost. Temporary columns/forms O(B+N). Counters usize and string allocation have no fallible resource boundary or overflow certificate.

Executable approximation gap: categorical parsing, effects and validation lack a useful measured percent metric here. No executable surrogate or 1/2/5/10% profile is attached; an exact test is not an approximant.

invariant

Invariants and limits

Malformed selected row causes no mutation/count increment for the entire sentence. Nonselected range/empty-node lines remain untouched by sentence. Lexical branches do not change FORM, UPOS or XPOS. Counts are additive; each lexical row contributes to at most one branch plus possible not repair.

composition

Source composition

Nested scopes use UTF-8 byte offsets [start,end) against the exact source SHA-256. They share the parent lexical projection; no nested fragment becomes a second registry source. Source outside these scopes, including helper types/tests, remains parent-modeled.

sentence selects all-digit first fields, copies their columns, returns unchanged if any selected row lacks exactly10 columns. It parses tag/upos/rel, applies matching emode table/ending before archaic verb lemma before eligible lowercase lemma, counts only changed rows, then postverbal_not updates heads/relations and writes selected rows back. text flushes sentence blocks and preserves comment content while normalizing newlines.

Cross-file join: ann.rs supplies Ann/Item, parse/check/write; main supplies Outcome and finish; batch and llm prompts feed codex_batch; hints and repair influence draft content before gates. These joins do not establish remote correctness or crash durability.

models

behavior_complement

A non-ten-column selected row excludes all lexical and not repairs for that sentence. PROPN/NOUN/ADJ/NUM/X/SYM exclude lowercase-only branch; lemma I is preserved. Range and decimal ids are excluded from selection; empty id accidentally satisfies all-digit predicate.

reverse_reconstruction

Repaired rows admit original rows differing in corrected lemma/features/head/relation, subject to ordered rule predicates. Counts restrict the number of changed rule applications but do not identify old values. text output admits LF or CRLF input and final-newline variants; original bytes cannot be uniquely reconstructed.

atomic_shape_gate

All selected column widths are checked before any per-word mutation. Invalid tag/upos/rel skips lexical branch, while postverbal_not sees fallback enum/head values.

rule_precedence

emode::fix with same upos wins, tagged distinguishes table vs ending; then eligible archaic fallback; only afterward capitalized lemma lowering. This is not an unordered set of substitutions.

count_units

Counters count changed words per lexical rule and n returned by postverbal_not, not bytes or sentences; repeated application on tested normalized fixtures does not increase counts.

newline_projection

text uses str::lines, outputs newline after each retained nonblank line and each blank separator; whitespace-only blanks normalize to empty and final newline may be added. Comments retain content but not original line terminators.

tests

Bounded source evidence

Selected actual-code tests (twice debug, twice release):

Run command: cargo test -p annot --bin annot --test codex_batches [--release] -- --test-threads=1 --skip ann:: --skip bfs_transfer_checks. The fake executable fixture uses temporary files, no live teacher/API. Paired named outcomes must match. Six compiled production mutations target batch last-wins, llm closed-set, repair shape gate, hints severity, main seed alias and queue resume. Each compilation exits0, test exits101, exact source restored and focused positive rerun exits0. The fixture itself has no separate mutation. Existing repair test may early-return without dictionary; independent added repair test always runs.

Unexecuted limits:

Validation limits: strict scoped Clippy exited101 on six pre-existing lints (three collapsible_if, one needless_range_loop, one type_complexity, one redundant_locals). Re-running with those four known lint categories allowed exited0. changed with an external augmented registry exited0 and found no missing changed-source models. Local groupants inspection reports only expected ancestor child/source-binding updates owned by integration; no owned leaf/fragment diagnostics.

This page in Markdown โ†’ https://md.groupants.elamur.ai/free/en/mova/annot/src/repair.rs.groupant/