ADR 0087: Incidence edits in the batch files (.dgt +i / -i, the .dgb flag incidence_edits)#
Status: Accepted. The format decisions are the author’s: HD10 (the
.dgtoperations+i h v/-i h v; the.dgbflag bit 3incidence_edits, format version 1 kept; the files of 0.3 written byte for byte as before; bit 4 and the weight code 3 reserved), decided by the author on 2026-10-28 (GOVERNANCE.md, approvals log, the rows of 2026-10-28). The technical parts (the record layout, the checks, the tests, the converter) are accepted under delegation (GOVERNANCE.md, “Delegation of technical ADRs”). It carries out M11a step 2 (PLAN 5.7; the M11a acceptance criteria 9 and 11).Date: 2026-10-29
Deciders: S M Shovan (HD10, 2026-10-28); the AI assistant, on the author’s behalf, for the technical parts (M11a, step carried-host-incidence-slack)
Builds on: ADR 0041 (section 8: the batch’s four groups), ADR 0045 (the
.dgbformat and its stable tier), ADR 0085 (the edits’ semantics).
Context#
0.3 made .dgt, .dgb and .hg stable-tier formats (version 1): a later release reads every
version-1 file as documented, and a change of rules is a new version. 0.3 reserved the .dgt
operations +i / -i (rejected, naming 0.4), and its .dgb readers reject any flag they do
not know. The writers refused batches with incidence edits (not_supported_error). With 0.4
applying the edits (ADR 0085), the batch files must carry them, MOSP_ESCHER’s vertex-kind
sessions must convert to them, and no 0.3 file may change.
Decision#
.dgt(%dgt 1): in a hypergraph file,-i h vremoves vertex v from the hyperedge with id h,+i h vadds it (h >= 0; v >= 0 and, with a vertex count, below it); removals and additions each keep file order;apply()takes them after the deletions and before the insertions whatever the line order. In a graph file they are hypergraph operations (anio_errornamingread_hyperedge_batches()). The writer writes-h,-i,+i,+hper batch. The version stays 1: the operations were reserved by version 1 for 0.4, and a 0.3 reader rejects them with its message..dgb(format version 1):batch_file_flags::incidence_edits = 8(hypergraph files): the record’s count block has two more counts (removals r, additions a: 56 bytes instead of 40), and after every array of 0.3 come the removal ids [r] (int64), removal vertices [r] (vertex type), addition ids [a], addition vertices [a], each checked by the reader (ids >= 0, vertices in range).known_graph(no flags) andknown_hypergraphare new constants andknownis their union (an api-change line);header_problemchecks the flags per kind. Bit 4 (vertex_records, graph files) and weight code 3 (float32, graph files) are reserved in the page and rejected. The page states the rule both milestones rely on once, in general: an additive flag, weight code or operation that version 1 reserved and that every earlier reader refuses loudly (io_error) is not a silent change of version 1; bit 4 and code 3 are reserved for label_propagation in 0.4 (M10b declares them; the M11a review corrected “a later release” in the page and inbatch_file_flags::known_graph’s comment, documentation only).Flags fixed at open. The whole-file writer sets
incidence_editsonly when a batch has an edit, so a file of batches without edits is the file 0.3 wrote, byte for byte (BinaryBatches.TheFilesOf03AreWrittenByteForByteAsBeforerewrites the 0.3 seeds, whichmake_dgb_seeds.pywrites from the specification, and the converted ESCHER-GPU dump);batch_writerrefuses a batch with edits for a file opened without the flag (invalid_argument_error, replacing 0.3’snot_supported_error: a documented-behaviour change of the stablebatch_iosurface, an api-change entry).The old reader refuses. dynG 0.3.0 (tag v0.3.0, built from
git archivein a scratch directory and removed after) reads 0.4’s files without edits and rejects those with edits:.dgb“invalid header: unknown flags 8 (written by a newer dynG?)” (itsbatch_binary.cpp:155,flags & ~known),.dgt“the incidence operation ‘-i’ is reserved for the incidence edits of hypergraph batches (0.4)” (parity/results/M11a-old-reader-refusal.json).Fuzzing and round trips. The
.dgbfuzzer’s hypergraph copy carries the edits and its round trip compares them; a seedhyper_incidence_editswritten from the specification; the.dgtfuzzer checks the edits’ ranges and round trip, with two seeds. Text and binary round trips,.dgt<->.dgb, the refusals (negative ids or vertices, a vertex out of range, an unknown flag) are unit tests.The Python layer takes incidence edits with M11b: until then its readers raise
NotSupportedErrorfor a.dgbfile with the flag or a.dgtbatch with an edit instead of dropping them (a deviation, the retrospective).The converter
dyng-compat-hsosp to-dgb(tools/compat/hsosp, built afterdyng-compat-escher) writes every session MOSP_ESCHER loaded as.hg(its virtual rows at their positions, weight 1),.dgb(expected ids = finalIds - 1,insert_first, the edits as (B id - 1, v); the operations on a virtual row filtered and counted) and.txt(the vertex count, the virtual rows’ ids and vertices, the Caps and CSR knobs, per batch B’s skippedOps and the filtered counts);replaychecks the ids and skip counts on slack_csr storage. Converting twice gives the same bytes; the digests of the T and P50 conversions are inparity/goldens.toml([sets.hyper_sssp_mosp_escher.converted], written byhsosp_goldens.py convert --write-toml, kept by a new export).
Consequences#
0.3’s files, readers and writers behave as before for every batch without edits; a 0.3 reader meets a 0.4 file with edits with an error, never a silent drop.
The reserved bit and weight code leave room for the vertex records and float weights of graph files without a new format version.