Format versions and compatibility
Every bundle loot sends, and every file it stores apart from a few plain-text or fixed-width ones that can't be misread, starts with a two-byte format version. A newer loot reads anything an older one wrote. An older loot refuses anything newer rather than guess at it.
The rule
The two bytes are [major][minor]. A build reads any major from 1 up to its own and refuses a higher one. It also refuses major 0, so a zeroed or truncated file can't pass as data. Every change to a layout bumps the major, on disk or on the wire. The minor is reserved and any minor of a known major is accepted.
| Reader | Data written by | Result |
|---|---|---|
| Newer loot | Older loot | Read |
| Same major | Same major | Read |
| Older loot | Newer loot | Refused, nothing misread |
A v14 build opening a store written at v15 stops at once:
loot: unsupported format version v15 โ upgrade loot (this build reads up to v14)
What reading older data means
A newer build keeps the decoder for every older major. A field added later reads as absent on older data, and loot never invents it: a change recorded before change ids existed simply has none. Some old sections are read only to step past them. An old bundle that declared each object's address has that address thrown away and re-derived from the bytes.
The direction that breaks
Once a newer loot writes into a repo, the files it rewrote carry the newer major. An older build then refuses the repo. Upgrading is safe and downgrading is not: don't run an older loot against a repo a newer one has written. Within major 14, once 0.4.32 or later has written a repo, run nothing older there: an older build refuses the operation log 0.4.32 writes but still runs, recording none of its operations, so a later loot undo can step back across a push or grant it made.
Hosts
A client always writes its own major. Before a push, loot asks the host which major it reads. If the host is behind, the push is refused before anything is sent, and the message says the host is the stale side. If the host doesn't answer that question, the push goes ahead unchecked. A host ahead of you still reads your pushes, but what it sends back is in its own major, so an older client pulling from it gets the same upgrade loot refusal.
Finding your number
loot --version --json
{"contract":14,"version":"0.4.30"}contract is the format major. Every --json response carries the same number, because the machine-output contract is versioned with the format: see Porcelain and --json contracts. A relay reports its major as format_major at /info. What each major added is in Format versions.