EventLog v0¶
P0 test traces use one batch per JSONL line:
{"version":0,"batch_hex":"000000000000000000000000"}
This example is an empty MAIN/Agent batch (principal 0, no client transaction ID). The reader accepts the canonical key order shown above, surrounding line whitespace, blank lines, and either hex case. Unknown versions, extra fields, malformed hex, truncation, invalid tags, duplicate/unordered map or set entries and trailing binary bytes are rejected. It is a canonical trace reader, not a general JSON parser.
The encoder emits lowercase hex. Binary layout:
- Integers: unsigned little endian; ID width follows SPEC §6.1.
- bool: one byte 0 or 1. Option: bool presence then value when present.
- byte arrays: raw fixed-width bytes. String: UTF-8 bytes with u32 byte length.
- Vec/set/map: u32 element count followed by elements; set/map keys strictly sorted.
- Struct fields: declaration order in model. Tuples: left to right.
- Enum: u8 tag followed by fields in declaration order. Existing tags are frozen;
future variants append.
Optags 0–13 correspond to CreateLogical, AddRevision, SetHead, AssertBase, RetractBase, AddRule, SetRuleEnabled, Rebind, RecordValidation, SetPolicy, ObserverWatermark, SetMetadata, OpenArtifact, ResolveArtifact. v1 (P6) adds tags 14–17: CreateBranch, ArchiveBranch, ExpectHeads, Merge, and non-main batches. v2 (P7, ADR 0015 §9) adds tag 18RecordValidation4(RecordValidation's fields, thenmeta: Option<[u8;32]>,if_absent: bool) and tag 19ResolveArtifact4(id, thennote: Option<[u8;32]>). They are used only when a new field is set: tag 18 withmeta = Noneandif_absent = falseis rejected, as is tag 19 withnote = None. v3 (P9, ADR 0017 §10) adds tag 20SetAccess(doc: AccessDoc:version: u16,owner,principals: map<name, u32>,groups: map<name, set<name>>,lanes: map<name, LaneEntry>,code_lanes,personal_egress: bool,default_lane;LaneEntryismembers,writers,curators(sets of strings),egress: bool,grants: map<string, set<string>>,deny: set<(string, string)>). v4 (P10, SPEC §6.1 contract 16, SD21.7) adds tag 22CreateLogicalwith a replica origin (tag 0's fields, thenteam: [u8;16]), tag 23MirrorAttach(key: string,head: [u8;32],base: bool), tag 24ObserverWatermarkwithgap = true(tag 10's fields; tag 10 always meansgap = false), ChannelReplica = 3, and[team_lanes]inSetAccess: bit 1 of thepersonal_egressbyte (so the byte is 0–3) marks ateam_lanes: LaneEntryafterdefault_lane. A Local create keeps tag 0, agap = falsewatermark tag 10 and an access document without[team_lanes]its v3 bytes, so their bytes are unchanged. In aLogicalrecord a replica origin sets the RecordKind byte's high bit (kind | 0x80) and appends the team after it. Each line carries the lowest version that can represent it. - Edge tags: Ref=0, Pin=1, Sem=2, Cur=3. Channel: Agent=0, Observer=1, Admin=2, Replica=3 (v4).
- RecordKind: Fact, Assumption, Decision, Plan, Convention, Procedure, Artifact, Evidence, CodeAnchor, Summary (0–9).
- References: Existing=0, New=1; LogicalRef additionally has Key=1, New=2.
- Verdict: Verified=0, Rejected=1, Pending=2. ArtifactType: Conflict=0, PendingReview=1, ImportBroken=2, AnchorBroken=3, DriftReport=4.
Decode limits: 16 MiB per binary value, 1,000,000 elements per collection, 32 MiB per JSONL document. Invalid batches can round-trip: semantic validation happens only in InputModel/core. Limits protect this test import boundary; in-memory transaction APIs have the checked ID limits in SPEC, not a u16 batch-size limit.
Wire also serializes input and derived snapshots for deterministic comparison and
digesting. Those encodings are not a durable storage/recovery API. P2 will define
its durable op_log envelope separately, including compatibility and crash behavior.