Mirrored reference
This page mirrors docs/CANONICAL-OUTPUT.md from the GoMeta.jl repository at 0.3.0, verbatim. File paths mentioned in it refer to a repository checkout.
CANONICAL-OUTPUT.md β GoMeta's canonical observable output β
IS: the record of GoMeta's canonical observable output β the single, deterministic, content-hashable artifact a golden test or a downstream consumer obtains from a
goMeta(bytes; config)run: the(blsStructure_bytes, render_bytes)pair fromGoMeta.outputs, plus thealtValues_evalssurface. (This document's name β CANONICAL-OUTPUT β names that canonical observable pair;GoMeta.outputsis the function that returns it.) Trust note: a default-configuredgoMetarun evaluates no condition text (the closed interpreter); only the explicitly opt-in full-eval mode can execute code βdocs/public-api.mdΒ§2/Β§3.2 and the SECURITY section ofREADME.mdstate the posture.DOES: (1) names the observable surface; (2) defines each half; (3) states the hide/discard render rules of the
jl-share-v1profile; (4) defines the evals surface; (5) carries the invariant register the shipped suite asserts; (6) states the CRLF normalization convention; (7) walks one example end-to-end.REASONING: the observable surface is pinned and deterministic, and this document is that pin's public statement. A change to the surface is a conscious, versioned change β never silent drift.
PURPOSE: GoMeta's observable behavior is pinned, deterministic, and hash-stable (engine operations; conditions run in the closed no-eval interpreter, so in a default-configured run a condition body cannot read or have effects β the explicitly opt-in
:full_eval_v1extension mode is the one exception, see the SECURITY section ofREADME.md); the committed example corpus and the golden test layer prove it byte-for-byte.
Β§1 β The observable surface β
GoMeta.outputs(result) -> (blsStructure_bytes, render_bytes) + altValues_evals(result):
the tree half β the parse-stage, verdict-free structural serialization (the parse-defect discriminator);
the render half β the post-apply share-target file bytes under the
jl-share-v1profile, complete over:discardAND:hide;the evals surface β the deterministic, final-verdicts-only per-cell map of evaluated Alterant values (GoMeta's semantic deliverable; the query-facing write payload).
The render half is GoMeta's reference / verification render β verification tooling that doubles as the conformance anchor. The core's primary semantic deliverable is the values-as-data surface (altValues_evals). The two are core outputs in different roles.
Β§2 β The tree half β
The deterministic structural serialization of the final parse tree. It is parse-stage and verdict-free: identical pre- and post-apply β it carries no verdict information. Its role is discriminating parse defects: two engines that parse identically produce identical tree bytes regardless of their alterant behavior.
Β§3 β The render half (jl-share-v1) β the hide/discard rules β
The render half completes the share-target emit over both non-show verdicts (:hide / :discard). The six rules:
:discard(any grain) β zero subtree bytes.:hideat Line grain β literal##prefix + the line's rendered bytes (indentation preserved after the marker). On a hidden line with MULTIPLE rendered segments, each rendered segment carries its own##marker UNLESS the segment already heads with the marker's bytes (the ensure-token rule β a trailing##-comment segment renders as-is; dated true-up 2026-08-12 for0.3.0, superseding the0.2.3per-segment doubling) β pinned by the committed pairs: the code lineusing Plots ## This β¦renders hidden as## using Plots ## This β¦(the line-start marker; the trailing comment segment already carries##), and a line with a trailing inline metaLine renders it##-marked too (β¦ ## #~ hide).:hideat Block grain β every emitted NON-EMPTY subtree line prefixed.:hideat Segment grain β lift-to-Line at v0 β a mid-line##would comment out all following shown segments (a correctness hazard); inline segment-hide is reserved as a profile-versioned extension.A hidden EMPTY line renders as a BARE empty line β the hide marker is applied only to non-empty lines (the emit's hide write sits in the non-empty branch). There is NO
##-only encoding for hidden empties at v0.Ensure-token, render-idempotent (dated true-up 2026-08-12 for
0.3.0β supersedes the0.2.3"prefix doubling" rule: a line already starting##used to become## ## β¦): a hide write is skipped when the source line's POST-INDENT head already begins with the flavor's hide marker, so a line already starting##renders AS-IS andrender β ingest β render == renderholds over the hide battery (a standing idempotence differential in the development fork proves it per armed flavor, with a stacking-forgery negative control). THE FIDELITY BOUND, disclosed: an authored marker-headed line under hide renders AS-IS β byte-indistinguishable from engine-hidden output; the bound only NARROWS distinguishability. Recovery is NOT a v0 behavior: the hide render remains ONE-WAY β no##-strip function exists; do not expect a renderβoriginal round-trip (reversibility never existed under the doubling rule either).
Two senses, never conflated: the input ## human-comment convention (Β§1 of the syntax reference) and the output ## hide-marker are distinct senses of the same two characters.
Inline metaLine segments are rendered, never silently dropped: verbatim on SHOWN lines (the committed Proposal pair keeps β¦ #~ show in its output) and ##-marked on HIDDEN lines (rule
- β both pinned by the committed pairs.
Metadata is ALIVE in the render β a stated DESIGN PROPERTY. Hide is a VISIBILITY operation: hidden metadata remains live metadata. Re-processing a share render therefore re-yields verdicts β a hidden metaLine's rendered form ## #~ β¦ re-parses on re-ingestion (at segment grain: same liveness, shifted scope). One carve-out: a hidden metaLine that re-ingests as a ## comment INSIDE a live meta block reads as block commentary β inert by the same rule that makes ## comments inert between metaLines. DISCARDED metadata, by contrast, is absent from the render and therefore gone on re-ingestion. This is by design, not a defect: choose discard when metadata must not survive the share; choose hide when the share should stay a living GoMeta document.
These rules are oracle-grounded where exercised: rules 1β4 ride the committed corpus (examples/), whose renders the golden test layer pins byte-for-byte (7/7); the rule-5 empty-line fact and the rule-6 ensure-token + one-way facts are engine behavior documented here (the corpus exercises neither a hidden empty line nor a marker-headed input line β the idempotence facts are proven by a standing differential in the development fork). (Dated true-up 2026-08-12 for 0.3.0: the former sentence grounded the rule-6 DOUBLING in the corpus; the doubling died with the ensure-token rule and the corpus outputs carry no doubled shapes.)
Share-profiles parametrize the render half (one source, N profile-keyed outputs); jl-share-v1 is the v0 profile and the only one at this release.
Β§4 β The evals surface β
altValues_evals(result) -> Vector{(cell_handle, attr, value, polarity)} β the evaluated Alterant values, per piece of the file: deterministic, content-hashable, final-verdicts-only. Sorted by (cell_handle, attr, value); deduped at capture; empty when no metaLine exists on ANY surface (the fed profile is a metaLine body). GoMeta.serialize_evals(altValues_evals(result)) is its canonical byte form. It is the query-facing write payload; it does not enter the (tree, render) pair.
Β§5 β The invariant register (asserted by the shipped suite) β
| Invariant | Falsification | Enforced by |
|---|---|---|
same (bytes, profile, config) β byte-identical GoMeta.outputs, across fresh processes (engine operations; see README SECURITY) | any byte diff | the golden layer (tests/golden/golden_tests.jl) β every fresh run must reproduce the pinned golden bytes byte-for-byte |
discard β zero subtree bytes; hide β all NON-EMPTY subtree lines ##-prefixed (Β§3 rules 3+5) | a leak or an absence | the golden render-polarity + not-tree-only canary testsets (tests/golden/golden_tests.jl) |
| tree half identical pre/post-apply (verdict-free) | verdict leakage into tree bytes | the verdict-free-tree testset (tests/golden/golden_tests.jl) |
| the evals surface deterministic + total over applied verdicts | nondeterminism / a dropped verdict | the golden layer's net-new-surface testsets (tests/golden/golden_tests.jl) β serialized evals against pinned shas + a double-run equality |
Design rule (no single named test): no identity is ever derived from an output hash β an output hash names a behavior (of an engine on an input under a config); it never names an object.
Β§6 β CRLF normalization (documented convention, NOT an error) β
Both setup paths chomp \r\n β line ENDINGS normalize to LF; line CONTENT bytes stay faithful (invalid UTF-8 preserved). Goldens are LF. This is a documented normalization convention, not a defect: it does not alter content bytes, only the line terminator. The hide-prefix rules (Β§3) respect LF endings.
Β§7 β Worked example (hide + discard, end-to-end) β
Input examples/InFileFolder/file_for_Example_Extended.jl line 14 ($# This Line should still be "hidden"β¦ #~ hide$) β parse (a text Line with a trailing inline metaLine) β absorb enqueues hide β apply (Visib = hide wins) β emit under jl-share-v1: $## # This Lineβ¦$ with the trailing inline metaLine segment ALSO rendered, ##-marked β the committed line ends β¦ ## #~ hide (rule 2's per-segment marker). Line 15 (#~ discard) β zero bytes in the output β the narration "Input line 15 will be missing from the output file!" is itself the committed expectation. The committed corpus pair pins both outcomes byte-for-byte.