brygge
brygge carries version-control history from one system to another. It decodes a Git, Mercurial, Subversion or CVS repository into one portable, verifiable file, an IR artifact, that belongs to no system, and encodes that artifact into a target system.
- Why it exists: moving history between systems tends to blur fact and guesswork. A migration that hides what it guessed cannot be trusted later.
- Its role: the bridge between two systems, with the IR artifact as the one handover point, so any source can
reach any target.
- Decoding is complete for all four sources.
- Encoding: prikk is the first target, through a built-in encoder that follows prikk’s own import design
(planned). brygge also writes Git repositories, through its own built-in encoder (
brygge encode git, RFC 019). For other targets, external encoder plugins do it, labelled as not part of brygge.
- What it does: it records what the source stated, marks what it had to derive, and records what it
could not carry, all inside the artifact.
inspectshows them, andverifychecks them, alone or against the source. Transform plugins can change an artifact on the way, but only by recording every change. brygge reads untrusted repositories, uses no network, and writes only where you tell it. - A typical day: you are leaving CVS.
brygge decode cvsturns the repository into an artifact.brygge inspectshows which changesets it had to reconstruct.brygge verify --against-sourceconfirms that the artifact still matches the repository. Thenbrygge encode <target>hands it to the new system.
The name: brygge is Norwegian for wharf, where cargo is unloaded from one ship, counted, labelled, and loaded onto the next. brygge does the same for history: every crate that arrived damaged is written down, and every one it had to repack is marked as repacked. No ship leaves with a crate it cannot account for.
Install
cargo install --locked brygge
On Arch Linux, from the AUR: brygge (built from source) or brygge-bin (the release’s binary).
brygge needs Rust 1.87 or later to build. Prebuilt binaries for Linux (x86_64, arm64), macOS (Apple Silicon) and Windows (x86_64) are attached to every GitHub release from 0.1.1 on.
Four commands
brygge decode git /path/to/repo --out repo.ir # or hg | svn | cvs
brygge inspect repo.ir # the fidelity report: carried, derived, dropped, flagged
brygge verify repo.ir --against-source /path/to/repo
brygge encode <target> repo.ir # through an external encoder plugin
Where to go next
- Importing a repository: the user guide for your source. It says what is carried, what is not, what is refused, and what you can do about it.
- Scripting and CI: Machine-readable output: every key, its versions, and the exit codes.
- Writing an encoder or a transform: Writing an encoder and Writing a transform: the rules a plugin must keep, and how brygge runs it.
- Reading or writing artifacts yourself: the IR artifact format, contract 0.3.0 (still reads 0.2.0).
- What brygge defends, and how: the threat model.
- The source code, the design decisions (RFCs) and the change log: the repository on GitHub.
Importing a Git repository
brygge decode git <repository> --out <artifact> [--infer-renames]
brygge reads a local Git repository directly (pure Rust, no git binary) and carries its history as the
repository recorded it. Before the run it states: “Git: content, history and messages are carried as the
source recorded them. Renames are inferred only with –infer-renames, and are then marked derived.
Authorship is Unverifiable.”
Memory while decoding
brygge keeps file content on disk while decoding, not in memory: a large repository needs free disk
space of roughly its content’s uncompressed size while decoding (the spill file, removed when brygge
exits), plus the artifact, which is several times smaller. --spill-dir <DIR> chooses where; the
default is --out’s own directory. A RAM-backed directory (tmpfs) moves the memory cost rather than
removing it. The option never changes the artifact. Compressing the artifact uses up to 8 threads and
about 100 MiB more memory than before (not growing with the repository), and makes decoding take about
1.5× as long.
A ceiling on the size of one tree (0.8.1): a repository where one commit’s tree holds more than 10,000,000 path entries is refused, exit 20. This is checked as each tree is walked, before an entry is stored — it cannot be reached by a real repository’s own files, but it bounds a crafted tree whose entries reuse one shared subtree: a tiny repository, stated in terms of real objects, can otherwise make a flat path list many times larger than the objects themselves. The ceiling counts the entries this one walk visits, not the number of distinct Git objects involved.
What brygge carries
- Every commit reachable from a branch (
refs/heads/*) or a tag (refs/tags/*), as a stated atom that keeps its commit id. Each file change is carried as the literal add, modify or delete between the commit and its first parent. - The author and the committer, each with its own time and timezone offset. Messages are carried as
bytes, and a commit’s declared
encodingis carried on its message. - Signatures (
gpgsig,gpgsig-sha256), preserved as bytes. A preserved signature verifies nothing in any target. Every other commit header (such asmergetag) is carried too, by name, in header order. - Branches and tags as refs. An annotated tag also carries its tagger, time, message and signature.
- Every object is checked against its id. A commit, tree, blob or tag whose content does not hash to its id stops the decode, so a preserved commit id is always a true link to its content. History is walked from the commits themselves, never from the commit-graph cache.
Submodules
A submodule (a gitlink, mode 160000) is carried as exactly what Git records at that path: the path
itself, and the commit id it pins in another repository. brygge never reads, fetches, imports or
verifies that other repository — it is never opened, and a commit id no object in this repository has
is normal for a submodule, not an error.
Wherever one appears — decode, inspect, encode git — the report states:
submodules: P path(s) in the history, T at the branch and tag tips; their own repositories were not read, imported or verified
.gitmodules, the file mapping each submodule path to a URL, is ordinary content: brygge carries it like
any other file, change for change. A submodule pointing at a commit its own repository no longer has is
carried as the source holds it — Git, not brygge, decides later whether that commit is still fetchable.
What it does not carry
Each of these is recorded in the artifact with its count, never dropped silently.
Representation. These records describe how Git stores and works with history, not history itself. The first three are always present.
packfile and delta layout, physical object storeindex and working treereflogsremote-tracking refs (N),notes refs (N),stash refs (N),other refs (N): refs outsiderefs/heads/andrefs/tags/.commits reachable only from dropped refs (N): for example stash commits, or remote-tracking commits never merged into a branch. They are not imported. If the count cannot be computed, the record reads(count unavailable).symbolic refs (N): an alias to another ref, such asrefs/remotes/origin/HEAD. The target ref is carried on its own.
Other. These records mark source-stated data that was not carried.
refs to non-commit objects (N): a tag or branch naming a tree or blob.nested tag objects not carried (N): in a tag of a tag, only the outer tag’s annotation is carried.unparseable author/committer/tagger times (N)andunparseable author/committer/tagger timezone offsets (N): the time, or just its offset, is left absent rather than guessed.undecodable encoding headers (N): anencodingheader that is not valid UTF-8.
A decode whose records are all representation records exits 0. Any record in the second group gives
exit 10 (recorded loss).
Options
--infer-renamesis off by default, so a default import is entirely as the source stated it.- With it on, a file deleted at exactly one path and re-added with identical content at exactly one other path, in the same commit, gets a rename hint.
- The hint is marked derived, with
rename_algorithm = exact-content-moveandrename_threshold = 100. It sits beside the literal delete and add, which stay. - Ambiguous cases (the same content at several paths) are left unmarked.
Repositories brygge refuses
A refusal exits 20, names the identifier below, and writes nothing.
| Identifier | Refused | What you can do |
|---|---|---|
replace-ref | any refs/replace/* ref | git replace -d <object> if unwanted, or make it permanent (git filter-repo) |
grafts | an info/grafts file | make it permanent (git filter-repo), or delete it if unwanted |
shallow-clone | a shallow clone | git fetch --unshallow, then decode |
object-alternates | objects borrowed from another store | in a copy, git repack -a -d, then remove the alternates file |
redirected-git-directory | a .git file, a commondir, or a symlinked .git/objects path | point brygge at the main git directory (git rev-parse --git-common-dir) |
non-utf8-path | a path that is not valid UTF-8 (shown as \xNN) | rename the path |
non-utf8-ref-name | a branch or tag name that is not valid UTF-8 | rename the ref |
non-utf8-commit-header-name | a commit header whose name is not valid UTF-8 | none without rewriting the commit |
sha256-object-format | a SHA-256 repository | no in-place conversion exists; git fast-export --all into a new SHA-1 repository, or wait for a release that reads SHA-256 |
brygge also refuses (exit 20) a repository beyond its ceilings rather than exhausting memory:
- a blob over 1 GiB, checked before the blob is read;
- more than 10,000,000 commits;
- a path over 4,096 bytes;
- a tree nested more than 256 levels deep;
- a chain of more than 32 tags.
Checking an import
brygge verify <artifact>runs the honesty and consistency checks that need nothing but the artifact.brygge verify <artifact> --against-source <repository>also decodes the repository again, with the options recorded in the artifact, and reports whether it corresponds. A mismatch exits50.brygge inspect <artifact>prints the fidelity report: what was carried, derived and dropped.
Importing a Mercurial repository
brygge imports what the repository would publish: the changesets hg clone would share. Secret and
hidden (obsolete) changesets stay behind, and the report counts them. brygge reads the local store
directly (no hg binary is needed), and it never modifies anything it reads.
brygge decode hg <repository> --out <artifact>
<repository> is the working directory that contains .hg (or the .hg directory itself).
Memory while decoding
brygge keeps file content on disk while decoding, not in memory: a large repository needs free disk
space of roughly its content’s uncompressed size while decoding (the spill file, removed when brygge
exits), plus the artifact, which is several times smaller. --spill-dir <DIR> chooses where; the
default is --out’s own directory. A RAM-backed directory (tmpfs) moves the memory cost rather than
removing it. The option never changes the artifact. Compressing the artifact uses up to 8 threads and
about 100 MiB more memory than before (not growing with the repository), and makes decoding take about
1.5× as long.
What brygge carries
- Every published changeset, as a stated atom: its parents, its file operations, and its message,
byte for byte.
- The user is carried as the author, with the email split out when present. Mercurial records one user and one date, so there is no separate committer or commit time: brygge never invents one.
- The time keeps its timezone offset.
- Renames and copies that Mercurial recorded (
hg mv,hg cp), as stated copies. Each copy names the changeset its source really came from: the first parent, the second parent in a merge, or an earlier changeset. A copy is never placed on a guess. - Changeset extras (every one,
branchincluded), carried as labelled bytes in their stored order.branchnames the changeset’s named branch. Mercurial stores it only on changesets that are not ondefault, and brygge carries it exactly where it is stored, so every changeset’s branch is stated in the artifact.- a
closeextra (Mercurial writes1) means the changeset closed its branch (hg commit --close-branch).
- Refs:
- every bookmark that names a published changeset;
- one ref per named branch, at Mercurial’s branch tip (
branchmap.branchtip, which is whathg update <branch>checks out): the tipmost open head of the branch among the published changesets, or, when every head is closed, the tipmost head. A branch may have several heads; every one of them is recoverable from the changesets’branchextras (a changeset of the branch with no published child on it), and a closed head’scloseextra says it was closed. - “Tipmost” is the highest revision number in this repository, as it is for
hg update. Two clones that pulled in a different order can therefore name different tips: that is Mercurial’s own behaviour, stated here and not hidden.
- Tags travel as the
.hgtagsfile in the history, as Mercurial stores them, not as refs. - Verified identity. Every revision brygge reads (changeset, manifest, file) is re-hashed the way
Mercurial hashes it, and a store whose content does not match its node is refused. The repository’s
identity is taken from its smallest published root, so a repository and its
hg cloneget the same identity.
What it does not carry
Each of these is recorded in the artifact’s loss boundary, never dropped silently. inspect shows them:
| Record | When |
|---|---|
revlog physical layout and delta chains | always: storage detail; the logical revisions are all carried |
dirstate and working copy | always: local state, not history |
phases (public/draft/secret) | the repository has phase data |
obsolescence markers | the repository has an obsstore; the markers are advisory and never become ancestry |
changesets not published: secret or archived (N) | secret or archived changesets were left out |
hidden (obsolete) changesets (N) | rewritten or pruned changesets were left out. A changeset that is both secret and obsolete is counted once, as not published |
copy sources not resolvable (N) | a recorded copy whose source could not be placed on an imported changeset; the copy is omitted, and the file is still carried |
copy metadata on an existing path not carried (N) | a copy recorded onto a path that already existed (hg cp -f); the file’s change is carried, the copy relationship is not |
bookmarks naming unimported changesets (N) | a bookmark names a secret, hidden or missing changeset |
unrepresentable timezone offsets (N) | a stored offset that is not a whole number of minutes; the time is carried, the offset is not |
The first two are storage representation only. If anything else is recorded, decode exits 10
(recorded loss) instead of 0.
Options
--infer-renamesdoes not apply to Mercurial: Mercurial records its renames itself, and brygge carries them as stated. Giving it is a usage error (exit2).--reconstruct-refsdoes not apply to Mercurial (it has real branches and bookmarks). Giving it is a usage error (exit2).
Repositories brygge refuses
A refusal exits 20, names what was refused, and writes nothing (an existing artifact at --out is left
untouched).
| Refused | Identifier | What you can do |
|---|---|---|
subrepositories (.hgsub, .hgsubstate) | subrepo | decode each subrepository separately |
the largefiles extension | largefiles | convert the large files to ordinary files (hg lfconvert --to-normal <repository> <new copy> writes a converted copy), then decode the copy |
the lfs extension | lfs | in a copy of the repository, convert the tracked files back to ordinary files, then decode the copy |
| a censored revision | censored-revision | none: the content no longer exists; keep the source repository |
a merge in progress (.hg/merge/state2) | unfinished-merge | finish the merge (hg resolve, then hg commit) or abort it (hg merge --abort), then decode again |
| a changeset extra whose key is not valid UTF-8 | non-utf8-extra-key | none without rewriting history; keep the source repository |
a file path that is not valid UTF-8 (shown as \xNN) | non-utf8-path | rename the file in a copy of the repository |
| a narrow clone’s ellipsis revision | ellipsis-revision | decode the full repository the narrow clone came from |
| an externally stored revision | external-storage-revision | as for lfs |
| a revision flag Mercurial does not define | unknown-revision-flag | none; Mercurial refuses it too |
These also exit 20:
- A format this build does not read: a
.hg/requiresentry such asrevlogv2,treemanifest, a narrow clone, or anything unrecognized; or an obsstore other than version 1. - A store without
fncache(Mercurial before 1.1, from 2008), whose file names are encoded differently (store-without-fncache). Clone it with a current Mercurial (hg clone --pull <old> <new>writes a current store), then decode the clone. - A size ceiling: a revision over 1 GiB once decompressed, or an obsstore or a small metadata file
(
phaseroots,bookmarks,localtags) over 64 MiB.
A corrupt or crafted store (for example, a revision that does not match its node) is a read error, exit
1.
Checking an import
brygge inspect <artifact>prints the fidelity report: what was carried, derived, dropped and refused.brygge verify <artifact>checks the artifact’s own honesty and integrity, with no source needed.brygge verify <artifact> --against-source <repository>decodes the repository again and confirms the artifact corresponds to it (corresponds). Authorship is always Unverifiable: brygge carries what the source says, and verifies no one’s identity.
Importing a Subversion repository
brygge reads Subversion history from one of two forms. It picks the form from what you give it:
- A dumpfile (a file): the output of
svnadmin dump(with or without--deltas) or ofsvnrdump dumpthat you made yourself. This is the preferred form. A dumpfile is the canonical, deterministic input: decoding the same dumpfile always gives byte-identical output, and no external tool runs. - A live repository directory: brygge runs a read-only
svnadmin dump <repo> --quietitself, with no shell and no network. This needssvnadminon yourPATH, and brygge records its version (svnadmin --version --quiet) in the artifact’s provenance. Twosvnadminversions could frame a dump differently.
Either way, provenance records which form was used (source_form: dumpfile or svnadmin-dump).
svnadmin dump /path/to/repo > repo.dump # once, on the machine that has the repository
svnrdump dump https://host/repo > repo.dump # or, for a repository you can only reach over the network
brygge decode svn repo.dump --out repo.ir # the preferred form
brygge decode svn /path/to/repo --out repo.ir # or let brygge run svnadmin dump
Memory while decoding
brygge keeps file content on disk while decoding, not in memory: a large repository needs free disk
space of roughly its content’s uncompressed size while decoding (the spill file, removed when brygge
exits), plus the artifact, which is several times smaller. --spill-dir <DIR> chooses where; the
default is --out’s own directory. A RAM-backed directory (tmpfs) moves the memory cost rather than
removing it. The option never changes the artifact. Compressing the artifact uses up to 8 threads and
about 100 MiB more memory than before (not growing with the repository), and makes decoding take about
1.5× as long.
The running tree shares unchanged directories between revisions (0.9). A branch or tag copy no
longer clones the tree it copies: it inserts the source directory where the copy lands, and a later
change copies only the directories on its own path back down to the root. Holding a snapshot — the
previous revision’s tree, or one copyfrom may still name later — now costs nothing beyond that one
handle, however large the tree is. Memory therefore follows the size of the history (how much ever
changed), not the number of tags times the number of files it last held, which is what made a
tag-heavy repository expensive before. For a history with many tags, --branch-lines keeps the
resulting artifact small too, on top of this: a tag’s own creation costs no operations at all (a copy
that creates a root has no ops), only the edits a branch or tag line makes afterward.
Two ceilings remain on what still costs real work, each refused, exit 20:
max_tree_entries(10,000,000): checked where a tree is expanded into entries — a directory copy’s expansion (the stated layer still records oneAddper copied file, as it always has), and--branch-lines’s own per-file walk when a new branch or tag line’s first revision is built from a copy. Not checked on an ordinary single-file change: a shared tree’s size costs nothing to hold, so only turning it into IR entries needs a ceiling.max_tree_nodes(50,000,000): the cumulative count of directory nodes and file entries the decoder has ever allocated across the whole decode — every directory actually copied or newly created, every new file. Never decreasing, so it bounds the total copy-on-write work a dump can cause, not any one snapshot’s size. Measured against a real, tag-heavy repository (codeblocks: 6,221 revisions, 316 copy-source revisions), this stays about 433× under the default.
max_copy_expansion (10,000,000, one directory copy’s own growth) is unchanged. None of these three are
reachable by real history: a dump that copies a directory, and later restates files inside the copy as
copies of their own, repeated many times over, is what crosses them — not a real repository’s own
history, however large.
Dump forms
brygge reads all three dumps of one repository, and gives the same artifact for each, byte for byte:
svnadmin dump: fulltext;svnadmin dump --deltas: text and properties as deltas against each node’s previous state;svnrdump dump <url>: deltas as well, and no SHA-1 checksums, only MD5.
Deltas are read. A text delta is svndiff (version 0), applied to the node’s base: the copy source for a node
that is copied, the path’s current content for a change, and nothing for a new file. A property delta sets and
removes properties against the base’s. brygge never runs svnrdump and never touches the network: run it
yourself and give brygge the file (this is the remedy for a URL source, below).
- Checksums are checked. Every checksum a dump states (
Text-content-md5/-sha1,Text-delta-base-*,Text-copy-source-*) is checked against the text brygge rebuilt, on every node, fulltext nodes included; a mismatch is a read error naming the path and the header. This is a consistency check (it also checks brygge’s own delta application), not authenticity: a dump is untrusted and can state any checksum it likes. Verify who made a dump by other means. - svndiff versions 1 (zlib) and 2 (lz4) are refused by name. Re-dump with
svnadmin dump(fulltext or--deltas) or withsvnrdump, which write version 0. - An incremental delta dump cannot be decoded alone.
svnadmin dump --deltas --incremental -r N:Mwrites deltas against revisions that are not in the dump; brygge stops with a read error naming the path, and never guesses the base. Dump the whole history. - One node’s text is at most 1 GiB, and the text all deltas reconstruct is bounded by the dump ceiling (8 GiB):
a small delta dump cannot expand without limit. Over either is refused (
ResourceLimit).
What brygge carries
- Every revision, in order, as one history entry each, with its file operations read literally from
the dump.
- A
replaceis carried as a replace, even when the new content is identical, because Subversion stated a new node. - A copy (
copyfrom) is carried as a stated copy that names the revision it came from.
- A
- File content, as the dump stores it. Stored text is the repository’s normal form; keyword and end-of-line expansion are working-copy transforms and are not applied.
- File modes:
svn:executablemakes a file executable;svn:specialmakes it a symlink, whose content is the bare link target (thelinkprefix Subversion stores is removed). A symlink whose content does not start withlinkis a malformed dump and is rejected, not guessed.- The two are tracked separately, so a file can have both, and removing
svn:specialfrom it leaves it executable. Setting or clearingsvn:specialwithout changing the text follows the new flag (the content gains or loses thelinkprefix).
- Claims:
svn:authoris the author’s name, with no email (Subversion records none);svn:logis the message;svn:dateis the author time, in UTC.- Subversion states no separate committer or commit time, so none is invented.
- Authorship is Unverifiable: brygge carries what the dump says and verifies nothing about who wrote it.
What it does not carry
Everything below is recorded in the artifact’s loss boundary, never dropped silently:
| Recorded as | What it means |
|---|---|
SVN physical storage and dumpstream framing | the dump’s framing and the repository’s storage layout; the logical revisions are kept |
svn:mergeinfo | advisory merge tracking, often incomplete; it never becomes a merge parent |
svn:eol-style / svn:keywords / svn:ignore (working-copy hints) | working-copy settings (also svn:global-ignores); the stored bytes are carried as they are |
custom (user-defined) properties | any property brygge does not recognize; not carried in this version |
empty directories (N) | directories that had no file under them after the revision that created them; the IR has no empty-directory entity |
unparseable svn:date (N) | revisions whose svn:date did not parse; they carry no time rather than a wrong one |
deleted or moved branches/tags not represented (N) | with --reconstruct-refs only; see below |
The framing, working-copy-hint and empty-directory records describe representation only. Any of the
others makes the decode exit 10 (recorded loss), unless a flag makes it exit 30 (below).
Branches and tags
Subversion has no branches or tags, only directories that follow a convention. With --reconstruct-refs,
brygge reconstructs them from the standard layout:
trunkis a branch;- each directory directly under
branches/is a branch; - each directory directly under
tags/is a tag.
Each ref points at the last revision that touched its directory. Every reconstructed ref is marked derived (brygge’s judgment, not something Subversion recorded), with the layout recorded beside it.
- Only live refs. A branch or tag directory that no longer has any file in the final revision
(deleted, moved to a new name, or never filled) gets no ref. It is counted as
deleted or moved branches/tags not represented (N). A branch moved to a new name that follows the layout appears under the new name. - Tags are not guaranteed immutable. An SVN tag is an ordinary directory, and commits can land in it after it is created. Each tag ref records this.
- Convention violations exit
30, and are flagged in the artifact:trunk/branches/tags layout not found: the repository does not follow the layout at all, and no ref is fabricated;paths outside the trunk/branches/tags layout (N): the layout was found, but N files in the final revision belong to no branch or tag.
Without --reconstruct-refs, no refs are produced, and the history is carried as the plain directory
tree it is.
Layout
The standard trunk/branches/tags convention is the default, but not every repository follows it
by that name, or follows it at the repository’s own root. Three options (RFC 020 D-3), each with
--reconstruct-refs or --branch-lines, name where each container actually is:
brygge decode svn repo --branch-lines --layout-trunk mainline
brygge decode svn repo --branch-lines --layout-branches devel/branches --layout-tags devel/tags
-
Each option changes only its own container.
--layout-trunk mainlinealone still expects the standardbranchesandtags— an option you do not give is never silently removed, unlikegit svn’s-T/-b/-t(see the mapping below). -
--layout-trunk .means the whole repository is the trunk, with no separate branches or tags container at all. Giving--layout-branchesor--layout-tagsalongside it is a usage error (exit2): there is nothing left for them to name. This is how a repository with no layout at all reaches Git (see “Limits in 0.8.0” in the Git-target guide):--layout-trunk . --branch-linesdecodes it as one line, since a copy that creates a root has no ops of its own (RFC 019 D-9) — the whole history still carries, just without a reconstructed branch/tag split. -
A path value is a repository-relative directory, never the whole filesystem path and never starting with
/: no leading/, no..or empty segment, and no trailing/..is accepted only as the whole value of--layout-trunk. -
Two containers may not collide once the options you did not give are filled in with their standard names: the same path twice, or one inside another (
--layout-trunk branches/mainis refused with the standardbranches, since it is inside that container), is a usage error. -
A project in a subdirectory of a larger repository:
brygge decode svn repo --branch-lines \ --layout-trunk proj-a/trunk --layout-branches proj-a/branches --layout-tags proj-a/tagsdecodes
proj-aalone; every path under a sibling project (proj-b/…) is outside the layout, so it is flagged and recorded as dropped — never silently lost. -
What is recorded.
params["layout"]carries whichever containers were actually used — the standard ones if none were given — soverify --against-sourcere-derives with the same policy a later reader would otherwise have to guess. The default label is unchanged from before this RFC (trunk=trunk,branches=branches,tags=tags), so every existing artifact and default decode stays byte-identical. -
For
git svnusers: the flags map directly, with one difference.git svnbrygge -T <path>/--trunk=<path>--layout-trunk <path>-b <path>/--branches=<path>--layout-branches <path>-t <path>/--tags=<path>--layout-tags <path>-s/--stdlayoutno option — the standard layout is the default The one difference: in
git svn, giving-Talone means the repository has no branches at all — the options not given are dropped, not defaulted. In brygge, an option you do not give always keeps its standard name; nothing is ever silently removed.
One line of history per branch (--branch-lines)
Without --branch-lines, every commit’s tree is the whole repository — trunk/, branches/x/,
tags/y/, all under one root — because that is what a Subversion revision actually is: one state of
the whole tree. That is faithful, but it is not a usable migration: a branch’s own history, compared
against its own files at the root of its tree, is what a Git user expects.
--branch-lines (RFC 019 Amendment A) implies --reconstruct-refs, and changes what an atom is:
instead of one atom per revision for the whole repository, there is one atom per revision per branch
or tag it touches, holding only that root’s own files, at the root of its tree.
- Parents. A branch/tag’s atoms chain to the previous atom on its own line. The line’s first atom,
when the branch was created by copying another branch or tag (
svn cp <src> <new-branch>), has that source’s own atom (at the copied revision) as its parent — so the new line starts from the copied content, not from nothing. A branch created with no copy (a plainmkdir) starts a line with no parent. - Every line gets a ref, live or not:
- a live line (the branch/tag still exists in the final revision) gets the ordinary ref a branch or tag always gets;
- a dead line (an earlier life of a branch that was deleted and recreated, or a branch deleted and
never recreated) gets its own ref too, named
<branch-or-tag>@r<its last revision>(for examplebranches/foo@r812) — so no reconstructed history is silently lost to Git’s garbage collector.deleted or moved branches/tags not represented (N)therefore never fires under--branch-lines: every line, live or dead, has a ref.
- A file copied from one branch to another is carried as an addition with a copy record naming the source branch’s own atom, not a separate unrelated history.
- A revision that touches no branch or tag (revision 0 is the usual case) gives no atom at all; it
is counted as
revisions with no branch change (N). - Paths outside every branch/tag (an explicit flag already covers the layout as a whole) are also recorded one at a time, naming the revision and the path, since they belong to no line.
- A branch or tag copied from a path outside every root (not from another branch or tag) starts a fresh line, with no parent, and its first atom is exactly the copied content — counted in the same convention-violation flag as “a root created from outside the layout (N)”.
- A repository with no
trunk/branches/tagslayout at all gets no refs from the standard convention, and--branch-lineshas nothing to build lines from — unless--layout-trunk .is given (see “Layout” above), which makes the whole repository the one trunk line.
Repositories brygge refuses
A refusal exits 20 and says why; nothing is written.
| Refused | What you can do |
|---|---|
svn-externals: any node with an svn:externals property, which reaches into other repositories | in a copy of the repository, remove the property, or export the referenced content into the tree; then dump the copy again |
remote-source: a URL instead of a local repository | make a local copy with svnrdump dump <url> > repo.dump, run yourself, and give brygge the dumpfile |
| a dump whose text deltas are svndiff version 1 or 2 (compressed) | dump again with svnadmin dump (fulltext or --deltas) or with svnrdump |
| a dump format version other than 1–3 | dump with a current svnadmin |
| a dump over 8 GiB, or one node’s text over 1 GiB | refused before it is read into memory (or allocated); larger dumps are not supported (streaming is deferred by measurement, RFC 010) |
An incremental delta dump (a delta against a revision the dump does not hold) is a read error, not a
refusal of a feature: exit 1, naming the path (see “Dump forms”).
A non-UTF-8 path is a malformed dump, not a repository shape. A dumpstream’s paths are UTF-8 by the
format’s own definition. brygge stops with a read error (exit 1), showing the offending bytes as \xNN.
Checking an import
brygge verify repo.ir checks the artifact on its own. brygge verify repo.ir --against-source <source>
also decodes the source again and compares the two:
- Give the same form the artifact was made from. An artifact made from a dumpfile is checked against
a dumpfile, and one made from a repository against a repository. Otherwise the comparison is
not-checked(the artifact was made from a <form>; verify against the same form, where<form>isdumpfileorsvnadmin-dump), the verdict isincomplete, and the exit is1. - A different
svnadminversion is noted, not failed. If the history is identical, verify passes and sayssvnadmin versions differ (<a> vs <b>); the history is identical. If the history differs, the failure detail names both versions, which is often the reason.
Importing a CVS repository
brygge imports a CVS repository’s main line (the trunk, plus — while a vendor branch is set — the
revisions cvs import put there, since that is what a plain cvs checkout gives you). With
--reconstruct-refs it also imports the branches cut from the main line, each with its own history.
Memory while decoding
brygge keeps file content on disk while decoding, not in memory: a large repository needs free disk
space of roughly its content’s uncompressed size while decoding (the spill file, removed when brygge
exits), plus the artifact, which is several times smaller. --spill-dir <DIR> chooses where; the
default is --out’s own directory. A RAM-backed directory (tmpfs) moves the memory cost rather than
removing it. The option never changes the artifact. Compressing the artifact uses up to 8 threads and
about 100 MiB more memory than before (not growing with the repository), and makes decoding take about
1.5× as long.
What brygge carries
- The main line’s full per-file content and history, reconstructed into changesets (every changeset atom
is
Derived(ReconstructedChangeset)— CVS has no atomic commit, so brygge’s grouping is its own judgment, carried with its clustering parameters and a confidence). - The main line itself, as the branch
trunk, with--reconstruct-refs(see below): aDerivedbranch ref at the main line’s last changeset, so every reconstructed main-line changeset is reachable from a ref. - Main-line tags, with
--reconstruct-refs. - Branches, with
--reconstruct-refs(see below): a ref of kind branch, and the branch’s own changesets.
Branches (with --reconstruct-refs)
A CVS branch is not one line of history: each file has its own branch, cut at its own revision, and nothing
says which commits belong together. A branch is identified by its symbol name (cvs tag -b BR), so branches
are imported only with --reconstruct-refs, and only the ones that have a name.
- The main line is the branch
trunk. With--reconstruct-refs, brygge adds oneDerivedbranch ref namedtrunk, at the main line’s last changeset — the same name the Subversion decoder uses for its own reconstructed main line, so one name serves both sources. A CVS symbol also namedtrunkrefuses the decode, naming the symbol and the first file that carries it: the name is reserved for the main line. A repository with no main-line changeset at all (every file starts on a branch) gets notrunkref. - The branch tree. The branch’s changesets are clustered from that branch’s revisions alone (the same
rules as the main line), and each is a
Derived(ReconstructedChangeset). A branch’s ref points at its last changeset; a branch with no commits is a ref at its parent. - The parent is the earliest covering changeset. The changeset on the main line after which the largest
number of the branch’s files were at their branch-point revision, the earliest such if several tie. When
every file of the branch was at its branch point right after one changeset, the parent is exact. When the
files were tagged at different moments (for example, one by one with commits between), no single changeset
is right: the parent is approximate, and brygge says so — the artifact carries a
ConventionViolationflag (“CVS branch point spans reconstructed changesets”) and the run exits30. This is a judgment, not a fact; the branch’s content is still exact (each file’s content on the branch is whatcvs checkout -r BRgives). - The branch-point atom. A branch may hold only some of the files (for example, a branch tagged from a
subdirectory). Then the tree the parent had is not the tree the branch started from, and brygge adds an atom
named
branch-point:<name>between the parent and the first branch changeset. It isDerived(ReconstructedBranch)and only adds and deletes the paths that differ, so that the branch’s tree equals what CVS gives. A branch that covers the whole tree has no such atom. A file added on the branch is added by its first branch revision; a trunk file added after the cut is not in the branch. - No merges are inferred. CVS records none (a merge is a plain commit on the target), and brygge does not guess them from the content: a branch’s atoms have one parent.
- Tags on a branch revision resolve to the branch changeset that contains that revision.
- A branch cut from a branch revision (a branch of a branch;
cvs tag -bfrom a working copy that is on another branch) is a line hanging from that branch: its parent is the changeset of the parent branch that holds the branch-point revision, chosen by the same earliest-covering rule, and the artifact records the parent line (parent_line). A branch is imported after its parent line. - A mixed working copy (
cvs tag -bfrom a working copy where some files are on one branch and some on another, or on the trunk) gives one symbol whose branch points lie on several lines. The parent line is the one holding most of them (ties go to the main line, then to the lower symbol name). The files whose branch point lies elsewhere are on the branch, at their branch-point content, but they do not say where the branch was cut, so the parent is approximate and flagged like any other approximate cut. The branch-point atom sets their content, so the branch’s tree is still whatcvs checkout -r <branch>gives. If the line holding most of the branch points is itself not imported, the whole branch is not imported (below), even when a minority of its files would hang from the main line: it is counted, never guessed.
What it does not carry
- Without
--reconstruct-refs, branches are not imported at all: every revision on a branch other than the currently-set vendor branch is excluded and recorded as a drop (CVS branch revisions not imported (…)), never silently. - Unnamed branches: revisions on a branch whose symbol was deleted have no name to identify the branch
across files. They are dropped and recorded (
CVS branch revisions on unnamed branches not imported (…)). - Branches whose parent line is not imported: a branch cut from a branch with no symbol in its file (an
unnamed branch, whose own revisions are dropped as above), from a vendor branch that is no longer the default,
or from a branch that is itself not imported. There is no parent to hang it from, so it is not imported and is
recorded (
CVS branches whose parent line is not imported (N branches, M revisions)), never guessed. - Vendor branches: while the vendor branch is the file’s default branch, its revisions are the main line,
as for
cvs checkout, and a branch cut from one of them (cvs import, thencvs tag -b) hangs from the main line like any other. After a file’s vendor branch is cleared, later vendor-import revisions are recorded (CVS vendor-branch revisions after the vendor branch was cleared (… revisions)). A vendor branch’s own symbol (e.g.VENDOR:1.1.1) is a literal odd-length number, not a “magic” one, and is not reconstructed as a branch. - A branch symbol naming a revision the file does not have (for example after
cvs admin -o): the file is not on the branch; recorded (CVS branch symbols naming a missing revision (…)). - A tag that ends up naming no imported revision is recorded as its own drop
(
CVS tags on branch revisions not reconstructed (…)), never silently skipped.
Repositories brygge refuses
A refusal exits 20 and names the file or symbol; nothing is written. Besides a remote (:pserver:)
source, a symlink, a path in both Attic/ and live, and a non-UTF-8 path, two more shapes are refused
because there is no honest way to import them:
default-branch-with-later-trunk— a file whose default (vendor)branchis still set, but which also has trunk revisions after that branch’s branch point (possible withcvs admin -b). A checkout gives the branch tip while the trunk moved on, so the file has no single main line. In a copy of the repository, reset the default branch withcvs admin -b(no argument) on that file, or repair it by hand, then import the copy. The consequence: the file’s main line then follows the trunk, and the vendor branch’s revisions are counted as branch revisions and not imported.non-utf8-symbol-name— a tag or branch symbol whose name is not valid UTF-8 (shown with\xNNfor the invalid bytes). Ref names in the IR are text and are never converted lossily. In a copy of the repository, rename or remove the symbol (cvs rtag -d/cvs rtag -r), then import the copy.
Seeing a repository’s branches before migrating
rlog -h file,vlists a file’s symbolic names, but does not mark which are branches — read the revision number yourself:- CVS’s “magic branch number” form has
0as the second-to-last component (e.g.1.2.0.2names the branch a plain revision would call1.2.2); - a vendor branch is stored literally instead, as an odd-length number of three or more components
(
1.1.1) — the admin section’sbranchfield, while set, names it the same way.
- CVS’s “magic branch number” form has
grep -A20 '^symbols' file,vshows the raw symbols table directly, for either form.
If you need what is not imported
Keep the source repository — brygge never modifies or removes anything it reads — and use another tool for the parts above that are recorded as drops.
Migrating to Git
brygge encode git <artifact> --out <dir>
brygge encode git is a supported, built-in encoder (RFC 019): it writes a new, bare Git repository
from an IR artifact, with every commit labelled by trailers naming where it came from and what, if
anything, brygge supplied, altered, derived or carried across a transform. git is reserved — encode git is never a plugin, and a brygge-encode-git on PATH is never run (encode --list shows it
shadowed by the built-in).
<dir>must not already exist. brygge refuses otherwise, naming it.- brygge verifies the artifact first, the same way every command that reads one does.
- The result is a bare repository: clone or push it, rather than checking it out in place —
git clone <dir> my-project. - A sidecar report,
<dir>.brygge-report, is written beside the repository, in the machine format (machine-output.md§3.9): the artifact’s digest, the brygge version, the default branch chosen, and every drop, flag, supplied and altered field the result carries. Keep it with the artifact and the repository.
Migrating from each source
Git and Mercurial carry their own author, committer and time already, so there is nothing to map:
brygge decode git <source> --out repo.ir # or: brygge decode hg <source> --out repo.ir
brygge encode git repo.ir --out repo.git
CVS has no Git-shaped branch history without --reconstruct-refs, and no email at all, so both
steps below matter:
brygge decode cvs <source> --out repo.ir --reconstruct-refs
brygge inspect --authors repo.ir > authors.map # then fill in each right-hand side
brygge transform authors repo.ir --map authors.map --out mapped.ir --require-all
brygge encode git mapped.ir --out repo.git
Subversion needs --branch-lines for the same reason CVS needs --reconstruct-refs — see “The
mapping” below for why — and the same author step, since Subversion also carries no email:
brygge decode svn <source> --out repo.ir --branch-lines
brygge inspect --authors repo.ir > authors.map # then fill in each right-hand side
brygge transform authors repo.ir --map authors.map --out mapped.ir --require-all
brygge encode git mapped.ir --out repo.git
What the result is
- The commit ids are new.
encode gitwrites its own commits; it cannot and does not reproduce the source’s own hashes (a Git source included — its SHA-1s depend on its own commit format, not the IR’s). - Every commit, and every annotated tag, carries a trailer block naming the source, what brygge supplied or altered, and the artifact it came from — see “The trailers” below.
- A ref that does not fit Git’s branch or tag namespace (an
Otherref: a Mercurial bookmark kept as such, or a Subversion branch’s earlier, deleted life under--branch-lines) lives underrefs/brygge/other/, outside both, so it never reads as either. - A sidecar report is written beside the repository (
<dir>.brygge-report) — see above. - The repository is bare. Clone or push it; it has no working tree of its own.
The mapping
| IR | Git |
|---|---|
| An atom | A commit |
A Branch, Bookmark or Mercurial NamedBranch ref | refs/heads/<name> |
A Tag ref, with an annotation | An annotated tag object, refs/tags/<name> |
A Tag ref, without one | A lightweight tag, refs/tags/<name> |
An Other ref | refs/brygge/other/<name> — outside both the branch and tag namespaces, so it never reads as either |
A path’s blob content, mode 100644/100755/120000 | A regular, executable, or symlink Git blob mode |
| A path’s submodule content | A gitlink, mode 160000 (M 160000 <commit> <path>), the pinned commit id written exactly as the source held it |
| Any other mode | Refused by name before anything is written — this should not occur |
The default branch (HEAD) is the first of trunk, main, master or default that the IR has as
a branch-like ref; otherwise the first branch-like ref in the artifact’s own canonical order. With no
branch-like ref at all (an artifact of tags only, or none), HEAD names refs/heads/main, which does
not exist yet — the report says so.
Refs that would collide on one Git ref (two IR refs of different kinds sharing one name, for
example) are refused by name, naming both, before anything is written — brygge never picks one or
renames either. Likewise, every Git ref name must pass Git’s own rules (git check-ref-format).
Every atom must be reachable from at least one ref — walked through parents from every ref’s own target. An artifact where some atom is not is refused, naming how many atoms and the first few by source id, before anything is written: a result that would silently lose history once Git garbage-collects is not a migration, and D-7’s pre-flight exists to catch exactly this. The refusal’s fix hint depends on whether the artifact has any ref at all:
- No refs at all, for CVS or Subversion: decode with
--reconstruct-refs, which gives the history its refs in the first place. For Git or Mercurial (which always carry the source’s own refs): a transform removed the one that would have reached these atoms, named by step when known. - Refs exist, but some atoms still are not reached by any of them:
--reconstruct-refswas already given and already worked, so the refusal does not suggest it again; it says plainly that no reconstructed ref reaches these atoms.
For Git or Mercurial this split does not change the hint: a removed ref is the only way an atom there goes unreached, whether or not other refs still exist.
A Subversion repository with no trunk/branches/tags layout at all reaches Git with
--layout-trunk . (RFC 020 D-3; see “Layout” in the Subversion guide): the whole repository decodes as
one line, since there is nothing to split it by.
For Subversion, the documented path is decode svn --branch-lines, then inspect --authors, then
transform authors, then encode git (see “Mapping authors” below for the middle two steps).
--branch-lines (RFC 019 Amendment A) gives each branch and tag its own line of history, with its own
files at the root of its tree — without it, the result keeps the whole repository tree in every
commit, which is faithful but not a usable migration.
Submodules
A submodule carried from the source (see “Submodules” in the Git guide) is written back as a gitlink
(mode 160000), the same path and the same pinned commit id. The report states the count (D-4 of RFC
021), and both G2’s own check and verify --against-target git compare it like any other entry: path,
kind and commit id.
Four things to know before relying on the result:
- The result’s submodules point at the same commits as the source’s. Nothing is re-pinned or updated.
git submodule updateon the result fetches from the URLs in.gitmodules— the source’s own, carried unchanged — so running it contacts those hosts. brygge itself contacts none.- brygge checked none of the submodules’ own repositories. A pinned commit id is carried as opaque bytes; it is never opened, fetched or verified.
- A submodule path missing from
.gitmodulesis carried exactly as the source held it, and Git then cannot fetch it — that is the source’s own state, not something this encoder introduces.
The trailers
Every commit, and every annotated tag, ends with one block of trailers after a blank line, in this
fixed order (git interpret-trailers --parse reads it back):
| Trailer | When | Says |
|---|---|---|
Brygge-Encoded: brygge <version> from <git|hg|svn|cvs> | always | this history was written by brygge from another source, not recorded natively here |
Brygge-Source-Id: <id> | commits only (a ref has no atom of its own) | the source’s own id for this commit, in a form that source’s own people would recognize |
Brygge-Derived: <scope> <kind> <params> | once per derived assertion the commit or one of its path operations carries | brygge’s own judgment produced this, not the source’s stated fact |
Brygge-Transformed: <scope> <step> <name> <version> (<changed>) | once per layer of a Transformed status | a transform changed this, naming which one and what it changed |
Brygge-Supplied: <fields> | when Git’s format needed a value the IR did not carry | exactly what brygge invented to satisfy Git, never silently |
Brygge-Altered: <field> (<why>) | when a value the IR did carry had to change to fit Git’s syntax | what changed and why, never folded into Brygge-Supplied: |
Brygge-Artifact: sha256:<digest> | always | the artifact this commit was built from, which holds the full loss record |
A Transformed mark on a ref with no message of its own to carry it (a lightweight tag, or a branch,
bookmark, named branch or Other ref) goes into the report instead, naming the ref.
Brygge-Source-Id’s form is specific to the source kind, not a generic encoding of the raw id:
| Source | Form | Example |
|---|---|---|
| git, hg | 40 lowercase hex characters, no prefix — the object id or node itself | Brygge-Source-Id: 4b825dc642cb6eb9a060e54bf8d69288fbee4904 |
| svn | r<decimal>, or r<decimal> <root> for a --branch-lines atom (the revision, then its own branch/tag’s root) | Brygge-Source-Id: r1234Brygge-Source-Id: r1234 branches/1.5 |
| cvs | one path@rev pair per line: the first right after the key, each later one on its own continuation line (so git interpret-trailers --parse still reads the whole thing as one value); or, for a branch-point atom, the literal branch-point:<name> | Brygge-Source-Id: a.c@1.1 b.c@1.2 |
| anything else | printable ASCII as is, otherwise hex: and lowercase hex | Brygge-Source-Id: hex:01ff0041 |
An id that does not fit its kind’s form (the wrong length for git/hg/svn; anything malformed for cvs —
not UTF-8, an empty pair, a pair with a leading or trailing space, or no @ at all) falls back to the
generic hex: form instead, so one bad id never breaks the rest. An id named in a refusal message is cut
to 80 characters plus …, since a CVS changeset’s id can otherwise run to a whole paragraph.
The field vocabulary in Brygge-Supplied:/Brygge-Altered: is author, author-email,
author-time, author-time-zone, committer, committer-email, commit-time,
commit-time-zone, tagger, tagger-email, tag-time, tag-time-zone. A bare field (author,
committer, tagger) means the whole identity was invented, or copied from the author because the
IR stated no distinct committer; <field>-email means only the email was missing — a weaker, narrower
claim. The two are never conflated: a reader must be able to tell “brygge invented this person” from
“brygge filled in an empty email” apart.
How brygge checks the result
Before encode git writes anything, it decodes the repository it just wrote, in process, and compares
it with the artifact. Any difference refuses the write: nothing is left at --out, and nothing at its
report. The same comparison is also a standalone command, over a repository someone kept:
brygge verify <artifact> --against-target git <repository>
It is read-only (the repository’s refs are listed the same way encode git itself runs git: no user
configuration, no hooks), and it may not be combined with --against-source — a run answers one
question, either “does this match the source” or “does this match the result”, never both at once.
What is compared, and how:
- Each result commit is matched to one artifact atom by its
Brygge-Source-Idtrailer, read back with the same per-source-kind form the trailer was written in. - States, never ops. The full path → content mapping after a commit must equal the full path → content mapping after its matched atom. Two decoders can represent the identical resulting tree with different operations — a Subversion replace against a Git modify, or a no-op modify Git never records — so operations are never compared, only the state they leave behind.
- Parents, author, committer and message are compared against exactly what this guide’s own rules say
the writer would produce: a field this encoder supplied or altered is checked against the documented
replacement (
<>,+0000, the author’s own claim), never against the artifact’s original, possibly absent, claim. - Refs are compared by D-3’s own mapping: names, kinds and targets, through the same atom matching; an
annotated tag’s tagger, time and message follow the same rules as a commit’s;
HEADmust name the default branch this guide’s “The mapping” section describes. - Nothing extra. A commit, ref or tag in the result beyond this mapping does not correspond — even one a later, unrelated branch added to a kept repository. A migrated repository that is still being worked on is no longer being compared against the artifact that produced it; check it before anyone builds on it.
A difference reports what changed, up to 20 of them, then a count; verify --against-target exits with
verify’s own failed-check code.
The cost: the check about doubles the time encode git would otherwise take, since it decodes the
repository it just wrote and compares it in full — measured on fish-shell (review 142), 78.4 s with the
check against 40.0 s without. Memory stays close to a plain decode’s own peak (0.86×–1.02× across every
repository measured; see “Evidence” below), because the check holds one tree state at a time, in
canonical order, the same way the decoder itself does.
Mapping authors
Subversion and CVS carry an author name but no email, and no distinct committer at all: without
mapping, encode git supplies a <> email (marked Brygge-Supplied: author-email) and copies the
author onto the committer (marked Brygge-Supplied: committer, commit-time, the whole identity). brygge transform authors gives them real Git identities first (RFC 019 D-4):
brygge decode svn repo --out repo.ir --branch-lines # Subversion only; see above
brygge inspect --authors repo.ir > authors.map # then fill in each right-hand side
brygge transform authors repo.ir --map authors.map --out mapped.ir --require-all
brygge encode git mapped.ir --out repo.git
inspect --authorslists every distinct identity the artifact carries — as an atom’s author or committer, or an annotated ref’s tagger — already in the map file’s own form, one line per identity, with its counts per role: redirect it to a file and fill in each right-hand side.- The map file: one
<source> = <Name> <<email>>mapping per line.#starts a comment, to the end of the line; blank lines are ignored.<source>is a bare name, matching an identity with exactly that name and no email (the Subversion/CVS case), or<Name> <<email>>, matching exactly that name and email (Git/hg). Neither form ever matches the other — a bare name never matches an identity that has an email, and the reverse, and both sides compare by exact bytes.- The target side needs a non-empty name and a non-empty email, and may not contain a newline,
<,>or NUL — the same ruleencode gititself applies to a written identity, so a mapped identity is never altered later.
transform authors <artifact> --map <file> --out <file> [--require-all]is the one built-in transform (authorsis reserved likeencode’sgit: abrygge-transform-authorsonPATHis never run, andtransform --listshows it shadowed by the built-in). It changes only an atom’s author and committer, and an annotated ref’s tagger; every change it makes is markedTransformed, by RFC 018 D-5’s own rule. An identity the map does not cover is listed on stderr with its counts;--require-allrefuses the whole transform (exit 2, nothing written) if any is left unmapped. A mapping line that matched nothing gives a warning naming the line — it is not an error, since one map may cover several repositories.- Every mapped commit says so:
encode git’s own trailers carryBrygge-Transformed: atom <k> authors <version> (author)(andcommitter, when that claim also changed) — nothing new in the encoder, since it is just rendering the mark the transform already wrote. Once a mapping supplies a real email, theBrygge-Supplied: author-emailmark is gone, because the email now exists.
Limits in 0.8.0
- Merges are not inferred. Subversion’s
svn:mergeinfois not read; a merge commit is not detected, and no Git merge commit is written. Each branch line is a plain, single-parent chain. - Non-UTF-8 annotated-tag messages are refused, named in the pre-flight report before anything is
written:
git fast-importhas noencodingcommand for a tag, unlike a commit message. - Not supported: LFS, SHA-256 object-format repositories, incremental or continuous synchronization,
pushing to a hosting service, and
git-svnmetadata. All are out of scope for this release. Submodules are supported (RFC 021): see “Submodules” above.
Evidence
The full corpus run — every source kind, against a real repository, with encode git’s own check and a
real git fsck --strict — is in tools/bench/README.md, “Result — Git target (RFC 019 D-8)”. In
summary: every run’s check gave corresponds, every fsck was clean, and for Git and Subversion the
result’s trees, authors, committers and times were independently compared against the source and found
identical (differing only by Subversion’s svn:keywords expansion, which is expected). The table also
has the method, so a later run can be compared under the same conditions.
IR artifact format — contract 0.4.0
This is the published wire contract for a brygge IR artifact (requirement PU-3): everything a foreign
encoder or reader needs to produce or consume one, without linking brygge-ir itself. It is normative —
brygge-ir’s own codec (crates/brygge-ir/src/canon.rs, model.rs, artifact.rs) implements exactly
what is written here (RFC 011, §2).
Design intent (RFC 011 D-1): tagged records with a critical bit, a strict canonical form — one
logical value has exactly one valid byte encoding — and a digest over the stored bytes, never a
re-encoding. Strictness is the integrity guarantee: an implementation that accepts a non-canonical byte
string would let two different byte strings mean the same value, defeating content-addressing
(AtomId/BlobId) and the artifact’s own digest.
1. Primitives
| Primitive | Encoding |
|---|---|
uvarint | Unsigned LEB128, minimal: the last byte (continuation bit clear) is never 0x00 unless it is also the first byte. A reader rejects any other encoding (a “trailing 0x80-continued zero”) as non-canonical. |
svarint | Zig-zag encode the signed value to an unsigned one ((v << 1) ^ (v >> 63)), then uvarint. |
bytes | The field’s value bytes, exactly as given — no length prefix of its own. The length comes from the enclosing field header. |
text | bytes that must be valid UTF-8. |
id32 | Exactly 32 raw bytes — no length prefix (the width is fixed by the schema). |
list<T> | uvarint(count), then count items back to back, each a record, an enum, or id32, as the schema for that list says. |
map | uvarint(count), then count entries of uvarint(klen) ‖ key(text) ‖ uvarint(vlen) ‖ value(text), with keys strictly ascending by byte value. |
| record | uvarint(n), then n fields, in strictly ascending tag order. |
| field | uvarint(tag) ‖ uvarint(len) ‖ value — exactly len bytes of value. tag = (id << 1) | critical (critical is 0 or 1). |
| enum | uvarint(variant) ‖ record — the variant’s own fields (a payload-less variant is the empty record, one byte: 0x00). |
2. Canonical rules
Every rule below is enforced on read. Violating one is a decode failure (Error::NonCanonical in
brygge-ir’s own reader) — never silently accepted, never repaired.
- A required field is always present, even when its value is zero or empty.
- An optional field that is absent is omitted — never present with an empty/sentinel value.
- A list (or
map) field that is empty is omitted — never present withcount = 0. - Field tags within one record are strictly ascending — no duplicate, no descending pair.
- Every varint is minimal (§1).
- Every declared length is exact: a field’s value, a record’s own field-count-implied span, a list item — none may be shorter or longer than what its length says.
- There are no trailing bytes: not after a record’s last field, not after a field’s value, not after the container’s blob store.
- Every field defined in contract 0.2.0 has
critical = 1. (The critical bit exists for a future minor version to add a non-critical field additively — see §4.) - Unknown fields:
- an unrecognized id with
critical = 1fails the read (Error::UnknownCriticalField { record, tag }) — this build cannot safely ignore a field that might change the record’s meaning; - an unrecognized id with
critical = 0is skipped by its declared length, and counted (surfaced asDecoded::skipped_non_critical_fields) — informational only, since a skipped field is, by construction, one that cannot change what the artifact claims.
- an unrecognized id with
3. Container (RFC 018 D-1: compact artifacts)
"BRYGGEIR" (8 bytes)
· format: u8 = 2
· version: uvarint(major) ‖ uvarint(minor) ‖ uvarint(patch) -- 0, 4, 0
· digest: 32 bytes
· metadata frames: frames
· blob table: uvarint(count) ‖ ( id32 ‖ uvarint(raw_len) )* -- in store order (§3b)
· blob frames: frames
frames := uvarint(nframes) ‖ frame*
frame := uvarint(codec) ‖ uvarint(raw_len) ‖ uvarint(stored_len) ‖ <stored bytes, exactly stored_len>
codec := 0 (stored: the bytes as they are) | 1 (DEFLATE, RFC 1951, raw — no zlib header or checksum)
The logical stream is what the digest covers, and what every length and content byte above is defined by (not necessarily stored as, when a frame is DEFLATE-compressed):
version bytes ‖ uvarint(meta_len) ‖ <Ir record, exactly meta_len bytes>
‖ uvarint(count) ‖ ( id32 ‖ uvarint(raw_len) )*
‖ <every blob's bytes, concatenated, in store order>
meta_len is not itself stored anywhere — it is the sum of the metadata frames’ own raw_lens, and the
reader recomputes it the same way the digest hash does: by summing those frames as it inflates them.
Frame headers (nframes/codec/raw_len/stored_len) and a Codec::Stored frame’s identical stored
bytes are never hashed directly; only each frame’s decompressed output is, in the order its frame
appears. The blob table’s bytes (count, each id32 ‖ raw_len) are not compressed at all — they sit in
the logical stream exactly as stored.
3a. Packing (recomputed and enforced on read)
- Metadata is cut into frames of exactly 1 MiB (
1 << 20) raw bytes each, the last one shorter. An empty metadata record is impossible (provenanceis required), so there is always at least one frame. - Blobs, in store order (§3b): a blob of 1 MiB or less joins the current frame if the frame’s raw total would stay at or under 1 MiB, or starts a new one if it would not; a blob over 1 MiB is a frame of its own. A blob never spans two frames. An empty blob adds nothing, and belongs to whatever frame is open, or opens a new (empty) one if none is.
- A reader recomputes this plan from the metadata’s total length and the blob table’s
raw_lens, and compares it against the actual frame count and each frame’sraw_len. Any mismatch — two frames that should have been one, a blob split across a frame boundary, a frame holding packed blobs but claiming more than 1 MiB — isError::NonCanonical(“frames do not match the packing rule”).
3b. Store order (RFC 018 D-2)
The blob table’s ids, and the blob frames’ content, are in store order: each blob’s position is set
by its first use — the earliest Add/Modify/Replace naming it, found by walking the Ir’s atoms in
their own canonical order and, within an atom, its ops in their own canonical path order — and blobs are
then sorted by that first use’s path (as bytes), breaking ties by the atom’s index. Grouping by path
rather than by history is what lets a DEFLATE frame compress a file’s successive revisions together. A
reader recomputes this order from the decoded Ir and rejects a table that is not in it.
3c. Bounds (checked before any allocation)
- An unrecognized
codec:Error::Decode("unknown frame codec N"). codec = 0:stored_lenmust equalraw_lenexactly, orError::Decode.codec = 1:raw_lenmust not exceed1032 × stored_len + 64— DEFLATE’s documented maximum expansion — orError::Decode, refused before any output buffer is allocated.- Inflating: the decompressed output must be exactly
raw_lenbytes (no more, no less), and every stored byte must be consumed; an inflate that overruns, under-runs, or leaves stored bytes unconsumed isError::Decode. - Error precedence: a frame that does not inflate at all is reported immediately as
Error::Decode("<metadata|blob> frame N: …")— there is no logical stream left to hash, so the digest is never consulted for this case. Otherwise, the usual rule holds:Error::DigestMismatchis checked, and takes precedence, before any other structural error (packing, store order, referential integrity) is reported — a corrupted-but-correctly-signed artifact is what those structural checks exist to catch; one that is not even correctly signed is reported as that, first.
Blob ids need not be ascending any more (store order, not id order, is canonical — §3b); each id still
equals SHA-256(bytes).
Read order — nothing later is ever inspected before an earlier check has passed:
- The magic. Anything else:
Error::Decode. - The format byte.
1means a pre-release artifact (from before contract 0.2.0/RFC 011):Error::PreReleaseArtifact, and the metadata is never parsed — the wire shape underneath changed too much between formats to read any further safely. Any value other than1or2:Error::Decode("unknown artifact format N"). - The version. A major or minor this build does not list as readable gives
Error::UnsupportedContract { found, supported }(“artifact contract 0.Y is not supported by this build (reads 0.2, 0.3, 0.4)”). Any patch is accepted. See §4 for the exact acceptance rule. - Every frame, inflated (§3c) — immediate refusal here bypasses the digest, as noted above.
- The digest, over the logical stream reconstructed above. A mismatch:
Error::DigestMismatch, before any of the checks below. - The metadata — the
Irrecord (§5). - The blob table’s packing and store order (§3a/§3b).
- The structural checks (§6) — canonical order and referential integrity across the whole artifact.
4. Version acceptance (RFC 011 D-3, widened by RFC 018 D-7)
While the contract’s major version is 0: a breaking change (a critical field or variant added,
changed, or removed) bumps the minor (0.y); a purely additive, non-critical-only change bumps
only the patch (0.y.z). A reader accepts a minor listed in its own build’s READABLE set — any
other y is refused with the message above — and within an accepted 0.y, unknown non-critical fields
are skipped per rule 9. Once the major reaches 1 (a brygge 1.0 release), the familiar rule resumes:
major is breaking, minor is additive, and a reader accepts any minor within its own major.
brygge-ir’s CURRENT (what it writes) is 0.4.0; READABLE (what it reads) is {0.2, 0.3, 0.4} — RFC 018 D-7 OQ-2 (0.2.0, the layout §8 describes) and RFC 021 D-2 (0.3.0, no longer written, but
still read exactly as §3 describes). A build that writes 0.4.0 keeps reading both prior minors.
Decoded::digest documents every contract’s digest definition together:
§3 for 0.3.0 and 0.4.0 (the same framed layout — see §5’s PathOp for the one place their metadata
differs), §8 for 0.2.0.
5. Records
Every field below is critical = 1 (rule 8). “req” = required (rule 1); “opt” = optional (rule 2);
“list” = a list/map, omitted when empty (rule 3).
Ir (the metadata root)
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | atoms | list<ChangeAtom> | list |
| 2 | refs | list<RefRecord> | list |
| 3 | provenance | ImportProvenance | req |
| 4 | dropped | list<DropRecord> | list |
| 5 | flags | list<Flag> | list |
| 6 | transforms | list<TransformRecord>, oldest first | list — RFC 018 D-5; omitted for a decoder’s own artifact (no chain); at most 64 records (Error::NonCanonical, checked at decode time) |
ChangeAtom
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | id | id32 | req |
| 2 | parents | list<id32>, in source order | list |
| 3 | ops | list<PathOp> | list |
| 4 | copies | list<CopyRecord> | list |
| 5 | metadata | MetadataClaims | opt — omitted when every claim is absent |
| 6 | source | SourceIdentity | req |
| 7 | status | EpistemicStatus | req |
AtomId (field 1’s value) = SHA-256 over the canonical encoding of this record without field 1:
that is, uvarint(n-1) followed by fields 2–7 (whichever of them are present), in the same ascending
order. A reader recomputes this from the other six fields and rejects a mismatch.
PathOp (enum)
What is at a path is a choice in the model (brygge_ir::model::Content: Blob { blob, mode } or
Submodule { commit } — RFC 021 D-1), but the wire for it is flat and additive, not a nested
record (review 186): a blob is fields 2 and 3, exactly as before this RFC; a submodule is the new field
5. The two are mutually exclusive — a record naming both, or naming neither (for any variant but
Delete), is Error::NonCanonical. Because a blob entry’s own fields are byte-for-byte unchanged, an
atom holding only blobs hashes to the exact same AtomId under contract 0.4.0 as it did under 0.3.0 —
this RFC changes no existing identity, only adds a new one.
| Variant | Name | Fields |
|---|---|---|
| 0 | Add | {1 path: text req, 2 blob: id32, 3 mode: uvarint, 4 status: EpistemicStatus req, 5 submodule: bytes} — exactly one of {2 and 3} or {5} |
| 1 | Modify | {1 path, 2 blob, 3 mode, 4 status, 5 submodule} (same shape and rule as Add). Whether a Modify’s kind matches what was already at the path is not a wire-canonicity rule this page states — it is an IR-level honesty rule brygge verify’s replay enforces (a change of kind must be a Replace), over and above what this format page’s reader alone can check. |
| 2 | Delete | {1 path req, 4 status req} (no content at all) |
| 3 | Replace | {1 path, 2 blob, 3 mode, 4 status, 5 submodule} (same shape and rule as Add; RFC 011 D-7 — a source that distinguishes “replace in place” from “modify”, widened by RFC 021 D-1 to also cover a change of kind between a blob and a submodule) |
Field order. Every record’s fields are written in strictly ascending tag order (rule 4), which is
field-id order here, not the order the table lists them in: a blob entry writes 1, 2, 3, 4; a
submodule entry writes 1, 4, 5 — status (field 4) comes before submodule (field 5), even though
it comes after blob/mode (fields 2/3) in a blob entry.
submodule (field 5, bytes, RFC 021 D-1). The pinned commit id of another Git repository, exactly
as the source stated it: 20 bytes for a SHA-1 repository, 32 for SHA-256 — any other length is
Error::NonCanonical. brygge never reads, fetches, or verifies that repository; the reference is
carried exactly as the source recorded it, nothing more. This build’s own Git decoder does not yet
produce one (that is batch G); the reader and every other consumer are ready for one regardless.
Readers, by contract:
- 0.2.0 and 0.3.0 recognize fields 1–4 only. Field 5 is unknown to them: naming it is
Error::UnknownCriticalField { record: "PathOp", tag: 5 }, exactly as any other unrecognized critical field would be (rule 9) — never silently read as, or mistaken for, a submodule. - 0.4.0 recognizes fields 1–5.
CopyRecord
A copy/rename hint, carried beside the literal ops that produced it (never replacing them). A move
is exactly: from_atom equals the atom’s first parent, and the atom’s own ops delete from.
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | from | text | req |
| 2 | from_atom | id32 | req |
| 3 | to | text | req |
| 4 | status | EpistemicStatus | req |
MetadataClaims
The one-claim rule: author/author_time are what the source attributes the change to; committer/
commit_time are populated only when the source states a distinct recording identity or time.
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | author | Identity | opt |
| 2 | author_time | Time | opt |
| 3 | committer | Identity | opt |
| 4 | commit_time | Time | opt |
| 5 | message | Text | opt |
Identity
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | name | Text | req |
| 2 | Text | opt |
Text
Bytes as the source gave them — not assumed to be UTF-8 just because most sources are.
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | bytes | bytes | req — may be empty |
| 2 | encoding | text | opt — set only when the source declared one; absent never means “UTF-8”, only “not stated” |
Time
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | seconds | svarint | req — seconds since the Unix epoch, as the source stated (may be negative) |
| 2 | offset_minutes | svarint | opt — the source’s own UTC offset in minutes; must fit i16 |
SourceIdentity
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | kind | SourceKind | req |
| 2 | repo_id | bytes | req |
| 3 | atom_id | bytes | req |
| 4 | signatures | list<Signature>, in source order | list |
| 5 | extras | list<Extra>, in source order | list |
SourceKind (enum)
| Variant | Name | Fields |
|---|---|---|
| 0 | Git | (payload-less) |
| 1 | Hg | (payload-less) |
| 2 | Svn | (payload-less) |
| 3 | Cvs | (payload-less) |
| 4 | Other | {1 label: text req} |
Signature
One opaque cryptographic signature the source carried over its own object (e.g. Git’s gpgsig), never
verified by brygge.
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | label | text | req — e.g. "gpgsig", "gpgsig-sha256" |
| 2 | bytes | bytes | req |
Extra
One opaque, source-specific datum with no other home in the IR, carried rather than dropped.
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | label | text | req |
| 2 | bytes | bytes | req |
EpistemicStatus (enum)
| Variant | Name | Fields |
|---|---|---|
| 0 | Stated | (payload-less) |
| 1 | Derived | the fields of Derivation, spliced in directly (not wrapped in a sub-field) |
| 2 | Transformed | {1 step: uvarint req, 2 changed: list<text> req, 3 prior: EpistemicStatus req} (RFC 018 D-5) |
Transformed (RFC 018 D-5, batch T): a transform step changed this assertion. step indexes
Ir.transforms (field 6, above); prior is the status this assertion had before
that step — itself Stated, Derived, or (for a multi-step chain) another Transformed, nested as deep
as the chain itself. changed names which part(s) of this assertion the step touched, from a closed
vocabulary (one for each of the three places Transformed may appear):
| Context | Vocabulary |
|---|---|
| An atom’s own status | author, author-time, committer, commit-time, message, ops, copies |
A PathOp’s own status | blob, mode, path — blob also names a change to a submodule’s own commit (RFC 021 D-1 adds no new word for it); mode never applies to a submodule, which has none |
A RefRecord’s own status | annotation, kind, name, target |
A CopyRecord’s own status may never be Transformed at all — copies are not a valid location for it
(§6). changed’s own wire shape is list<text>, but — unlike every other list<T> in this schema —
each item is self-delimiting (uvarint(len) ‖ bytes, the same shape a bare text value would have as
a record field) rather than itself a record or a fixed-size id: nothing else encloses it to say where one
item ends and the next begins. changed is non-empty and strictly ascending by the item’s own text (so no
part repeats).
Derivation
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | kind | DerivationKind | req |
| 2 | by | text | req |
| 3 | decoder_version | text | req |
| 4 | params | map | list — omitted when empty |
| 5 | confidence | uvarint | opt — must be ≤ 100 |
DerivationKind (enum)
| Variant | Name | Fields |
|---|---|---|
| 0 | InferredRename | (payload-less) — required params: rename_algorithm, rename_threshold |
| 1 | ReconstructedChangeset | (payload-less) — required params: window_secs, cluster_keys (date_rule from the CVS decoder’s own handoff onward) |
| 2 | ReconstructedBranch | (payload-less) — required params: layout or source |
| 3 | InferredMerge | (payload-less) |
| 4 | NormalizedMetadata | (payload-less) |
| 5 | Other | {1 note: text req} |
RefRecord
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | name | text | req |
| 2 | kind | RefKind | req |
| 3 | target | id32 | req |
| 4 | status | EpistemicStatus | req |
| 5 | source | SourceIdentity | opt |
| 6 | annotation | Annotation | opt |
RefKind (enum)
| Variant | Name | Fields |
|---|---|---|
| 0 | Branch | (payload-less) |
| 1 | Tag | (payload-less) |
| 2 | Bookmark | (payload-less) |
| 3 | NamedBranch | (payload-less) |
| 4 | Other | {1 label: text req} |
Annotation
A tag/ref’s own annotation, when the source carries one distinct from the ref pointer itself (e.g. an annotated Git tag object).
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | tagger | Identity | opt |
| 2 | time | Time | opt |
| 3 | message | Text | opt |
DropRecord
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | class | LossClass | req |
| 2 | what | text | req |
| 3 | reason | text | req |
| 4 | step | uvarint | req iff class is Transform, absent for every other class (RFC 018 D-5) — which transform step (an index into Ir.transforms) dropped this |
LossClass (enum)
| Variant | Name |
|---|---|
| 0 | Representation |
| 1 | AdvisoryUnreliable |
| 2 | Other |
| 3 | Transform — RFC 018 D-5: a transform step dropped this; DropRecord.step names which one |
(All payload-less.)
Flag
One flagged condition (RFC 011 D-8) — drives a CLI’s convention/confidence exit class. Unlike a
DropRecord, nothing here was dropped; a flag says “this import needs attention”, not “this datum is
missing”.
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | kind | FlagKind | req |
| 2 | what | text | req |
| 3 | count | uvarint | req — at least 1 |
| 4 | reason | text | req |
FlagKind (enum)
| Variant | Name |
|---|---|
| 0 | ConventionViolation |
| 1 | BelowConfidenceFloor |
(All payload-less.)
ImportProvenance
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | source | SourceIdentity | req |
| 2 | brygge_version | text | req |
| 3 | decoder | text | req |
| 4 | decoder_version | text | req |
| 5 | params | map | list |
TransformRecord
One transform program’s own run over an artifact (RFC 018 D-5, batch T): what program, what version,
with what parameters, named by consumed — the §3 D-3 digest of the artifact this step read.
Ir.transforms holds these oldest first. A record’s own output is never stored directly: record k’s
output is record k + 1’s own consumed, and the last record’s output is the artifact’s own overall
digest (§3).
| id | Field | Type | Kind |
|---|---|---|---|
| 1 | name | text | req — the plugin-name grammar [a-z0-9][a-z0-9-]*, at most 64 bytes |
| 2 | version | text | req — non-empty |
| 3 | params | map | list — omitted when empty |
| 4 | consumed | id32 | req — the D-3 digest of the artifact this step read |
6. Canonical orders and structural checks
Enforced on read; a compliant writer produces them directly (no reordering pass needed on the read side — a mismatch is a canonical-form violation, not something a reader repairs).
- Atoms are in the builder’s canonical order: topological, with the ready set at each step
ordered by
(source.atom_id bytes, AtomId)— a full, deterministic tiebreak. A reader recomputes this order from the parent links and rejects any artifact whose atoms are not already in it. Atom ids are unique. Every parent — and every copy’sfrom_atom— names an atom strictly earlier in this order, never the atom itself and never a later one. - Ops within one atom are strictly ascending by path (so there is at most one op per path per atom).
Copies within one atom are strictly ascending by
(to, from, from_atom). - Refs are strictly ascending by
(name, kind variant), and every ref’stargetnames an atom present in the artifact. - Dropped entries are strictly ascending by
(class variant, step, what)— RFC 018 D-5 widened this from(class variant, what); an absentstepsorts before any present one, so every non-Transformdrop (which never has astep) sorts ahead of everyTransformdrop at the same class variant (moot in practice, sinceTransformis its own variant, but this is the rule a reader checks). Flags are strictly ascending by(kind variant, what). - Blobs: every op whose content is a blob (
Add/Modify/Replacewith fields 2/3, never a submodule) names one present in the blob store, and every stored blob is referenced by at least one such op — no orphans either way. A submodule’scommit(field 5) is never a blob store reference.
Transform chain (RFC 018 D-5)
A reader enforces these over Ir.transforms and every place EpistemicStatus::Transformed or a
Transform-class drop can appear, beyond each record’s own field shape (§5):
- At most 64 transform records. More is
Error::NonCanonical, checked asIr.transformsis decoded — before any of the checks below run. TransformRecord.namematches the plugin-name grammar ([a-z0-9][a-z0-9-]*, at most 64 bytes) andTransformRecord.versionis non-empty, orError::Decode/Error::NonCanonical.- Every
Transformed.step— on an atom’s, an op’s, or a ref’s own status — is strictly less thanIr.transforms.len(). ATransform-class drop’sstepis checked the same way. Either violation isError::NonCanonical(“…step N is not less than the chain’s length M”). - A nested
prior’s ownstep, ifprioris itselfTransformed, is strictly less than the outer layer’sstep— so a chain’s steps strictly decrease as you walk from the outermostTransformeddown throughpriorto the eventualStated/Derivedbase. Violating this isError::NonCanonical. (Decode also caps how deep thispriornesting may go, at 64 layers, independent of and before the check above against the chain’s real length — a defensive bound against a maliciously deep chain, not a looser rule than the one above.) - Every
Transform-class drop has astep, and no drop of any other class does — enforced whereDropRecorditself is decoded (§5), not here; this section’s own job is only the range check above. Transformed.changedis non-empty, strictly ascending by its own text, and every entry parses against the closed vocabulary for where theTransformedsits (an atom’s own vocabulary, an op’s, or a ref’s — listed withEpistemicStatusin §5). An entry outside that context’s vocabulary isError::Decode(“…uses a part outside its vocabulary”); a non-ascending, duplicate, or emptychangedisError::NonCanonical.- A
CopyRecord’s own status may never beTransformed. Unlike an atom’s, an op’s, or a ref’s own status, a copy record is not a valid location for it at all — anyTransformedfound there isError::NonCanonical(“Transformed may not appear on a copy record’s own status”), regardless of its ownstep/changed/prior. - Contract 0.2.0 has none of this.
Irfield 6 (transforms),EpistemicStatusvariant 2 (Transformed),LossClassvariant 3 (Transform), andDropRecordfield 4 (step) are all 0.3.0 additions (§4). A 0.2.0 artifact that smuggles any one of them in (hand-crafted bytes, since the shared record decoders are contract-oblivious by design — §5’s decoders do not themselves know which contract they are reading) is refused, naming exactly which one:Error::NonCanonical("contract 0.2.0 does not have Ir field 6 (transforms)"),"...EpistemicStatus variant 2 (Transformed)","...LossClass variant 3 (Transform)", or"...DropRecord field 4 (step)".
Two things worth stating plainly about this chain:
- A record’s own output digest is never stored — only implied.
TransformRecord.consumednames the digest of the artifact a step read; the digest of what it produced is simply record k + 1’s ownconsumed, or, for the chain’s last record, the artifact’s own overall digest (§3). There is no separate “output” field anywhere, and none is needed. - A chain’s full losses are enumerable from the artifact alone. Every
Transform-class drop names its ownstep, so a reader can list, for each record inIr.transforms, exactly what that step dropped and why — without running the transform programs themselves, or even knowing what they are beyondname/version/params.
What a reader cannot check alone: whether an atom, op, or ref with no Transformed mark was truly
left unchanged by a given step. The chain’s own rules (above) only constrain what a Transformed mark
claims; they say nothing about an assertion that carries none. Confirming that a step actually touched
only what it marked, and nothing else, needs that step’s own input to compare against — the artifact
TransformRecord.consumed names — which is a check over two artifacts, not one. That is batch P’s own
output-side verification, not something this reader-only format page can state or enforce.
7. Worked example: a minimal one-atom artifact (contract 0.4.0)
Built by hand (no decoder): one atom adding the path a with content hi, no parents, no refs, no
drops, no flags, Stated throughout; ImportProvenance{source: {kind: Git, atom_id: "repo"}, brygge_version: "0.1.0", decoder: "d", decoder_version: "0.1.0"}; the atom’s own source: {kind: Git, atom_id: "r1"}. 232 bytes total, shown here as verified hex (generated and hex-dumped, not estimated):
0000: 42 52 59 47 47 45 49 52 02 00 04 00 00 35 94 03
0010: 6e 13 8b f7 d1 3a 8c c4 57 d2 f4 38 dd c1 1d 0b
0020: 32 a1 ae 41 31 66 06 6a f8 3f 8c 1f 01 00 8e 01
0030: 8e 01 02 03 68 01 04 03 20 fb 34 ab c7 0f fe 87
0040: bb 6d 5d 01 28 fe 5c 6e a8 7b c6 22 69 c5 a8 b2
0050: 29 1a 95 78 21 3d 7d 3e 80 07 31 01 00 04 03 01
0060: 61 05 20 8f 43 43 46 64 8f 6b 96 df 89 dd a9 01
0070: c5 17 6b 10 a6 d8 39 61 dd 3c 1a c8 8b 59 b2 dc
0080: 32 7a a4 07 03 a4 83 02 09 02 00 00 0d 0b 03 03
0090: 02 00 00 05 00 07 02 72 31 0f 02 00 00 07 21 04
00a0: 03 0d 03 03 02 00 00 05 00 07 04 72 65 70 6f 05
00b0: 05 30 2e 31 2e 30 07 01 64 09 05 30 2e 31 2e 30
00c0: 01 8f 43 43 46 64 8f 6b 96 df 89 dd a9 01 c5 17
00d0: 6b 10 a6 d8 39 61 dd 3c 1a c8 8b 59 b2 dc 32 7a
00e0: a4 02 01 00 02 02 68 69
Annotated, offset by offset:
| Offset | Bytes | Meaning |
|---|---|---|
0x00–0x07 | 42 52 59 47 47 45 49 52 | Magic, "BRYGGEIR". |
0x08 | 02 | Format 2. |
0x09–0x0b | 00 04 00 | Version: major 0, minor 4, patch 0. |
0x0c–0x2b | (32 bytes) | The digest — SHA-256 of the logical stream (§3), never these stored bytes directly. |
0x2c | 01 | Metadata frames: uvarint(nframes) = 1. |
0x2d | 00 | That frame’s codec: 0 (stored). |
0x2e–0x2f | 8e 01 | raw_len = 142 (two-byte uvarint). |
0x30–0x31 | 8e 01 | stored_len = 142, matching raw_len. |
0x32 | 02 | The Ir record’s own field count: 2 (atoms, provenance). |
0x33–0x35 | 03 68 01 | Field tag 3→id 1 (atoms), length 104: list<ChangeAtom> count 1, the one ChangeAtom at 0x36–0x9c. |
0x36 | 04 | The ChangeAtom’s own field count: 4 (id, ops, source, status). |
0x37–0x58 | 03 20 + (32 bytes) | Field id (tag 3→id 1, length 32) — this atom’s AtomId. |
0x59–0x8b | 07 31 … | Field ops (tag 7→id 3, length 49): list<PathOp> count 1, one Add. |
0x5c | 00 | PathOp variant 0 (Add). |
0x5d | 04 | Add’s own field count: 4 — path, blob (field 2), mode (field 3), status. This is the blob shape: fields 2 and 3 present, field 5 (submodule) absent — contrast §7a. |
0x5e–0x60 | 03 01 61 | Field path (tag 3→id 1, length 1): "a". |
0x61–0x82 | 05 20 + (32 bytes) | Field blob (tag 5→id 2, length 32): 8f43…7aa4, SHA-256("hi"). |
0x83–0x87 | 07 03 a4 83 02 | Field mode (tag 7→id 3, length 3): uvarint(0o100644). |
0x88–0x8b | 09 02 00 00 | Field status (tag 9→id 4, length 2): Stated. |
0x8c–0x98 | 0d 0b … | Field source (tag 13→id 6, length 11): SourceIdentity{kind: Git, repo_id: "", atom_id: "r1"}. |
0x99–0x9c | 0f 02 00 00 | Field status (tag 15→id 7, length 2): the atom’s own status, Stated. |
0x9d–0xbf | 07 21 … | Back in the Ir record: field provenance (tag 7→id 3, length 33): as stated above. |
0xc0 | 01 | Blob table: uvarint(count) = 1. |
0xc1–0xe0 | (32 bytes) | The blob’s id32 — 8f43…7aa4. |
0xe1 | 02 | That blob’s raw_len = 2. |
0xe2–0xe5 | 01 00 02 02 | Blob frames: 1, codec 0 (stored), raw_len/stored_len both 2. |
0xe6–0xe7 | 68 69 | The content, "hi" — the file’s end. |
A reader following §3’s read order would: verify the magic and format; parse the version and confirm it
is in READABLE; inflate the one metadata frame and the one blob frame; reconstruct the logical stream
and recompute its digest, comparing it with 0x0c–0x2b; parse the 142-byte Ir record; check the blob
table’s one entry is in store order and its packing matches §3a’s plan; verify the blob’s content hashes
to its declared id; then run the structural checks of §6 — a single atom with no parents is trivially
“in canonical order”, its Add op’s blob is present, and the one stored blob is referenced by that op,
so nothing is orphaned.
Everything from 0x2c onward in a blob-only artifact like this one is byte-for-byte what a contract
0.3.0 build would write for the same Ir (review 186’s own proof obligation): only the version byte
at 0x0a and the digest at 0x0c–0x2b (which covers the version bytes) ever differ. AtomId —
0x39–0x58 above — is one of the bytes that does not move.
7a. Worked example: a submodule entry (RFC 021 D-1)
The genuinely new shape: one atom adding a submodule at path m, pinning a 20-byte commit id, no
parents, no refs, no drops, no flags, Stated throughout; the same provenance and atom source as §7.
No blob is stored at all — a submodule has none. 175 bytes total, shown here as verified hex:
0000: 42 52 59 47 47 45 49 52 02 00 04 00 42 a1 78 b3
0010: e9 4d 78 50 33 72 c1 37 b1 c5 27 b1 e2 da a2 41
0020: a9 76 e9 58 00 99 8b 74 4e 70 b2 ff 01 00 7d 7d
0030: 02 03 57 01 04 03 20 c5 cc 23 8c 79 fb f4 dc 9a
0040: 52 9d e8 b7 5f ff ea 78 e9 99 d5 f1 1d 93 f2 2c
0050: 7e 12 32 ae c1 30 d7 07 20 01 00 03 03 01 6d 09
0060: 02 00 00 0b 14 8f 43 43 46 64 8f 6b 96 df 89 dd
0070: a9 01 c5 17 6b 10 a6 d8 39 0d 0b 03 03 02 00 00
0080: 05 00 07 02 72 31 0f 02 00 00 07 21 04 03 0d 03
0090: 03 02 00 00 05 00 07 04 72 65 70 6f 05 05 30 2e
00a0: 31 2e 30 07 01 64 09 05 30 2e 31 2e 30 00 00
| Offset | Bytes | Meaning |
|---|---|---|
0x00–0x0b | — | Magic, format 2, version 0.4.0 — as §7. |
0x0c–0x2b | (32 bytes) | The digest, over this artifact’s own logical stream. |
0x2c–0x2f | 01 00 7d 7d | Metadata frames: 1, codec 0 (stored); raw_len and stored_len are each the single-byte uvarint 0x7d = 125 (both under 128, so each fits in one byte — unlike §7’s two-byte 142). |
0x30 | 02 | The Ir record’s own field count: 2 (atoms, provenance). |
0x31–0x33 | 03 57 01 | Field atoms (tag 3→id 1, length 87): list<ChangeAtom> count 1, the one ChangeAtom at 0x34–0x89. |
0x34 | 04 | The ChangeAtom’s own field count: 4 (id, ops, source, status). |
0x35–0x56 | 03 20 + (32 bytes) | Field id (tag 3→id 1, length 32) — this atom’s AtomId. |
0x57–0x78 | 07 20 … | Field ops (tag 7→id 3, length 32): list<PathOp> count 1, one Add. |
0x5a | 00 | PathOp variant 0 (Add). |
0x5b | 03 | Add’s own field count: 3 — path, status, submodule (field 5). Not 4: fields 2 and 3 (blob/mode) are absent entirely, not merely zero. |
0x5c–0x5e | 03 01 6d | Field path (tag 3→id 1, length 1): "m". |
0x5f–0x62 | 09 02 00 00 | Field status (tag 9→id 4, length 2): Stated. |
0x63–0x78 | 0b 14 + (20 bytes) | Field submodule (tag 11→id 5, length 20): the pinned commit id, 8f434346…a6d839. This is the one field this RFC adds — note its tag (11) sorts after status’s (9), so it is written last, even though blob/mode would have sorted before status had this been a blob entry (§5’s field-order note). |
0x79–0x85 | 0d 0b … | Field source (tag 13→id 6, length 11): SourceIdentity{kind: Git, repo_id: "", atom_id: "r1"}. |
0x86–0x89 | 0f 02 00 00 | Field status (tag 15→id 7, length 2): the atom’s own status, Stated. |
0x8a–0xac | 07 21 … | Back in the Ir record: field provenance (tag 7→id 3, length 33): as §7. |
0xad | 00 | Blob table: uvarint(count) = 0 — a submodule references no blob, so this artifact’s blob store is empty. |
0xae | 00 | Blob frames: uvarint(nframes) = 0. |
A reader would decode exactly as §7 through the digest check, then: on reaching the one Add op, see
field 5 rather than fields 2/3 and build Content::Submodule { commit }, checking its length is
20 or 32 (here, 20); confirm the blob table is empty and the blob-frame count is 0 (both legitimately
— a submodule-only atom stores no blob), and run §6’s structural checks exactly as before — trivially,
since there is no blob to be orphaned either way.
8. Contract 0.2.0 (read only)
This build still reads contract 0.2.0 (RFC 018 D-7, OQ-2) — the layout before RFC 018’s frames —
but never writes it; write_to only ever produces §3’s contract 0.4.0 (RFC 021 D-2). Kept here
exactly, for a reader that still meets one of these artifacts.
8a. Container
"BRYGGEIR" (8 bytes)
· format: u8 = 2
· version: uvarint(major) ‖ uvarint(minor) ‖ uvarint(patch) -- 0, 2, z
· digest: 32 bytes
· metadata: uvarint(len) ‖ <Ir record, exactly len bytes>
· blobs: uvarint(count) ‖ ( id32 ‖ uvarint(len) ‖ bytes )*
Blob ids are strictly ascending, and each id equals SHA-256(bytes).
The digest is SHA-256 over the stored bytes, from the first version byte to the end of the
input, excluding the 32 digest bytes themselves (i.e. version ‖ metadata ‖ blobs, concatenated
exactly as stored — never a re-encoding, and never frame-wrapped). A mismatch: Error::DigestMismatch,
with the same precedence as §3’s final bullet (checked before any structural error).
8b. Worked example: a minimal one-atom artifact
Built by hand (no decoder): one atom adding the path a with content hi, no parents, no refs, no
drops, no flags, Stated throughout. 219 bytes total, shown here as verified hex (every offset below was
checked against the actual bytes, not estimated):
0000: 42 52 59 47 47 45 49 52 02 00 02 00 1a 02 79 48
0010: a3 e1 7c ae 79 dd f2 14 88 50 10 7f c3 6a 71 81
0020: 49 7d e1 f1 61 15 4f 2d f1 44 7b a2 89 01 02 03
0030: 69 01 04 03 20 7c 58 68 f0 f3 1e 81 5a 16 ae eb
0040: d8 95 ba a8 93 15 e3 38 ab 8e 3b 2d 26 f5 e0 c4
0050: 6e 71 97 ed d6 07 31 01 00 04 03 01 61 05 20 8f
0060: 43 43 46 64 8f 6b 96 df 89 dd a9 01 c5 17 6b 10
0070: a6 d8 39 61 dd 3c 1a c8 8b 59 b2 dc 32 7a a4 07
0080: 03 a4 83 02 09 02 00 00 0d 0c 03 03 02 00 00 05
0090: 01 72 07 02 63 31 0f 02 00 00 07 1b 04 03 0b 03
00a0: 03 02 00 00 05 01 72 07 01 61 05 05 30 2e 31 2e
00b0: 30 07 01 64 09 01 30 01 8f 43 43 46 64 8f 6b 96
00c0: df 89 dd a9 01 c5 17 6b 10 a6 d8 39 61 dd 3c 1a
00d0: c8 8b 59 b2 dc 32 7a a4 02 68 69
Annotated, offset by offset. Rows inside a record are summarised; not every byte has its own row (the
Add op’s inner fields and ImportProvenance’s are not each spelled out, for instance):
| Offset | Bytes | Meaning |
|---|---|---|
0x00–0x07 | 42 52 59 47 47 45 49 52 | Magic, "BRYGGEIR". |
0x08 | 02 | Format 2. |
0x09–0x0b | 00 02 00 | Version: major 0, minor 2, patch 0 — each a one-byte uvarint since all three fit in 7 bits. |
0x0c–0x2b | (32 bytes) | The digest — SHA-256 of everything from 0x09 to the end of the file, excluding the 32 digest bytes themselves (0x0c–0x2b), as §8a states. |
0x2c–0x2d | 89 01 | uvarint(137): the metadata (Ir record) is 137 bytes, spanning 0x2e–0xb6. |
0x2e | 02 | The Ir record’s own field count: 2 (only atoms and provenance are present — refs/dropped/flags are all empty and so omitted, rule 3). |
0x2f | 03 | Field tag 3 → id 1 (atoms), critical 1. |
0x30 | 69 | Field length 105 (one byte). The atoms list spans 0x31–0x99. |
0x31 | 01 | list<ChangeAtom> count: 1. |
0x32 | 04 | The one ChangeAtom’s own field count: 4 (id, ops, source, status — parents/copies/metadata are all empty/absent and omitted). |
0x33–0x34 | 03 20 | Field tag 3 → id 1 (id), length 32: the atom’s AtomId follows, 0x35–0x54. |
0x55–0x56 | 07 31 | Field tag 7 → id 3 (ops), length 49: the ops list spans 0x57–0x87. |
0x57 | 01 | list<PathOp> count: 1. |
0x58 | 00 | The PathOp enum’s variant: 0 (Add). |
0x59 | 04 | Add’s own field count: 4 (path, blob, mode, status). |
0x88 | 0d | Field tag 13 → id 6 (source), length 12 (next byte 0x89): the atom’s SourceIdentity, 0x8a–0x95. |
0x96–0x97 | 0f 02 | Field tag 15 → id 7 (status), length 2: EpistemicStatus, 0x98–0x99 = 00 00 (Stated: variant 0, an empty record). |
0x9a–0x9b | 07 1b | Back in the Ir record: field tag 7 → id 3 (provenance), length 27: ImportProvenance, 0x9c–0xb6. |
0xb7 | 01 | Blob-store uvarint(count): 1. |
0xb8–0xd7 | (32 bytes) | The blob’s id32 — 8f43…7aa4, the SHA-256 of the two content bytes below (this is in fact the well-known SHA-256("hi")). |
0xd8 | 02 | Blob length: 2. |
0xd9–0xda | 68 69 | The content, "hi" — the file’s end. |
A reader following §8a’s layout would: verify the magic and format; parse the version and confirm
0.2.x; recompute the digest over 0x09–end (excluding the digest field itself) and compare; parse the
137-byte Ir record (which recurses into the one ChangeAtom, its ops, source, and status, and the
ImportProvenance); parse the one blob and verify its id; then run the structural checks of §6 — a
single atom with no parents is trivially “in canonical order”, its Add op’s blob is present, and the
one stored blob is referenced by that op, so nothing is orphaned.
Machine-readable output (--format machine)
Every brygge command can print its result in a stable, versioned, line-oriented form for scripts and CI gates, instead of the human report. This page is that contract: the external design’s machine-readable output (CL-07) and report format (CT-04).
1. Format
-
Lines of
key=value, one per line, each ending in a newline, on stdout only. -
Everything else goes to stderr. That includes:
- the faithfulness statement
decodeprints before it runs; - the
wrote <path> (<n> bytes)line; - notes such as “field(s) from a newer contract were not understood”;
- every error and refusal message.
A consumer can read stdout without filtering. On an error or refusal stdout is empty, and the exit code (§4) says what happened.
- the faithfulness statement
-
Keys never contain text from a source repository. Keys are fixed words, fixed labels (listed below), and decimal indexes (
atom.3.id,loss.0.what). -
Naming rule. A key is dot-separated segments in
snake_case(every key matches^[a-z0-9_]+(\.[a-z0-9_]+)*$, which is tested). An enumerated value, a label, iskebab-case. Where a label becomes part of a key, its hyphens become underscores: the labelinferred-renameis counted under the keyderived.inferred_rename. Any text that can come from a source (a ref name, a message, a path, a drop or flag description) appears only as a value. -
Values that can carry source text are percent-encoded.
- Every byte outside the safe set
A-Z a-z 0-9 - . _ ~ / @ : +becomes%XX, with uppercase hex. That includes%,=, space, newline, and each byte of a non-ASCII UTF-8 character. - So an encoded value can never contain
=or a line break, and can never forge a line or a key. - To recover the text, percent-decode the value, then read the bytes as UTF-8.
- The Enc. column below marks the keys whose values are encoded this way. Other values are numbers, lowercase hex, or labels drawn only from the safe set.
- Every byte outside the safe set
-
The order of lines is fixed for a given artifact, as listed in the tables. Indexed groups count up from
0with no gaps. Grouped counts (derived.*,dropped.*,flagged.*) appear in ascending order of their label, and only when non-zero. -
Hex values (
atom.N.id,ref.N.target, and the rest) are lowercase and unencoded. IR ids are 64 hex digits (SHA-256). -
atom.N.source_idis the hex of the source’s own identifier bytes:- a Git commit SHA-1 or an hg changeset node: 40 digits;
- an SVN revision number, as an 8-byte big-endian integer: 16 digits;
- a CVS reconstructed changeset, which has no native id: the hex of its sorted
path@revisionlist, with entries joined by newlines.
2. Versioning
Each block of output starts with the version key that governs it. The versions are independent of the brygge release and of the IR contract.
| Version key | Governs | Current value |
|---|---|---|
report_version | the fidelity report: the lines decode and inspect print (§3.1) | 3 |
inspect_version | the transform-chain section (§3.2) and the per-atom listing inspect --atoms appends (§3.3) | 4 |
verify_version | verify’s lines (§3.4) | 5 |
encode_list_version | encode --list’s lines (§3.5) | 2 |
encode_version | encode’s own banner and exit lines (§3.6) | 1 |
transform_list_version | transform --list’s lines (§3.7) | 2 |
transform_version | transform’s own banner, exit, and result lines (§3.8) | 1 |
encode_git_version | encode git’s pre-flight refusal lines and its <dir>.brygge-report sidecar (§3.9) | 2 |
inspect_authors_version | inspect --authors’s lines (§3.10) | 1 |
transform_authors_version | the built-in transform authors’s own result lines (§3.11) | 1 |
The rule (normative):
- A version is bumped whenever any key or value domain of the output it governs changes:
- a key is added, removed or renamed;
- a label is added to or removed from a value domain;
- the meaning of a key or value changes;
- the order guarantee changes.
- Nothing is changed silently under an unchanged version.
- A consumer checks the version key first, and treats an unknown version as unknown output rather than guessing.
contract_version (in the atom listing) is the artifact’s own IR contract version (RFC 018: this
build writes 0.3.0 but still reads 0.2.0, so an older artifact’s inspect reports 0.2.0, not this
build’s own 0.3.0). It is not an output version.
3. Keys
3.1 The fidelity report — decode and inspect (governed by report_version)
decode prints this after writing the artifact. inspect <artifact> prints the same lines for any
artifact.
| Key | Value | Enc. |
|---|---|---|
report_version | 3 | |
atoms | number of atoms (commits / changesets / revisions) | |
refs | number of refs | |
blobs | number of distinct content blobs | |
content_bytes | total bytes of those blobs | |
skipped_non_critical_fields | fields from a newer IR contract that this build skipped when reading the artifact (always printed; 0 when none, and always 0 from decode) | |
derived.<kind> | count of derived records of that kind, for each kind present. <kind> is one of inferred_rename, reconstructed_changeset, reconstructed_branch, inferred_merge, normalized_metadata, other | |
dropped.<class> | count of drop records of that class, for each class present. <class> is one of representation, advisory_unreliable, other, transform | |
flagged.<kind> | the summed count of flags of that kind, for each kind present. <kind> is one of convention_violation, below_confidence_floor | |
transformed_atoms.<step> | count of atoms a transform marked Transformed at that step, for each step present (RFC 018 D-5). Present only when the artifact has a non-empty transform chain | |
transformed_refs.<step> | as transformed_atoms.<step>, for refs | |
transformed_drops.<step> | as transformed_atoms.<step>, for Transform-class drops |
The Subversion layout, decode only (RFC 020 D-3), governed by its own decode_svn_layout_version,
independent of report_version. Appended after the lines above, present only for decode svn --reconstruct-refs or --branch-lines — absent from every other decode (not Subversion, or Subversion
without either option), which is unchanged.
| Key | Value | Enc. |
|---|---|---|
decode_svn_layout_version | 1 | |
decode.svn.layout.trunk | the trunk container’s path, or . for the whole-repository form (--layout-trunk .) | ● |
decode.svn.layout.branches | the branches container’s path; absent under the whole-repository form | ● |
decode.svn.layout.tags | the tags container’s path; absent under the whole-repository form | ● |
Submodules (RFC 021 D-4), governed by its own decode_submodules_version, independent of
report_version. Appended after the lines above, for both decode and inspect (either prints the
same fidelity report), present only when the history holds at least one submodule — absent entirely
otherwise, so an ordinary repository’s report is unchanged.
| Key | Value | Enc. |
|---|---|---|
decode_submodules_version | 1 | |
decode.submodules.paths | distinct paths that ever held a submodule anywhere in the history | |
decode.submodules.at_tips | distinct paths holding a submodule at any ref’s own target |
3.2 The transform chain — inspect (governed by inspect_version)
Printed right after §3.1’s lines, for any inspect <artifact> call (RFC 018 D-5, batch T) —
unlike §3.3, this section is not gated behind --atoms. It is omitted entirely when the artifact’s
transform chain (Ir.transforms) is empty, which is every artifact brygge itself writes today (RFC 018
D-5: brygge writes no transformed artifact yet) — so a decoder’s own inspect output is unchanged.
| Key | Value | Enc. |
|---|---|---|
transforms | the chain’s length, N | |
transform.<k>.name | step k’s own transform name | ● |
transform.<k>.version | step k’s own transform version | ● |
transform.<k>.consumed | the D-3 digest (hex) of the artifact step k read | |
transform.<k>.changed_atoms | how many atoms carry a Transformed layer naming step k, anywhere in their status chain — an atom with a multi-step chain counts once at each step it actually names, not only its outermost one | |
transform.<k>.changed_refs | as changed_atoms, for refs | |
transform.<k>.dropped | how many Transform-class drops name step k |
Steps appear in chain order, 0 to N - 1. There is no transform.<k>.params.* key in this form — a
step’s own parameters are a human-form-only detail (inspect --atoms’s human rendering, under
show_params); this machine form carries exactly the six keys above, every time.
This section carries no inspect_version= line of its own. The key is printed once, together with
§3.3’s atom listing, whenever --atoms is given; when it is omitted, this section’s keys still appear
(if the chain is non-empty) but with no version line in that call’s own output — a consumer pinning this
section’s schema reads the inspect_version value stated here (4) directly, or adds --atoms to see
the line printed.
3.3 The atom listing — inspect --atoms (governed by inspect_version)
The listing is appended after §3.1’s lines. It does not repeat atoms: every key appears once.
| Key | Value | Enc. |
|---|---|---|
inspect_version | 4 | |
contract_version | the artifact’s own IR contract version, major.minor.patch (this build writes 0.4.0; an older artifact may report 0.2.0 or 0.3.0) | |
atom.N.id | the atom’s IR id (hex) | |
atom.N.status | stated, or derived:<kind> with <kind> a label (inferred-rename, reconstructed-changeset, reconstructed-branch, inferred-merge, normalized-metadata, other) | |
atom.N.status_other | present only when the status is derived:other: the kind’s own name | ● |
atom.N.source_id | the source’s own id for the atom (hex; empty if none) | |
atom.N.ops | number of path operations | |
atom.N.submodule_ops | how many of those ops carry a submodule (RFC 021 D-4); 0 when none | |
atom.N.parents | number of parents | |
atom.N.message | the message’s exact bytes (empty when there is none) | ● |
atom.N.copy.M.from | copy source path | ● |
atom.N.copy.M.from_atom | the IR id of the atom the copy came from (hex) | |
atom.N.copy.M.to | copy destination path | ● |
atom.N.copy.M.status | stated or derived:<kind> | |
atom.N.copy.M.status_other | present only when the status is derived:other: the kind’s own name | ● |
atom.N.copy.M.move | true (the source was deleted in the same atom: a rename) or false | |
ref.N.name | ref name | ● |
ref.N.kind | branch, tag, bookmark, named-branch, other | |
ref.N.kind_other | present only when the kind is other: the kind’s own name | ● |
ref.N.target | the IR id of the atom it names (hex) | |
ref.N.status | stated or derived:<kind> | |
ref.N.status_other | present only when the status is derived:other: the kind’s own name | ● |
loss.N.class | representation, advisory-unreliable, other | |
loss.N.what | what was dropped, with its count | ● |
flag.N.kind | convention-violation, below-confidence-floor | |
flag.N.what | what was flagged | ● |
flag.N.count | how many |
Atoms appear in the artifact’s order (parents before children); copies, refs, drops and flags appear in artifact order.
atom.N.message is byte-exact. Percent-decode it to get the message’s bytes, whatever they are,
including a message that is not UTF-8. (The human form of inspect shows control characters escaped, as
all human output does.) An absent message and an empty one both print an empty value.
3.4 verify (governed by verify_version)
| Key | Value | Enc. |
|---|---|---|
verify_version | 5 | |
verify.skipped_non_critical_fields | fields from a newer IR contract this build skipped when reading the artifact (always printed; 0 when none) | |
verify.check.<name> | pass, fail, or not-checked (the check could not run). <name>, in this order: integrity, structure, replay, derivations, source_invariants, provenance, loss_boundary | |
verify.check.<name>.detail | printed right after its check’s line, only when the check is not pass: why | ● |
verify.authorship | always unverifiable | |
verify.internal | pass if every check passed, else fail | |
verify.against_source | not-run (no --against-source); for Git, hg and SVN corresponds or does-not-correspond; for CVS reproduces or does-not-reproduce; root-corresponds/root-reproduces (RFC 018 D-5: the artifact has a non-empty transform chain, so only its chain’s own root — Ir.transforms[0].consumed — was compared against a fresh decode, never the whole artifact); or not-checked (requested but could not run) | |
verify.against_source.detail | present only when verify.against_source is does-not-correspond, does-not-reproduce or not-checked: why — a version-across-brygge not-checked names the artifact’s own version to re-run with (e.g. decoded by brygge <a>; this build (<b>) decodes differently, which a newer decoder may do legitimately; run `verify --against-source` with brygge <a> for a definite answer) | ● |
verify.against_source.note | present only when the source comparison succeeded with something worth noting (e.g. svnadmin versions differ (<a> vs <b>); the history is identical; or decoded by brygge <a>, re-derived by <b>; the history is identical when the artifact was made by a different brygge version (RFC 018, review 106 V-1); or the decoder's floor changed between the two decodes: added <items>; removed <items> when the two decodes’ provenance.params["floor"] differ — a decoder’s floor is a fact about the decoder, never about the history, so it is aligned before comparing and only noted (review 140); or, for root-corresponds/root-reproduces, always: <N> transform(s) after it were not re-run, with the version note appended too when the versions differed). A note never means failure | ● |
verify.against_target | not-run (no --against-target); corresponds or does-not-correspond; or not-checked (requested but could not run) — RFC 019 D-6: the same comparison encode git runs in process, over a kept repository instead | |
verify.against_target.detail | present only when verify.against_target is does-not-correspond or not-checked: why — for does-not-correspond, up to 20 differences, then a count of the rest | ● |
verify.result | pass, fail (something that ran did not hold), or incomplete (a requested comparison could not run, and nothing failed) |
The seven verify.check.<name> lines always appear, in the order above, each followed by its .detail
when it did not pass. not-run (for verify.against_source/verify.against_target) means “not
requested”; not-checked means “requested or due, but could not run”. --against-source and
--against-target are never both given in one run (a usage error), so at most one of the two is ever
not not-run. verify.result is always last.
3.5 encode --list (governed by encode_list_version)
| Key | Value | Enc. |
|---|---|---|
encode_list_version | 2 | |
encoder.N.target | the plugin’s target name | ● |
encoder.N.path | its resolved, absolute path | ● |
encoder.N.shadowed | true if an earlier PATH directory already has a plugin of this target, or if the target is git (brygge would never run either); else false | |
encoder.N.shadowed_by | present, built_in, only when encoder.N.target is git (RFC 019 D-1: git is a reserved, built-in target, never a plugin, regardless of PATH position) |
Plugins appear in PATH order (and, within one directory, by target name — a directory listing’s own
order is unspecified). On stdout, like every other command’s result; encode --list runs no plugin, so
nothing competes for stdout the way encode <target> itself does (§3.6). (Version 2: git’s entry, if
one is found, is now always shadowed, with the new shadowed_by key; version 1 had neither.)
3.6 encode <target> (governed by encode_version)
encode <target>’s own status — unlike every other command’s machine output — goes to stderr, not
stdout: stdout is the plugin’s, inherited and untouched, for the whole run. Nothing about the plugin’s
own output is in this contract; only brygge’s own banner (printed once, before the plugin starts) and
the line after it ends are.
If the mandatory verify-first check (OQ-4) does not pass, the plugin never starts, and brygge prints
verify’s own lines (§3.4) to stderr instead of this section — look for verify_version, not
encode_version, to tell the two apart.
Otherwise, before the plugin starts:
| Key | Value | Enc. |
|---|---|---|
encode_version | 1 | |
encode.target | the target name | ● |
encode.plugin_path | the plugin’s resolved, absolute path | ● |
encode.banner | always not_part_of_brygge |
After the plugin ends, exactly one of:
| Key | Value | Enc. |
|---|---|---|
encode.exit_code | the plugin’s own exit code (brygge’s own process exits with the same code) | |
encode.signal | Unix only: the signal number that killed the plugin (brygge’s own process then exits 1) |
3.7 transform --list (governed by transform_list_version)
| Key | Value | Enc. |
|---|---|---|
transform_list_version | 2 | |
transformer.N.name | the plugin’s own name | ● |
transformer.N.path | its resolved, absolute path | ● |
transformer.N.shadowed | true if an earlier PATH directory already has a plugin of this name, or if the name is authors (brygge would never run either); else false | |
transformer.N.shadowed_by | present, built_in, only when transformer.N.name is authors (RFC 019 D-4: authors is a reserved, built-in transform, never a plugin, regardless of PATH position) |
The same shape §3.5 (encode --list) uses, over brygge-transform-* plugins instead of
brygge-encode-* ones. On stdout; transform --list runs no plugin. (Version 2: authors’s entry, if
one is found, is now always shadowed, with the new shadowed_by key; version 1 had neither.)
3.8 transform <name> (governed by transform_version)
This section is for an external plugin only. The built-in transform authors (authors is
reserved; §3.11) never runs a plugin, so none of this section’s keys apply to it — it has its own
version and its own, shorter set of result keys instead.
transform <name>’s own status — like encode <target> (§3.6) — goes to stderr, not stdout: the
plugin’s own stdout/stderr are inherited and untouched for the whole run.
If the mandatory verify-first check does not pass, or the input has two atoms sharing one source
identity, the plugin never starts, and brygge prints verify’s own lines (§3.4) — or, for the
source-identity refusal, a single line starting refused: — to stderr instead of this section.
Otherwise, before the plugin starts:
| Key | Value | Enc. |
|---|---|---|
transform_version | 1 | |
transform.name | the plugin’s own name | ● |
transform.plugin_path | the plugin’s resolved, absolute path | ● |
transform.banner | always not_part_of_brygge |
After the plugin ends, exactly one of:
| Key | Value | Enc. |
|---|---|---|
transform.exit_code | the plugin’s own exit code (brygge’s own process exits with the same code) | |
transform.signal | Unix only: the signal number that killed the plugin (brygge’s own process then exits 1) |
On exit 0, once the plugin’s own output has passed every internal check and
brygge_ir::transform::check, exactly these, naming the step check itself just accepted:
| Key | Value | Enc. |
|---|---|---|
transform.step | the new transform record’s own index | |
transform.atoms_changed | how many atoms this step changed | |
transform.ops_changed | how many ops this step changed | |
transform.refs_changed | how many refs this step changed | |
transform.dropped | how many new drops this step made |
If the plugin’s own output fails any check instead, brygge prints one line, the transform's output was refused: <why>, deletes the plugin’s temp output, leaves --out untouched, and exits 50 — none of the
five keys above appear.
3.9 encode git (governed by encode_git_version)
encode git <artifact> --out <dir> (RFC 019) is the built-in, supported encoder — git is reserved and
never looked up as a plugin. Unlike encode <target>’s own banner/exit lines (§3.6), which it still
prints to stderr before a pre-flight refusal, this section’s two outputs are a refusal report
(stderr, in --format’s chosen form) and a sidecar file, <dir>.brygge-report, which is always in
this machine form regardless of --format — it is written once, beside the result, for later reading.
If the mandatory verify-first check (OQ-4) does not pass, nothing below is printed; brygge prints
verify’s own lines (§3.4) instead.
If the pre-flight (D-7) finds any refusal — a mode Git cannot write, two refs colliding on one Git
ref, a non-UTF-8 annotated-tag message, or a ref name git check-ref-format rejects — brygge writes
nothing at <dir>, prints this to stderr, and exits 2:
| Key | Value | Enc. |
|---|---|---|
encode_git_version | 2 | |
encode_git.refusal.N | one refusal’s own text, naming the atom (by source id) or the ref | ● |
If the in-process check (RFC 019 D-6, batch G2) finds any difference between the result and the
artifact — after a real git fast-import, before anything is renamed into place — brygge removes the
working directory, writes nothing at <dir> or its report, prints “the result does not match the
artifact; refusing to write <dir>:” followed by up to 20 differences and then a count, and exits 1.
None of the keys below appear; the comparison itself is verify --against-target’s own (§3.4), which
can run the same check again afterward over a repository brygge did write.
Otherwise, <dir> is written, and <dir>.brygge-report holds:
| Key | Value | Enc. |
|---|---|---|
encode_git_version | 2 | |
encode_git.artifact_digest | sha256:<hex> | |
encode_git.brygge_version | the brygge version that wrote it | |
encode_git.default_branch | the branch --initial-branch named (D-3) | ● |
encode_git.default_branch_existed | true unless the IR had no branch-like ref at all (tags only), in which case this name has no commits | |
encode_git.commits | commits written | |
encode_git.tags | tags written (annotated or lightweight) | |
encode_git.refs | every ref written, tags included | |
encode_git.check | always corresponds — this report is only ever written once the in-process check above has already passed | |
encode_git.dropped.<class> | as dropped.<class> in the fidelity report (§3.1), for the artifact encoded | |
encode_git.flagged.<kind> | as flagged.<kind> in the fidelity report (§3.1) | |
encode_git.submodules.paths | as decode.submodules.paths above (RFC 021 D-4); present only when the artifact holds at least one submodule | |
encode_git.submodules.at_tips | as decode.submodules.at_tips above; present only alongside encode_git.submodules.paths | |
encode_git.supplied.<field> | how many times that field was Brygge-Supplied | ● |
encode_git.altered.<field> | how many times that field was Brygge-Altered | ● |
encode_git.unplaced_ref_transform.N | a Transformed mark on a ref with no message of its own to carry it (a lightweight tag, a branch, a bookmark, a named branch, or an Other ref) — one line per such ref, naming it | ● |
brygge’s own exit code is the fidelity class decode would give for the encoded artifact (§4): 0
cleanly, 10 if it carries a recorded (non-representation) drop, 30 if it carries a flag.
3.10 inspect --authors (governed by inspect_authors_version)
inspect --authors <artifact> replaces the default fidelity report (§3.1) entirely — there is nothing
else to decode beyond the artifact itself. Identities are sorted by total count (descending), then by
their own bytes (name, then email), for a deterministic order when counts tie.
| Key | Value | Enc. |
|---|---|---|
inspect_authors_version | 1 | |
authors.N.name | the identity’s claimed name | ● |
authors.N.email | the identity’s claimed email, present only when the identity has one | ● |
authors.N.count.author | how many atoms claim it as their author | |
authors.N.count.committer | how many atoms claim it as their committer | |
authors.N.count.tagger | how many annotated refs claim it as their tagger |
The human form is already in the map file’s own line form (§3.11; <source> = , then a comment with
the non-zero counts): redirect it to a file and fill in each right-hand side.
3.11 transform authors (governed by transform_authors_version)
brygge transform authors <artifact> --map <file> --out <file> [--require-all] (RFC 019 D-4) is the
one built-in transform — authors is reserved and never looked up as a plugin. Unlike transform <name>’s own banner/exit lines (§3.8), there is no plugin to bracket with a banner, so this section has
no “before”/“after” split: either the transform is refused before anything runs, or it completes and
writes this section’s keys.
If the mandatory verify-first check does not pass, or the input has two atoms sharing one source
identity, brygge prints verify’s own lines (§3.4) — or, for the source-identity refusal, a single
line starting refused: — and none of this section’s keys appear.
If the map file itself is malformed, brygge prints each problem, one per line, naming it by its
1-based line number, and exits 2. Plain text, in both formats — a map file is user input, read before
anything about the artifact’s own output format matters.
If any identity the artifact carries is left unmapped, brygge lists it on stderr, with its
per-role counts, in both formats, before anything else runs — authors.N.*’s own shape (§3.10), without
the inspect_authors_version line, since this is a diagnostic aside, not an output block. With
--require-all, this is followed by a refusal and exit 2, and nothing below is printed.
A mapping that matched no identity at all gives one warning line, naming the line, in both formats. It is not a refusal — a shared map may cover several repositories — and does not stop the run.
Once the transform completes and is accepted (the same output check transform <name> itself runs,
§3.8):
| Key | Value | Enc. |
|---|---|---|
transform_authors_version | 1 | |
transform.step | the new transform record’s own index | |
transform.atoms_changed | how many atoms this step changed | |
transform.ops_changed | always 0 — authors never touches an op | |
transform.refs_changed | how many refs this step changed | |
transform.dropped | always 0 — authors never removes anything | |
transform.authors.mapped | how many distinct identities the artifact carries were found in the map | |
transform.authors.unmapped | how many distinct identities were not |
If the transform’s own output somehow fails brygge_ir::transform::check (not expected in practice,
since Edit passes it by construction), brygge prints the same the transform's output was refused: <why> line transform <name> does, deletes its temp file, leaves --out untouched, and exits 50 —
none of the keys above appear.
If a declared resource ceiling (0.8.1) is reached while Edit::finish rebuilds the output —
max_ir_ops, the only one reachable here, since authors touches no tree or copy of its own — brygge
prints the same refused: <what> exceeds brygge's ceiling (<ceiling>) line a decoder’s own ceiling
gives (§4’s row for exit 20) and exits 20; none of the keys above appear either.
4. Exit codes
The exit code carries the outcome class, so a gate can branch without parsing output.
| Code | Meaning | From |
|---|---|---|
0 | clean: completed, with at most representation-class drops (storage layout, nothing of the history) | any command |
10 | recorded loss: completed, and something other than representation was dropped and recorded | decode, encode git, transform authors |
20 | refused: a source feature brygge refuses rather than approximates (a floor feature, named in the message), an unsupported format, or a resource ceiling | decode, transform authors |
30 | flagged: completed, but a condition needs attention (an SVN layout brygge could not follow, or CVS reconstructions under the confidence floor) | decode, encode git, transform authors |
40 | reserved (partial or interrupted import); not produced by 0.1.0 | — |
50 | verify result fail | verify |
1 | runtime failure: unreadable input, I/O, an internal decoder fault; also verify result incomplete. They are told apart by stdout: a runtime failure prints nothing, while an incomplete verify prints its lines ending in verify.result=incomplete | any command |
2 | usage error: bad arguments, or an option given to a source kind it does not apply to | any command |
When several classes apply to one decode, 30 takes precedence over 10.
encode git’s in-process check (RFC 019 D-6, batch G2) sits between the pre-flight and this table’s
own 0/10/30 exit: if it finds any difference, encode git exits 1, the same runtime-failure code
as any other reason it could not finish — nothing in this table’s other rows is reached that run.
verify --against-target follows verify’s own codes above exactly as --against-source does:
50 for does-not-correspond, 1 for not-checked.
encode <target>’s own exit code is not in this table: if its mandatory verify-first check does not
pass, it exits with verify’s own code above; otherwise it exits with the plugin’s own code, unchanged
(or 1, naming the signal, if the plugin was killed by one). A bad or reserved target, or a target not
found on PATH, is 2.
transform <name>’s own exit code is not in this table either, and follows more of its own path
than encode’s does: if verify-first fails, verify’s own code; if the input has two atoms sharing one
source identity, 50; otherwise the plugin runs, and a non-zero exit or a signal passes through exactly
as encode’s does; on a clean plugin exit, 50 if the plugin’s own output fails any check (§3.8), else
the fidelity class decode would have given that same output (this table’s 0/10/30 rows). A bad
name, or a name not found on PATH, is 2; --out naming the same file as <artifact> is also 2.
A resource ceiling (0.8.1) reached while a plugin builds its own output is the plugin’s own exit 20 to
give, the same convention brygge’s own code follows; it passes through here exactly like any other
plugin exit code. For the built-in authors transform, 20 is brygge’s own, given in-process (§3.11).
encode git’s own exit code, unlike the plugin-based commands above, is in this table (§3.9): if
its mandatory verify-first check does not pass, verify’s own code; a pre-flight refusal (D-7) is 2;
otherwise <dir> is written, and the exit code is the fidelity class decode would give for the
encoded artifact — this table’s 0/10/30 rows, encode git added to their “From” column. A
runtime failure (git missing, a subprocess that could not start, an I/O error) is 1, as for any
command.
transform authors’s own exit code is also in this table, and simpler than any plugin-based
command’s (§3.11): verify-first failure or a duplicate source identity follow transform <name>’s own
rule above; a malformed map file, or --require-all refusing an unmapped identity, is 2; 50 if its
own output somehow fails transform::check; otherwise this table’s 0/10/30 rows, transform authors added to their “From” column. There is no plugin to spawn, so there is no signal or
could-not-start case — a runtime failure here is only an I/O error (reading the artifact or the map,
or writing --out), 1 as for any command. --out naming the same file as <artifact> is 2, as for
transform <name>.
5. Examples
Real output of brygge 0.1.0 on a two-commit Git repository with a rename and an annotated tag, decoded with rename inference. Ids depend on the commits’ exact bytes.
brygge decode git repo --out repo.ir --infer-renames --format machine (exit 0):
report_version=3
atoms=2
refs=2
blobs=1
content_bytes=6
skipped_non_critical_fields=0
derived.inferred_rename=1
dropped.representation=3
brygge inspect repo.ir --atoms --format machine (exit 0; the §3.1 lines, then):
inspect_version=4
contract_version=0.3.0
atom.0.id=40c88458f2adab841b4353ad79f99c845609fdc74b5e4d5a3910406f5947175d
atom.0.status=stated
atom.0.source_id=9dcbe4988473481fe5490b12403c1603b1a814c1
atom.0.ops=1
atom.0.parents=0
atom.0.message=first%20commit%0A
atom.1.id=4f14ba03b534cbe7961cd07dc3ac24519610fb75fff2f1b891bb47a862119019
atom.1.status=stated
atom.1.source_id=7c702384c1b99eb1b3a9ccd42daeee929ed8de91
atom.1.ops=2
atom.1.parents=1
atom.1.message=rename%20%3D%20move%0A
atom.1.copy.0.from=a.txt
atom.1.copy.0.from_atom=40c88458f2adab841b4353ad79f99c845609fdc74b5e4d5a3910406f5947175d
atom.1.copy.0.to=b.txt
atom.1.copy.0.status=derived:inferred-rename
atom.1.copy.0.move=true
ref.0.name=master
ref.0.kind=branch
ref.0.target=4f14ba03b534cbe7961cd07dc3ac24519610fb75fff2f1b891bb47a862119019
ref.0.status=stated
ref.1.name=v1
ref.1.kind=tag
ref.1.target=4f14ba03b534cbe7961cd07dc3ac24519610fb75fff2f1b891bb47a862119019
ref.1.status=stated
loss.0.class=representation
loss.0.what=index%20and%20working%20tree
loss.1.class=representation
loss.1.what=packfile%20and%20delta%20layout%2C%20physical%20object%20store
loss.2.class=representation
loss.2.what=reflogs
brygge verify repo.ir --against-source repo --format machine (exit 0):
verify_version=5
verify.skipped_non_critical_fields=0
verify.check.integrity=pass
verify.check.structure=pass
verify.check.replay=pass
verify.check.derivations=pass
verify.check.source_invariants=pass
verify.check.provenance=pass
verify.check.loss_boundary=pass
verify.authorship=unverifiable
verify.internal=pass
verify.against_source=corresponds
verify.against_target=not-run
verify.result=pass
The same artifact truncated to 200 bytes, brygge verify truncated.ir --format machine (exit 50):
verify_version=5
verify.skipped_non_critical_fields=0
verify.check.integrity=fail
verify.check.integrity.detail=brygge-ir%20integrity%20digest%20mismatch%20%28tampered%20or%20truncated%29
verify.check.structure=not-checked
verify.check.structure.detail=the%20artifact%20failed%20to%20decode%3B%20this%20check%20cannot%20run
verify.check.replay=not-checked
verify.check.replay.detail=the%20artifact%20failed%20to%20decode%3B%20this%20check%20cannot%20run
verify.check.derivations=not-checked
verify.check.derivations.detail=the%20artifact%20failed%20to%20decode%3B%20this%20check%20cannot%20run
verify.check.source_invariants=not-checked
verify.check.source_invariants.detail=the%20artifact%20failed%20to%20decode%3B%20this%20check%20cannot%20run
verify.check.provenance=not-checked
verify.check.provenance.detail=the%20artifact%20failed%20to%20decode%3B%20this%20check%20cannot%20run
verify.check.loss_boundary=not-checked
verify.check.loss_boundary.detail=the%20artifact%20failed%20to%20decode%3B%20this%20check%20cannot%20run
verify.authorship=unverifiable
verify.internal=fail
verify.against_source=not-run
verify.against_target=not-run
verify.result=fail
Writing an encoder
brygge’s half of the pipeline ends at the IR artifact (requirement PU-3): a decoder reads a source
repository and writes an artifact; inspect/verify read it back and report on it; an encoder reads
it and produces something in a target system. brygge supports exactly one encoder itself, brygge encode git (RFC 019) — this page is for whoever writes another, on brygge-ir alone, for any other target, run
as an external plugin (brygge encode <target>, §6).
It assumes you know Rust and your target format, but have never read brygge’s own code. The one real
worked example is brygge’s own built-in encoder, crates/brygge/src/encode_git/ (IR → a git fast-import stream) — complete, tested against real fixtures from all four of brygge’s decoders, and
worth reading alongside this page: every rule below is one it actually follows. (Its earlier,
unsupported form, examples/encode-git, RFC 017, is retired; its logic moved here when RFC 019 made
git a supported, built-in target rather than a plugin.)
1. Reading an artifact
let decoded = brygge_ir::from_file(&artifact_path)?; // or `read_from` over any `Read + Seek`
let ir: &brygge_ir::Ir = &decoded.ir;
Before from_file/read_from return anything, they have already checked, in this order (normative in
the IR artifact format):
- the container’s magic and format byte;
- the contract version — an unknown contract is refused (
Error::UnsupportedContract), before anything else is even attempted; this build writes contract0.4.0and still reads0.2.0and0.3.0(RFC 018 D-7, RFC 021 D-2); - the integrity digest — nothing below is accepted before it matches (
Error::DigestMismatch). For a0.3.0or0.4.0artifact (compact artifacts, RFC 018 D-1) this is the SHA-256 of the logical (decompressed) content, never of the on-disk, possibly-DEFLATE-compressed bytes; a0.2.0artifact’s digest is the prior definition, over the stored bytes directly.Decoded::digestis always the one the reader actually checked, whichever contract it is; - the metadata’s and blob store’s canonical form — every atom id unique, every parent/ref target
known, no orphan or missing blob, and (for a
0.3.0or0.4.0artifact) the blob table in store order — see §2 — rather than ascending by id; - each blob’s own content address — a blob’s bytes are hashed and checked against its claimed id as they stream past.
So by the time you have a Decoded, the Ir inside it is exactly what the artifact’s own digest and
every blob’s own content address vouch for. A blob read later is re-hashed against its content address
too (the artifact-backed ContentStore): if the underlying file changes after the pass that verified
it, the next read of that blob returns a typed ArtifactChanged error, never silently-different bytes.
Read blobs one at a time, with ContentStore::get — the whole point of the artifact-backed store
(RFC 015 D-3/D-4) is that nothing beyond the metadata and a small index needs to be in memory at once;
buffering every blob up front throws that away for no benefit.
What is at a path is a choice (RFC 021 D-1). PathOp::content() returns Option<&Content>, and
Content is Blob { blob, mode } (ordinary file content) or Submodule { commit } (a pinned reference
to a commit in another Git repository, which brygge never reads). There is no accessor that collapses a
submodule into a BlobId — your match on Content must cover both. Hold a submodule, or refuse it by
name; never write it as a file. A submodule’s commit is not file content, and treating it as such
would silently misrepresent what the source recorded.
Migrating from before 0.4.0: PathOp::Add/Modify/Replace used to carry blob: BlobId and
mode: u32 directly; they now carry content: Content. Where you matched PathOp::Add { blob, mode, .. }, match PathOp::Add { content: Content::Blob { blob, mode }, .. } instead (refusing or otherwise
handling the Content::Submodule case explicitly) — your encoder will not compile against the new
brygge-ir until it does.
Two shapes this match can take, each valid depending on what your target can hold:
#![allow(unused)]
fn main() {
// Hold it — a target with its own gitlink-like concept (`encode git` does this):
match content {
Content::Blob { blob, mode } => write_blob(blob, mode)?,
Content::Submodule { commit } => write_gitlink(commit)?,
}
// Refuse it by name — a target with nothing to hold it in:
match content {
Content::Blob { blob, mode } => write_blob(blob, mode)?,
Content::Submodule { .. } => return Err(Refusal::Submodule { path: path.clone() }),
}
}
Either is honest. Writing a submodule’s commit bytes as if they were file content is not.
2. The order
ir.atoms is already in canonical order: parents before children. You do not need to sort or
topologically walk it yourself — one pass, in the given order, is enough to know that every atom’s
parents have already been seen. Process ir.refs after every atom (every ref’s target atom is already
behind you), then surface the loss boundary (ir.loss) and flags (ir.flags) to whoever is watching —
see §3.
If your encoder reads every blob in bulk rather than lazily per op (an encoder for a target with its own
content store, for instance), use brygge_ir::artifact::store_order(ir) for the order to read them in:
it is the same order a 0.3.0 artifact’s blob frames are packed in, so reading in that order touches
each compressed frame exactly once, instead of re-inflating one repeatedly out of order.
encode_git reads every blob this way, before writing any commit.
3. The honesty obligations of an encoder
brygge’s IR distinguishes what a source stated from what a decoder derived
(EpistemicStatus) and records what it explicitly dropped (ir.loss) rather than silently omitting
it. An encoder’s job is to carry that distinction into the target, not to flatten it:
-
Carry
Derivedmarks and their parameters into the target, or say they were dropped. EveryDerivedassertion names its kind and the exact parameters that produced it (DerivationKind). If your target has nowhere to put that (no trailer, no note, no custom field), say in your own output, in words, that something was inferred and dropped — never let it disappear without a trace.encode_gitputs oneBrygge-Derived: <scope> <kind> <params>trailer per derivation on the commit it concerns.Brygge-Derived: atom reconstructed-changeset window_secs=180,cluster_keys=author+message,date_rule=… -
Carry every
Transformedmark, with its step, record name, version, and changed parts, and its prior status — recursively, sincepriorcan itself beTransformedorDerived— or say in the target that it was dropped.EpistemicStatus::Transformed(RFC 018 D-5) names which transform step (Ir.transforms[step]) changed an atom’s, an op’s, or a ref’s assertion, and what it changed (changed);prioris what the assertion was before that step, which may itself need the same treatment one or more layers down. If your target has nowhere to put a step’s own name/version (no trailer, no note, no custom field), say so in your own output, the same way you would for a droppedDerivedmark. Also report the whole chain to the user, human-readably, once per run —inspectalready does this for the artifact alone; your encoder’s own run is the moment that chain actually reaches a target, so say which steps ran and what each one’s ownconsumeddigest was. -
Never invent a value the IR does not carry. A missing committer, a missing time zone, a missing email — if your target’s format requires something the IR left absent (most targets require more structure than the IR promises, by design — see §5), you may supply a placeholder, but you must mark that you did.
encode_gitadds oneBrygge-Supplied: <fields>trailer naming exactly what it invented (for examplecommitter, commit-time-zone), and never writes that trailer when nothing was supplied. -
Mark a value you had to change, even when the IR did carry it — distinctly from one you invented. A target’s own syntax can force a change on a value the IR stated in full: Git’s line-oriented identity syntax cannot carry a literal newline, an angle bracket, a NUL, or non-UTF-8 bytes, so
encode_gitfolds, strips, or replaces them to write the line at all. That is not invention — the IR carried a real value — but it is not exactly what the source said either, so it gets its own trailer,Brygge-Altered: <field> (<why>), never folded intoBrygge-Supplied::Brygge-Altered: author-name (not UTF-8, replaced), author-email (newline folded) -
Report the loss boundary and flags.
ir.loss.droppednames every class of thing the decoder explicitly chose not to carry, and why;ir.flagsnames conditions that need the user’s attention (a convention violation, a confidence floor).brygge_ir::summaryturns both, plus the derived counts, into oneFidelityReport— render it (render_human/render_machine) and show it to whoever is running your encoder, the same waybrygge inspect/verifyalready do.encode_gitprints it to stderr once, after writing its main output. -
Present the result as your own work, never as something brygge verified. brygge verified the artifact — its integrity, its canonical form, every blob’s content address. It verified nothing about what you do with it. Label your output as such, everywhere a user would see it: your
--help, yourREADME, and (unless your target format has no notion of a commit message to put one in) a trailer on every commit naming your encoder and its version, the wayBrygge-Encoded: brygge <version> from <source kind>does for the built-in one.examples/transform-authors(a still-unsupported example, for a transform, not an encoder) states it the same way: “an unsupported example; not part of brygge.” Say the equivalent for your own encoder, with your own target’s name in place of “example,” so nobody mistakes your plugin’s output for brygge’s own claim.
4. Versioning
Pin the IR contract version your encoder supports (brygge_ir::version::CURRENT is the one the
brygge-ir you built against produces) — never the brygge tool’s own release version. The two move on
different schedules (IX-07): a contract version changes only when the wire format itself does, so
several releases in a row can write the exact same contract (0.8.1 and 0.9.0 both wrote 0.3.0; the
release that carries RFC 021 D-2 moves to 0.4.0). brygge-ir’s own
reader already refuses an artifact whose contract it does not know
([Error::UnsupportedContract][contract]) before parsing a byte of its metadata — you inherit that
refusal for free by reading through from_bytes/read_from/from_file rather than parsing the
container yourself. The full wire format, if you ever do need to parse it directly, is normative in
IR artifact format.
5. Running as a brygge encode plugin
brygge encode <target> <artifact> [-- <plugin arguments>…] runs your encoder as an external plugin
(RFC 017 D-3), found on PATH — brygge does not ship one, does not register one, and does not know
anything about it beyond the convention below.
- The binary name is
brygge-encode-<target>. On Unix, any executable regular file of that name onPATH; on Windows,brygge-encode-<target>.exespecifically — never.bator.cmd, which run throughcmd.exeand its own argument-splitting rules, not the exact bytes brygge spawns with. brygge resolves the path itself and spawns it directly: never the bare name, so the current directory and a source repository are never where it looks (PATHonly, in order, skipping empty and relative entries — not even the directory brygge itself runs from). - The target name is
[a-z0-9][a-z0-9-]*, at most 64 bytes. Anything else is a usage error before any lookup happens.prikkis reserved for the built-in encoder (Track B1, RFC 008) and is never looked up onPATH, even if abrygge-encode-prikkexists there. - The arguments you receive:
brygge-encode-<target> --artifact <artifact> [<plugin arguments>…].<plugin arguments>are exactly what the user wrote after--, verbatim, in order — brygge runs no shell, so there is no quoting or expansion to account for. - Your stdin, stdout and stderr are the user’s, inherited and untouched. Whatever you print to stdout is the user’s output; brygge writes nothing there itself while you run.
- brygge verifies the artifact before it ever starts you (OQ-4): the same checks
brygge verify <artifact>runs (never--against-source). If the verdict is not a cleanpass, brygge prints that report instead and exits withverify’s own exit code (50 for a failed check; 1 for an unreadable file, an unsupported contract, or a pre-release artifact) — you are never started at all. If you read the artifact yourself throughbrygge-ir, you get the same checks over again (includingArtifactChangedif it changes under you); if you parse the bytes yourself, you get nothing from brygge — the guarantee in §1 isbrygge-ir’s, not the file’s. - A banner brackets your run, on stderr, not yours to print: before you start, brygge names you and your resolved path and states you are not part of it; after you end, it states your exit code (or, on Unix, the signal that killed you). Because brygge’s own failures (a bad or reserved target, not found, a failed verify) all happen before that banner, a user who sees it knows the exit code that follows is yours, not brygge’s.
- Your own exit code is passed straight through — brygge’s process exits with it unchanged. If a
signal kills you (Unix), brygge exits
1and names the signal. If brygge cannot even start you (a permission error, a race where the file vanished), that is brygge’s own failure: exit1, with the OS error and the path. brygge encode --list [--format human|machine]shows everybrygge-encode-*plugin found this way, inPATHorder, so a user can see what is actually reachable; one hidden by an earlierPATHdirectory’s plugin of the same target is marked shadowed — the machine form is in Machine-readable output.
6. What brygge does not do for you
brygge supports no third-party encoder — there is no plugin API beyond a process convention (§5), no registry, no compatibility promise for anything you build. And brygge verifies the artifact: its integrity, its canonical form, its content addressing. It never verifies an encoder’s output. Whatever your encoder writes to its target is your own claim, not brygge’s.
Writing a transform
A transform reads a brygge IR artifact and writes another one, derived from it (RFC 018 D-6):
rewriting authors, squashing atoms, dropping a path’s history — anything that changes the IR while
staying the IR. It is a distinct thing from an encoder (Writing an encoder):
an encoder’s output leaves the IR for some other target; a transform’s output is itself an IR artifact,
and must honestly record everything it changed so a later reader — human or brygge transform’s own
check — can see exactly what happened and what did not.
brygge supports no transform itself (it is not part of brygge’s shipped surface) — this page is for
whoever writes one, on brygge-ir alone. The one real example,
examples/transform-authors (a mailmap-style author/committer rewrite), is unsupported and not part of
brygge, but it is complete and worth reading alongside this page — every rule below is one it actually
follows.
1. What a transform is, and is not, allowed to do
A transform may:
- change an atom’s
author,author_time,committer,commit_time, ormessage; - change an existing blob op’s blob or mode (
AtomEdit::set_op_blob/set_op_moderefuse a submodule op by name — RFC 021 D-5: a submodule has neither, and these never turn one into a file), or move any op to a new path; - remove an atom, an op, or a copy, recording why;
- remove a ref, or rename it, or change its annotation, recording why for a removal;
- do nothing at all — an honest no-op step is accepted (see §3).
A transform may not:
- invent an atom, an op, or a ref that has no counterpart in the input — only an input’s own atoms, ops, and refs can ever appear in the output, under the matching rules in §3;
- change what the input already recorded as dropped, or any earlier transform step in the chain —
provenance, flags, and every existing
LossBoundarydrop pass through byte-identical, always; - retarget a ref to an atom that is not the same atom, by identity (
SourceIdentity) — a ref may be removed, or renamed, but not pointed somewhere new; and - change a copy record in place — a copy is removed (recorded) or it survives byte-identical (mapped through the atom matching); there is no partial edit of one.
2. Edit: the sanctioned way to build one
brygge_ir::transform::Edit computes every mark from the difference with the input itself — never
from what you say happened — so a transform built with it passes check (§3) by construction. This is
examples/transform-authors’s entire core:
let mut params = BTreeMap::new();
params.insert("map_sha256".to_string(), BlobId::of(map_bytes).to_hex());
params.insert("map_entries".to_string(), map.len().to_string());
let mut edit = Edit::begin(input, "authors-example", env!("CARGO_PKG_VERSION"), params);
for (in_atom, atom_edit) in input.ir.atoms.iter().zip(edit.atoms()) {
if let Some(author) = &in_atom.metadata.author {
if let Some(new) = remap(map, author) {
atom_edit.set_author(Some(new.clone()));
}
}
// ...committer, the same way...
}
let output_ir = edit.finish()?; // computes every mark, rebuilds, and runs `check` on its own result
Edit::begin takes the input, the step’s own name/version/params (the new TransformRecord), and
hands back a working copy of every atom and ref. atoms()/atom_mut(index) give you an AtomEdit to
change in place (set_author, set_op_blob, move_op, remove_op, …); ref_mut/rename_ref/
remove_ref do the same for refs. Nothing here lets you add an atom or an op the input did not already
have — every setter edits something that already exists.
What is at a path is a choice (RFC 021 D-1): PathOp::content() is Content::Blob { blob, mode } or
Content::Submodule { commit } — never both, never collapsed into a bare BlobId for you. Hold a
submodule, or refuse it by name; never write it as a file. Migrating from before 0.4.0:
PathOp::Add/Modify/Replace used to carry blob/mode directly; they now carry content: Content
— a match on PathOp::Add { blob, mode, .. } becomes PathOp::Add { content: Content::Blob { blob, mode }, .. }, with the Content::Submodule case handled explicitly.
finish() then:
- diffs your working copy against the input to compute exactly what changed, atom by atom and ref by ref;
- rebuilds through
IrBuilder, so every id and canonical ordering is recomputed, never carried over from the input; - writes the new
TransformRecord(consumed= the input artifact’s own digest) and every drop your removals asked for; and - runs
check(§3) on its own result, returningError::Invariantif it ever refuses whatfinishjust built — a bug inEdititself, never in your own edits, since every edit above only ever produces a differencecheckalready accepts.
Removing an atom reparents its children, in order, without duplicates: Edit’s own one policy
choice for what “removed” means for the DAG shape (RFC 018 D-6). If a surviving ref still targets a
removed atom, finish refuses — remove_ref it explicitly instead; there is no retarget to fall back
to.
3. brygge_ir::transform::check: the honesty rule
pub fn check(input: &Decoded, output: &Decoded, name: &str) -> Result<StepSummary, Violation>
Accepts output as an honest transform of input, performed by a plugin named name, only if:
- the chain —
output’s owntransformsisinput’s, unchanged, plus exactly one new record namingnameand consuminginput’s own digest; - everything else passes through wholesale — provenance, flags, and every earlier drop, unchanged;
- atoms are matched by
SourceIdentity— never byAtomId(which is content-derived and changes the moment anything upstream of an atom does) — and every unmatched input atom has exactly oneatomdrop recording it, no more, no fewer; - ops are matched by path within each matched atom, and copies are matched by
to— the same invent/disappear/drop accounting as atoms, one level down; - every surviving atom’s parents equal the input’s own, mapped through the matching — a removed
parent is substituted by its own parents (§2) — and
ChangedPart::Parentsis marked only when a real substitution happened, never merely because an id value changed; - refs are matched by
(kind, name), with the same marking/drop accounting, plus: a target is compared by the atom’s own identity, not by id value, soChangedPart::Targetis marked only on a genuine retarget; and - blobs are trivially content-addressed — nothing to check beyond what the artifact reader already guarantees.
An honest no-op step is accepted: if nothing in the input actually changed, check still requires
the new transform record to exist (rule 1), but every atom, op, ref, and drop passes through unmarked.
Edit::finish always writes the step it was asked to make, even when every count in its own
StepSummary comes back zero — recording that a transform ran and found nothing to do is itself honest,
and distinct from the transform never having run at all.
duplicate_source_identity(input) — check’s own first rule, exposed separately — lets a caller refuse
an input with two atoms sharing one SourceIdentity before ever running a plugin on it: nothing
downstream could match atoms by it at all. brygge transform’s own CLI does exactly this.
4. The Transform-class drop grammar
A LossClass::Transform drop’s what field follows a fixed grammar, checked at decode time
(Error::Decode on violation — normative in IR artifact format):
| Form | Names |
|---|---|
atom <id> | a removed atom, by its own (input-side) AtomId, 64 lowercase hex characters |
op <id> <path> | a removed op, by its atom’s input id and the op’s own path |
copy <id> <to> | a removed copy, by its atom’s input id and the copy’s own to |
ref <kind> <name> | a removed ref, by kind (branch/tag/bookmark/named-branch/other:<label>) and name |
A single space separates each part; the path or name runs to the end of the line. Every AtomId here is
always the input artifact’s own — a transform’s drops describe what it removed from what it was
given, not anything about its own output’s (different) ids.
5. The params rule
A transform’s own params (on its TransformRecord) are evidence a reader can check without trusting
the transform’s own say-so — a content hash, a count, a flag — never a path, a timestamp, or anything
else that only makes sense on the machine that ran it. examples/transform-authors records
map_sha256 and map_entries, never the map file’s own path: the artifact alone must never reveal
where on disk a transform ran, and a hash is how a reviewer confirms which map ran, by comparing it
against the map file itself.
6. Running as a brygge transform plugin
brygge transform <name> <artifact> --out <file> [-- <plugin arguments>…] runs your transform as an
external plugin (RFC 018 D-6 §3), found on PATH — the same convention brygge encode uses for an
encoder (Writing an encoder §5), with one addition: your own output is written
to a file, and brygge checks it before accepting it.
- The binary name is
brygge-transform-<name>. The same lookup rules asencode’s target:PATHonly, in order, skipping empty and relative entries;.exeonly on Windows, never.bat/.cmd. The same name may exist as both abrygge-encode-<name>and abrygge-transform-<name>plugin with no conflict — the two are looked up under different prefixes. - The name is
[a-z0-9][a-z0-9-]*, at most 64 bytes. Anything else is a usage error before any lookup happens.authorsis reserved for the built-in transform (RFC 019 D-4) and is never looked up onPATH, even if abrygge-transform-authorsexists there —transform --liststill shows it, marked shadowed by the built-in.examples/transform-authorsstays the plugin reference example, under its own name. - The arguments you receive:
brygge-transform-<name> --artifact <artifact> --out <tmp-file> [<plugin arguments>…].<tmp-file>is a private, already-reserved path — write your output there directly (truncate-and-write is fine; brygge reserved the name, not the writing).<plugin arguments>are exactly what the user wrote after--, verbatim, in order; brygge runs no shell. - Your stdin, stdout and stderr are the user’s, inherited and untouched.
- brygge verifies the input artifact before it ever starts you, exactly as
encodedoes, then refuses an input with two atoms sharing oneSourceIdentity(§3) before you run at all. - A banner brackets your run, on stderr, the same shape
encode’s is. - Your own exit code is passed straight through on a non-zero exit or a signal — nothing of yours is
trusted further, and the temp file is removed. On exit
0, brygge reads what you wrote back, runs its own internal checks on it, thenbrygge_ir::transform::check; any failure there removes the temp file, prints why, and exits50—--outis never touched. Only once your output has passed every one of those does brygge rename the temp file over--out, exactly asdecode --outbehaves (silently, atomically overwriting whatever was already there), and print the one result linecheckitself computed. brygge transform --list [--format human|machine]shows everybrygge-transform-*plugin found this way, the same shapeencode --listdoes — see Machine-readable output.
7. What brygge checks, and what it cannot
brygge’s own check verifies the shape of honesty: every change marked, every removal recorded,
nothing invented, nothing disappeared without a trace. It cannot verify that your transform did the
right thing — that a mailmap entry maps to the correct person, that squashing was the squash the user
actually wanted. That judgment is yours; check only ever refuses a transform that lied about what it
did, never one that did something unwise but told the truth about it.
brygge — Requirements Specification
| Document | brygge Requirements (what it must do, must never do, and must decide) |
| Version | v0.3 (for the 0.1.0 release) |
| Date | 2026-09-24 (v0.3: prikk facts re-verified against prikk 0.46.0 on 2026-09-23, and the owner rulings on RFC 113 recorded; v0.2 2026-09-03) |
| Basis | RFC 113 (History import foundations, Accepted; §4.3–§4.5 ruled by prikk’s owner on 2026-09-13) as the governing import contract; prikk reality per the 2026-08-31 audit (prikk 0.27.1), re-verified against prikk 0.46.0 on 2026-09-23 (§11, §12); none of the prikk-side dependencies gate the decode/IR half; project rules in .git-exclude/rules/ |
| Not | a design, a schema, an API, or code. Where a decision belongs to a human, it is named in §11/§12 and left there. |
| ID scheme | PU- purpose · NG- non-goal · PR- preserve rule · HO- honesty rule · VF- verification · ID- idempotence · FA- failure · BN- boundary · IR- IR obligation · SRC- per-source · UD- prikk-side dependency · OQ- open question |
Delivery status (2026-09-24). The decode → IR half is released as brygge 0.1.0 against these requirements for all four named sources (Git, hg, SVN, CVS) — see
development/handoffs/HANDOFF.md,ROADMAP.mdandrfcs/. This document remains the stable contract those decoders satisfy. The encode → prikk half waits on prikk: §11 and §12 record prikk’s state and rulings as re-verified against prikk 0.46.0 on 2026-09-23. prikk decides its import design; brygge informs it (ROADMAP, Track B).
brygge (Norwegian: wharf — where cargo is landed) carries version-control history out of existing systems (Git, Mercurial, Subversion, CVS — and, by design, others) and into a different one, through an intermediate representation (IR) that belongs to no particular system. The pipeline is two deliberately separated halves: decode a source into the IR; encode a target from the IR. The first target is prikk; the IR and decoders are meant to be reusable so other version-control projects can write their own encoders and get import “for free,” and so a new source is a new decoder against the same IR, not a redesign.
Two halves, versioned separately (v0.2). The decode → IR half depends on the source systems, which are decades-stable, and on nothing in prikk. It can therefore be built, tested, and stabilized to a durable contract now, while the encode-to-prikk half waits on prikk-side decisions still open (§11 UD, §12 OQ). This document keeps the two halves’ obligations separable so the first half can reach stability independently — that separation is a requirement (PU-6), not merely a schedule.
The governing sentence, inherited from RFC 113 and binding on everything below: facts derive, judgment is authored, and the join is checked. A migration tool that silently guesses produces history nobody can trust; where approximation is unavoidable, it must be labelled; and every requirement here is written to survive a hostile reader asking “how would anyone know if this were wrong?”
0. The two things a reader must hold before the requirements make sense
(a) prikk records what these systems do not, and cannot be made more precise than its source. prikk’s atom is an operation against node identity — a stable identity for a file across renames and edits. Git has no node identity (renames are inferred at read time); Mercurial records a rename when the author used hg mv/hg cp — a stated fact brygge can carry — but not otherwise, and even then it is a path-level copy, not prikk’s stable cross-history node identity; SVN records path copies, not node identity; CVS has no atomic commit at all. So an importer must either infer what prikk requires or admit it did not have it — and inference is a guess, which prikk’s whole proposition forbids doing silently. Mercurial narrows how often brygge must infer; it does not remove the boundary. This is not a difficulty to engineer away; it is a boundary to record.
(b) prikk’s receiving surface for imports is ruled but not built. This is the single most important fact for scoping brygge, and it is easy to get wrong. RFC 113 §4.1/§4.2 and §3.1 are ruled; the runnable prikk surface behind them is not:
| Thing brygge would need on the prikk side | State in prikk 0.27.1 (the 2026-08-31 audit; §11 has the 0.46.0 state) | Consequence for brygge |
|---|---|---|
An Attestation carrying import provenance | Type defined and gated, never constructed in production; current fields (policy_version, plugin_set_hash, plugin results, Pass/Warn/Fail status) are audit-shaped, not import-shaped — using it for imports “is a format change if so” (RFC 113 §4.1) | brygge cannot assume an import-attestation shape exists; it is a prikk-side dependency (UD-1) |
An Import block kind | Code defined, but currently refused by prikk’s block validator (“Block kind is not authorized”) | brygge cannot produce a prikk-storable import block today — UD-2 |
| Permission to seal imported history, and by whom | Open owner question (RFC 113 §4.4) | brygge must not assume imports can be sealed — OQ / UD-3 |
Unverifiable AUTHOR-signature outcome | Exists and is correct for this (DC-53) | The one piece brygge can rely on today |
The honest reading: brygge can be built and be genuinely useful now for decode → IR, IR inspection, IR-to-IR comparison, and producing a proposed prikk object set for review — but it cannot land verified, sealable prikk imports until UD-1…UD-3 land. Requirements below separate “what brygge owes” from “what brygge is waiting on.”
1. Purpose (PU-…)
- PU-1 — Carry history out of Git, Mercurial, SVN, and CVS (and further sources over time) into an IR that belongs to no system. Decode is the first half of the value and stands on its own: a faithful IR of a source repository is useful before any encoder exists.
- PU-2 — Encode prikk from the IR as the first target, satisfying prikk’s import contract (RFC 113) once its receiving surface exists (UD-1…UD-3). Until then, encode a reviewable proposal, not sealed history.
- PU-3 — Be a reusable VCS-abstraction, not a prikk-only feeder — in both directions. The IR is the reusable core. Targets: a second target’s encoder must be writable against the IR alone, without reading brygge’s prikk encoder and without brygge changing; prikk is the first and most demanding client (it needs node identity and provenance), not the only one, and a snapshot-based target must also be encodable from the same IR. Sources: a new source (the owner names Git, Mercurial, Subversion, CVS, “etc.”) must be a new decoder implemented against the shared IR obligations (§10), not a modification of the IR or of existing decoders. Source-extensibility and target-extensibility are symmetric properties of the same IR; neither may bake in the other side’s assumptions (IR-1/IR-6).
- PU-4 — Make the fidelity of an import legible to the person who ran it and to a later third party — the honesty and verification requirements (§4, §5) are the product, as much as the bytes.
- PU-5 — Carry the dependency weight prikk refuses to. brygge exists because a Git decoder needs
gix(~100 crates) orlibgit2(C), which would be a step change in prikk’s deliberately small audited dependency surface. brygge owns that weight so prikk stays small; this is a purpose because it governs brygge’s boundaries (§8) — brygge’s output must be checkable by a prikk that never links a single brygge dependency. - PU-6 — The decode → IR half is independently stabilizable, and stability is a deliverable. Because decode depends only on the (decades-stable) source systems and not on prikk, the decode/IR half must be able to reach a durable, versioned contract (IX-07 for the IR; a stable tool surface for
decode/inspect/verify) before the encode-to-prikk half is finished — indeed before prikk’s receiving surface exists at all. Every requirement is written so that decode, the IR, inspection, and internal/against-source verification form a complete product on their own (PU-1), with the encoder as a separable consumer. “Stabilize the first half” is therefore a property the requirements must not obstruct: no decode/IR obligation may be defined in terms of a prikk-side dependency (§11).
2. Non-goals (NG-…) — stated as firmly as the goals
- NG-1 — Not a Git/Mercurial/SVN/CVS compatibility or interoperability layer. One-way import, never a wrapper, never reading
.git//.hg/as live storage for a running prikk. (RFC 113 §7.) - NG-2 — Not round-tripping. Exporting prikk (or any target) history back to a source system is a separate project and not implied here.
- NG-3 — Not authorship laundering. No mechanism may make imported history appear natively authored or natively verified. Imported authorship is
Unverifiableby construction, and brygge must never present it otherwise. This is the failure RFC 110 §4 names (“manufactured verification”), and it is the one brygge is most able to commit by accident. - NG-4 — Not a promise of completeness. A refusal of an unsupportable source feature is a feature (§7’s floor), not a bug.
- NG-5 — Not making a source more precise than it was. brygge must never emit an IR record or target object that asserts a guarantee the source did not make (e.g., a recorded rename where the source only had delete+create) unless the record also states that brygge derived it (HO-1).
- NG-6 — Not the target’s authority. brygge does not decide whether an import may be trusted, sealed, or admitted. It produces material about which the target makes those decisions. (§8.)
- NG-7 — Not a general backup or archival tool. The deliverable is history translated into the IR/target, with recorded loss — not a byte-for-byte copy of the source repository.
3. What a successful migration must preserve (PR-…)
The test, from RFC 113 §3.1, is not “everything” (unachievable) and not “what looks important” (drifts). It is: preserve what a future reader’s ability to check something depends on. What that reader checks is faithfulness-to-source, so:
- PR-1 — Content. The actual file bytes at each recorded state. A migration that loses content is not a migration.
- PR-2 — Structure and ancestry. The parent/child relationships between the source’s atoms (commits/revisions/reconstructed changesets), as the source expressed them — including multi-parent merges up to whatever the target’s floor accepts (§7).
- PR-3 — Messages and authorship metadata, as claims not verified facts. Author name/email/time, committer, message text — carried as what the source asserted, never elevated to what the target verified. (This is where NG-3 lives operationally.)
- PR-4 — The source’s own identifiers and signatures, preserved opaquely. A Git commit SHA and its GPG signature, an SVN revision number, a CVS per-file revision tag: these verify nothing in the target, but they are the only cryptographic/identifier link back to the original, and they are what lets a third party check the import against the source it claims to come from (VF-2). RFC 113 §3.1 names this as the field most likely to be dropped as “useless here” and most damaging to lose. brygge must preserve it opaquely, never discard it as unverifiable-in-target.
- PR-5 — The parameters that governed any inference. Which similarity threshold produced a rename, which clustering window produced a CVS changeset, which branch convention was assumed for SVN — recorded so the same output can be reproduced and the judgment reviewed (VF-1, HO-1).
- PR-6 — The import’s own provenance: what source it was made from (source repository identity, source atom identifiers), the brygge version and decoder version, and the encode target and its version. This is what makes an import reproducible and comparable (VF-1) rather than an unaccountable one-time act.
What brygge is permitted to lose — but only if the loss is recorded (PR-loss)
Two classes are safe to omit, per RFC 113 §3.1:
- PR-7 — Representation rather than assertion: packfile layout, delta encoding, index/working-copy state, reflogs — reconstructible or purely local. May be dropped; the class dropped is still stated (HO-2).
- PR-8 — Advisory data known to be unreliable: SVN mergeinfo is the standing example. Preserving wrong data as if authoritative is worse than dropping it — but the drop is recorded (HO-2), because a reader must not mistake “brygge chose not to carry this” for “the source did not have it.”
- PR-9 — The one class never safe to omit silently: anything whose absence makes a remaining claim look stronger than it is. If dropping a datum would let a reader over-trust what remains, it must be carried or its absence loudly stated. This is the load-bearing preservation rule; PR-7/PR-8 are its permitted exceptions, not competitors to it.
4. How honesty is enforced (HO-…)
Honesty is not a report brygge offers; it is a property of every object brygge writes, so that it cannot be skipped, lost in a log, or separated from the history it describes.
- HO-1 — Derived ≠ stated, in the object itself. Any IR record or target object that brygge derived (a rename inferred from similarity, a CVS changeset reconstructed from per-file revisions, an SVN branch inferred from a path copy) must carry, in the record, that it was derived and by what parameters (PR-5). A reader must be able to tell an asserted fact from a brygge judgment without re-running the heuristic — because re-running it is exactly what a different brygge version would do differently (RFC 113 §4.2). “Facts derive, judgment is authored, the join is checked”: the derivation is marked at the operation, not reconstructed at read time.
- HO-2 — The boundary of loss is recorded. Every import states what class of information it dropped and what it derived, so a reader knows the shape of the loss without re-deriving it (PR-7…PR-9). A known limit written down is a property; the same limit unwritten is a defect waiting for whoever trusts the output.
- HO-3 — Authorship is
Unverifiable, surfaced, never dressed up. Imported history is “present, readable, and not verifiable as authored.” brygge’s target encoding must land it in exactly the target’s vocabulary for that (for prikk,Unverifiable), and brygge’s own presentation must never show imported authorship as sound, verified, or native (NG-3). - HO-4 — The fidelity summary is unskippable and travels with the import. The person who ran the import must be told, at the end of a run and durably, what was preserved, what was derived (with confidence/parameters), what was dropped, and what was refused — and this summary must be derivable from the objects themselves (HO-1/HO-2), not a side report that can drift or be deleted. “Where they are told it” is: at completion, and in the import’s own provenance record, such that a later reader recovers the same summary from the imported objects without brygge present.
- HO-5 — No honesty control may be configurable off. Verbosity may vary; the existence of the derived-vs-stated marking, the loss boundary, the
Unverifiablestatus, and the fidelity summary may not be suppressed by any flag. A migration tool whose honesty is optional produces history nobody can trust.
5. Verification — what “faithful” can mean when the source guaranteed less than the target records (VF-…)
“Safely preserved” cannot mean “verified,” because the target cannot verify what the source never signed. It must mean reproducible and comparable (RFC 113 §3).
- VF-1 — Determinism. Re-running the same brygge version over the same source with the same parameters produces the same IR and the same target objects — or the difference is explainable by a stated cause. Determinism is what lets a third party check the claim at all; non-determinism makes “faithful” uncheckable. (Note the tension with content-addressed targets: see UD-4.)
- VF-2 — Round-checkable against the source. Because the source’s own identifiers and signatures are preserved opaquely (PR-4), a third party holding the original source repository can check that brygge’s output corresponds to it — commit-by-commit / revision-by-revision — without trusting brygge. This is the strongest form of “faithful” available, and it is the reason PR-4 is non-negotiable.
- VF-3 — Internally checkable without the source. A reader holding only the import can check: that every derived record is marked (HO-1); that the loss boundary is stated (HO-2); that authorship is
Unverifiable(HO-3); that content and ancestry are internally consistent; and that the provenance record names its source and parameters (PR-6). This does not prove faithfulness-to-source (only VF-2 can), but it proves brygge did not hide anything, which is a distinct and checkable property. - VF-4 — The two claims are never conflated. “prikk verified this” and “this was faithfully imported and prikk verified nothing about its authorship” must be distinguishable by any reader at any time (RFC 113 §3, third point). brygge must make the second claim in a form the target already distinguishes from the first — for prikk, that is
Unverifiableplus provenance-in-an-attestation, not history that looks native. - VF-5 — Faithfulness is defined per source, and the definition is published. Because Git, Mercurial, SVN, and CVS guaranteed different things, “faithful” means something different for each (§7). brygge must state, per source, what faithfulness can mean for it and what it explicitly cannot — so a user’s expectation is set before they run, not corrected after.
6. Idempotence and re-runs (ID-…)
- ID-1 — Re-importing the same source is defined, not accidental. Running brygge twice over the same source must either produce an equivalent result (VF-1) or state precisely why it differs (new brygge version, changed parameters, changed source). “I ran it again and got different history” must never be a silent outcome.
- ID-2 — Re-import is not a merge. brygge does not attempt to reconcile a re-import with a previously-imported-and-then-locally-modified target; that is the target’s history-manipulation surface, not brygge’s (BN-4). brygge’s obligation is a fresh, deterministic translation whose relationship to a prior import is stated (same source + same params + same version → same objects), leaving reconciliation to the target.
- ID-3 — Provenance makes double-import detectable by the target. Because each import records what it was made from (PR-6), a target can recognize that two imports share a source; whether it deduplicates, refuses, or admits both is the target’s decision (BN-3), not brygge’s — but brygge must supply enough provenance for the target to make it.
- ID-4 — Content-addressed determinism caveat. For a content-addressed target (prikk), identical input objects yield identical ids only if every identity-bearing field is itself deterministic. brygge must therefore make every field it controls deterministic (VF-1) and must name every field it cannot (e.g., an import timestamp, if the target’s provenance object carries authoritative time) as a stated non-determinism, not let it silently perturb ids. See UD-4.
7. The sources are not one problem (SRC-…)
brygge must treat each source separately and publish, per source, what faithfulness can mean (VF-5) and what is refused rather than approximated (the floor — an owner decision, OQ-3/§11). Git, Mercurial, SVN, and CVS differ enormously in what they guaranteed, and the IR (§10) exists precisely so those differences are recorded, not flattened. A future source (“etc.”, PU-3) is added as a new decoder that answers these same questions in its own terms.
The four named sources form a difficulty gradient, which is also the recommended build order: Git (a real DAG, identity inferred) → Mercurial (a real DAG, identity often stated) → SVN (revisions atomic, branches by convention) → CVS (no atomic commit at all). Each earlier source de-risks the IR before the next stresses it.
SRC-Git — hard but tractable
- SRC-G1 Content-addressed, atomic commits, a real DAG: content, ancestry, and messages import faithfully as claims.
- SRC-G2 The two hard problems are identity inference (renames: Git records delete+create, prikk wants a node identity — every inferred rename is marked derived with its similarity parameters, HO-1) and the feature floor (submodules, octopus merges beyond the target’s parent limit, replace refs, grafts, shallow clones — refused, not approximated; the exact list is the owner’s, OQ-3).
- SRC-G3 GPG-signed commits: the signature is preserved opaquely (PR-4) and verifies nothing in the target; brygge must never present a GPG-signed Git commit as a verified prikk author (NG-3).
SRC-Hg (Mercurial) — tractable, and epistemically closer to prikk than Git
- SRC-H1 Like Git, Mercurial has content-addressed, atomic changesets and a real DAG, so content, ancestry, and messages import faithfully as claims (PR-1/2/3) with the same discipline as SRC-Git.
- SRC-H2 — Renames are frequently stated, not inferred, and this must be honoured. Mercurial records copy/rename metadata in filelogs (via
hg mv/hg cp, or commit-time similarity the source chose to record). Where the source recorded a rename, it is a source-stated fact and must be carried as stated (not re-derived, not marked derived) — a genuine advantage over Git that reduces the derived-marking burden (HO-1). Where the source did not record it (a plain remove+add), brygge carries delete+create as stated, and only marks a rename derived if it chooses to infer one — with its parameters (PR-5). The IR must be able to hold both “rename, stated by source” and “rename, derived by brygge” as distinct epistemic states (IR-2); collapsing them would throw away exactly the fidelity Mercurial uniquely offers. - SRC-H3 — Mercurial-specific structure needs floor rulings (OQ-3). hg carries concepts with no clean prikk analogue: named branches (a branch name embedded in the changeset) versus bookmarks (movable Git-like refs) — two branch models that may coexist; phases (
public/draft/secret— largely local workflow state, representation not assertion, PR-7); obsolescence markers / evolve (metadata about rewritten changesets — advisory, PR-8); multiple heads per named branch; and.hgtags(tags stored as versioned history, a quirk that is itself content to preserve). brygge must map named branches and bookmarks to the IR’s branch-identity notion without silently privileging one, drop-with-record the representation-only parts (phases, obsmarkers) per HO-2, and refuse-or-flag anything the owner’s floor names (OQ-3). - SRC-H4 Mercurial’s node ids and any commit signatures are preserved opaquely (PR-4) and verify nothing in the target (NG-3).
SRC-SVN — different, not easier
- SRC-S1 Atomic revisions help ancestry, but branches and tags are path copies, not first-class refs — branch identity must be reconstructed by convention (
/trunk,/branches/x,/tags/x) that many real repositories violate. Every reconstructed branch is a derived record (HO-1); a repository that violates the convention must be refused or flagged, never silently mis-branched. - SRC-S2 Mergeinfo is advisory and frequently wrong (PR-8): brygge must not import it as authoritative ancestry; it is dropped-with-record or carried-as-advisory-and-labelled, never promoted to a real merge parent.
- SRC-S3 SVN’s per-path copy semantics do not map to node identity any better than Git’s; the same derived-marking discipline applies.
SRC-CVS — a research problem, and the honest deliverable may be lossy
- SRC-C1 There are no atomic commits. A changeset must be reconstructed from per-file revisions by clustering on author, message, and time window — the
cvs2svn-lineage approach, imperfect by nature. - SRC-C2 A CVS import cannot be more faithful than its reconstruction. Every reconstructed changeset is a derived record carrying its clustering parameters (HO-1), and the fidelity summary (HO-4) must make the reconstruction’s uncertainty prominent, not buried.
- SRC-C3 — The honest position, stated plainly (the task’s hardest ask): a faithful CVS import in the sense VF-2 offers for Git (round-checkable against a canonical source atom) is not achievable, because CVS has no atomic source atom to check against — the changeset is brygge’s construction, not CVS’s record. The honest deliverable is therefore a lossy, explicitly-labelled reconstruction: content and per-file history preserved faithfully; changeset grouping preserved as brygge’s derived judgment, reproducible (VF-1) and reviewable (VF-3) but never claimed as the source’s own fact. brygge must tell a CVS user this before they run (VF-5), so “faithful CVS import” is never a promise brygge made and broke.
8. Boundaries — brygge’s responsibility vs. the target’s (BN-…)
- BN-1 — brygge owns: decode, the IR, encode, and honesty about all three. It is responsible for reading the source correctly, representing it faithfully-with-provenance in the IR, translating the IR into target objects, and making every derivation and loss legible (§4).
- BN-2 — The target owns: admission, trust, verification, and storage. Whether the produced objects are accepted, whether they are trusted, whether they are sealed, and how they are stored are the target’s decisions. brygge produces material about which the target decides (NG-6).
- BN-3 — The provenance interface is the boundary. brygge’s obligation to the target is to supply provenance (PR-6) sufficient for the target to make its admission/trust/dedup/seal decisions; the target’s obligation is to have a place to put it and a policy about it. For prikk that place is an
Attestation(RFC 113 §4.1) — which does not yet fit (UD-1). - BN-4 — brygge never manipulates target history. No merge, rebase, reconcile, or seal on the target’s behalf. A re-import is a fresh translation (ID-2); what the target does with it is the target’s.
- BN-5 — brygge’s dependency weight stops at its own boundary. brygge may depend on
gix/libgit2/SVN/CVS libraries freely (PU-5), but nothing brygge produces may require the target to link any of them. A prikk repository must be able to verify a brygge import using only prikk’s own dependency surface; the import’s checkability (VF-3) must not route through a brygge dependency. This is the concrete meaning of “brygge carries the weight, prikk does not.”
9. Failure behaviour (FA-…)
- FA-1 — Partial imports are recorded, never silently truncated. If an import stops (interrupted run, source error, an unsupportable feature hit mid-stream), what was and was not imported must be stated, and the partial result must be distinguishable from a complete one — a half-imported history that looks whole is a manufactured-verification failure (NG-3).
- FA-2 — A source that violates its own conventions is refused or flagged, never guessed. The SVN-branch-convention violation (SRC-S1) is the archetype: brygge does not silently pick an interpretation. It refuses, or it imports with the violation loudly recorded as a derived judgment (HO-1) the user must accept.
- FA-3 — An unsupportable source feature is refused with a named reason, not approximated. The floor (§7, OQ-3) produces refusals; each refusal names the feature and why it is refused, so the user knows exactly who can migrate and who is told no.
- FA-4 — Interrupted runs leave no ambiguous target state. brygge must not leave the target holding objects that appear complete but are not; because sealing/admission is the target’s act (BN-2), brygge’s safe failure mode is to produce a clearly-incomplete-and-labelled proposal that the target has not admitted, rather than a partially-admitted history.
- FA-5 — Determinism survives failure. Re-running after a failure reproduces the same result up to the failure point (VF-1); a failure is not a source of divergence.
10. The IR’s obligations (IR-…) — requirements on it, not a schema for it
The IR is the reusable core (PU-3) and the place all three honesty disciplines live. Its obligations, as requirements:
- IR-1 — The atom asserts what its source could guarantee, not what a target wants. Designed for faithfulness-with-provenance, not neutrality: a neutral IR converges on “snapshots plus metadata” (the common denominator), which is exactly what prikk is not, and offers nowhere to record that identity inference happened (RFC 113 §3.1). The IR must be able to hold less than prikk wants (a snapshot with no node identity) and to carry the marker that a node-identity encoder will have to infer the rest — so that inference happens in the encoder, visibly, not hidden in the IR.
- IR-2 — Every record carries its epistemic status. Stated-by-source vs. derived-by-decoder is a property of every atom (HO-1). A CVS reconstructed changeset and a Git commit may occupy the same IR slot while being epistemically different things; an IR that cannot say which is lying by omission and is non-conformant.
- IR-3 — The source’s opaque identifiers and signatures are first-class IR content (PR-4), not decoder-local scratch discarded before encode. The IR is where the cryptographic link back to the source is preserved for VF-2.
- IR-4 — The loss boundary is representable in the IR (HO-2): the IR can state what a decoder dropped and what it derived, per import, so any encoder reproduces the same fidelity summary (HO-4) and two imports are comparable.
- IR-5 — The IR is encoder-agnostic and decoder-shared. An encoder for a second target must be writable against the IR’s stated obligations alone (PU-3), and the answers to “what is a record / what is preserved / what is omitted” must be shared across decoders even though they resolve differently per source — otherwise the IR cannot compare a Git import to a CVS one and “how faithful was this?” stops having an answer (RFC 113 §3.1 closing rule).
- IR-6 — The IR privileges no target’s identity model, but can carry any target’s needs. It must not bake in prikk’s
NodeId(that would make it useless to a snapshot target), yet it must be expressive enough to let a node-identity encoder record inferred identity with provenance. The IR’s job is to be the honest substrate; identity inference is the encoder’s authored judgment, marked as such.
11. prikk-side dependencies brygge is waiting on (UD-…)
These are prikk’s to build (RFC 113 §4); brygge’s requirements name them so no requirement above silently assumes them. They gate PU-2 (real prikk imports), not PU-1/PU-3 (decode, IR, other targets).
| ID | Dependency | prikk state (re-verified at prikk 0.46.0, 2026-09-23) | What it gates |
|---|---|---|---|
| UD-1 | An Attestation shape that fits import provenance | Unbuilt. The type exists but is audit-shaped; import use is a prikk format change (RFC 113 §4.1, RFC 114) | BN-3, VF-4 for prikk: no prikk import attestation can exist until its shape does |
| UD-2 | An authorized Import block kind (or a ruling that imports use Normal blocks) | Unbuilt. The Import kind is defined but refused by the block validator | Whether prikk can store import blocks at all |
| UD-3 | A ruling on whether imported history may be sealed, and by whom | Ruled 2026-09-13 (RFC 113 §4.4): only an adopted maintainer seals imported history | Settled: imported history can become sealed prikk history, by an adopted maintainer’s act |
| UD-4 | A deterministic identity contract for import-time fields | Ruled 2026-09-23 by prikk’s architect (reply to brygge letter 001): an import attestation’s created_at is the zero sentinel, and its payload is wholly identity-bearing | ID-4 / VF-1: re-runs are reproducible; brygge’s IR carries no import time either (IR contract 0.2.0) |
| UD-5 | Format stability (Badge criterion 2) and sync (criterion 1) | Met (prikk RFC 114 format stability; sync) | Settled |
The importer is prikk’s own import command, run by an adopted maintainer (prikk’s architect, 2026-09-23). prikk’s import theme is unscheduled; brygge informs it with its requirements, and its encoder (ROADMAP Track B1) is built once UD-1 and UD-2 exist, conforming to what prikk decides.
12. Open questions — the ones that are not brygge’s to answer (OQ-…)
Per RFC 113 §4.3–§4.5, these belong to the receiving project’s owner. brygge names each, states what it changes downstream, and stops.
Status (re-verified 2026-09-23): OQ-1, OQ-2 and OQ-3 (for Git) were ruled by prikk’s owner on 2026-09-13 (RFC 113 §4.3–§4.5): the importer signs the import declaration; only an adopted maintainer seals imported history; and for Git, refuse, never approximate. The questions are kept below as posed, because the requirements above cite them. OQ-4 remains prikk’s to specify.
- OQ-1 — What, if anything, the importer signs. “I imported this from that source” is a true, signable claim; “this person authored this” is not the importer’s to assert. Downstream effect: whether every prikk import carries a signed import-attestation (and what
verifysays about an import with none) — it changes what a bundle receiver sees and whether an import has any authenticated provenance at all. This is DC-35 territory (who may sign what). Not brygge’s. - OQ-2 — Whether imported history may be sealed at all, and by whom. Sealing is a maintainer act with a verified signature; a maintainer sealing imported blocks makes a real inclusion claim. Downstream effect: whether a migration ends in native sealed history or a permanently-unsealed imported tier — the difference between “migrated to prikk” and “readable in prikk.” Not brygge’s (UD-3).
- OQ-3 — The source-side floor, per source. Which features are refused rather than approximated (Git submodules/octopus/grafts/shallow; SVN convention-violating layouts; CVS reconstructions below a confidence bar). Downstream effect: this decides who can migrate and who is told no — product scope, not engineering. brygge implements whatever floor is set and refuses cleanly below it (FA-3); it does not set the line.
- OQ-4 — (surfaced, downstream of OQ-1) What
verifyreports for an import. If OQ-1 yields a required import-attestation,verifymust have something to say about its presence/absence; if it yields none, imported blocks areUnverifiable-authored with no provenance object. This is the receiving project’s to specify; brygge must be able to target either answer.
Traceability (task coverage)
| Task requirement | Where |
|---|---|
| Purpose and non-goals, non-goals as firm as goals | §1 PU, §2 NG |
| What must be preserved / permitted to lose, loss recorded | §3 PR (PR-9 the load-bearing rule) |
| How honesty is enforced; where told; impossible to skip | §4 HO (HO-4 unskippable, HO-5 non-configurable) |
| Verification; what “faithful” means when source guaranteed less | §5 VF (VF-2 round-check, VF-5 per-source) |
| Idempotence and re-runs | §6 ID (ID-4 the content-addressed caveat) |
| Failure behaviour | §9 FA |
| Boundaries: brygge vs. target | §8 BN (BN-5 the dependency-weight boundary) |
| The IR’s obligations as requirements | §10 IR |
| Git / Mercurial / SVN / CVS treated separately; hg stated-renames; CVS honesty | §7 SRC (SRC-H2 stated vs derived renames; SRC-C3 the lossy-but-labelled verdict) |
| Source-extensibility (a new source = a new decoder) and the decode/IR half’s independent stability | PU-3 (sources), PU-6, §0 intro |
| Given decisions honoured (attestation-not-payload; derived-marked; boundary-recorded; Unverifiable) | HO-1, HO-2, HO-3, BN-3, and threaded throughout |
| Questions not to answer, with downstream effect, then stop | §12 OQ |
| Uncertainty stated as uncertainty | §0(b), §11 UD, SRC-C3, ID-4 |
End of brygge Requirements v0.2. This document is the contract a design must satisfy; it deliberately contains no architecture, schema, or API. What is buildable now vs. gated, precisely: the decode → IR half (the IR obligations §10, and the Git/Mercurial/SVN/CVS decoders, inspection, and internal/against-source verification) depends only on the source systems and can be designed and stabilized now (PU-6). The encode-to-prikk path past a reviewable proposal waits on the prikk-side dependencies §11 (UD-1…UD-3) and the owner’s open questions §12 (OQ-1…OQ-3), exactly as RFC 113 §4a states. Build order follows the §7 difficulty gradient: foundations → Git → Mercurial → SVN → CVS.
brygge — External Design Specification
| Document | brygge External Design (black-box view) |
| Version | v0.3 (for the 0.1.0 release) |
| Date | 2026-09-24 (v0.3: §2.1 command surface revised per owner ruling D-7, 2026-09-23; prikk facts re-verified against prikk 0.46.0, 2026-09-24; v0.2 2026-09-03) |
| Inputs | brygge Requirements v0.2 (brygge-01-requirements-spec-v0.1.md) — cited as PU/NG/PR/HO/VF/ID/FA/BN/IR/UD/OQ; RFC 113 (import contract); prikk reality (the 0.27.1 audit, re-verified against prikk 0.46.0 on 2026-09-23: RFC 113 is accepted and its §4.3–§4.5 were ruled on 2026-09-13; UD-1 and UD-2 remain unbuilt — see brygge-01 §11/§12); project rules |
| Scope | WHAT brygge exposes at its boundaries — its command surface, the external contract of the IR (intermediate representation), the fidelity and provenance outputs, and the interaction flows — for the parts that can be designed before the owner’s open questions are settled. The requirements are explicit that OQ-1…OQ-3 gate per-source encoder design; this document honours that by designing the pipeline, the IR contract, and the honesty surface now, and stopping at each gated point (§8). |
| Not | internal architecture, the IR’s byte schema (the requirements forbid a schema), APIs, or code. |
| ID scheme | BD- boundary · AC- actor · CL- command surface · IX- IR external contract · FS- fidelity/honesty surface · PX- provenance-to-target interface · CF- configuration · FL- flow · CT- external data contract · OP- operational behaviour · GATED- a surface that cannot be designed until an owner question is answered. (DC- avoided — it collides with prikk’s RFC numbering.) |
Delivery status (2026-09-24). The command surface of §2.1 is released in brygge 0.1.0, the first release:
decode <git|hg|svn|cvs> <source> --out <artifact>,inspect <artifact>andverify <artifact> [--against-source <source>], with human and machine output (CL-07) and the CL-08 outcome-class exit codes. The IR external contract is IR contract 0.2.0 (RFC 011), which replaced the pre-release 1.0.0 freeze; its wire format is published inreference/ir-artifact-format.md. The GATED- surfaces (the prikk encoder) wait on prikk (§8; ROADMAP Track B). SeeHANDOFF.md. This document remains the black-box contract the CLI satisfies.
Design stance carried from requirements: facts derive, judgment is authored, the join is checked — so every user-visible surface makes the derived-vs-stated distinction inescapable (HO-1), makes loss legible (HO-2), and never lets honesty be turned off (HO-5). Where a Git mental model expects “just import it,” the surface redirects to “decode, review fidelity, then encode a proposal.”
1. System boundary & actors
1.1 Boundary (BD-…)
[source repos] [source-system libraries] [the operator + reviewers]
Git / SVN / CVS ─read→ gix/libgit2, SVN, CVS ┌──── runs, reviews, decides ────┐
│ (brygge's heavy deps) │ │
▼ ▼ ▼ ▼
┌──────────────────────── brygge process ─────────────────────────────────────────────┐
│ DECODE (per source) ─▶ the IR (faithfulness-with-provenance) ─▶ ENCODE (per target) │
│ every atom marked stated-vs-derived (IR-2); source ids preserved opaque (IR-3) │
│ ───────────────────────────────────────────────────────────────────────────────────│
│ FIDELITY SURFACE (HO-4): what was preserved / derived / dropped / refused │
└───────────────────────────────────────┬───────────────────────────────────────────────┘
▼
[target proposal + provenance] ──▶ target system (prikk, or another)
decides admission / trust / seal
(BN-2 — NOT brygge)
- BD-01 — Inside brygge: the per-source decoders, the IR, the per-target encoders, and the honesty machinery that spans all three (derived-marking, loss-boundary recording, the fidelity summary). brygge is responsible for reading the source correctly, representing it faithfully-with-provenance, translating it, and making every derivation and loss legible (BN-1).
- BD-02 — Outside brygge: the source repositories; the heavy source-system libraries brygge links (
gix/libgit2, SVN, CVS — PU-5); the operating system; the target system (prikk or another), which owns admission, trust, verification, sealing, and storage (BN-2); and the humans. - BD-03 — The dependency-weight boundary is a hard external property (BN-5): brygge may link whatever it needs to read a source, but nothing it emits may require the target to link any of those. A prikk repository verifies a brygge import using only prikk’s own dependency surface; the import’s checkability (VF-3) never routes through a brygge dependency. This is externally observable: a consumer can confirm the target proposal and the IR are consumable with none of brygge’s decoder dependencies present.
- BD-04 — brygge never mutates the target (BN-4): it produces files; it does not admit, seal, merge, or reconcile. A re-import is a fresh translation (ID-2); what the target does with it is the target’s.
- BD-05 — Two separable halves, separable in the boundary (PU-1/PU-3): decode → IR is complete and useful without any encoder; the IR is a durable, inspectable artifact between the halves, not an internal handoff. A second target’s encoder is a consumer of the IR at this boundary, not a modification of brygge.
1.2 Actors (AC-…)
brygge has no accounts; roles are what a person is doing, and map to which surfaces they touch.
| ID | Actor | Does | Touches |
|---|---|---|---|
| AC-01 | Migrator | runs decode/encode over their own source | CL decode/encode, CF parameters, FS summary |
| AC-02 | Fidelity reviewer | reads what an import preserved/derived/dropped before trusting it | FS surface, IR inspection (CL inspect), VF-3 internal checks |
| AC-03 | Third-party verifier | holds the original source and checks the import corresponds to it | VF-2 round-check (CL verify –against-source), PX provenance |
| AC-04 | Target maintainer | decides whether to admit/seal the proposal — outside brygge (BN-2) | receives PX provenance + the proposal; acts in the target’s tool, not brygge |
Note AC-04 is listed to mark the boundary: brygge’s obligation to them is provenance sufficient to decide (BN-3, PX-*), not a decision.
2. External interfaces
2.1 Command surface (CL-…)
The command surface makes the decode/encode separation visible and the honesty outputs unavoidable. It is a tool surface, not a target’s VCS surface: brygge issues no VCS verbs against the target (BD-04).
Revised in v0.3 (2026-09-23, owner ruling D-7). The surface is three verbs with one noun per concept, and nothing is silently ignored.
Vocabulary (used identically in the CLI, reports, README and this document): source (the repository or dumpfile read), artifact (the IR file brygge writes), stated, derived, dropped (not carried, and recorded), flagged (a convention or confidence problem recorded in an artifact that was produced; RFC 011 D-8), refused (the whole import declined, so no artifact is written). Imported authorship is Unverifiable: it cannot be checked, which is different from “not yet checked”.
- CL-01 —
brygge decode <source-kind> <source> --out <artifact> [source options]-
Reads a source into an IR artifact.
<source-kind>∈ {git,hg,svn,cvs} today, each with its own honestly-scoped support (SRC-*). -
The set is open by design: a new source is a new
<source-kind>value backed by a new decoder against the shared IR obligations (PU-3, IR-5), not a brygge redesign. -
--outis required;decodenever runs without producing its artifact. -
Decode stands alone (PU-1) and needs no target. It records the inference parameters it used in the IR (PR-5), states the source’s faithfulness scope before running (FS-05), and prints the fidelity report at the end (FS-01).
-
Source options each create a derived layer and are named for what they do:
--infer-renames(git, hg): exact-content rename inference, marked derived;--reconstruct-refs(svn, cvs): branch/tag reconstruction by convention or symbol, marked derived.
An option given for a source kind it does not apply to is refused with a message naming the option and the kinds it applies to (exit
2). It is never silently ignored.
-
- CL-02 —
brygge inspect <artifact> [--atoms]- Reads an artifact without the source.
- By default it prints the fidelity report: exactly what
decodeprinted, reconstructed from the artifact alone (FS-02, HO-4). --atomsadds the reviewer’s detail: each atom’s epistemic status (stated vs derived, IR-2), its opaque source identifiers (IR-3), its derived records with their parameters, and the loss boundary (IR-4). This is the advanced view; the default stays small for newcomers.- Read-only.
- CL-03 —
encoderuns external encoder plugins;encode prikkis Track B1’s.brygge encode <target>runsbrygge-encode-<target>, found onPATHonly, after verifying the artifact, and labels it as not part of brygge (RFC 017 D-3). The targetprikkis reserved for the built-in encoder, which follows prikk’s import foundations (Track B1). - CL-04 —
brygge verify <artifact> [--against-source <source>]— the two checkable meanings of “faithful”, kept visibly separate (VF-4):- Always: the VF-3 checks any reader can run without the source.
- Every derived record is well-formed and carries its parameters.
- The loss boundary is stated.
- Content and ancestry are internally consistent.
- The per-source honesty invariants hold (e.g. every CVS changeset is derived).
- Provenance names its source and parameters.
- Authorship is reported as Unverifiable by construction. This is not presented as a check that could pass or fail.
- With
--against-source, additionally: the VF-2 round-check for AC-03. Brygge re-derives from the original source using the recorded parameters and confirms correspondence atom by atom, keyed on the preserved source identifiers (PR-4), without trusting the earlier run. - The report shows the two results as separate lines and never merges them into one verdict.
- Always: the VF-3 checks any reader can run without the source.
- CL-05 — merged into CL-02. The fidelity report is
inspect’s default output. (The formersummaryverb is withdrawn: one verb reads an artifact.) - CL-06 —
--version,--help, per-command--help. brygge is a tool, so unlike stikk it does own its full command vocabulary and help surface. Help lists only commands that exist. - CL-07 — Machine-readable output (
--format machine).- Every reporting command offers a stable, versioned, line-oriented form (CT-04), so a migration can be scripted and gated in CI. The human form is the default.
- Text that comes from a source repository is untrusted.
- It never appears in a machine-format key. Items are indexed instead.
- Machine values use a specified escaping, so no source text can forge a line or a key.
- In the human form, control characters are shown escaped, so no source text can drive or disguise the terminal (threat model T-1/T-3).
- CL-08 — Exit codes carry the outcome class.
-
The codes (a lesson taken from stikk’s audit of prikk’s coarse 0/1):
Code Meaning 0clean 10completed with recorded loss (the normal, honest outcome: not an error, but not silent either) 20a source feature refused below the floor (FA-3) 30a convention or confidence line crossed (FA-2) 40partial/interrupted, reserved (FA-1) 50a verifycheck failed1runtime failure (unreadable input, I/O, an internal decoder fault) 2usage error (bad arguments, an option given where it does not apply) -
A CI gate can therefore tell “faithful within stated limits” from “hit the floor”, and “called wrongly” from “broke”, without parsing prose.
-
- CL-09 —
transformruns external transform plugins.brygge transform <name> <artifact> --out <file>runsbrygge-transform-<name>, found onPATHonly, after verifying the input artifact and refusing one with two atoms sharing one source identity (RFC 018 D-6). The plugin’s own output is itself checked —brygge_ir::transform::check’s honesty rule, that every change is marked and every removal recorded — before it is accepted; any failure leaves--outuntouched.transform --listshows every plugin found this way, the same shapeencode --listdoes.
2.2 The IR’s external contract (IX-…)
The requirements forbid a schema (they are requirements on the IR, IR-1…IR-6). The external design states the IR’s black-box contract — what any consumer may rely on — without defining bytes. That contract is the product boundary of PU-3.
- IX-01 — The IR is a durable, inspectable artifact, not an internal handoff (BD-05). It can be written by
decode, read byinspect/verify/encode, kept, diffed, and consumed by a foreign encoder. - IX-02 — Every atom exposes its epistemic status (IR-2): a consumer can always ask “did the source state this, or did a decoder derive it?” and get an answer, per atom, with the governing parameters when derived (PR-5). An IR that cannot answer is non-conformant.
- IX-03 — Source identifiers and signatures are first-class, opaque content (IR-3, PR-4): a consumer can read a Git SHA, a GPG signature, an SVN revision number, a CVS revision tag back out unchanged — brygge neither interprets them as target-meaningful nor discards them.
- IX-04 — The loss boundary is queryable (IR-4): a consumer can ask, per import, what class of information the decoder dropped and what it derived — the shape of the loss without re-deriving it.
- IX-05 — The IR privileges no target’s identity model (IR-6): it does not bake in prikk’s node identity; a snapshot-based target encoder finds a snapshot it can use, and a node-identity target encoder finds the source facts plus the marked places where it must author inference itself. Identity inference is the encoder’s authored judgment, marked as such — never pre-decided in the IR.
- IX-06 — The IR’s answers to “what is a record / preserved / omitted” are shared across decoders (IR-5): a Git IR and a CVS IR are comparable, so “how faithful was this import?” has a cross-source answer. This is what makes the IR a reusable abstraction rather than three private formats.
- IX-07 — The IR is versioned and its version is legible (supports ID-1/VF-1): a consumer knows which IR contract it is reading, and a re-decode under the same brygge version produces the same IR.
2.3 The fidelity & honesty surface (FS-…)
- FS-01 — Every run emits a fidelity record, and it is unskippable (HO-4, HO-5): at the end of
decodeand ofencode, brygge states what was preserved, what was derived (with confidence/parameters), what was dropped (by class), and what was refused. No flag suppresses it (HO-5); verbosity may vary, existence may not. - FS-02 — The summary is recoverable from the objects, not just printed (HO-4):
brygge inspect <artifact>(CL-02) reconstructs it from the artifact alone. This is the external proof that honesty “travels with the import” and cannot be lost by deleting a log. - FS-03 — Derived records are visibly marked wherever they appear (HO-1): in
inspect, in the summary, and in the target proposal, an inferred rename / reconstructed CVS changeset / inferred SVN branch reads as derived by brygge, distinct from a source-stated fact, without the reader re-running the heuristic. - FS-04 — Authorship is shown
Unverifiable, never dressed up (HO-3, NG-3): nowhere in any brygge surface does imported authorship read as sound, verified, or native. A GPG-signed Git commit is shown with its signature preserved and verifying nothing in the target — the two are never conflated (VF-4). - FS-05 — Per-source faithfulness is stated before the run, not after (VF-5):
decode/encodefor a given source declare, up front, what faithfulness can mean for that source and what it cannot — most sharply for CVS (FS-06). - FS-06 — The CVS surface states its verdict before it runs (SRC-C3): a CVS decode announces that a faithful-in-VF-2’s-sense import is not achievable (no atomic source atom to check against), that the deliverable is a lossy, explicitly-labelled reconstruction, and that changeset grouping is brygge’s derived judgment — so “faithful CVS import” is never a promise the surface implied and broke.
2.4 The provenance-to-target interface (PX-…)
This is brygge’s obligation to the target (BN-3) — the interface across the boundary at which the target makes its own admission/trust/seal decisions.
- PX-01 — Every proposal carries provenance (PR-6): source repository identity, source atom identifiers, brygge version, decoder version, target and version, and the inference parameters (PR-5). Enough for the target to make its decisions and for a third party to run VF-2.
- PX-02 — Provenance is separable from the history it describes (RFC 113 §4.1’s shape): a statement about the imported history, not baked into the history’s atoms — so the target can carry it as its own kind of object (for prikk, an
Attestation) rather than altering what a patch/commit is. - PX-03 — The provenance carries the honesty boundary (HO-2 → BN-3): the target (and a bundle receiver downstream) can read what class of information was dropped and what was derived, so honesty survives the hand-off, not just the run.
- PX-04 — The exact prikk provenance object shape is GATED on prikk (§8 GATED-1): PX-01…PX-03 state what provenance must convey; the form it takes in prikk is prikk’s to define (UD-1), and brygge targets whatever prikk settles.
2.5 Configuration (CF-…)
- CF-01 — Inference parameters are configurable and recorded (PR-5): similarity thresholds (Git renames), clustering windows (CVS changesets), branch conventions (SVN) may be set; whatever is set is written into the IR/provenance, so the output stays reproducible (VF-1) and the judgment reviewable. A parameter that changed the output but was not recorded would break determinism’s checkability — forbidden.
- CF-02 — Honesty controls are not configurable (HO-5): no flag turns off derived-marking, the loss boundary,
Unverifiable, or the fidelity summary. Configuration tunes inference, never honesty. - CF-03 — The source-side floor is configuration the owner sets, not the migrator (OQ-3): which source features are refused rather than approximated is product scope. brygge exposes the floor as a declared policy it enforces (FA-3), and the migrator sees refusals, not a knob to lower the floor. The floor’s contents are GATED (§8 GATED-4).
3. User interaction flows (FL-…)
Numbered user-action → system-response. Each cites the requirement it realizes.
- FL-01 — Decode a Git repository (AC-01). 1.
brygge decode git <path> --out out.ir. 2. brygge states, up front, Git’s faithfulness scope (FS-05) and any features it will refuse under the floor (CF-03). 3. It reads content, ancestry, messages as claims (PR-1/2/3), preserves commit SHAs and GPG signatures opaquely (PR-4), and marks every inferred rename as derived with its similarity parameters (HO-1/FS-03). 4. It writes the IR and prints the decode fidelity record (FS-01): preserved / derived / dropped / refused. 5. Exit code carries the outcome class (CL-08). - FL-02 — Inspect the IR before trusting it (AC-02). 1.
brygge inspect out.ir --atoms. 2. brygge lists atoms with each one’s epistemic status (IX-02) — a reviewer sees exactly which records are source-stated and which are brygge-derived, and the parameters behind each derivation. 3. The reviewer reads the loss boundary (IX-04): what class was dropped, what was derived. No target is involved; this is fidelity review, not migration. - FL-03 — Encode a prikk proposal and read its fidelity (AC-01). (Design intent for Track B1; not in the current surface, see CL-03. The concrete flow is settled by RFC 008, conforming to prikk’s import foundations.) 1.
brygge encode prikk …. 2. brygge builds a prikk proposal — labelled, unsealed, authorshipUnverifiable(FS-04) — because sealing/admission is the target’s and the prikk import surface is not yet built (§8). 3. It attaches provenance (PX-01) in the shape prikk will settle (PX-04). 4. It prints the encode fidelity record (FS-01) and states, in-band, that this is a proposal the target has not admitted (FA-4). - FL-04 — Verify internally, then against the source (AC-02 then AC-03). 1.
brygge verify out.irconfirms every derived record is marked, the loss boundary is stated, authorship isUnverifiable, and provenance names its source (VF-3) — provable with no source present. 2. A third party runsbrygge verify out.ir --against-source <original-git>; using the preserved SHAs (PR-4), brygge confirms the import corresponds to the original atom-by-atom without trusting brygge (VF-2). 3. The report distinguishes “corresponds to source” (VF-2) from “internally honest” (VF-3) — never conflating them (VF-4). - FL-05 — Re-run and get identical output (AC-01, ID-1/VF-1). 1. The migrator re-runs the same
decode+encodewith the same parameters and brygge version. 2. brygge produces the same IR and the same proposal. 3. If anything differs, brygge states the cause (new version, changed parameters, changed source) — “I ran it again and got different history” is never silent (ID-1). 4. For a content-addressed target, any field brygge cannot make deterministic (e.g., an import timestamp, if prikk’s provenance object carries authoritative time) is named as a stated non-determinism, not left to silently perturb ids (ID-4, UD-4). - FL-06 — Hit a refused feature (AC-01, FA-3). 1. A Git repo uses submodules / an octopus merge beyond the target’s parent limit / grafts. 2. brygge refuses the feature with a named reason (not an approximation), tells the migrator exactly which feature and why, and exits with the “hit the floor” class (CL-08). 3. The migrator knows precisely who can migrate and who is told no — set by policy (CF-03), not guessed.
- FL-07 — An SVN repo that violates its own convention (AC-01, FA-2, SRC-S1). 1.
brygge decode svn …finds a layout that breaks the/trunk//branches/xconvention branch identity depends on. 2. brygge does not silently pick an interpretation: it refuses, or it imports with the reconstructed branch recorded as a derived judgment the migrator must accept (HO-1). 3. Mergeinfo, being advisory and frequently wrong, is dropped-with-record or carried-as-advisory-and-labelled, never promoted to a real merge parent (PR-8/SRC-S2). - FL-08 — A CVS run surfaces its lossy reconstruction (AC-01, SRC-C3). 1.
brygge decode cvs …announces, before running (FS-06), that a faithful-in-VF-2’s-sense import is not achievable and the deliverable is a lossy, explicitly-labelled reconstruction. 2. It preserves per-file content and history faithfully, and reconstructs changesets by clustering (with the window recorded as a parameter, PR-5). 3. Every reconstructed changeset is marked derived (HO-1); the fidelity summary makes the reconstruction’s uncertainty prominent, not buried (FS-01). 4. The migrator was told the honest deliverable up front, so no promise was made and broken. - FL-09 — Interrupted import (AC-01, FA-1/FA-4/FA-5). 1. A run stops mid-stream. 2. What was and was not imported is stated; the partial result is distinguishable from a complete one (FA-1). 3. Because admission is the target’s (BN-2), brygge’s safe failure is a clearly-incomplete-and-labelled proposal the target has not admitted — never a half-admitted history that looks whole (FA-4). 4. Re-running reproduces the same result up to the failure point (FA-5).
- FL-10 — Decode a Mercurial repository (AC-01, SRC-H1…H4) (conceptually the second source, after FL-01). 1.
brygge decode hg <path> --out out.ir. 2. brygge states hg’s faithfulness scope (FS-05) and any floor refusals (CF-03). 3. Where the source recorded a rename (hg mv), brygge carries it as a source-stated fact — not marked derived (SRC-H2, IX-02); where it did not, brygge carries delete+create as stated, marking a rename derived only if it infers one (HO-1/FS-03). The inspect and fidelity surfaces therefore show hg imports with fewer derived marks than an equivalent Git import — a visible, checkable consequence of hg recording more. 4. Named branches and bookmarks are mapped to the IR’s branch-identity notion without privileging one; phases and obsolescence markers are dropped-with-record as representation/advisory (PR-7/PR-8, HO-2);.hgtagshistory is preserved as content. 5. Fidelity record + outcome-class exit as FL-01.
4. Data contracts (external) (CT-…)
- CT-01 — Inputs brygge accepts: a source repository (Git/hg/SVN/CVS, by kind + location); an IR artifact (for
inspect/verify/encode); inference parameters (CF-01); the declared source-side floor policy (CF-03, contents GATED). No target credentials, no network endpoints — brygge reads sources and writes files. - CT-02 — Outputs brygge produces: the IR artifact (its external contract is IX-*, its byte schema deliberately undefined here); the target proposal (for prikk: labelled, unsealed,
Unverifiable, with provenance); the fidelity record/summary (FS-01, reproducible via CL-05); and verification reports (VF-2/VF-3, CL-04). Every output is a file or a report; brygge writes nothing into the target’s storage (BD-04, BN-2). - CT-03 — The provenance interface to the target (PX-*): what brygge conveys across the boundary for the target’s admission/trust/seal decisions. Its content is specified (PX-01…PX-03); its prikk form is GATED (PX-04, UD-1).
- CT-04 — The tool’s machine-readable report format (CL-07) is a versioned contract, distinct from the IR: it is how a CI gate consumes
decode,inspectandverifyresults and outcome classes. Versioned so a migration pipeline can pin it. Every key, value domain, version key and the bump rule are specified inreference/machine-output.md. (This is a report schema, permitted; the IR schema remains the design phase’s, not this document’s.) - CT-05 — What a prikk repository must be able to assume about brygge output (BN-5, the requirements’ central constraint): that it is consumable and checkable with only prikk’s own dependency surface — no brygge dependency required to read the proposal, verify it internally (VF-3), or carry its provenance. This is the externally-testable form of “brygge carries the weight, prikk does not.”
5. Operational behaviours (OP-…)
- OP-01 — Determinism is an observable property, not a hope (VF-1): the same inputs yield byte-identical IR and proposal;
verify --against-sourceand a re-run are the two ways a user confirms it. Any non-determinism brygge cannot avoid is named (ID-4). - OP-02 — Large imports show progress and are cancellable (a real migration is long): brygge reports progress and can be stopped; a stop is a clean partial (FA-1/FA-4), never an ambiguous target state.
- OP-03 — Honesty is emitted continuously, not only at the end: refusals (FA-3) and convention violations (FA-2) surface at the atom they occur on, so a long run does not hide a floor-hit until completion.
- OP-04 — Error presentation names the class (mirrors CL-08): recorded loss (normal, honest), floor refusal, convention violation, partial/interrupted, internal failure — each distinct, each actionable, none collapsed into a bare failure.
- OP-05 — brygge leaves the target untouched on any exit (BD-04, FA-4): success produces a proposal the target has not yet admitted; failure produces a labelled partial; neither writes into the target’s storage.
6. Traceability (design items → requirements)
| Design area | Realizes |
|---|---|
| BD-01…05 · AC-01…04 | BN-1/2/4/5, PU-1/3/5, IR-6 |
| CL-01…08 | PU-1/2/3, FS/HO surface, VF-2/VF-3, FA-1/2/3, CL-08 ↔ audit lesson |
| IX-01…07 | IR-1…IR-6, PR-4, ID-1/VF-1 |
| FS-01…06 | HO-1…HO-5, NG-3, VF-4/VF-5, SRC-C3 |
| PX-01…04 | PR-6, BN-3, RFC 113 §4.1, UD-1 |
| CF-01…03 | PR-5, HO-5, OQ-3 |
| FL-01…09 | PU-1, PR-*, HO-1, VF-2/3/4, ID-1/4, FA-1…5, SRC-S1/S2/C3 |
| CT-01…05 | BN-2/5, IX-, PX-, CL-07 |
| OP-01…05 | VF-1, FA-1/4/5, ID-4 |
7. Design-set entry point (for the owner)
Per project-rules §Workflow. Two brygge documents exist:
brygge-01-requirements-spec-v0.1.md— what it must do / never do / decide (the contract).brygge-02-external-design-v0.1.md— this document: the black-box surface for what can be designed now.
The load-bearing design decisions this document commits: the decode/IR/encode split is visible in the command surface (CL-01/03) and the IR is a durable, inspectable artifact (IX-01), so decode and a second target’s encoder are real products, not internal steps; honesty is a surface property, not a report (FS-*), unskippable and recoverable from the objects; and brygge’s dependency weight stops at its boundary (BD-03/CT-05), the externally-testable form of the constraint that created the project.
8. What cannot be externally designed yet — GATED surfaces (GATED-…)
The requirements are explicit that OQ-1…OQ-3 gate per-source design (RFC 113 §4a). This document designs up to those gates and stops, rather than inventing a surface that presumes an answer. Each gate names what it blocks and what brygge does in the meantime.
| ID | Gated surface | Blocked on | brygge’s interim behaviour |
|---|---|---|---|
| GATED-1 | The exact prikk provenance object shape the encode prikk proposal attaches (PX-04) | UD-1 — prikk’s Attestation is audit-shaped and never constructed; import use is a format change (RFC 113 §4.1) | PX-01…PX-03 fix the provenance content; the prikk form is targeted once prikk defines it. The proposal carries provenance in a clearly-labelled interim form, not a claimed-final prikk object |
| GATED-2 | Whether the prikk proposal uses an Import block kind or Normal blocks | UD-2 — Import kind is defined but refused by prikk’s validator | The proposal is structured so either ruling is targetable; it does not emit an Import block prikk would reject today |
| GATED-3 | Whether the proposal can become sealed prikk history, and the encode surface for that | UD-3 / OQ-2 — sealing imports is an open owner question | encode prikk produces an unsealed, Unverifiable proposal only (FL-03); no seal path is exposed; the surface states this is the honest ceiling until the owner rules |
| GATED-4 | The contents of the per-source floor (which features are refused) | OQ-3 — the floor is product scope, the owner’s | CF-03 exposes the floor mechanism (declared policy, enforced by refusal FA-3); the specific refused-feature lists per source are filled in when the owner sets them |
| GATED-5 | What the target’s verify reports about an import, which the FS/PX surface must align with | OQ-4 (downstream of OQ-1) | FS-04/VF-4 keep the two claims distinct regardless of the answer; the surface adapts to whichever prikk specifies |
| GATED-6 | What, if anything, the importer signs — and thus whether encode has a signing step at all | OQ-1 / DC-35 — who may sign what | No signing surface is designed; “I imported this” as a signable claim is left unbuilt until the owner rules who may assert it (NG-6 keeps brygge out of authoring authority) |
Sequencing consequence (RFC 113 §4a, §5; requirements §7 gradient): the IR obligations (IX-) and the honesty/verification surface (FS-, VF-*) can be internally designed next, source by source, in the order Git → Mercurial → SVN → CVS — the decode/IR half, which depends on no prikk decision and is what brygge stabilizes first (PU-6). The prikk encode surface (CL-03 for prikk) cannot be finalized past a reviewable proposal until GATED-1/2/3 land; the per-source floors cannot be finalized until GATED-4 (for hg that includes phases/obsmarkers and the named-branch-vs-bookmark mapping). This document deliberately leaves those open rather than guess — a confident wrong external surface would be worse than a stated gate (the requirements’ own rule).
End of External Design v0.2. Next internal design work should start where no gate blocks it: the IR’s internal representation satisfying IX-/IR-, then the decoders in gradient order (Git → Mercurial → SVN → CVS, CVS last and permitted to be lossy). This decode/IR half is the near-term stabilization target (PU-6). The prikk encoder past a reviewable proposal waits on the §8 gates (GATED-1…6, i.e. prikk’s UD-1…UD-3 and the owner’s OQ-1…OQ-3).
brygge — Threat Model
| Document | brygge Threat Model (security) |
| Version | v0.15 |
| Date | 2026-11-27 (v0.15); 2026-11-26 (v0.14); 2026-11-25 (v0.13); 2026-11-24 (v0.12); 2026-10-30 (v0.11); 2026-10-29 (v0.10); 2026-10-21 (v0.9); 2026-10-20 (v0.8); 2026-10-17 (v0.7); 2026-09-25 (v0.6); 2026-09-24 (v0.5, v0.4 and v0.3 revisions; v0.2 2026-09-09; v0.1 2026-09-03) |
| Revised | v0.15 (2026-11-27, 0.10.0, RFC 021 Git submodules, contract 0.4.0) changes the owner’s Git floor, and the IR contract. The floor (owner, 2026-11-26): submodule is no longer refused. A submodule is carried as exactly what Git records, a path and the commit id it pins in another repository; its repository is never opened, fetched, followed or verified (no object lookup is made for the id, and there is no network, as before). Its path goes through C-2c’s checks like any entry’s, and its id must be 20 bytes (SHA-256 repositories stay refused). replace-ref, grafts, shallow clones and octopus merges beyond a target’s limit stay refused. C-1g / condition A: wherever a submodule appears (decode, inspect, encode git), the user reads one sentence, that the submodules’ own repositories were not read, imported or verified, so no output implies a check brygge did not make. Condition B: a target holds a submodule or refuses it by name. encode git writes it back as a submodule, and its check (G2) compares it, so a moved pointer is does-not-correspond. A future prikk encoder refuses it (letter 008, sent). C-3b: contract 0.4.0 adds one field (a submodule entry’s pinned id). An entry states a blob or a submodule, never both or neither, and the reader refuses anything else; verify refuses a Modify that changes an entry’s kind. The identity rule: a contract may add fields, but never re-encode an existing one, so every existing atom keeps its id (proven on the whole corpus: the same history decoded by 0.9.0 and 0.10.0 gives equal IRs, ids included). Readers of 0.3.0 and earlier refuse a 0.4.0 artifact at the version gate. T-6: .gitmodules is carried as file content, as before, so a URL that holds credentials is the source’s own published content (RR-1); running git submodule update on a result contacts the source’s hosts, which brygge never does, and the guide says so. No new parser, dependency or network path. v0.14 (2026-11-26, 0.9.0, RFC 020 Subversion at real size and shape) removes the cause of the amplification 0.8.1 bounded, and adds three options. C-2d: the Subversion decoder’s tree shares unchanged directories between revisions (reference-counted directory nodes, copied on write), so a retained snapshot or a directory copy costs O(depth), not a copy of the tree. Measured: the 0.8.1 shape (2,000 files, 160 tags) now decodes at about 432 MB (measured with the real binary), where 0.8.1 refused it at about 3.3 GB; the peak grows linearly in tags (about 2.6 MB a tag in the stated layer, which still records one Add per copied file, and about 0.5 MB with --branch-lines); codeblocks falls from about 1.5 GB to about 355 MB. Every artifact is byte-identical. The ceiling on retained snapshot entries is gone; max_tree_nodes (50,000,000) bounds the cumulative directory nodes and file entries the tree allocates, and max_tree_entries is checked where a tree is expanded into entries. max_copy_expansion and max_ir_ops are unchanged. RR-total-memory narrowed: 0.8.1’s residual (about 3.3 GB before refusal) closes; the stated layer’s per-file record of a tag copy is the remaining linear cost, and the guide points tag-heavy histories to --branch-lines. Input (TB-4): --layout-trunk, --layout-branches and --layout-tags are operator input, validated before decoding (relative, no .. or empty segment, no overlapping containers). The layout is recorded in provenance with %, , and = percent-encoded, so a path holding one is read back exactly; the default label is unchanged. C-3c: a recorded layout that cannot be read gives not-checked, never a silent comparison against the default layout. No new parser, dependency or output path. v0.13 (2026-11-25, 0.8.1, a security patch) discloses and closes an amplification gap in C-2d, present since 0.1.0. Two decoders could be made to use memory out of all proportion to a small input, an availability fault only, never a wrong or corrupt result. Subversion: a directory copy is a few bytes of dump, but the decoder kept a full copy of the repository tree for every revision a later copy named, so a dump of about 0.5 MB with 160 tag copies of a 2,000-file trunk reached about 4.4 GB. Git: trees that reuse one subtree at every level (about 108 paths from a 112 KB repository) ran without bound, because the ceilings covered depth and path length, not the number of entries a tree expands to. Fixed by four declared ceilings, each checked before the memory it protects is used: max_tree_entries (10,000,000 entries in one tree, Git and Subversion), max_copy_expansion (one Subversion directory copy, the same), max_retained_entries (20,000,000 entries across the Subversion snapshots kept for later copies, about 170 bytes each as measured), and max_ir_ops (200,000,000 operations in one artifact, in brygge-ir’s builder, so for every decoder and transform). Each refuses with a resource limit (exit 20). Every corpus repository stays at least 2.96× below every ceiling, and decodes byte-identically to 0.8.0. Not affected: Mercurial manifests and CVS RCS files are flat reads, already bounded by their byte ceilings (max_revision_bytes, max_rcs_bytes). C-2d now states the lesson: a ceiling must bound what an input can expand to, not only how many bytes it is. RR-total-memory: a hostile Subversion dump can still reach about 3.3 GB before max_retained_entries refuses it; 0.9 removes the cause by sharing unchanged directories between snapshots. v0.12 (2026-11-24, 0.8.0, RFC 019 Git as a target) adds a supported encoder, a new subprocess and a new output path. New TB-8 (brygge → git, for encode git). C-2b: git is a trusted external tool, like svnadmin: resolved on PATH among absolute entries only, never the current directory, spawned with no shell, under a cleared environment (an empty temporary HOME, an empty GIT_CONFIG_GLOBAL, GIT_CONFIG_NOSYSTEM=1, LC_ALL=C), so no user configuration, template or hook reaches the result; a hostile ~/.gitconfig and GIT_TEMPLATE_DIR are proven to change nothing. C-1g widened: the built-in encoder’s output is brygge’s own, so it is labelled and checked by brygge. Every commit and annotated tag ends with Brygge- trailers (who encoded it from what source, the source’s own id, every derived, transformed, supplied or altered value, and the artifact’s digest), which survive a clone, unlike notes. Before the repository is handed over, brygge decodes it with its own Git decoder and compares every commit with the artifact (parents, the full tree state, identities, the exact message bytes, every ref and nothing extra); a difference refuses the result and leaves nothing behind. verify --against-target git runs the same check on a kept repository; a git replace view is refused, not checked. The name git is reserved, so no plugin can stand in for the built-in. C-7: encode git builds the repository in a private sibling directory and renames it into place only after the check passes; <dir> and its report must not exist beforehand, and the report is renamed into place last. C-3b: the builder now refuses a repeated copy record, so an artifact its own reader rejects can no longer be written; this closed a released Subversion decoder fault (a directory copy whose files were also restated as copies wrote an artifact that failed verify, fail-closed, never a false pass). C-3c: a decoder’s floor list is aligned before --against-source compares, with a note when it differs, because two successful decodes prove the source holds nothing either floor refuses. Derived layers (HO-1): decode svn --branch-lines derives one line of history per branch, and CVS --reconstruct-refs derives the main line as trunk; both are opt-in and marked ReconstructedBranch. Every atom must be reachable from a ref, or encode git refuses, so no history is left for Git to garbage-collect. C-4d: faster-hex 0.10.1 closes RUSTSEC-2026-0306; autocfg 1.5.1 is a new build-time dependency of it, in the Git decoder only; brygge-ir’s closure is unchanged, and the encoder module is held to brygge-ir and std by a source-level check. RR-plugin-trust covers git as it covers any tool on PATH. Re-verified for 0.7.1 (2026-11-21), with no revision: 0.7.1 adds no parser, dependency, input path or format change. Its changes are in four places. Dependencies (C-4d): rustix moves from 1.1.4 to 1.1.6 for RUSTSEC-2026-0486 (unsound xattr functions). brygge cannot reach it: none of its dependents in brygge’s tree (gix-index, gix-prompt, tempfile) calls those functions. Nine new informational “unsound” advisories against heapless 0.8.0 (RUSTSEC-2026-0574 to 0582, 2026-11-18) are not reachable either. heapless is linked only through faster-hex 0.10.0, which uses it only when its alloc feature is off. gix-hash turns that feature on, so none of heapless’s code is in brygge. The patched heapless 0.9.4 needs a newer faster-hex, and that a newer gix. That upgrade waits for the next minor release, together with RUSTSEC-2026-0306 (RR-1). Tests: the plugin integration tests find the sibling binaries beside CARGO_BIN_EXE_brygge, because Rust 1.100 moved the test executables. Packaging (C-4f): brygge-bin’s .SRCINFO names each architecture’s attested tarball, and the AUR build container mounts the release tools read-only from the same trusted checkout of the workflow’s own commit. Documentation. Every control holds. v0.11 (2026-10-30, 0.7.0, RFC 018 contract 0.3.0) adds compression to the untrusted read path, and a second plugin boundary. C-3b: artifacts are DEFLATE frames. Every frame’s size is checked against the contract’s packing plan before it is inflated; inflation streams through a fixed 64 KiB buffer, stops at the declared size, and refuses a stream that is longer, shorter or left unconsumed. An artifact of about 256 KiB that inflates to 256 MiB passes verify within a 16 MiB peak. The digest now covers the logical (uncompressed) content, a function of the IR alone; the compressed bytes are outside it, and the canonical form is strict at the logical level. Artifacts of contract 0.2.0 are still read. New TB-7 (brygge → an external transform plugin). New C-3d: a transform records itself (a chain of records citing the digest each step read; a Transformed status that keeps the prior one; a Transform loss naming exactly what was removed), and brygge transform checks the output against the input (transform::check): every change marked, every removal recorded, nothing invented, provenance unchanged. It refuses the output otherwise and writes nothing. verify --against-source checks a chain’s root against the source (root-corresponds), never plain corresponds. C-3c: across brygge versions, --against-source re-stamps the re-decode before comparing, so an identical history is corresponds with a note and a different one is not-checked; until 0.7.0, every artifact from an earlier version was falsely reported as does-not-correspond. C-2b covers transform plugins under the same lookup rules. C-7: brygge transform writes a temporary file in --out’s directory, removed on every refusal. INV-4/C-4a: brygge-ir links miniz_oxide and adler2 (pure Rust, forbid(unsafe_code)). RR-total-memory: the artifact is 4.6×–7.5× smaller; the spill file still holds the uncompressed content; parallel compression adds a constant of about 100 MiB. New residual RR-transform-trust. v0.10 (2026-10-29, 0.6.0, RFC 017 Extensibility) adds one boundary: brygge encode <target> runs an external encoder plugin, a program the operator installed. New TB-6 (brygge → an encoder plugin). C-2b: running a plugin is not running source-provided code: brygge finds it on PATH only, among absolute entries, never in the current directory or a repository, and on Windows accepts .exe only; it spawns the resolved path directly, with no shell. INV-2 holds. New C-1g: an encoder’s output is never presented as brygge’s. brygge verifies the artifact first and refuses to run the plugin if that fails; it prints, before the plugin runs, that the plugin is not part of brygge and that brygge verified the artifact, not the plugin’s output; the name prikk is reserved for the built-in encoder, so no plugin can stand in for it. The encoder guide states the honesty rules an encoder must keep, and examples/encode-git (unsupported, never released) keeps them: every value it supplies or alters is marked in the commit. INV-4/C-4a: brygge-ir’s dependency closure is checked on every target platform at once; before, the check ran for the host only, and missed libc on aarch64 (through sha2). New residual RR-plugin-trust: a plugin runs with the operator’s privileges, and brygge does not vet it. v0.9 (2026-10-21, 0.5.0, RFC 015 Scale at real size and RFC 016 Arch Linux packaging) changes how brygge holds content, and adds a second publication channel. C-7: besides the artifact, decode (and verify --against-source) now writes one private spill file while it runs: created new, mode 0600, named .brygge-spill-…, in --spill-dir or the output’s directory, unlinked at once on Unix and deleted on close on Windows, so it is never left behind, even when the process is killed. Its location never reaches the IR. A full disk is a typed error naming the directory, with no artifact written. C-3b: the artifact reader is one streaming pass that hashes every byte and accepts nothing before the digest matches; a blob read later is re-hashed against its content address, so an artifact that changes while it is open gives ArtifactChanged, never different bytes. C-8: streaming with bounded memory is built. RR-total-memory narrowed: the peak now follows the metadata, not the content (fish-shell: decode 18.7 GiB → about 410 MiB; verify 9.1 GiB → about 64 MiB); there is still no aggregate ceiling. C-4f restated: it now names the dev-dependency guard, and covers the AUR packages: the attestations verified before packaging, the binary package checked byte for byte against the attested binary, the AUR host key pinned. New residual RR-aur-key: the AUR has no short-lived credential, so a stored SSH key, scoped to the owner’s AUR account, publishes there. v0.8 (2026-10-20, 0.4.0, RFC 014 Hardening) adds C-2g, adversarial (mutation) testing of every parser of untrusted bytes, of the IR artifact reader, and of verify’s checks. Disclosed and closed: five CVS RCS-reader defects present in 0.1.0–0.3.1, found by C-2g: an infinite loop on a truncated symbols/branches list; a crafted ed-script line number that spun the apply loop; a pre-allocation sized by an untrusted count; a subtraction panic on a malformed revision number; and a million-step walk on a cyclic chain. All are availability only. C-2a: RCS edit scripts that no tool writes are refused: out-of-order or overlapping commands, which CVS does not define; a zero-count add, which CVS 1.11 mishandles; and commands past the end, which CVS refuses too. C-4d: the scheduled check is the advisory watch, the one poll of an external source. C-4f: the release tools refuse a versioned dev-dependency on an unpublished crate, which a dry-run cannot see. New residual RR-total-memory: there is no aggregate memory ceiling; a real brygge decode peaks at about 4× its IR content (RFC 015 D-1 corrected RFC 014 D-4’s decode-only figure). v0.7 (2026-10-17, 0.3.1) discloses and closes a gap in C-2d. From 0.1.0 to 0.3.0, a crafted zstd-compressed Mercurial revlog chunk of under 128 KB could exhaust memory (RUSTSEC-2026-0344, in ruzstd before 0.9.1). The decoder expanded a whole block inside one read(), so brygge’s outer ceiling, a .take() on the stream, never got control back. It is a denial of service, never memory corruption. Fixed by ruzstd 0.9.1, which bounds each block, and by an explicit window cap at the revision ceiling. Audited and found bounded: hg zlib, the CVS RCS delta, the SVN svndiff reader, and gix-odb’s loose-object read. C-2d now states the lesson: an outer read limit bounds what a callee returns, not what it allocates. C-4c: the MSRV rises to 1.87, the floor of the only patched ruzstd. v0.6 (2026-09-25, 0.3.0, RFC 013 and batch I) reviews the three new input paths and closes RR-svn-special-toggle. New parsers, each bounds-checked, panic-free and ceilinged: the svndiff version 0 reader (SVN delta dumps; every length and offset checked before use, the target ceiling applied before a window runs, svndiff 1/2 refused by name), SVN property deltas, Mercurial’s complete store path encoding (hashed dh/ names computed from the logical path, never reversed; a missing file is a read error), and CVS branch history (per-branch clustering, the parent rule, the branch-point atom). C-2d gains the SVN per-node text ceiling (1 GiB) and the total a delta dump may reconstruct (the dump ceiling), so a small delta dump cannot amplify. C-2f gains the SVN dump checksums (MD5 and SHA-1 on every node where stated; a consistency check, not authenticity). C-3b: the reader’s canonical order for refs, drops and flags now follows the specified variant numbers; before, an artifact with drops of two classes or with both flag kinds (any CVS repository with branch revisions) failed its own integrity check, a false failure, fail-closed, never a false pass. Separately, the Mercurial decoder wrote two refs of one name for a branch with two heads, which the contract forbids: that artifact was invalid, and verify rightly rejected it. The decoder now writes one ref per branch, and the builder refuses to write any artifact with a repeated ref, drop or flag key, so brygge can no longer emit an artifact its own reader rejects. C-4d: one new dependency, md-5 (RustCrypto, MIT OR Apache-2.0, in the SVN decoder only); brygge-ir’s closure is unchanged. RR-cvs-reconstruction extends to branch points. Re-verified for 0.2.0 (2026-09-24): increments 5, 3 and 3b change how the Git and CVS decoders hold and compute state, not what they read or trust: no new parser, dependency, input path or output. The ceilings (C-2d) and every control hold, and the byte-identical output was checked by two-build comparison. v0.5 (2026-09-24, 0.2.0 batch C) closes RR-cvs-read-toctou: the CVS reader checks that the file it opened is the file its walk saw (C-2c), and a narrower note replaces the residual. v0.4 (2026-09-24) folds RFC 012 (release automation) and the new supported platforms. New control: C-4f the release pipeline (a verified, gated, tagged commit on main; published only on the owner’s approval; crates.io trusted publishing with no stored secret; SHA-pinned actions in the jobs that hold credentials; published crates checked byte for byte against the tag; binaries with checksums and build-provenance attestations; a published version’s tag never moved, by governance rule). C-4d gains the weekly advisory check. C-2c is proven on Windows (symlinks and directory junctions refused, in CI) and noted for macOS. New residuals: RR-release-agent-credentials and RR-release-dispatch-tools. v0.3 (2026-09-24) folds the 0.1.0 correction cycle (intake review CR-01…CR-21, reviews 002–011) and closes the model against the code as built. New controls: C-1f output neutralization; C-2f source-object integrity (Git objects re-hashed, the commit-graph cache not trusted, tag chains verified; every hg revision checked against its node with a collision-detecting SHA-1); C-6d only what the source would publish is imported (Git carried namespaces; the hg published view). Restated to match the code: C-2a (strict, typed refusal; the panic boundary; release overflow checks), C-2c (read confinement, and the floor refusals that enforce it), C-2d (the declared ceilings, checked before allocation), C-3a (the seven verify checks and the three-valued verdict), C-3b (IR contract 0.2.0: version gate first, critical bit, strict canonical form, digest over the stored bytes), C-7 (atomic write), C-8 (cancellation and progress are not built; stated as such), C-9 (no stated non-determinism remains in the IR). Residuals: RR-cvs-reconstruction, RR-cvs-read-toctou and RR-svn-special-toggle added; RR-git-loose-object-symlink, RR-git-object-id-unverified and RR-hg-node-unverified (found and closed in the same cycle) closed; RR-gix-sha1 narrowed; RR-4 and RR-svn-svnadmin-version updated to the rulings and the code. v0.2 (2026-09-09) folds the RFC 004 (gix) and RFC 006 (SVN Tier D) security-review deltas: C-2e/C-4b/INV-4 — a C surface may be isolated to a subprocess, not only a dedicated FFI crate; TB-2 acknowledges subprocess decoder producers; C-2b clarifies that invoking a trusted external tool is not executing source-provided code; and three residuals added — RR-gix-sha1, RR-svn-svnadmin, RR-svn-svnadmin-version. |
| Basis | brygge Requirements v0.2 (PU/NG/PR/HO/VF/ID/FA/BN/IR/UD/OQ) and External Design v0.2 (BD/CL/IX/FS/PX/CF/FL/CT/OP/GATED); RFC 113 (import contract); project rules (.git-exclude/rules/, §Release Deliverables — a threat model is a first-class release deliverable) |
| ID scheme | A- asset · TB- trust boundary · T- threat · C- control · INV- security invariant · RR- residual risk · ASSUME- assumption |
| Not | code, an API, or a dependency audit report. It states what brygge must defend, against whom, and how — so the design and tests can be checked against it. |
The essence, in one paragraph. brygge is unusual among the ecosystem’s tools: it reads untrusted input (a source repository is attacker-controllable in every byte), it links or drives heavy third-party code to do so (gix for Git; an svnadmin subprocess for SVN — the very reason it is a separate project from prikk, PU-5), and it produces artifacts that a target system will trust and import. Its two signature dangers follow directly: (1) manufactured verification — producing history that reads as native or verified when it is neither (the failure RFC 110 §4 and NG-3 name), and (2) hostile source input — a crafted repository that exploits a decoder, escapes the output directory, exhausts the host, or smuggles executable content. Everything below organizes the defense of those two, plus the supply-chain and boundary properties that keep brygge’s weight from becoming prikk’s.
1. Assets (A-…)
- A-IMPORT — the integrity and honesty of the produced IR (intermediate representation) and target proposal. This is the primary asset: downstream readers and the target trust it. Its value is not just correct bytes but the truthful marking of what was stated vs derived, what was preserved vs dropped, and that authorship is unverified (HO-1…HO-4).
- A-HOST — the operator’s machine and the brygge process. brygge parses attacker-controlled repositories with large parsers; a compromise or crash here is a real cost.
- A-TARGET-TRUST — the target’s trust boundary. The target (prikk first) decides admission/seal (BN-2); brygge must never produce output that induces the target — or a human reviewing it — to over-trust imported history.
- A-SUPPLY — brygge’s dependency supply chain. The heavy decoder libraries are both the enabling asset and the largest attack/audit surface.
- A-SOURCE-CONTENT — secrets and PII that live inside source history. brygge carries source content faithfully by design; that content may include committed secrets, private emails, and internal paths. brygge must not worsen their exposure.
2. Trust boundaries (TB-…)
| ID | Boundary | Direction & trust |
|---|---|---|
| TB-1 | source repository → brygge | Untrusted in. Every object, path, name, message, size, and delta is attacker-controllable. This is brygge’s defining boundary and has no analogue in stikk. |
| TB-2 | heavy decoder libraries (or tools) → brygge | Semi-trusted, large. gix/libgit2/SVN/CVS libraries — or a decoder subprocess such as svnadmin dump (RFC 006 Tier D) — process the untrusted bytes of TB-1; a vulnerability in them is a vulnerability in brygge, though a subprocess confines that vulnerability to a separate address space (C-2e/C-4b). |
| TB-3 | brygge → target system | brygge’s output is a claim, not authority. The target owns admission/trust/seal (BN-2). brygge’s obligation is honest, sufficient provenance (BN-3). |
| TB-4 | operator ↔ brygge | Trusted. The operator runs brygge, sets inference parameters (CF-01), and the owner sets the floor policy (CF-03). brygge trusts the operator’s host and configuration. |
| TB-5 | brygge output → third party / bundle receiver | The import’s honesty and provenance must survive the hop to someone holding only the output (VF-3) or the output plus the original source (VF-2). |
| TB-6 | brygge → an external encoder plugin (since 0.6.0, RFC 017 D-3) | The operator’s own installed code, trusted as the operator’s host is (TB-4, ASSUME-1), and never source-provided. brygge hands it an artifact it has just verified. What the plugin writes is outside brygge’s guarantee, and is labelled so (C-1g). |
| TB-7 | brygge → an external transform plugin, and back (since 0.7.0, RFC 018 D-6) | The operator’s own installed code, as TB-6, never source-provided. brygge hands it an artifact it has just verified. Unlike an encoder’s, its output comes back into brygge’s chain, so brygge does not trust it: the output is read as untrusted input (C-3b) and checked against the input (C-3d) before anything is written to --out. |
| TB-8 | brygge → git (since 0.8.0, RFC 019 D-1) | A trusted external tool on the operator’s host, as svnadmin is (TB-2, C-2b), run under a cleared environment. brygge writes the stream git fast-import reads, then checks what git wrote against the artifact before handing it over (C-1g), so a faulty or replaced git gives a refused result, not a wrong one. |
3. Threats and controls (T-…, C-…)
T-1 (Spoofing) — manufactured verification / authorship laundering
A source (or a careless run) yields history that reads as natively authored or prikk-verified. The archetype: a GPG-signed Git commit presented as a verified prikk author; or imported history that looks indistinguishable from sealed native history. This is brygge’s worst failure — a trust-destroying one for the whole ecosystem (A-IMPORT, A-TARGET-TRUST).
-
C-1a —
Unverifiableby construction (HO-3, NG-3). Imported authorship lands in exactly the target’s vocabulary for “present, readable, not verified as authored”; for prikk that isUnverifiable. It is never shown as sound/green/native anywhere in any brygge surface (FS-04). -
C-1b — honesty is a property of every object, not a report (HO-4, FS-01/FS-02). The derived-marking, the loss boundary, and the
Unverifiablestatus live in the IR/proposal and are recoverable from them (brygge inspect), so they cannot be lost, skipped, or separated from the history they describe. -
C-1c — honesty is non-configurable (HO-5, CF-02). No flag suppresses derived-marking, the loss boundary,
Unverifiable, or the fidelity summary. Configuration tunes inference, never honesty. -
C-1d — the two claims are never conflated (VF-4, FS-04). “verified by the target” and “faithfully imported, authorship unverified” are distinguishable by any reader at any time; a preserved source signature is shown as preserved and verifying nothing in the target, never as a target signature.
-
C-1e — derived ≠ stated, in the object (HO-1, IR-2). An inferred rename / reconstructed CVS changeset / inferred SVN branch is marked derived where it appears; a reader tells judgment from fact without re-running the heuristic.
-
C-1f — untrusted text cannot forge brygge’s own output (CL-07; CR-19). Source text (names, messages, paths, ref names, reasons derived from them) could otherwise print a fake
PASSline, a fake key, or terminal control sequences that hide or recolor a verdict.- Human output: every control character and every bidirectional or invisible Unicode format character is shown escaped (
\u{XXXX}), and a literal backslash is doubled, so an escape in the output is never ambiguous with one in the input. - Machine output: untrusted text never appears in a key (items are indexed). Values are percent-encoded outside a small safe set, so a value can never contain
=or a newline and can never forge a line or a key. - One renderer: only the CLI prints. Decoder libraries write nothing to stdout or stderr, so no text can bypass the neutralization.
- Human output: every control character and every bidirectional or invisible Unicode format character is shown escaped (
-
C-1g — an encoder’s output is never presented as brygge’s (since 0.6.0, RFC 017 D-1/D-3). An encoder sits after brygge’s chain (TB-6), so its output could be mistaken for something brygge verified, the T-1 archetype one hop later.
- Verify first, always:
brygge encoderunsverify’s internal checks on the artifact, and on anything butpassit printsverify’s report and exits withverify’s code. The plugin never starts. A plugin is never handed an artifact brygge would reject. - The label: before the plugin runs, brygge prints on stderr that the plugin is external, not part of brygge, and that brygge verified the artifact, not the plugin’s output, with the plugin’s resolved path. brygge’s own refusals all come before that line, so its presence tells a reader whose exit code follows.
- The reserved name:
encode prikkis the built-in encoder’s (Track B1), and is never looked up onPATH. No plugin can stand in for it. - The rules for encoders: the encoder guide (
docs/src/reference/writing-an-encoder.md) requires an encoder to carry or discloseDerivedmarks, to mark every value it supplies or alters, and to report the loss boundary.examples/encode-git, unsupported and never released, does so in every commit (Encoded-supplied:,Encoded-altered:,Brygge-Derived:,Brygge-Artifact:). - brygge supports no third-party encoder. It vouches for the artifact it checked, and for nothing a plugin produces.
- Verify first, always:
T-2 (Tampering / Elevation / DoS) — hostile source repository
A crafted source exploits brygge or its host through TB-1/TB-2: memory-safety bugs in a decoder; path traversal / symlink escape / absolute paths in source-declared file paths; decompression or delta bombs; pathological object counts or sizes; and source-embedded executable content — Git hooks, .gitattributes clean/smudge filters, submodule URLs, SVN hook scripts, CVS .cvsignore/wrappers (A-HOST, A-IMPORT).
-
C-2a — all source bytes are untrusted (TB-1). No decoder path assumes well-formedness; malformed input is a refusal (FA-2/FA-3), never undefined behaviour. Where a format’s reference tool is itself undefined on malformed input, brygge refuses rather than imitating it. For example, RCS edit scripts that
diff -nnever writes are refused. For out-of-order or overlapping commands CVS defines nothing: 1.11 refuses them through unsigned wraparound, and 1.12 returns artifacts of its reverse traversal. A zero-count add is a heap write past its buffer in 1.11, and a silent no-op in 1.12. Commands past the end are refused by both CVS lines, and by brygge.- Strict, never guessed. A malformed field is a typed error, not a default. Examples: an unparseable RCS date or an out-of-range date component; an unknown escape or duplicate key in an hg extra; a malformed phaseroots, bookmark or localtag line; an SVN symlink without its
linktarget. - Refused where carriage cannot be exact. A shape brygge cannot carry byte-exact is a named floor refusal (exit 20), never a lossy conversion. This covers non-UTF-8 paths, and names that the IR holds as text: Git ref names and commit header names, CVS symbol names, and hg extra keys.
- Contained failure. An unexpected panic inside a decoder or a decoder dependency is caught at one boundary in the CLI and becomes a typed failure (exit 1), never an unclassified abort. Release builds keep integer overflow checks, so an arithmetic wrap that review missed becomes that typed failure rather than a false value.
- Strict, never guessed. A malformed field is a typed error, not a default. Examples: an unparseable RCS date or an out-of-range date component; an unknown escape or duplicate key in an hg extra; a malformed phaseroots, bookmark or localtag line; an SVN symlink without its
-
C-2b — brygge never executes source-provided code. Decode reads objects; it does not run hooks, apply clean/smudge filters, fetch submodules, or execute any script the source carries. Filter/hook content is preserved opaquely as data (PR-4) if it is history, never invoked. This is an invariant (INV-2). Running a trusted external tool to read a source (RFC 006 Tier D invokes
svnadmin dump) is distinct from and does not breach this: the tool is operator-environment code (TB-4), not source-provided, andsvnadmin dumpexecutes no repository hook scripts (hooks fire on commit/revprop paths, never on dump). A tool that did run source-embedded code, or a source construct that reaches out (svn:externals), is refused — externals are refused, not resolved (→ the SVN floor).- Encoder plugins (since 0.6.0, RFC 017 D-3) are operator-installed code too (TB-6), never source-provided, and brygge keeps it so. The plugin is found on
PATHonly, and only among its absolute entries: an empty or relative entry is skipped, so the current directory and a source repository are never searched. On Unix, it must be a regular file with an execute bit; on Windows, a regular file namedbrygge-encode-<target>.exe(never a.bator.cmd, which run throughcmd.exe). The target name must match[a-z0-9][a-z0-9-]*, so no path or shell character reaches the lookup. brygge resolves the path itself and spawns it directly, never the bare name (Windows’ own search would look elsewhere first), with no shell, and passes the arguments verbatim. - Transform plugins (since 0.7.0, RFC 018 D-6; TB-7),
brygge-transform-<name>, are found and run by exactly the same code, with the same rules. The two kinds never stand in for each other.
- Encoder plugins (since 0.6.0, RFC 017 D-3) are operator-installed code too (TB-6), never source-provided, and brygge keeps it so. The plugin is found on
-
C-2c — source-declared paths are data, not filesystem targets; brygge reads only the repository it is given. Paths from the source name content inside the IR; brygge never uses a source-declared path as a write destination (→ C-7). On the read side, a source must not be able to make brygge read another location on the host into the IR, which would be a confused deputy (T-6/T-7):
- Git: opened with gix’s isolated options (no global, system or environment configuration). Alternates, a redirected git directory (
gitdir:files,commondir), and a symlinked.git,objects,objects/info,objects/packor pack entry are refused. So are grafts, replace refs and shallow clones, which would substitute history. - CVS: any symlink under the repository root, file or directory, is refused; entries are examined with
lstatand never followed.- The file opened is the file walked. On Unix it must have the same device and inode as the walk’s
lstat. On Windows it is opened without following a link, and refused if it is a link or any reparse point. - A swap between the walk and the open is
Read(“changed while being read”), never a read of another file.
- The file opened is the file walked. On Unix it must have the same device and inode as the walk’s
- Mercurial: the store is read in place; a repository in the middle of a merge is refused.
- SVN: a dumpfile is read as one stream; a live repository is read only through
svnadmin dump. - Per platform (RFC 012; tested in CI on Linux x86_64 and arm64, macOS and Windows):
- Windows: a file symlink, a directory symlink and a directory junction are each refused, under
a CVS root and in Git’s redirected-directory checks.
stdreports a junction as a symlink, because its reparse tag is a name surrogate, and a CI test asserts it. A Windows name that is not valid Unicode is refused asnon-utf8-path. - macOS: APFS and HFS+ cannot hold a file name that is not valid UTF-8, so that refusal cannot arise there. Its escaping stays tested on every platform.
- Windows: a file symlink, a directory symlink and a directory junction are each refused, under
a CVS root and in Git’s redirected-directory checks.
- Git: opened with gix’s isolated options (no global, system or environment configuration). Alternates, a redirected git directory (
-
C-2d — resource bounds, refuse rather than exhaust (→ T-8). Declared ceilings on object size, total count, path length and depth, and decompressed size. A ceiling is checked before the memory it protects is allocated. An outer read limit (a
.take()on a decoder’s stream) bounds only what the decoder returns, not what it allocates internally, so a decompression ceiling is claimed only where the decoder’s own allocation is bounded, too (each site audited in v0.7). Hitting a ceiling is a typed refusal (ResourceLimit, exit 20) naming what exceeded and the ceiling with its unit, never an OOM, a stack overflow or a hang. Each decoder keeps its ceilings in one place, and its README lists them:- Git: blob size, read from the object header before the body is read; commit count; path length; tree depth, enforced by an iterative tree walk (recursion on attacker-chosen depth could abort the process beyond any panic boundary); tag-chain length.
- Mercurial: every decompression and every delta application is bounded. zlib inflates into brygge’s buffer, so the outer limit bounds it. zstd is bounded by
ruzstd0.9.1’s per-block bound plus a window cap at the revision ceiling; before 0.3.1 it was not (see v0.7). Each reconstructed revision must also equal its index’s recorded length. The obsstore and the small metadata files (phaseroots, bookmarks, localtags) have ceilings; the dirstate read is 40 bytes. - SVN: the dumpstream is size-checked before reading and read through a bound. One node’s text (fulltext or reconstructed from a delta) is at most 1 GiB, and everything a delta dump reconstructs is at most the dumpstream ceiling; both are checked before a delta window runs. The
svnadminsubprocess’s stdout is bounded, and its stderr is drained with only a bounded prefix kept, so the child can never deadlock. - CVS: each
,vfile is size-checked before reading and read through a bound; the file count is bounded. - Streaming (bounded memory, not just bounded input): RFC 010’s increments 2 and 4 were deferred by measurement in 0.2.0, since every peak tracks the IR itself.
-
C-2e — memory-safety posture. brygge’s own crates
forbid(unsafe_code). The unsafe/C surface is confined to dependencies (RR-1) and, if a C library is used at all, to a single dedicated FFI crate — or, preferably where available, to a subprocess (RFC 006 Tier D reads SVN viasvnadmin dumprather than linkinglibsvn), which contains any memory-safety fault in that C code in a separate address space where it cannot corrupt brygge’s process or defeatforbid(unsafe_code)(→ C-4b). -
C-2f — source identifiers are verified, not trusted (PR-4, VF-2). brygge preserves a source’s own object ids (a Git SHA, an hg node) as the link back to the source. A crafted repository could present content under an id it does not hash to, and brygge would then publish a false link.
- Git: every object whose content or links reach the IR is re-hashed with the repository’s hash kind and compared with the id it was requested by; a mismatch stops the decode. That covers commits, trees, blobs, and every tag on a tag chain. History is walked from verified commits only: the commit-graph cache, an unverified index of parent ids, is not consulted, and a walk that disagrees with verified commit content is a read error. The SHA-256 object format is refused until the reader supports it.
- Mercurial: every revision brygge reads (changelog, manifest, filelog) is checked against its node with Mercurial’s own revision hash,
sha1(min(p1, p2) ‖ max(p1, p2) ‖ raw text), using a collision-detecting SHA-1 as Mercurial does. A mismatch, or a detected collision, stops the decode. A filelog’s store name, including a hasheddh/name, is computed from the logical path with Mercurial’s own encoding, so a wrong or missing file is a read error, never a silent skip. Revisions whose stored text is not the hashed text (ellipsis, external storage) and unknown revision flags are refused by name. The repository identity is taken from the smallest published root, which is read and therefore verified. - SVN: every checksum a dump states (
Text-content-md5/-sha1,Text-delta-base-*,Text-copy-source-*) is checked on every node, and a mismatch stops the decode. This is consistency, not authenticity: the dump is untrusted and can state any checksum. It catches a corrupt dump, a delta applied to the wrong base, and a fault in brygge’s own delta application.svnrdumpwrites MD5 only, hencemd-5.
-
C-2g — the parsers are tested adversarially, not only by example (RFC 014). Every parser of untrusted bytes (RCS, the SVN dumpstream and svndiff, the hg revlog, its metadata files and its store encoding, the IR artifact reader) and
verify’s checks on a received artifact are fed format-aware mutations of real seeds: boundary values at length, count and size fields, and at every declared ceiling. Each must giveOkwithin its ceiling, or a typed error; never a panic, a hang, or an over-ceiling result. The tests run on stable Rust, in the ordinary suite. A quick depth runs on every push. A deep depth runs under an OS memory cap whenever parser code orCargo.lockchanges, and at each release cut, so an allocation that escapes a ceiling kills the run (proven against the RUSTSEC-2026-0344 decoder). Every finding becomes a permanent regression test.
T-3 (Tampering) — altering the import, or stripping its honesty
An attacker (or accident) modifies the IR between decode and encode, or strips derived-marks / loss-boundary / provenance so the output looks more trustworthy than it is (A-IMPORT).
-
C-3a — inconsistency is detectable (VF-3; CR-02).
brygge verify, which needs no source, runs seven checks, and each can fail:- integrity: the contract version and digest;
- structure: parents exist and precede their children, refs target atoms, ref names are unique per kind, and there is at most one op per path per atom;
- replay: replaying each atom along its first parent is consistent (adds target absent paths; modifies, deletes and replaces target present ones);
- derivations: every derived record carries the parameters its kind requires (for example, a reconstructed CVS changeset needs its window, keys, date rule and confidence rule);
- source-invariants: an atom’s status fits its source kind, so a CVS artifact relabelled
Statedfails even with its ids and digest recomputed; - provenance: it names its decoder, versions and source;
- loss-boundary: the loss boundary is present and well-formed.
The verdict is three-valued:
pass,fail, orincomplete(a requested--against-sourcecould not run). It is never reported aspasswith a non-zero exit. -
C-3b — the artifact is integrity-checkable and versioned (IX-07; RFC 011). The IR carries its contract version and a content digest, so tampering or truncation is detectable rather than silent (this is detectability, not authentication — see RR-4).
-
The version gate runs first: an artifact of an unknown contract is refused before anything else is parsed.
-
The digest covers the logical content (since 0.7.0, contract 0.3.0, RFC 018 D-3): the uncompressed stream the frames give, never a re-encoding, and never the compressed bytes. It is a function of the IR alone, because the store order and the frame packing are fixed by the contract and checked by the reader. A 0.2.0 artifact’s digest covers its stored bytes, as before.
-
The canonical form is strict at the logical level: a non-canonical encoding of the same content is refused, so no two logical streams mean one artifact. Two files that differ only in compression are one artifact, with one digest, by design.
-
Decompression is bounded before it allocates (since 0.7.0, RFC 018 D-1; reviews 099 and 101):
- every frame’s declared size is checked against the packing plan, which the blob table fixes, before its stored bytes are read;
- a DEFLATE frame may not claim more than DEFLATE’s maximum expansion;
- inflation streams through a fixed 64 KiB buffer, stops at the declared size, and refuses a stream that is longer, shorter, or leaves stored bytes unconsumed.
So a small artifact cannot claim a large allocation. An artifact of about 256 KiB that inflates to 256 MiB, 16 times the bound, passes through
verifywithin a 16 MiB peak, measured in a child process; that test fails, never skips, on Linux. The lesson of RUSTSEC-2026-0344 (C-2d) applies here too. -
Evolution is safe by construction: each field carries a critical bit. An unknown critical field is refused, and an unknown non-critical field is skipped and reported, never silently ignored.
-
One pass, and nothing read twice unchecked (since 0.5.0, RFC 015 D-4). The reader streams the file once: it feeds every byte into the digest, checks the canonical order, and hashes each blob as it passes, keeping only the metadata and an index. Nothing is accepted before the digest matches. A blob read later, from the same open file, is re-hashed against its content address; a mismatch is
ArtifactChanged. So a file that changes while brygge reads it can never be parsed as bytes other than those it verified.from_bytesis the same parser over memory. Since 0.7.0, a blob read later re-inflates its frame under the same bounds, and is still re-hashed.
-
-
C-3c — determinism catches divergence (VF-1, C-9). A fresh re-decode of the same source under the same version reproduces the IR; a tampered artifact diverges from the reproduction.
verify --against-sourcereportsnot-checked(verdictincomplete), neverfail, when the source given is a different form from the one recorded (an SVN dumpfile versus a live repository). It compares SVN decodes with the recordedsvnadminversion aligned, noting a version difference rather than failing on it.- Across brygge versions (since 0.7.0, review 106 V-1). The IR records which brygge and decoder made it, and every derivation records its decoder’s version, which its atom’s id covers. Until 0.7.0, the comparison therefore reported every artifact made by an earlier brygge as
does-not-correspond, a false claim of tampering. Now, when the versions differ, the re-decode is re-stamped to the artifact’s versions and rebuilt (Ir::restamped), then compared: an identical history iscorresponds, with a note naming both versions; a different one isnot-checked(verdictincomplete), naming the version to re-run with, because a newer decoder may decode differently and legitimately. With equal versions, the comparison is strict, as before. - The cost, accepted: an attacker who also edits the recorded version turns a
failinto anincomplete. That is never apass, its exit code is non-zero, and the report names the recorded version.restampedis never written by the CLI, so it cannot relabel an artifact.
- Across brygge versions (since 0.7.0, review 106 V-1). The IR records which brygge and decoder made it, and every derivation records its decoder’s version, which its atom’s id covers. Until 0.7.0, the comparison therefore reported every artifact made by an earlier brygge as
-
C-3d — a transform records itself, and brygge checks it (since 0.7.0, contract 0.3.0, RFC 018 D-5/D-6). A transform (an IR → IR program) could otherwise launder history: change an author, remove a file, and present the result as the decoder’s original, the T-3 archetype.
-
The record, in the artifact:
- a chain of records, each naming the transform, its version and parameters, and the digest (C-3b) of the artifact it read, so the chain links back to the decoder’s original;
- a
Transformedstatus on every atom, op and ref a transform changed, naming exactly the changed parts from a closed vocabulary, and keeping the prior status, so an earlierDerivedis never erased; - a
Transformloss for everything removed, naming exactly one thing (atom,op,copyorref).
The reader refuses a malformed chain (C-3a), and a 0.2.0 artifact carrying any of it.
-
The check, at brygge’s boundary (TB-7):
brygge transformverifies the input first, runs the plugin into a temporary file, reads the output as untrusted input, and runstransform::checkagainst the input:- one new record, citing the input’s digest;
- provenance, flags and earlier records unchanged;
- every difference marked, exactly, in both directions;
- every removal recorded;
- nothing added (no atom, no op without an input op).
On any failure it deletes the file, writes nothing, and exits 50. The check is a public function, so anyone holding both artifacts can run it, and
transform::Editbuilds outputs that pass it by construction. -
Back to the source:
verify --against-sourceon a chained artifact re-decodes and compares the result’s digest with the chain’s first record. The verdict isroot-corresponds(CVS:root-reproduces), naming how many steps were not re-run; never plaincorresponds. -
What it cannot do is check a step run outside
brygge transform(RR-transform-trust).
-
T-4 (Supply chain) — the heavy dependency surface
The decoder libraries (~100 crates for gix, or C for libgit2, plus SVN/CVS) are the largest attack and audit surface, and the reason brygge is separate from prikk (A-SUPPLY, PU-5).
- C-4a — isolate the weight behind the decoder boundary. The heavy deps live only in the per-source decoder crates; the IR, the honesty/verify path, and the encoders do not link them. VF-3 (internal verification) must run without any decoder dependency present — the internal analogue of BN-5.
brygge-ir’s closure is a committed allowlist (crates/brygge-ir/allowed-dependencies.txt), checked bytools/check-ir-isolation.shfor every target platform at once (cargo tree --target all, since 0.6.0): before, the check ran for the host only, and missedlibc, whichsha2pulls in throughcpufeatureson aarch64. Since 0.7.0 the closure also holdsminiz_oxideandadler2(RFC 018 D-4, approved by the owner under RFC 009 D-6): pure Rust,forbid(unsafe_code), already in the lock file. They are not pinned with=, so a crate that linksbrygge-irkeeps its own resolution; a golden-bytes test shows when an upgrade changes the file bytes (never the digest, C-3b).examples/encode-gitproves PU-3 against the same allowlist: an encoder onbrygge-iralone. - C-4b — pure-Rust preferred; C isolated by FFI crate or subprocess. Prefer pure Rust (e.g.
gix, keepsforbid(unsafe)maximal) over a C library (e.g.libgit2). If C code is unavoidable for a source, isolate it — in preference order: (1) a pure-Rust reader (no C at all — the ideal); (2) a subprocess that produces a parseable stream brygge reads in pure Rust (RFC 006 SVN Tier D:svnadmin dump→ brygge’s own dumpstream parser) — the C fault surface is a separate process, not brygge’s address space, and vanishes entirely when the operator supplies the dumped stream directly; (3) a single dedicated FFI crate — the one placeunsafe/C is linked into brygge, mirroring prikk’sprikk-ffidiscipline — used only when neither (1) nor (2) is available. The subprocess (2) is stronger isolation than the FFI crate (3) and is preferred wherever the source ecosystem offers a suitable tool. - C-4c — pin and lock. Exact dependency versions; the lockfile is committed; upgrades are deliberate and reviewed. A security fix may raise the MSRV, when the only patched version needs it (0.3.1: 1.85 to 1.87, for
ruzstd0.9.1). The MSRV job in CI proves the new floor. - C-4d — supply-chain gates in CI.
cargo-deny(advisories, licenses, banned/duplicate crates) andcargo-auditrun in CI; a new advisory fails the build. New or upgraded decoder dependencies get explicit architect review (governance). The advisory watch (advisory-watch.yml) runscargo auditagainst the newest advisory database with no code change. It is brygge’s only scheduled job: a new advisory is an external event with no trigger in the repository, so it is polled (GOVERNANCE.md, “Work is triggered, never scheduled”). The isolation ofbrygge-ir(C-4a/C-5) is enforced in CI against a declared allowlist of its dependency closure (tools/check-ir-isolation.sh), not merely observed. - C-4e — minimize. The dependency set is kept as small as the mission allows; a dependency is justified, not defaulted-in.
- C-4f — the release pipeline publishes only what was verified, on the owner’s go-ahead (RFC 012;
release.yml). A compromised pipeline could publish a maliciousbryggeto everycargo installuser, so it is the place brygge holds its only publish credential. The pipeline enforces:- What is released:
- an annotated
X.Y.Ztag, onmain, equal to the workspace version, with its CHANGELOG section; - gated by the same reusable workflow as CI, on the tagged commit;
- built for the four CI-proven platforms before anything is published, unless a dispatch turns the binaries off (as for 0.1.0, whose release has none, and whose gates run on Linux only). Publication is all-or-nothing behind these checks.
- an annotated
- Who authorizes it: the owner’s explicit go-ahead, given before the architect pushes the tag
(
GOVERNANCE.md); the tag push starts the publication. (A per-release approval gate in thereleaseenvironment was used for 0.1.1 and removed for v0 by owner ruling, RFC 012 D-2.) Thereleaseenvironment stays, without a reviewer: it scopes crates.io trusted publishing, and it admits onlymainand release tags. A published version’s tag is never moved or deleted: a governance rule (GOVERNANCE.md), not a GitHub ruleset. It was deliberately not mechanized in v0 (RFC 012 D-2, amended), because crates.io versions cannot change anyway. - What the credential is: crates.io trusted publishing issues a token that lasts minutes, to this
workflow in this environment; no crates.io token is stored anywhere.
- Permissions are least-privilege per job (
contents: readby default;id-token: writeonly where a token is minted;contents: writeonly for the GitHub release). - Every third-party action in
release.ymlis pinned to a commit SHA. - No workflow expression is interpolated into a shell script.
- The release tools refuse a versioned dev-dependency on an unpublished crate, which a publish dry-run
cannot see before the cut (
tools/check-release-dev-deps.sh).
- Permissions are least-privilege per job (
- What was released is checked:
- after publication,
bryggeis installed from crates.io and smoke-tested; - every published crate is compared byte for byte with the tag;
- binaries carry SHA-256 checksums and GitHub build-provenance attestations
(
gh attestation verify).
- after publication,
- The AUR packages (since 0.5.0, RFC 016):
brygge, built from the tag’s source archive, andbrygge-bin, the release’s binary. Theaurjob runs only after the GitHub release succeeds:- it verifies each Linux binary’s attestation before rendering anything;
- it builds both packages in an
archlinux:base-develcontainer pinned by digest, as an unprivileged user.bryggeruns the full test suite (check());brygge-binis checked to install the attested binary byte for byte (makepkg’s stripping is off), and the job fails otherwise; - it clones the AUR repositories anonymously over HTTPS. The SSH key (RR-aur-key) is written to a mode-0600 file only in the push step, and removed whatever the outcome;
- the AUR host key is pinned in
packaging/aur/known_hosts; the host key is never accepted on first use; - an AUR failure after a release is reported as “released; AUR not updated”, never as a green run.
- What is released:
T-5 (Elevation) — brygge output enlarging the target’s audited surface
A design in which consuming a brygge import forces the target to link a brygge dependency would defeat the whole separation: prikk’s deliberately small audited dependency surface would grow through the back door (A-TARGET-TRUST, BN-5).
- C-5 — the boundary is a tested property (CT-05). The IR, the proposal, and internal verification (VF-3) are consumable and checkable with only the target’s own dependency surface — no brygge decoder dependency required downstream. This is verified by a test that consumes brygge output with none of brygge’s decoder deps present.
T-6 (Information disclosure) — leaking source secrets, or importing them unknowingly
Source history may contain committed secrets, private emails, GPG signatures, and internal paths. Threat: brygge exfiltrates them (network/telemetry/logs), or the operator imports secrets without realizing they travel (A-SOURCE-CONTENT).
- C-6a — no network, no telemetry (INV-3). brygge reads sources and writes operator-specified files only (CT-01). There is no phone-home, no analytics, no remote fetch during decode (submodules are refused, not fetched — C-2b).
- C-6b — no content in logs beyond the operator’s chosen surface. Diagnostics name atoms, classes, and counts; they do not dump source content into logs that could outlive the operator’s intent.
- C-6c — carried-verbatim is stated, not silently scrubbed. brygge preserves source content faithfully (VF-2 depends on it), so it must not silently redact — but the fidelity surface states plainly that content is carried verbatim from source, so the operator knows secrets-in-history come along and can act in the source before import. brygge names what it does not do; scrubbing is the operator’s pre/post step (RR-3).
- C-6d — only what the source would publish is imported (CR-05). Some history in a repository was never meant to leave it.
- Git: history comes only from the carried namespaces (
refs/heads/*,refs/tags/*). Commits reachable only from stash, notes, remote-tracking or other refs are not imported, and they are counted. - Mercurial: brygge computes the repository’s published view (what
hg clonewould share). Secret, archived and internal-phase changesets, and hidden (obsolete) ones, are not imported, and they are counted. - A migration therefore cannot carry a changeset the source marked private.
- Git: history comes only from the carried namespaces (
T-7 (Elevation) — confused deputy / errant writes
A source with crafted paths tries to make brygge write outside --out (A-HOST).
- C-7 — write only where told. brygge writes one file, the artifact at
decode --out; source-derived paths are never write targets (C-2c). This mirrors stikk’s “never write inside a repository” discipline, one boundary over. The write is atomic: a temporary file in the same directory, synced, then renamed over the target. An interrupted or failed decode leaves the previous artifact intact, never a truncated one.- The spill file (since 0.5.0, RFC 015 D-3). While it decodes, brygge keeps file content in one temporary file instead of memory: in
--spill-dir, which must already exist, or else the output’s directory. It is created withcreate_newand mode 0600 under a unique.brygge-spill-…name. On Unix its directory entry is removed as soon as it is open; on Windows it is opened delete-on-close. So it is private while it exists, and gone when the process ends, however it ends. Its location never reaches the IR or the provenance, and it never changes the artifact. A write error, a full disk included, is a typed error naming the directory, and no artifact is written.verify --against-sourcespills its re-decode under the same rules. - The transform output (since 0.7.0, RFC 018 D-6).
brygge transformwrites one more file: a temporary file in--out’s directory, created withcreate_newand mode 0600 under a unique.brygge-transform-…name, which the plugin writes. It is not unlinked, because the plugin needs its path. It is deleted on every refusal path (a plugin failure or signal, a failed verify, a failed check), and on success renamed over--out, atomically.--outmay not be the input. An interrupt of brygge itself can leave it behind; it holds only what the plugin wrote.
- The spill file (since 0.5.0, RFC 015 D-3). While it decodes, brygge keeps file content in one temporary file instead of memory: in
T-8 (Denial of service) — resource exhaustion
Enormous repositories, pathological delta chains, deep trees, huge file counts, decompression bombs (A-HOST). (Called out separately from T-2 because it is a normal operating condition for real migrations, not only an attack.)
- C-8 — bounded and honest at the limit. A ceiling hit is a typed refusal with a named reason (FA-3, C-2d), never an OOM that leaves an ambiguous artifact. An interrupted run leaves no artifact, or the previous one intact (C-7); brygge does not write partial artifacts.
- Not built: progress reporting and graceful cancellation (OP-02). Interrupting brygge simply stops it. That is safe because of C-7, but it gives no progress and produces no labelled partial.
- Built in 0.5.0 (RFC 015): content is held on disk while decoding (C-7’s spill file), the artifact is written and read as a stream (C-3b), and memory follows the metadata rather than the content. What remains is RR-total-memory.
T-9 (Tampering) — non-determinism as a trust hole
If brygge is non-deterministic, “faithful” is uncheckable (VF-1 fails) and a tamper can hide in the noise (A-IMPORT).
- C-9 — determinism is a security property. The same inputs yield byte-identical IR and proposal; any non-determinism brygge cannot avoid is named as a stated non-determinism, never left to silently perturb output. Since contract 0.3.0, the digest is reproducible for the same brygge version, source and parameters whatever the codec’s version, and the file bytes are reproducible for the same brygge build (C-3b); parallel compression keeps them byte-identical to a serial write. Since contract 0.2.0, the IR carries no import time, so no stated non-determinism remains in the IR itself. The one input-side dependency is the
svnadminversion for a live SVN decode (RR-svn-svnadmin-version). prikk ruled that an import attestation’screated_atis a fixed sentinel (UD-4), so the proposal adds none either.
4. Security invariants (INV-…) — the non-negotiables
A change that breaks one of these is a security bug, not a preference. Several must be enforced by test.
- INV-1 — No manufactured verification. Imported authorship is
Unverifiableby construction; honesty (derived-marking, loss boundary, status, fidelity summary) is a property of every produced object and is not configurable off. (T-1) - INV-2 — Source input is untrusted, and brygge never executes source-provided code. No hooks, filters, submodule fetches, or scripts are run; all source-driven resource use is bounded. (T-2/T-8)
- INV-3 — No network I/O; writes only to operator-specified outputs. (T-6/T-7)
- INV-4 — The dependency surface is isolated, minimized, pinned, and audited, on every target platform; brygge’s own crates
forbid(unsafe_code); any C code lives only in a dedicated FFI crate or a subprocess (C-4b). (T-4) - INV-5 — brygge output never enlarges the target’s audited surface — consumable and internally verifiable with the target’s own dependencies alone. (T-5)
- INV-6 — Determinism and object-carried, recoverable provenance are integrity controls. (T-3/T-9)
5. Residual risks & assumptions (RR-…, ASSUME-…)
- RR-1 — The heavy decoder dependencies may contain vulnerabilities. This is the accepted cost of the mission (it is why brygge is separate from prikk). Mitigated by isolation (C-4a), pure-Rust preference (C-4b), pinning + supply-chain gates (C-4c/d), and the recommendation that operators run brygge over untrusted source repositories in a sandbox (container / restricted user / no ambient credentials), since TB-1 input reaches those libraries. (v0.4 note:
cargo auditreports RUSTSEC-2026-0306, an informational “unsound” advisory againstfaster-hex 0.10.0, reached only throughgix-hash. It is tracked by the advisory watch and reviewed with every dependency update. 0.7.1 note: nine informational advisories againstheapless0.8.0, linked through the samefaster-hex, are not reachable (see the 0.7.1 re-verification); 0.8.0 note:faster-hex0.10.1 fixes 0306, and it is semver-compatible withgix-hash0.26, sogixstays at 0.87. The nineheaplessadvisories stay, unreachable, on everygixversion released so far, becausegix-hashstill usesfaster-hex0.10; they clear when it moves tofaster-hex2, whereheaplessis optional.) - RR-2 — brygge cannot make a lying source honest. A faithfully-imported falsehood is still a falsehood; VF-2 checks correspondence to the source, not the source’s own truthfulness. Detecting source-level fraud is out of scope.
- RR-3 — Secrets/PII in source history are carried faithfully. Redaction would break fidelity (VF-2) and is the operator’s decision in the source, before or after import; brygge’s duty is to state that content is carried verbatim (C-6c), not to scrub it.
- RR-4 — brygge’s artifact is integrity-detectable (C-3b) but not cryptographically authenticated, and brygge never signs. prikk ruled on 2026-09-13 (RFC 113 OQ-1/OQ-2) that the importer signs the import declaration, and that the importer is prikk’s own import command, run by an adopted maintainer. Authentication therefore happens at prikk’s boundary, over what that maintainer imports, once prikk’s import attestation (UD-1) is built. Until then, anyone who can alter an artifact can also recompute its digest; the defense is
verify --against-source(C-3c) against the source. - RR-gix-sha1 —
gixreads SHA-1 Git objects without collision detection (RFC 004 security review; relates to RUSTSEC-2025-0021, cleared as an advisory by pinning forward). This is inherent to SHA-1 repositories and does not touch brygge’s integrity model: the IR re-hashes everything under SHA-256 (AtomId/BlobId/digest, RFC 003 D-3), and the Git SHA-1 is preserved opaquely as a source identifier (PR-4), trusted for nothing in any target. The residual is source misread under a deliberate SHA-1 collision, mitigated by SHA-256 re-hashing andverify --against-source(RFC 004 D-7). Narrowed in v0.3: since every object is now re-hashed against its id (C-2f), a mismatched object is impossible; only a true SHA-1 collision remains. Trackgix’s SHA-256-object support as it matures (the SHA-256 object format is refused until then). - RR-svn-svnadmin — brygge trusts the operator’s
svnadminbinary and its dump output (RFC 006 Tier D; TB-4). A hostile or compromisedsvnadminon the host could feed a false dumpstream; mitigated by ASSUME-1 (the host is trusted) and by the dumpfile path, which bypasses the subprocess entirely. Separately,svnadminparsing a hostile repository is a semi-trusted-tool surface (a TB-2 variant in subprocess form), isolated by process (C-2e/C-4b) and covered by RR-1’s sandbox recommendation for untrusted sources. - RR-svn-svnadmin-version — decode of a live SVN repository depends on the
svnadminversion (RFC 006 Tier D): two versions could frame the dumpstream differently, so the byte-for-byte result across hosts is guaranteed only for the same tool version. Named as a stated non-determinism (C-9), mitigated by treating the dumpstream as the canonical deterministic input (decoding the same dumpfile is always identical) and recording the source form (live dump vs supplied dumpfile) in provenance soverify --against-source(VF-2) is well-defined. Implemented in 0.1.0: provenance recordssource_form, plussvnadmin_version(neutralized, bounded) for a live decode;verify --against-sourcerefuses to compare across forms (not-checked) and aligns the version before comparing (C-3c). - RR-cvs-reconstruction — a CVS changeset is brygge’s derived judgment, not a source record (RFC 007). A consumer that ignores the
Derivedstatus could over-trust the grouping as if CVS had recorded it. The marking is in every atom; the confidence rule (span-overlap-v1), its inputs and every order split are recorded; the fidelity report leads with it; and the faithfulness statement states the limit before the run. The residual is a consumer discarding honesty brygge attached, which brygge cannot prevent, only make impossible to lose (the CVS-specific sharpening of RR-2). Since 0.3.0 it covers branch history too: a branch’s parent edge is brygge’s judgment (branch_point_rule, andbranch_pointexact, approximate or unconstrained, with approximate flagged), and a branch-point atom’s ops areDerived; no merge parent is ever inferred. - RR-cvs-open-blocking (replaces RR-cvs-read-toctou, closed in v0.5): on Unix the CVS reader’s
openis an ordinary one, and the identity check follows it. So someone who can swap a,vpath for a FIFO while brygge reads could make thatopenblock: a hang, never a read of the wrong file. This needs concurrent write access to the source, a compromise of A-HOST (ASSUME-1). It is not mechanized in v0, because a non-blocking open needs a per-OS constant or a dependency. - RR-release-agent-credentials — the AI agents (architect, implementer) act through the owner’s own git
and GitHub credentials, so GitHub cannot tell them apart from the owner (RFC 012 D-2).
- Nothing mechanical stops an agent from creating, moving or deleting a tag.
- With no approval gate, pushing a release tag is the act that publishes, so an agent that pushed a version tag could start a publication.
- Mitigations:
GOVERNANCE.md(“Cutting a release”) and the agents’ standing instructions: only the architect tags, only after the owner’s go-ahead, and the implementer never tags;verify’s checks narrow what such a tag could publish to a commit onmain, at the workspace version, with a CHANGELOG section and green gates;- two-factor authentication on the owner’s accounts.
- RR-release-dispatch-tools — a dispatched release runs the release tools of the commit it was dispatched
from, not of the tag (needed to release a tag that predates the tools, like 0.1.0).
- Mitigation: the
releaseenvironment admits onlymainand release tags, so those tools are always code committed tomainor to a release tag. It is reviewed by the project’s process, not enforced by a branch rule: RFC 012 D-2 deliberately adds no branch protection, and CI gates such a commit after it is pushed. - The tools’ test-only environment hooks (
BRYGGE_TEST_*) are set by no workflow, andverify-publishedchecks the real crates.io independently.
- Mitigation: the
- Closed in v0.3:
- RR-git-loose-object-symlink (a symlinked loose object could read outside the repository): a loose object now either hashes to its id, so it is the right object wherever it was read from, or the decode stops (C-2f).
- RR-git-object-id-unverified (a preserved Git id could be a false link): every object is verified (C-2f).
- RR-hg-node-unverified (the same gap for Mercurial nodes, found in the 0.1.0 release review): every revision read is verified (C-2f).
- RR-total-memory — no aggregate memory ceiling. C-2d’s ceilings bound each object, never the total. A large legitimate repository can therefore still exhaust the host’s memory, rather than being refused with
ResourceLimit. Narrowed in v0.9 (0.5.0, RFC 015): content no longer sits in memory, so the peak follows the metadata (commits, trees, paths), not the content. For fish-shell (23,496 commits; 4.6 GiB of content),decodefell from about 18.7 GiB to about 410 MiB,verifyandinspectfrom about 9.1 GiB to about 64 MiB, andverify --against-sourcefrom about 14 GiB to about 472 MiB (tools/bench/README.md). What remains:- the metadata still grows with the history, without a total ceiling;
- the cost moved to disk: the spill file holds every unique blob uncompressed. Since 0.7.0 the artifact is compressed, 4.6×–7.5× smaller on the measured repositories, so the spill file is now the larger of the two. A full disk is a typed error (C-7), not a hang;
decodecompresses on up to 8 threads, with at most 64 MiB of raw frames in flight: a constant of about 100 MiB more than 0.6.0, which does not grow with the repository;- a RAM-backed
--spill-dir(tmpfs) moves the cost back into memory. The operator’s sandbox (RR-1) should still bound memory and disk.
- RR-aur-key — the AUR packages are published with a stored SSH key (RFC 016). The AUR offers no short-lived credential like crates.io’s trusted publishing, so the secret
AUR_SSH_PRIVATE_KEYlives in the GitHubreleaseenvironment.- What it could do if stolen: push to every package the owner’s AUR account maintains, not only
bryggeandbrygge-bin, since AUR keys are per account. A PKGBUILD is a shell script thatmakepkgruns on the user’s machine, so a malicious push is code execution for whoever next builds the package without reading it. - Mitigations:
- the key is generated for this use only, and lives only in the secret (
docs/src/development/releasing.md, “AUR”); - the
releaseenvironment admits onlymainand release tags (RR-release-dispatch-tools); - the job writes the key only in its push step, never on a dry run, and removes it whatever the outcome; the host key is pinned;
- every AUR commit is public, under the owner’s identity, and the AUR’s own convention is that users read a PKGBUILD before building it;
- if the key is suspected leaked: remove it from the AUR account first, then replace the secret (
releasing.md).
- the key is generated for this use only, and lives only in the secret (
- It is accepted for v0. If the AUR gains a short-lived credential, the job should move to it.
- What it could do if stolen: push to every package the owner’s AUR account maintains, not only
- Disclosed and closed in v0.8: five CVS RCS-reader defects (never listed as residuals, because they were unknown until C-2g found them), in 0.1.0–0.3.1: an infinite loop on a truncated
symbols/brancheslist; an apply loop spun by a crafted ed-script line number; a pre-allocation sized by an untrusted count; a subtraction panic on a malformed revision number; and a million-step walk on a cyclicnextchain. Each is closed in 0.4.0, with a regression test. - Disclosed and closed in v0.7: the zstd decompression gap (it was never listed as a residual, because it was unknown until RUSTSEC-2026-0344): a crafted zstd revlog chunk could exhaust memory in 0.1.0–0.3.0. It is closed in 0.3.1 (C-2d).
- Closed in v0.6: RR-svn-special-toggle (a property-only change of
svn:specialkept the previous content): the node’s content is recomputed from its base’s SVN text under the new flag, and malformed symlink text is still refused (C-2a). It is checked againstsvn catin all three dump forms. - Closed in v0.5: RR-cvs-read-toctou (a symlink swapped in between the walk and the open would be followed): the opened file must be the walked file (C-2c).
- RR-plugin-trust — an encoder plugin runs with the operator’s privileges, and brygge does not vet it (RFC 017 D-3; TB-6). Whatever program is first on
PATHasbrygge-encode-<target>is the one that runs, as with any command onPATH,gitandcargosubcommands included.- Mitigations:
- the lookup rules (C-2b);
- the label, which prints the resolved path before the plugin runs (C-1g);
brygge encode --list, which shows every plugin found, and marks one hidden by an earlierPATHentry as shadowed;- and verify-first, so a plugin never receives an artifact brygge rejects.
- What brygge’s check does not cover: it verifies the file when it checks it. A plugin that reads the artifact with
brygge-irgets the same checks again,ArtifactChangedincluded; a plugin that parses the bytes itself gets nothing from brygge. The guide says so. - It is the operator’s trust choice, as ASSUME-1 already states for the host.
- Mitigations:
- RR-transform-trust — a transform’s honesty is checked only where brygge runs it (RFC 018 D-6; TB-7).
- A transform plugin runs with the operator’s privileges, as an encoder plugin does (RR-plugin-trust), with the same mitigations.
- Inside
brygge transform, its output cannot lie about its own shape: C-3d checks every difference against the input. Whatcheckcannot judge is whether the transform’s change was wise (a wrong author mapping is a marked, honest wrong mapping). - Outside it, anyone can write a well-formed 0.3.0 artifact with
brygge-ir’s writer, with or without a chain. Such a file is not checked at transform time. The defence is--against-source: an artifact whose content differs from its source’s decode and carries no chain (a forgery that hides its transform) givesdoes-not-correspond; one whose chain’s root is not the source’s decode gives the same. A reader holding a step’s input can runtransform::checkitself. - It is the same class as RR-4: the artifact is integrity-detectable, not authenticated.
- ASSUME-1 — The operator and their host are trusted; the source repository is not. brygge defends A-HOST against the source (TB-1), not against a hostile operator.
- ASSUME-2 — The target enforces its own admission/trust/seal (BN-2). brygge’s honesty is necessary but not sufficient; the target’s policy is the last line, and OQ-1…OQ-3 (owner’s) decide what that policy is for prikk.
6. Controls × threats
| Control ↓ / Threat → | T-1 | T-2 | T-3 | T-4 | T-5 | T-6 | T-7 | T-8 | T-9 |
|---|---|---|---|---|---|---|---|---|---|
| C-1a…e honesty in the object | ● | ● | |||||||
| C-1f output neutralization | ● | ● | |||||||
| C-1g encoder output labelled, verify first | ● | ○ | |||||||
| C-3d transforms recorded and checked | ● | ● | |||||||
| C-2a…e untrusted-input handling | ● | ○ | ● | ● | |||||
| C-2f source identifiers verified | ○ | ● | ● | ||||||
| C-3a…c integrity/verify/determinism | ● | ● | |||||||
| C-4a…e dependency isolation/audit | ○ | ● | ○ | ||||||
| C-4f the release pipeline | ○ | ● | ● | ||||||
| C-5 boundary-not-enlarged (tested) | ○ | ● | |||||||
| C-6a…c no-network / carried-verbatim | ● | ○ | |||||||
| C-6d only what the source would publish | ● | ||||||||
| C-7 write-only-where-told | ○ | ○ | ● | ||||||
| C-8 bounded/cancellable | ○ | ● | |||||||
| C-9 determinism | ○ | ● |
(● primary control, ○ contributing.)
7. Traceability
| Threat-model element | Requirements / design basis |
|---|---|
| T-1 / C-1* / INV-1 | NG-3, HO-1…HO-5, VF-4, FS-01/02/04, CF-02; RFC 113 §2/§3; C-1f: CL-07, CR-19; C-1g and TB-6: RFC 017 D-1/D-3, CL-03 (amended) |
| T-2 / C-2* / INV-2 | TB-1, FA-2/FA-3, PR-4; PU-5 (why the surface exists); C-2c: CR-11; C-2d: RFC 010 D-4, CR-10/CR-17; C-2f: PR-4, VF-2 |
| T-3 / C-3* / INV-6 | VF-1/VF-3, IX-07, HO-4, FS-02, ID-4; C-3a: CR-02, RFC 011 D-10; C-3b: RFC 011, RFC 015 D-4, RFC 018 D-1/D-3; C-3d and TB-7: RFC 018 D-5/D-6, CL-09 |
| T-4 / C-4f | RFC 012 (release automation); RFC 016 (the AUR packages); GOVERNANCE.md “Cutting a release”; docs/src/development/releasing.md |
| T-4 / C-4* / INV-4 | PU-5, BN-5; project dependency-discipline (mirrors prikk’s small, audited dependency posture and prikk-ffi) |
| T-5 / C-5 / INV-5 | BN-5, CT-05 |
| T-6 / C-6* / INV-3 | CT-01, NG-3, PR-3/PR-4; C-6d: CR-05, owner ruling D-4 (2026-09-23) |
| T-7 / C-7 / INV-3 | BD-04, CT-02; CR-13; the spill file: RFC 015 D-3/D-3a |
| T-8 / C-8 | FA-1/FA-3/FA-4/FA-5, OP-02; RFC 015 |
| T-9 / C-9 / INV-6 | VF-1, ID-4, UD-4 |
End of Threat Model v0.11. Per project rules, this document is revisited every release: a release whose changes touch new source parsers, new dependencies, the IR/provenance format, or any untrusted-input path updates this model; other releases re-verify its controls still hold. The controls most likely to need a test from day one: INV-2 (no source code executed; path-safety), INV-4/INV-5 (dependency isolation; output consumable without brygge deps), and INV-1 (honesty is present and non-suppressible in every produced object).
brygge — Project handoff
Read this first. This document hands brygge from its founding architect to the incoming team. It is the map: what brygge is, the state at handover, the invariants you must never regress, where every artifact lives, how to build and gate it, and the prioritized backlog. Everything it references is in this repository; nothing load-bearing lives only in someone’s head.
Date of handover: 2026-09-12. Updated for the 0.10.0 release, 2026-11-27. State: brygge
0.1.0 is released: the decode → IR half for all four named sources, on IR contract 0.2.0.
0.1.1 added Windows support and the release workflow (RFC 012), 0.2.0 bounds long Git and
CVS histories (RFC 010), 0.3.0 reaches SVN delta dumps, Mercurial’s hashed store paths and CVS branch
history (RFC 013), 0.4.0 mutation-tests every untrusted parser and validates brygge against real
public repositories of every source kind (RFC 014), 0.5.0 keeps a decode’s content on disk and
streams the artifact writer and reader, so peak memory tracks a history’s metadata rather than its total
content, and publishes brygge/brygge-bin to the AUR (RFC 015, RFC 016), 0.6.0 turns the IR into
the official extension point: an encoder author’s guide, an unsupported reference encoder from IR to Git
(examples/encode-git), and external encoder plugins run with brygge encode <target> (RFC 017 Parts A
and B), and 0.7.0 is the next contract revision, RFC 018: artifacts are compressed (contract 0.3.0,
batch C), transforms can record themselves in the contract and be checked for honesty by the reader (batch
T), and brygge transform <name> runs them as external plugins, with brygge checking every plugin’s output
against its input before writing anything (batch P; RFC 017 Part C). 0.7.1 is a patch for Rust 1.100’s
test-binary layout and the AUR’s .SRCINFO architectures. 0.8.0 adds Git as a second, supported
target (RFC 019): brygge encode git writes a new bare Git repository from an artifact, checked against
it with brygge’s own Git decoder before it is handed over; verify --against-target git runs the same
check on a kept repository; brygge transform authors maps source identities to Git identities; and
Subversion --branch-lines and CVS’s trunk main line give every branch and tag its own reachable line
of history. This build still reads contract 0.2.0. 0.8.1 bounds decoding against amplifying inputs (a
security patch, threat model v0.13). 0.9.0 removes the cause: the Subversion decoder’s tree shares
unchanged directories between revisions, so memory follows the size of the history, not tags × files
(the ceiling max_retained_entries is replaced by max_tree_nodes); --layout-trunk,
--layout-branches and --layout-tags name a non-standard layout, each changing only its own
container, and --layout-trunk . decodes a repository with no layout as one line. 0.10.0 carries Git
submodules: a Git repository with a submodule, refused until now, decodes with each submodule carried as
a pinned reference (its path and the commit id it pins), never its own repository; encode git writes
it back and checks it; artifacts are now contract 0.4.0, and every existing atom keeps its id across
the bump (threat model v0.15). All gates are green, and CI enforces them on the declared MSRV. The
encode → prikk half waits on prikk’s import foundations (see §8).
1. What brygge is, in one paragraph
brygge carries version-control history from one system to another: it decodes an existing system (Git, Mercurial, Subversion, CVS) into an intermediate representation (IR) that belongs to no particular system, and encodes a target from it (prikk first, built in and planned; others through external plugins). The pipeline is two deliberately separated halves: decode a source into the IR; encode a target from the IR. The one idea everything turns on is faithfulness with provenance, not neutrality: brygge records what the source literally guaranteed, and marks — in the object itself — anything it had to infer. It reads untrusted input, links no network, and writes only where told. The governing upstream contract is prikk RFC 113 (History import foundations).
2. Status at handover
| Area | State |
|---|---|
| Decode → IR (Track A) | Released in 0.1.0 for all four sources: Git, Mercurial, Subversion, CVS (main line). See CHANGELOG.md and the user guides in docs/src/guide/. |
| IR contract | 0.4.0 (RFC 021, an entry’s content is a blob or a submodule, carried as exactly what Git records; the identity rule — a contract may add fields, but never re-encode an existing one, so every existing atom keeps its id; this build still reads 0.2.0 and 0.3.0). Tagged fields with a critical bit, a strict canonical form; published in docs/src/reference/ir-artifact-format.md. |
| CLI | brygge decode <git|hg|svn|cvs> <source> --out <artifact>, inspect <artifact> [--atoms|--authors], verify <artifact> [--against-source <source>|--against-target git <repo>], encode <target> <artifact> [-- <plugin args>] / encode --list (RFC 017 D-3; git is a reserved, built-in, checked target, RFC 019 D-1/D-6; every other target is an external plugin found on PATH only), transform <name> <artifact> --out <file> [-- <plugin args>] / transform --list (RFC 018 D-6; authors is a reserved, built-in transform, RFC 019 D-4; every other name is an external plugin, checked against its input before anything is written); human and versioned machine output (docs/src/reference/machine-output.md); CL-08 exit classes. |
| Encode → prikk (Track B) | Not started past design. prikk ruled OQ-1…OQ-3 (2026-09-13) and UD-4 (2026-09-23); the encoder waits on prikk building UD-1 and UD-2 (RFC 008; see §8). brygge encode (RFC 017 D-3) runs an external plugin for every target but the reserved built-ins (git, supported since 0.8.0; prikk, reserved and still unavailable until this lands). |
| Gates | fmt · clippy -D warnings · test · cargo deny · cargo audit · tools/check-ir-isolation.sh · tools/check-links.sh · tools/test-release-tools.sh, all --locked, on the default toolchain and on MSRV 1.87; CI-enforced (§7). CI runs fmt, clippy and test on Linux x86_64, Linux arm64, macOS (Apple Silicon) and Windows (RFC 012 D-9). |
| Toolchain | Rust 2024, MSRV 1.87 (raised from 1.85 for the ruzstd security fix, RUSTSEC-2026-0344; enforced by CI). |
| Third-party deps | sha2 (core); gix (Git); flate2, ruzstd and sha1-checked (hg); sha2 (CVS). SVN adds md-5 and sha1-checked (dump checksums). |
3. The non-negotiables (never regress these)
brygge’s value is these invariants. A change that breaks one is a security/trust bug, not a preference.
They are stated in the threat model (docs/src/brygge-03, §4) and the requirements (brygge-01); the
short form:
- INV-1 — No manufactured verification. Imported authorship is
Unverifiableby construction; the derived-marking, loss boundary, and fidelity summary are properties of every produced object and are not configurable off. This is the whole point of brygge. (Seehonesty.rs;verify’s seven checks.) - INV-2 — Source input is untrusted; brygge never executes source-provided code. No hooks, filters, submodule/externals fetches, or scripts. Every parser is bounds-checked and panic-free.
- INV-3 — No network I/O; writes only to operator-specified outputs. (svnrdump-over-network refused;
:pserver:refused; source-declared paths are never write targets.) - INV-4 — The dependency surface is isolated, minimized, pinned, audited; brygge’s own crates
forbid(unsafe_code); C is isolated to an FFI crate or a subprocess (RFC 009; brygge-03 C-4b). - INV-5 — brygge output never enlarges the target’s audited surface — the IR and
verify’s artifact-only checks link no decoder; a target checks an import with only its own dependencies. - INV-6 — Determinism + object-carried provenance are integrity controls. Same input → byte-identical IR. Non-determinism is a trust hole (a tamper could hide in it), so it is forbidden, not merely avoided.
And the owner’s design philosophy, which decided every close call: clean, safe, secure, robust — over rich-but-complicated. Lean to refuse or defer rather than approximate; keep trust surfaces small; surface trade-offs to the owner rather than silently choosing. When in doubt, that is the tie-breaker.
4. Architecture and the crate map
Two-layer design enforced by the dependency graph (RFC 009 D-1): the light core (brygge-ir) that a
target can depend on, and the isolated decoders that read one source each. The core links no
decoder, enforced in CI by tools/check-ir-isolation.sh against a declared allowlist.
| Crate | Role | Third-party deps |
|---|---|---|
brygge-ir | The IR: types, canonical codec, content store, epistemic-status taxonomy, the versioned artifact, the recoverable fidelity report. The durable product boundary (PU-3). | sha2 only |
brygge-decode-git | Git → IR. Every object verified against its id; renames inferred only on request (marked Derived); a submodule entry is carried as a pinned reference (its path and commit id), never opened, fetched or followed (RFC 021). | gix (isolated; security-reviewed) |
brygge-decode-hg | Mercurial → IR. Pure-Rust revlog reader; the published view; every revision verified against its node; stated renames and copies carried as Stated. | flate2, ruzstd (decompression), sha1-checked (node verification) |
brygge-decode-svn | Subversion → IR. Pure-Rust dumpstream parser; branches/tags Derived by convention; svnadmin is an optional producer subprocess, not linked; the running tree shares unchanged directories between revisions, copy-on-write (RFC 020 D-1), so a copy costs O(depth), not O(files). | md-5, sha1-checked |
brygge-decode-cvs | CVS → IR. Pure-Rust RCS ,v reader; main line only; the changeset itself is Derived (no atomic commit). | sha2 (the repository fingerprint) |
brygge | The CLI. Wires the decoders in (permitted for the binary, RFC 009 D-1); the core and verify’s artifact-only checks still link none. | — |
tools/bench | Dev-only memory/time harness (RFC 010). Not published. | — |
Each decoder exposes one narrow decode(...) -> Result<brygge_ir::Ir, Error> and follows the same shape:
an all-Stated faithful spine, a marked Derived layer beside the literal ops, a read-a-policy floor that
refuses with a named reason, and against-source verification by preserved source ids. Conventions: 2018
module style (foo.rs + foo/, no mod.rs), tests as siblings (#[cfg(test)] mod tests;).
5. The document map (where everything lives)
| You want… | Read |
|---|---|
| What brygge must do / never do / must decide | docs/src/brygge-01-requirements-spec-v0.1.md (requirements, v0.3) |
| The black-box surface (commands, IR contract, honesty surface, flows) | docs/src/brygge-02-external-design-v0.1.md (external design, v0.3) |
| What brygge defends, against whom, how | docs/src/brygge-03-threat-model-v0.1.md (threat model, v0.3) |
| How to import from each source, what is carried, refused and why | docs/src/guide/ (one guide per source) |
| The machine-readable output (keys, versions, exit codes) | docs/src/reference/machine-output.md |
| The whole docs set as a book | docs/src/SUMMARY.md (mdbook) |
| The exact IR artifact wire format (for a foreign encoder or reader) | docs/src/reference/ir-artifact-format.md (contract 0.4.0, RFC 021, PU-3; reads 0.2.0 and 0.3.0 too) |
| Direction, milestones, release cycles, prikk dependencies | ROADMAP.md |
| How decisions are made, who approves what, the gates | GOVERNANCE.md |
| Every design decision + its build spec | rfcs/ — see rfcs/README.md (the index and the source of truth for RFC state) |
| A decoder’s build spec / security review / D-9 fit | rfcs/handoffs/<rfc>/ |
| How to use brygge; how to read the fidelity report | README.md |
| What a crate is and how it’s bounded | crates/*/README.md |
| Decoder memory/time measurement | tools/bench/README.md |
The RFC set (rfcs/README.md is authoritative): in done/, implemented in 0.1.0: 001 IR
foundations · 002 honesty & provenance · 003 determinism, format & versioning · 004 Git decoder · 005
Mercurial decoder · 006 Subversion decoder · 007 CVS decoder · 009 dependency & supply-chain policy · 011
the IR contract re-cut (contract 0.2.0) · and 000, the RFC lifecycle policy. Accepted: 010 bounded
memory & streaming (increment 1 shipped in 0.1.0; increments 3, 3b and 5 in 0.2.0; increments 2 and 4
deferred by measurement) · 012 release automation · 013 source reach (0.3.0, in progress). 008 is reserved for the
Track-B prikk-encoder RFC; its design begins when prikk’s import foundations exist (§8).
6. Governance and method (unchanged by the handover)
- Roles (
GOVERNANCE.md): owner/PM/authorizer (the human — unchanged; rules the owner-only questions, solely authorizes every release/tag/publish/irreversible act), architect/designer/reviewer and implementer/tester (these two roles pass to the incoming team). - Design-first, always: requirements → external design → threat model → RFC + handoff → implementation → tests. Never inverted. Every accepted RFC gets a program-design handoff before code.
- Owner-only decisions (never settle these alone): the per-source floor contents (OQ-3), adopting or upgrading a heavy/decoder dependency (RFC 009 — the read tier is owner-ruled), direction/themes, and every release/tag/publish. When you hit one, surface it with a recommendation; do not choose silently.
- The RFC lifecycle is the five-folder variant (
proposed → accepted → done, plusarchive/): the folder is the source of truth for state; updaterfcs/README.mdin the same commit that moves an RFC. - The security gate: any change that adds/alters a source decoder, changes a dependency, or touches an
untrusted-input path must get an architect security review against
brygge-03and revisit the threat model (a touching change updates it; others re-verify).
7. Building, testing, and the gates
# The full gate suite — all must pass, all --locked (CI-enforced; mirror it locally before every commit):
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked
# The no-identity run (a missing git identity has broken CI twice this way: request 068, then 074).
# CI's runners carry no git config at all; a developer's own machine usually does, which lets a test
# that commits into a scratch repository pass locally and fail only in CI. Run this once, before
# filing any request, and report its sum:
GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null HOME="$(mktemp -d)" cargo test --workspace --locked
cargo deny check # advisories, licenses, banned/duplicate crates (INV-4)
cargo audit # known vulnerabilities in the dependency tree
./tools/check-ir-isolation.sh # brygge-ir's dependency closure matches its allowlist (RFC 009 D-7)
./tools/check-links.sh # relative links in every *.md file resolve
./tools/test-release-tools.sh # the release tools (RFC 012); needs the network and the `0.1.0` tag
# Portability (RFC 012 D-9): CI proves Linux, macOS and Windows by running there. Before a commit, at least
# compile the other targets (the test code included):
cargo check --workspace --all-targets --locked --target x86_64-pc-windows-gnu
cargo check --workspace --all-targets --locked --target x86_64-apple-darwin
# The MSRV run. CI builds on the declared MSRV (1.87), not on your newer local toolchain, so a local
# "green" says nothing about CI until these two pass too (use a scratch --target-dir):
cargo +1.87 clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo +1.87 test --workspace --locked
# The measurement harness (dev-only), before/after any RFC 010 increment:
cargo run -p brygge-bench --release
cargo publish --workspace --dry-run is not a per-push gate. Once a version is actually on
crates.io, packaging rewrites a dependency’s path = away, so verifying it must resolve from a
registry — and a dry-run of that same, now-published version resolves a workspace sibling like
brygge-ir from crates.io, not the local tree, so it cannot see any API added since (review 075). It
belongs to the release cut’s own prep and release.yml’s verify step, where the version being checked
has not been published yet and the check is meaningful; tools/check-release-dev-deps.sh stays a
per-push gate, since it catches the class of bug a dry-run cannot see regardless of version.
Mutation tests (RFC 014 D-1/D-2/D-3): every parser that reads untrusted bytes (the four decoders’
hand-written readers, and brygge-ir’s artifact reader) mutates a handful of its own valid fixtures —
generic byte operators plus format-aware boundary writes at the fields a parser module itself declares
“interesting” (a length, a count, a window size) — and asserts no panic and no output past the format’s
own ceiling. Two depths, picked by BRYGGE_MUTATION_DEPTH:
- quick (unset, the default): part of the ordinary
cargo test --workspaceabove, on every push, everywhere; adds well under a second per crate. - deep (
BRYGGE_MUTATION_DEPTH=deep,--release): orders of magnitude more mutations per seed..github/workflows/mutation.ymlruns it under a memory cap (ulimit -v) whenever a parser’s source,tools/mutate, orCargo.lockchanges — not scheduled (GOVERNANCE.md, “Work is triggered, never scheduled”) — and the dev team also runs it by hand as part of every release cut’s preparation (docs/src/development/releasing.md).
A finding — a panic, an over-ceiling Ok, or a run slower than its time budget — panics the test with the
seed index, the iteration, the exact operator chain, and the path of a saved file holding the mutated
input (under target/mutation-findings/); rerun the same test to reproduce it, or feed the saved file
through the parser directly. Turn the finding into a named regression test in the crate’s ordinary tests
before fixing it, so it runs on stable everywhere, forever (four such findings came from the very first
module built this way, brygge-decode-cvs’s RCS reader — see its rcs/mutation.rs module doc).
CI’s result for the pushed commit is part of every report (gh run list): a review request states the
local 1.87 run before the commit, and the CI run id and its result after the push. A red CI blocks the cut and
is fixed before anything else. Cargo.lock holds human_format at 1.1.0 for the MSRV (see the root
Cargo.toml); do not update it past that without re-running the 1.87 gates.
Conventions the gates and reviews enforce: forbid(unsafe_code) in every shipped crate; public items
documented (missing_docs = warn); the panic-prone clippy lints (unwrap_used, expect_used,
indexing_slicing) warn, so under -D warnings they are effectively denied in non-test code — brygge
parses untrusted input and must never panic on malformed bytes. Tests may #![allow(...)] these.
To add a new source decoder (the “etc.” in PU-3): write the RFC (following 004–007’s shape) → get the
read-tier ruled by the owner (RFC 009) → the handoff, the brygge-03 security review, and the D-9
additive-fit confirmation → a new brygge-decode-<src> crate exposing decode() → wire it into the CLI’s
decode_source/source_kind_of. The IR should hold it with no contract change, or with a new field under
RFC 011’s rules (a non-critical field is additive; a critical one is a contract version bump). Any
contract change is a deliberate, owner-approved event, never a silent one.
8. The backlog — what’s next, prioritized and honest
Nothing here is required for 0.1.0 to be correct; all of it is planned scope or gated work, recorded so
the team inherits the reasoning, not just the TODO. ROADMAP.md is authoritative for scheduling.
0.2.0 — Scale (RFC 010, measurement-gated; the baseline and every A/B are in tools/bench/README.md):
- Done: increment 5, the Git snapshot retention bound (11.7× lower peak at 20,000 commits).
- Done: increment 3, CVS trunk reconstruction in one pass (197× faster at 5,000 revisions per file).
- Done: increment 3b, the CVS clustering overlap count in near-linear time (8× faster at 100,000 revisions). Increment 3 revealed it.
- Deferred by measurement: increment 2 (the SVN dumpstream iterator) and increment 4 (a streaming writer). After 5 and 3, every peak tracks the IR itself: a constant multiple of content for content-heavy repositories (Git ~2.8×, CVS ~4.2×, SVN ~4.6×), and about 5 KiB per atom for history-heavy ones. Revisit when a real import is memory-bound.
0.3.0 — Source reach (RFC 013, done; handoffs in rfcs/handoffs/013-source-reach/):
6. Done: CVS branch-aware import (with --reconstruct-refs), which lifts 0.1.0’s main-line-only limit.
7. Done: SVN delta dumps (svndiff0, svnadmin --deltas and svnrdump), which also closes
RR-svn-special-toggle.
8. Done: Mercurial’s store path encoding, completed (hashed dh/ long paths, reserved names, .i/.d
directories).
9. CVS adaptive clustering windows: deferred (RFC 013 OQ-3); no measured need yet. CVS vendor branches
after clearing: deferred (OQ-6); counted with an exact record until a real repository needs them.
0.4.0 — Hardening (RFC 014, done; handoffs in rfcs/handoffs/014-hardening/):
10. Done: mutation tests for every parser of untrusted bytes, the IR artifact reader, and verify’s
checks — a quick depth in every test run, a deep depth under a memory cap whenever parser code or a
dependency changes, and at each release cut. Found and fixed five pre-existing CVS defects, present
since 0.1.0 (RFC 014 D-1).
11. Done: real-world validation — brygge decodes and verifies pinned public repositories of every
source kind; results and import shapes in tools/bench/README.md (RFC 014 D-4). Findings: Git
submodules are refused by name (a floor change, candidate for a later RFC, not part of 0.4.0); memory
at real scale (a project needing ~10 GiB is memory-bound on an ordinary machine) fires RFC 010’s
revisit trigger for its next cycle.
12. Done: RCS edit-script strictness — an edit script whose commands are out of order, overlap, reach
past the end, or add zero lines is refused, since no tool writes one and no CVS version defines one
(reviews 063/064).
13. Done: brygge … | head (or any reader that stops early) no longer panics with “Broken pipe”.
14. Done: the scheduled advisory check renamed Advisory watch, documented as brygge’s only
scheduled job — every other job is triggered (RFC 014 D-7).
0.5.0 — Scale at real size, and the AUR (RFC 015 and RFC 016, done; handoffs in
rfcs/handoffs/015-scale-at-real-size/ and rfcs/handoffs/016-arch-linux-packaging/):
15. Done: measured where a real decode’s peak actually goes, phase by phase, on the real corpus (RFC
015 D-1).
16. Done: a streaming artifact writer (artifact::write_to) — brygge decode no longer holds the
whole encoded artifact beside the decoded Ir (RFC 015 D-2).
17. Done: a disk-backed content store (ContentStore::spilling, a Storage choice threaded through
every decoder’s decode_with_storage) and --spill-dir; decoding keeps file content on disk, not in
memory. The CVS decoder’s own extra content copy (review 074) was fixed alongside it (RFC 015 D-3).
18. Done: a streaming artifact reader (artifact::read_from/from_file) — verify and inspect
read in one hashed pass, re-checking every blob read later against its content address, and
verify --spill-dir for --against-source’s re-decode (RFC 015 D-4).
19. Done: Arch Linux packages, brygge (built from source) and brygge-bin (the release’s attested
binary), rendered, built and checked in a pinned Arch container, and pushed to the AUR by
release.yml after each release (RFC 016).
20. Result: fish-shell’s (23,496 commits) brygge decode peak fell from about 18.7 GiB to about 410
MiB, and brygge verify from about 9.1 GiB to about 64 MiB; artifacts stayed byte-identical
throughout. Full measurements in tools/bench/README.md.
0.6.0 — Extensibility (RFC 017 Parts A and B, done; handoffs in rfcs/handoffs/017-extensibility/):
21. Done (batch G): an encoder author’s guide (docs/src/reference/writing-an-encoder.md) and an
unsupported, labelled reference encoder from IR to Git (examples/encode-git, git fast-import),
the isolation proof for PU-3; artifact::Decoded gains digest, the artifact digest the reader
already verified (RFC 017 D-1, D-2).
22. Done (batch E): brygge encode <target> <artifact>, running an external plugin
(brygge-encode-<target>) found on PATH only, never the bare name; the artifact is verified first
and the plugin never runs on a failed verdict; brygge encode --list (RFC 017 D-3).
23. Done: brygge-ir’s own isolation check now covers every target (cargo tree --target all),
closing a gap where libc (through cpufeatures, from sha2, on non-x86 targets) was absent from
allowed-dependencies.txt and unchecked by a single-runner check (found during the 0.6.0 cut).
Deferred by explicit owner decision:
24. A TUI: deferred, not rejected (2026-09-12). If pursued, the standing architect recommendation is a
separate brygge-tui crate over brygge-ir (never in the decode binary), designed to make
derived/dropped/refused more visible, not less. Draft an RFC first.
Track B — encode → prikk:
25. RFC 008 (prikk encoder). prikk decides its import design, and brygge informs it proactively
(ROADMAP Track B).
- prikk ruled OQ-1…OQ-3 on 2026-09-13: the importer signs, and an adopted maintainer seals.
- prikk ruled UD-4 on 2026-09-23. The importer is prikk’s own import command.
- The encoder waits on prikk building UD-1 (an import-shaped attestation) and UD-2 (an authorized
import block kind). brygge-01 §11 records the state as of prikk 0.46.0.
9. Known limits (set expectations honestly)
- One built-in encoder, Git. 0.1.0 is decode + inspect + verify (§8, Track B); 0.6.0 adds
brygge encode <target>, which ran an external plugin found onPATHonly — brygge itself supported none; 0.8.0 addsencode gitas a supported, built-in target (RFC 019), checked against the artifact before it is handed over. Every other target is still an external plugin only;prikkstays reserved and unavailable (§8). - CVS is lossy by nature (SRC-C3): the changeset is brygge’s reconstruction, and every atom is
Derived. Changeset-levelverify --against-sourceis not offered, because there is no source changeset to check against; only per-file content and deterministic reproduction are. Branch history is imported with--reconstruct-refs(0.3.0); without it, the main line only. All of this is stated before the run (VF-5) and indocs/src/guide/cvs.md. - SVN reads dumpfiles of every form (fulltext,
--deltas,svnrdump), and svndiff 1/2 are refused by name. CVS reads a local repository;:pserver:is refused. - Git SHA-256 repositories are refused until the Git dependency reads them.
- Peak memory is O(content): the IR is the content. Ceilings refuse rather than exhaust, but nothing streams: RFC 010 increments 2 and 4 are deferred by measurement.
- No progress reporting or cancellation. Interrupting a decode is safe (the artifact write is atomic), but it produces nothing.
- The threat model is the living document, revisited every release (v0.3 for 0.1.0, v0.4 for 0.1.1, v0.5 for 0.2.0, v0.6 for 0.3.0, v0.7 for 0.3.1, v0.8 for 0.4.0, v0.9 for 0.5.0, v0.10 for 0.6.0, v0.11 for 0.7.0, re-verified for 0.7.1, v0.12 for 0.8.0, v0.13 for 0.8.1, v0.14 for 0.9.0, v0.15 for 0.10.0).
Handover complete, and 0.1.0 released. The gates are green on the MSRV, the invariants hold, and the reasoning behind every decision is in the RFCs and their handoffs. Build the next thing the way this was built: design first, refuse rather than misread, keep honesty in the object, and measure before you optimize.
brygge — Governance & approval policy
How decisions are made and who approves what. brygge is developed by the same three-role team as the
rest of the ecosystem, and follows the same design-first method (ROADMAP.md, rfcs/).
Handover (2026-09-12). The architect/designer/reviewer and implementer/tester/reviewee roles pass from the founding architect to the incoming team; the owner/PM/authorizer (the human) is unchanged and continues to rule the owner-only decisions and to solely authorize every release, tag, publish, and irreversible or outward-facing act. Nothing else in this policy changes — the gates, the owner-only list, the security gate, and the design-first method all carry over. New team: start at
HANDOFF.md.
Roles
| Role | Who | Authority |
|---|---|---|
| Owner / PM / authorizer | the human maintainer | Sets direction and themes; rules the owner-only questions (below); solely authorizes every release, publish, tag, force-push, and any irreversible or outward-facing action; approves adding a new heavy dependency. |
| Architect / designer / reviewer | the senior agent | Owns the design set (brygge-01/02/03), the RFCs, the roadmap, and the threat model; accepts RFCs (design-settled); reviews and approves implementation. Recommends; does not self-authorize releases or owner-only decisions. |
| Implementer / tester / reviewee | the implementing agent | Builds and tests against an accepted handoff; runs all gates (incl. supply-chain); submits for review. Does nothing irreversible or outward-facing. |
Owner-only decisions (no one else settles these)
These are inherited from prikk RFC 113 §4a and brygge’s own scope; the architect must not decide them alone:
- OQ-1 — what an importer signs, if anything (DC-35 territory: who may assert what).
- OQ-2 — whether imported history may be sealed, and by whom.
- OQ-3 — the per-source floor: which source features are refused rather than approximated (this decides who can migrate and who is told no — product scope).
- Adding or upgrading a heavy decoder dependency (e.g. adopting
libgit2, adding an SVN/CVS library): the architect assesses and recommends; the owner approves, because the dependency surface is the project’s defining risk (INV-4, threat T-4). - Direction, themes, and the acceptance of an RFC as “the next theme.”
The architect does settle the design-level rulings that are the architect’s under RFC 113 §4a (the IR — intermediate representation — atom, derived-marking, provenance-in-attestation-not-payload) and everything in the design set that is not on the owner-only list.
Approval flow
| Change | Drafts | Approves to proceed | Authorizes the outward act |
|---|---|---|---|
| Requirements / external design / threat model | architect | architect (design); owner for any owner-only item | — |
RFC proposed → accepted | architect | architect (design settled) + owner if it touches an owner-only decision | — |
| Program-design handoff | architect | architect | — |
| Implementation of an accepted handoff | implementer | architect (review) | — |
| A new/upgraded dependency | architect (assessment) | owner | — |
| Release (version bump, tag, publish) | architect prepares (readiness report, cut commit); implementer commits the approved prep and reports CI | architect (gates green, notes ready) | owner authorizes; the architect executes (see “Cutting a release”) |
Gates every change must pass (CI-enforced)
The ecosystem’s three, plus brygge’s supply-chain gates (its defining risk):
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked
cargo deny check # advisories, licenses, banned/duplicate crates (INV-4)
cargo audit # known vulnerabilities in the dependency tree
./tools/check-ir-isolation.sh # brygge-ir's dependency closure matches its allowlist (RFC 009 D-7)
Conventions match the ecosystem: Rust 2024, MSRV pinned, English, unsafe forbidden in brygge’s own
crates (any C/FFI confined to a single dedicated crate or a subprocess — C-4b, threat model v0.2),
2018 module style (foo.rs + foo/,
no mod.rs), tests as siblings (#[cfg(test)] mod tests;, never inline), no panics on fallible input,
public items documented.
Work is triggered, never scheduled
Jobs run on a push, a change to the paths they guard, a release cut, a finding, or on demand. The single
exception is the advisory watch (.github/workflows/advisory-watch.yml), which polls the RustSec
database because a new advisory is an external event with no trigger here. A new scheduled job needs an
RFC.
The security gate (brygge-specific)
Any change that (a) adds or alters a source decoder, (b) changes a dependency, (c) touches an untrusted-input path (parsing, path handling, resource bounds), or (d) changes the IR/provenance format must:
- get an explicit architect security review against
brygge-03(the threat model); - pass the supply-chain gates above; and
- revisit the threat model per the project rule — a change touching the above updates
brygge-03; any other release re-verifies its controls still hold.
The invariants that must never regress (a violation is a security bug, not a preference): INV-1 (no
manufactured verification; honesty non-suppressible), INV-2 (source input untrusted; no
source-provided code executed; bounds + path-safety), INV-3 (no network; write only where told),
INV-4 (dependency surface isolated/pinned/audited; forbid(unsafe) in brygge’s crates), INV-5
(brygge output never enlarges the target’s audited surface), INV-6 (determinism + object-carried
provenance).
Release cycle (summary; see ROADMAP.md for detail)
- One minor release per theme (0.1.0 Honest decode, 0.2.0 Scale, 0.3.0 Source reach), and a patch release for fixes that change no scope.
- The IR contract has its own version in every artifact, separate from the tool version, and it evolves by RFC 011’s rules (a critical bit on every field).
- Security and advisory fixes ship out-of-band, promptly.
- Tags are bare versions (no
v), CI-gated.
Cutting a release (who does what)
(Recorded after the 0.1.0 cut, 2026-09-24. At 0.1.0 the tag and the crates.io publication were carried out by the implementer on an owner message that was meant otherwise. The result was correct: the published crates are byte-identical to the tagged source. The boundary was not written down; it is now.)
| Step | Who |
|---|---|
| Readiness report, release notes, and the cut commit’s documentation | architect |
| Committing and pushing the approved cut commit, and reporting its CI result | implementer |
| Authorizing the cut, and the scope of publication (tag, crates.io, GitHub release) | owner, explicitly, per release |
Executing the cut: the tag, cargo publish, the install check, the GitHub release | architect, on that authorization, one step at a time |
Since RFC 012 (accepted 2026-09-24), the cut is executed by release.yml. The owner’s explicit go-ahead,
given immediately before the tag, is the authorization; the architect records it and pushes the tag, and
the workflow verifies, publishes and releases with no further manual step. (A per-release approval click
in GitHub was used for 0.1.1 and then removed for v0 by owner ruling.) The procedure and the owner’s one-time setup are in
../releasing.md; the manual steps below remain the fallback.
- A published version’s tag is never moved or deleted. A tag whose release failed before anything was published may be deleted and re-created, on the owner’s go-ahead. This is a rule, not a GitHub ruleset: RFC 012 D-2, as amended 2026-09-24, keeps v0 free of mechanisms whose cost outweighs their need at this stage.
- The implementer never tags, publishes or creates a release. A message that appears to hand the implementer one of these steps is confirmed with the owner and routed to the architect; it is never acted on directly.
- The architect confirms with the owner immediately before each irreversible step (pushing the tag,
each
cargo publish, creating the release), even under a standing authorization, and reports each step’s result. - crates.io: publish from a clean checkout of the tag, with
--locked, in dependency order. A first-time publication of several new crates can hit crates.io’s new-crate rate limit (HTTP 429). Wait for the stated time, then publish only the remaining crates. Published versions can be yanked, never deleted. - Dates. Project records (the CHANGELOG, RFC status lines, reviews) use the owner’s local date (JST).
Timestamps quoted from external systems (crates.io, CI, git) keep their own zone, stated (for example,
22:24 UTC).
Releasing brygge
How a brygge release is cut: .github/workflows/release.yml, specified by RFC 012. Who does what is set
by GOVERNANCE.md (“Cutting a release”):
- the owner authorizes each release by giving the architect an explicit go-ahead;
- the architect prepares the release and pushes its tag;
- the implementer never tags or publishes.
One-time setup (the owner; needs repository-admin and crates.io-owner rights)
(Released tags are protected by a governance rule rather than a GitHub ruleset, and there is no per-release approval click: both by owner ruling for v0, RFC 012 D-2 as amended 2026-09-24.)
Do these once, before the first automated release. Each is reversible in the same settings page.
-
Create the
releaseenvironment. GitHub → the repository → Settings → Environments → New environment → name itrelease.- Required reviewers: none. The per-release approval gate was removed for v0 after 0.1.1; the owner’s go-ahead before the tag is the authorization.
- Deployment branches and tags: Selected branches and tags. Add the tag rule
*.*.*and the branchmain;mainis needed for re-runs dispatched from the Actions tab. This setting is part of the security design: a dispatch runs the release tools of the commit it was dispatched from, and this rule means that commit can only bemainor a release tag. - Add no secrets of its own for this step — crates.io trusted publishing needs none. RFC 016 (below) adds the workflow’s first stored secret, the AUR SSH key, to this same environment.
-
Trust the workflow on crates.io. For each of the six crates (
brygge-ir,brygge-decode-cvs,brygge-decode-git,brygge-decode-hg,brygge-decode-svn,brygge): crates.io → the crate → Settings → Trusted Publishing → Add → GitHub, with:- repository owner
prikk-vcs; - repository
brygge; - workflow filename
release.yml; - environment
release.
With this in place, the workflow gets a crates.io token that lasts minutes, and no crates.io token is stored anywhere.
- repository owner
-
Account safety: two-factor authentication on the GitHub and crates.io accounts that hold these rights.
-
AUR (RFC 016;
bryggeandbrygge-bin, published by theaurjob after each release):- Generate a key pair for this purpose only:
ssh-keygen -t ed25519 -C "brygge release workflow" -f aur_brygge. - Add the public key (
aur_brygge.pub) to thenabbisenAUR account: My Account → SSH Public Key. - Add the private key (
aur_brygge) as the secretAUR_SSH_PRIVATE_KEYin the GitHubreleaseenvironment (the same one crates.io trusted publishing uses). - Delete the local private key file afterwards — it lives only in the secret.
- If the key is ever suspected leaked: remove it from the AUR account first, then replace the secret.
Its blast radius is every package the
nabbisenAUR account maintains (RFC 016 OQ-1, RR-aur-key).
- Generate a key pair for this purpose only:
Cutting a release
- The preparation:
- the architect assembles the cut commit: the version bump in
Cargo.toml(the workspace version and the workspace dependency versions);CHANGELOG.md:[Unreleased]→[X.Y.Z] — <date>, headed by the release notes; status lines, where they name a version; - the dev team runs the deep mutation depth (
BRYGGE_MUTATION_DEPTH=deep cargo test --workspace --release --locked -- --test-threads=4, built first and then run under the same memory capmutation.ymluses; the pinned thread count matters, because the cap covers the whole test process) locally, for every parser crate, and records the iterations, the time, and any finding in the cut request (RFC 014). This is a recorded step of the prep, not a new CI gate —mutation.ymlalready runs the same depth on every push that touches a parser orverify’s own checks; - the dev team runs the real corpus (review 111 N-2; the method, review 127 F-2), on the release
commit, when a decoder,
brygge-ir’s reader, writer or content store, or the CLI’s decode path changed since the previous release:tools/fixtures.sh fetch(fetches whatever is missing, then verifies everything with no further network), then, in one session on the same machine,python3 -I tools/bench/release-corpus.py <binary> fixtures/corpus tools/corpus/real.toml eza fish-shell tortoisehg-thgrun twice — once withfixtures/previous-release/<version>/brygge(the previous release’s real published binary, never a local rebuild), once with the new release build. Each run prints, per repository, the artifact’s size. Across releases an artifact’s bytes, and so possibly its size, differ by the version it records (in its provenance, and in every derived mark); that the history is the same is proved by the cross-version--against-sourcecheck, not by bytes. A timing session needsuptimeunder 16 (half the threads) at its start, or the figures are recorded as “load-confounded”, with no comparison drawn. Each run also prints the decode’s time and peak RSS, andverify’s time and peak RSS, withos.wait4giving each child’s ownru_maxrss(neverRUSAGE_CHILDREN’s running total across two calls — the review 099 lesson). Both rows go intools/bench/README.md’s per-release table, so the previous release’s row is re-measured on this machine too and machine drift between cycles cannot fake a regression.brygge-bench real(fetching aside) stays the RFC 014 D-4 shape-and- correctness run; it is not this step. A time comparison takes the median of three runs per binary (review 154): a single pair’s run-to-run spread on one machine can exceed 10% with nothing changed, so one run of each is not enough to tell a real regression from noise. When none of those changed, state so in the cut request and reuse the previous release’s row rather than re-measuring (stated, not silently copied); - the dev team runs the cross-version
--against-sourcecheck (review 111 N-2), on the release commit, when the IR model, a decoder’s derivation, or--against-sourcechanged since the previous release:tools/fixtures.sh fetchfor the previous release’s real published binary (fixtures/previous-release/<version>/brygge, never a local rebuild), then decode one Git repository (with--infer-renames) and one CVS repository with that binary, decode the same two with the new release build, and runverify --against-sourcewith the new build against the previous build’s artifacts. This is the level-3 confirmation of the level-2 proof V-1/V-2 already committed undercrates/brygge/tests/data/. Record the result in the cut request.
- the architect assembles the cut commit: the version bump in
- The implementer commits and pushes it, and reports its CI result (all four platforms green).
- The architect asks the owner for the go-ahead, immediately before the tag, and records it. Then
the architect pushes the annotated tag:
git tag -a X.Y.Z -m "brygge X.Y.Z", thengit push origin X.Y.Z. Pushing the tag is the act that publishes. release.ymlruns.verifyre-checks the tag and runs the full gates on it, and the binaries are built. Nothing is published unless all of that passes.- Then the workflow:
- publishes the crates that are not yet on crates.io, in dependency order;
- installs
bryggefrom crates.io and smoke-tests it; - checks the published crates are byte-identical to the tag;
- creates the GitHub release, with the binaries, their checksums and their provenance attestations;
- renders, builds and lints
bryggeandbrygge-binin a pinned Arch Linux container, verifying each binary’s attestation first, and pushes both to the AUR (RFC 016).
- The architect checks the run, verifies the release page and the AUR packages, and records the release.
A failed attempt. If the run fails before publish to crates.io (the tag was wrong, a gate
failed), nothing was published. The architect may then delete the tag and re-create it on the fixed
commit, with the owner’s go-ahead (git push --delete origin X.Y.Z). Once any crate of a version is
published, its tag is never moved or deleted (GOVERNANCE.md).
If only the aur job fails, the crates and the GitHub release are already published and stay
published: the run still fails (never a quiet green), but outcome reports it distinctly, as “released;
AUR not updated”. The architect re-runs aur alone: Run workflow with the same tag and aur_only: true, after fixing the cause. The same path, with a pkgrel input, is RFC 016 D-3’s packaging-only fix
(a PKGBUILD change with no new brygge release); dry_run: true stops before git push, to prove the job
without touching the AUR.
Never push a placeholder to an AUR package name. A deleted package cannot be pushed to again until a Package Maintainer restores it, and an orphaned one until its adoption is granted (2026-10-28 → 2026-11-02, which delayed 0.5.0’s and 0.6.0’s packages).
A packaging-only fix is a dispatch with aur_only: true, the same tag, and pkgrel raised. The brygge
version does not change.
Re-running.
- Actions → Release → Run workflow with the same
tag. It is safe: crates already published are skipped. - It stops without changing anything if the GitHub release already exists (
aur_onlyis the exception: it never touches crates.io or the GitHub release, only theaurjob). - A release of an older tag is never marked “Latest”: only a version higher than every release already on
GitHub is (
tools/release-latest.sh). - The inputs
binaries: falseandnoteare for releases whose binaries cannot or should not be built; 0.1.0 is the only such release so far.
Checking a downloaded binary.
sha256sum -c brygge-<target>.tar.gz.sha256, thengh attestation verify brygge-<target>.tar.gz --repo prikk-vcs/brygge.- Or install from source with
cargo install --locked brygge.
Manual fallback (only when the workflow cannot run)
The architect executes it, confirming each step with the owner immediately before it:
- From a clean checkout of the tag,
cargo publish -p <crate> --lockedfor each crate not yet published, in dependency order. cargo install --locked brygge --version X.Y.Z, then a smoke test.tools/check-published.sh X.Y.Z.gh release create X.Y.Z --verify-tag --notes-file <(tools/release-notes.sh X.Y.Z).
A first publication of several new crates can hit crates.io’s new-crate rate limit (HTTP 429). Wait for the time it states, then continue with the remaining crates. Versions can be yanked, never deleted.