treeagree-main-json-escape
The groupant beside tools/treeagree/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
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 |
control_partition | control_partition | partial source derived model | control_partition |
utf8_identity | utf8_identity | partial source derived model | utf8_identity |
size_bound | size_bound | partial source derived model | size_bound |
transport_gap | transport_gap | partial source derived model | transport_gap |
Model text
descriptant
Descriptant
output starts/ends quote; quotes, backslashes, newline and tab escape, other controls below U+0020 use four hex digits, remaining Unicode scalars copy.
Epoch 2026-10-31
Prospective source reading identified conditional input alignment, information loss and failure order before tests. Existing production code is retained; added tests use actual helpers. Finite results update this source-bound model, not all parser/corpus semantics.
No executable percentage surrogate has a justified observation metric for these categorical/effectful APIs. Future profiles require metric, domain and real-reference evidence at caps 1/2/5/10%; no higher cap. Syntax is partial lexical Rust projection without macro expansion or semantic resolution.
approximant
Forward approximant
output starts/ends quote; quotes, backslashes, newline and tab escape, other controls below U+0020 use four hex digits, remaining Unicode scalars copy.
Composition
This fragment is the exact byte-scoped helper identified in the manifest; its relation is restricted to the operations above.
The containing source wires this scoped relation to its callers. Treeagree proposal→gate→commit and treebanks parse→match→collect→render are actual joins; parsecmp is an independent diagnostic path. The external group model distinguishes these tags.
catalog
Typed models for treeagree-main-json-escape
Subject: source SHA-256 fadc15525d579f8681612a25d06356fed2156f8f7054b54e61ffc07c5a590032; manifest supplies exact source/byte scope. Domain: admitted states in forward model, nonoverflow arithmetic and successful allocations. Observation: one terminating invocation, except explicitly described file trace. Source-derived partial relations; named finite tests constrain selected cases only. Each entry holds arguments and environment fixed except its stated intervention.
behavior_complement
On completion no raw control scalar below U+0020 occurs between quotes; no file effects.
Operator: inner exclusion on admitted domain. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
reverse_reconstruction
JSON decoding of this valid escaped string uniquely recovers source scalars; json_field is not that decoder for unicode controls.
Operator: compatible antecedent relation, retaining ambiguity. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
control_partition
Newline/tab take short escapes before general control case, including carriage return in hex case.
Operator: specialized observation relation under the stated fixed inputs. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
utf8_identity
Noncontrol nonquote Unicode copies exactly, without normalization or ASCII transliteration.
Operator: specialized observation relation under the stated fixed inputs. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
size_bound
Empty input produces two bytes; output byte length is 2 plus per-scalar emission lengths.
Operator: specialized observation relation under the stated fixed inputs. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
transport_gap
Emitted unicode escape for NUL is not reconstructed by json_field, so unrestricted serializer/parser roundtrip is unsupported.
Operator: specialized observation relation under the stated fixed inputs. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
tests
Scoped evidence
Parent native slice and exact names are in ../tests.md.
json_str fragment is source-derived only; no direct JSON roundtrip assertion. Its unicode-control mismatch with json_field is explicitly unsupported.
This fragment has no independent full-coverage claim. Its byte range and source hash bind the source-derived relation; parent test success is evidence only where that helper is actually reached.
invariant-and-cost
Invariant and cost
O(input UTF-8 bytes plus escaped output), worst six ASCII bytes per control; allocation only.
On completion no raw control scalar below U+0020 occurs between quotes; no file effects.
The complement and specialized catalog constrain preserved coordinates and effect boundaries. Empty/malformed domains are only guaranteed where explicitly admitted. No whole-program cost bound follows from a helper bound.
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/tools/treeagree/src/main.rs.groupant/json-escape.groupant/