Skip to main content

Module journal

Module journal 

Expand description

The journal generator: docs/reference/journal-format.md from the record types and the committed byte golden.

The on-disk format has two registries, and this page is both of them (§7):

  • the types. crates/atune_core/src/storage/journal/record.rs declares Header, OpRecord and the Op enum, one variant per mutating Storage method. Their serde attributes are the wire names — #[serde(tag = "kind", rename_all = "kebab-case")] is why a report line says "kind":"report" — so the generator reads the attributes rather than a table of names somebody kept in step by hand. A syn parse for the same reason the errors generator needs one: a serde attribute is compile-time, and nothing at run time can hand back the rule rather than one instance of its result.
  • the bytes. crates/atune_core/tests/goldens/journal_full_study_v{N}.jsonl is a whole study’s journal, byte-pinned by a test that replays it back to the study that produced it. It is the worked example, quoted verbatim: a hand-written sample would be a fourth copy of the format, and the one thing a reader wants from a format reference is a file they can trust byte for byte.

Two fail-closed checks tie the two together. The golden’s own header must carry the FORMAT_VERSION the code writes — a page cannot show a v1 file as an example of a v2 format — and every kind in the golden must be a variant the enum declares, so the example can never contain a line the table above it does not explain.

Structs§

JournalFormat
Generates the journal-format reference page.
Operation 🔒
One Op variant: its wire tag, its payload and its documentation.

Constants§

BLESS 🔒
The command that regenerates the golden, for the page to cite.
GENERATOR 🔒
This generator’s name, for fail-closed error messages.
GOLDENS 🔒
The directory the byte goldens live in.
SOURCE 🔒
The file that owns the record format.

Functions§

field_of 🔒
The value of a top-level JSON field, as written.
format_version 🔒
The FORMAT_VERSION the code writes.
kebab_case 🔒
Serde’s rename_all = "kebab-case" applied to a variant name.
named_struct 🔒
The struct name, which must have named fields.
operation_kind 🔒
The kind of an operation line.
operations 🔒
The Op variants, in declaration order, with their wire tags.
render_envelope 🔒
Writes the two line shapes and their common envelope.
render_fields 🔒
Writes one struct’s fields as a definition list of code spans.
render_floats 🔒
Republishes the module’s own explanation of the non-finite float encoding.
render_golden 🔒
Quotes the committed byte golden, and checks it against the types above.
render_operations 🔒
Writes the operation catalogue.
require_serde 🔒
Requires the enum to be internally tagged on tag, and kebab-cased.
serde_arguments 🔒
The arguments of every #[serde(…)] attribute on an item, as written.