utopia-ia/elffuss-braid public
Changesets · Branches · Tags · Compare
| Changeset | 0cba57aa99aa2d35295b929354f2b2ca81dca3ccd023febe8842fba9bcff79cc |
|---|---|
| Author | KikoCis <KikoCis@users.noreply.github.com> · 2026-10-15 20:22 +02:00 |
| Committer | KikoCis <KikoCis@users.noreply.github.com> · 2026-10-15 20:24 +02:00 |
| Parents | None: the first changeset |
21 files changed
added .github/workflows/ci.yml +66 −0
| @@ -0,0 +1,66 @@ | ||
| 1 | +name: CI | |
| 2 | + | |
| 3 | +on: | |
| 4 | + push: | |
| 5 | + branches: [main] | |
| 6 | + pull_request: | |
| 7 | + | |
| 8 | +permissions: | |
| 9 | + contents: read | |
| 10 | + | |
| 11 | +env: | |
| 12 | + CARGO_TERM_COLOR: always | |
| 13 | + RUSTFLAGS: -D warnings | |
| 14 | + | |
| 15 | +jobs: | |
| 16 | + test: | |
| 17 | + name: test (${{ matrix.os }}) | |
| 18 | + strategy: | |
| 19 | + fail-fast: false | |
| 20 | + matrix: | |
| 21 | + os: [ubuntu-latest, ubuntu-24.04-arm, macos-15] | |
| 22 | + runs-on: ${{ matrix.os }} | |
| 23 | + steps: | |
| 24 | + - uses: actions/checkout@v5 | |
| 25 | + - uses: dtolnay/rust-toolchain@stable | |
| 26 | + with: | |
| 27 | + components: rustfmt, clippy | |
| 28 | + - uses: Swatinem/rust-cache@v2 | |
| 29 | + - run: cargo fmt --all --check | |
| 30 | + - run: cargo clippy --workspace --all-targets --locked | |
| 31 | + - run: cargo test --workspace --locked | |
| 32 | + | |
| 33 | + msrv: | |
| 34 | + name: minimum Rust version | |
| 35 | + runs-on: ubuntu-latest | |
| 36 | + steps: | |
| 37 | + - uses: actions/checkout@v5 | |
| 38 | + - uses: dtolnay/rust-toolchain@1.89 | |
| 39 | + - uses: Swatinem/rust-cache@v2 | |
| 40 | + - run: cargo check --workspace --locked | |
| 41 | + | |
| 42 | + wasm: | |
| 43 | + name: format crate on WebAssembly | |
| 44 | + runs-on: ubuntu-latest | |
| 45 | + steps: | |
| 46 | + - uses: actions/checkout@v5 | |
| 47 | + - uses: dtolnay/rust-toolchain@stable | |
| 48 | + with: | |
| 49 | + targets: wasm32-unknown-unknown | |
| 50 | + - run: cargo check -p elffuss-braid-format --target wasm32-unknown-unknown --locked | |
| 51 | + | |
| 52 | + deny: | |
| 53 | + name: licences and advisories | |
| 54 | + runs-on: ubuntu-latest | |
| 55 | + steps: | |
| 56 | + - uses: actions/checkout@v5 | |
| 57 | + - uses: EmbarkStudios/cargo-deny-action@v2 | |
| 58 | + | |
| 59 | + privacy: | |
| 60 | + name: privacy check | |
| 61 | + runs-on: ubuntu-latest | |
| 62 | + steps: | |
| 63 | + - uses: actions/checkout@v5 | |
| 64 | + with: | |
| 65 | + fetch-depth: 0 | |
| 66 | + - run: scripts/privacy-check.sh |
added .gitignore +4 −0
| @@ -0,0 +1,4 @@ | ||
| 1 | +/target | |
| 2 | +/fuzz/target | |
| 3 | +/fuzz/corpus | |
| 4 | +/fuzz/artifacts |
added CONTRIBUTING.md +45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +# Contributing | |
| 2 | + | |
| 3 | +Thanks for wanting to help. Braid is pre-alpha, so the most useful | |
| 4 | +contributions right now are reviews of the [design](docs/design.md) and the | |
| 5 | +[format](docs/spec/format-v1.md), bug reports, and tests. | |
| 6 | + | |
| 7 | +## Build and test | |
| 8 | + | |
| 9 | +You need a stable Rust toolchain, 1.89 or newer. | |
| 10 | + | |
| 11 | +```bash | |
| 12 | +cargo build | |
| 13 | +cargo test --workspace | |
| 14 | +cargo fmt --all --check | |
| 15 | +cargo clippy --workspace --all-targets -- -D warnings | |
| 16 | +cargo deny check # needs cargo-deny | |
| 17 | +``` | |
| 18 | + | |
| 19 | +CI runs the same checks on every platform in its matrix, checks the minimum | |
| 20 | +Rust version, builds the format crate for WebAssembly, and runs the privacy | |
| 21 | +check in `scripts/privacy-check.sh`. | |
| 22 | + | |
| 23 | +## Rules | |
| 24 | + | |
| 25 | +- **No code from git or any other GPL project.** Git is GPLv2 and braid is | |
| 26 | + Apache-2.0. Do not port, translate or paste from git's sources. Reading | |
| 27 | + documentation and observing behaviour is fine. The git bridge uses | |
| 28 | + [gitoxide](https://github.com/GitoxideLabs/gitoxide), which is MIT or | |
| 29 | + Apache-2.0. | |
| 30 | +- **Dependencies must be compatible with Apache-2.0.** `deny.toml` holds the | |
| 31 | + list of accepted licences. | |
| 32 | +- **Hashed formats are specified first.** A change to the bytes of an id, a | |
| 33 | + tree or a changeset needs an update to `docs/spec/format-v1.md` and to its | |
| 34 | + golden vectors in the same pull request. After milestone 1 such a change | |
| 35 | + needs a new format version. | |
| 36 | +- **Performance claims come with a reproducible script** and are stated as a | |
| 37 | + ratio against git on the same machine. Do not publish absolute timings or | |
| 38 | + describe your hardware. | |
| 39 | +- **Tests come with the change.** Bug fixes include a test that fails without | |
| 40 | + the fix. | |
| 41 | + | |
| 42 | +## Licence of contributions | |
| 43 | + | |
| 44 | +Unless you say otherwise, any contribution you submit is licensed under | |
| 45 | +Apache-2.0, as section 5 of the [licence](LICENSE) describes. |
added Cargo.lock +408 −0
| @@ -0,0 +1,408 @@ | ||
| 1 | +# This file is automatically @generated by Cargo. | |
| 2 | +# It is not intended for manual editing. | |
| 3 | +version = 4 | |
| 4 | + | |
| 5 | +[[package]] | |
| 6 | +name = "anstream" | |
| 7 | +version = "1.0.0" | |
| 8 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 9 | +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" | |
| 10 | +dependencies = [ | |
| 11 | + "anstyle", | |
| 12 | + "anstyle-parse", | |
| 13 | + "anstyle-query", | |
| 14 | + "anstyle-wincon", | |
| 15 | + "colorchoice", | |
| 16 | + "is_terminal_polyfill", | |
| 17 | + "utf8parse", | |
| 18 | +] | |
| 19 | + | |
| 20 | +[[package]] | |
| 21 | +name = "anstyle" | |
| 22 | +version = "1.0.14" | |
| 23 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 24 | +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" | |
| 25 | + | |
| 26 | +[[package]] | |
| 27 | +name = "anstyle-parse" | |
| 28 | +version = "1.0.0" | |
| 29 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 30 | +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" | |
| 31 | +dependencies = [ | |
| 32 | + "utf8parse", | |
| 33 | +] | |
| 34 | + | |
| 35 | +[[package]] | |
| 36 | +name = "anstyle-query" | |
| 37 | +version = "1.1.5" | |
| 38 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 39 | +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" | |
| 40 | +dependencies = [ | |
| 41 | + "windows-sys", | |
| 42 | +] | |
| 43 | + | |
| 44 | +[[package]] | |
| 45 | +name = "anstyle-wincon" | |
| 46 | +version = "3.0.11" | |
| 47 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 48 | +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" | |
| 49 | +dependencies = [ | |
| 50 | + "anstyle", | |
| 51 | + "once_cell_polyfill", | |
| 52 | + "windows-sys", | |
| 53 | +] | |
| 54 | + | |
| 55 | +[[package]] | |
| 56 | +name = "anyhow" | |
| 57 | +version = "1.0.104" | |
| 58 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 59 | +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" | |
| 60 | + | |
| 61 | +[[package]] | |
| 62 | +name = "arrayvec" | |
| 63 | +version = "0.7.8" | |
| 64 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 65 | +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" | |
| 66 | + | |
| 67 | +[[package]] | |
| 68 | +name = "bitflags" | |
| 69 | +version = "2.13.2" | |
| 70 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 71 | +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" | |
| 72 | + | |
| 73 | +[[package]] | |
| 74 | +name = "blake3" | |
| 75 | +version = "1.8.7" | |
| 76 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 77 | +checksum = "6d9e454fc11f76977dc803893aff6304ed33d6a26efae8696573bea74baa27ae" | |
| 78 | +dependencies = [ | |
| 79 | + "arrayvec", | |
| 80 | + "cc", | |
| 81 | + "cfg-if", | |
| 82 | + "constant_time_eq", | |
| 83 | + "cpufeatures", | |
| 84 | +] | |
| 85 | + | |
| 86 | +[[package]] | |
| 87 | +name = "cc" | |
| 88 | +version = "1.8.0" | |
| 89 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 90 | +checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838" | |
| 91 | +dependencies = [ | |
| 92 | + "find-msvc-tools", | |
| 93 | + "shlex", | |
| 94 | +] | |
| 95 | + | |
| 96 | +[[package]] | |
| 97 | +name = "cfg-if" | |
| 98 | +version = "1.0.5" | |
| 99 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 100 | +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" | |
| 101 | + | |
| 102 | +[[package]] | |
| 103 | +name = "clap" | |
| 104 | +version = "4.6.7" | |
| 105 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 106 | +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" | |
| 107 | +dependencies = [ | |
| 108 | + "clap_builder", | |
| 109 | + "clap_derive", | |
| 110 | +] | |
| 111 | + | |
| 112 | +[[package]] | |
| 113 | +name = "clap_builder" | |
| 114 | +version = "4.6.7" | |
| 115 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 116 | +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" | |
| 117 | +dependencies = [ | |
| 118 | + "anstream", | |
| 119 | + "anstyle", | |
| 120 | + "clap_lex", | |
| 121 | + "strsim", | |
| 122 | +] | |
| 123 | + | |
| 124 | +[[package]] | |
| 125 | +name = "clap_derive" | |
| 126 | +version = "4.6.7" | |
| 127 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 128 | +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" | |
| 129 | +dependencies = [ | |
| 130 | + "heck", | |
| 131 | + "proc-macro2", | |
| 132 | + "quote", | |
| 133 | + "syn", | |
| 134 | +] | |
| 135 | + | |
| 136 | +[[package]] | |
| 137 | +name = "clap_lex" | |
| 138 | +version = "1.1.1" | |
| 139 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 140 | +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" | |
| 141 | + | |
| 142 | +[[package]] | |
| 143 | +name = "colorchoice" | |
| 144 | +version = "1.0.5" | |
| 145 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 146 | +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" | |
| 147 | + | |
| 148 | +[[package]] | |
| 149 | +name = "constant_time_eq" | |
| 150 | +version = "0.4.2" | |
| 151 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 152 | +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" | |
| 153 | + | |
| 154 | +[[package]] | |
| 155 | +name = "cpufeatures" | |
| 156 | +version = "0.3.1" | |
| 157 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 158 | +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" | |
| 159 | +dependencies = [ | |
| 160 | + "libc", | |
| 161 | +] | |
| 162 | + | |
| 163 | +[[package]] | |
| 164 | +name = "elffuss-braid-cli" | |
| 165 | +version = "0.0.1" | |
| 166 | +dependencies = [ | |
| 167 | + "anyhow", | |
| 168 | + "clap", | |
| 169 | + "elffuss-braid-format", | |
| 170 | + "serde_json", | |
| 171 | + "tempfile", | |
| 172 | +] | |
| 173 | + | |
| 174 | +[[package]] | |
| 175 | +name = "elffuss-braid-format" | |
| 176 | +version = "0.0.1" | |
| 177 | +dependencies = [ | |
| 178 | + "blake3", | |
| 179 | +] | |
| 180 | + | |
| 181 | +[[package]] | |
| 182 | +name = "errno" | |
| 183 | +version = "0.3.14" | |
| 184 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 185 | +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" | |
| 186 | +dependencies = [ | |
| 187 | + "libc", | |
| 188 | + "windows-sys", | |
| 189 | +] | |
| 190 | + | |
| 191 | +[[package]] | |
| 192 | +name = "fastrand" | |
| 193 | +version = "2.5.0" | |
| 194 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 195 | +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" | |
| 196 | + | |
| 197 | +[[package]] | |
| 198 | +name = "find-msvc-tools" | |
| 199 | +version = "0.1.14" | |
| 200 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 201 | +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" | |
| 202 | + | |
| 203 | +[[package]] | |
| 204 | +name = "getrandom" | |
| 205 | +version = "0.4.3" | |
| 206 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 207 | +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" | |
| 208 | +dependencies = [ | |
| 209 | + "cfg-if", | |
| 210 | + "libc", | |
| 211 | + "r-efi", | |
| 212 | +] | |
| 213 | + | |
| 214 | +[[package]] | |
| 215 | +name = "heck" | |
| 216 | +version = "0.5.0" | |
| 217 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 218 | +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" | |
| 219 | + | |
| 220 | +[[package]] | |
| 221 | +name = "is_terminal_polyfill" | |
| 222 | +version = "1.70.2" | |
| 223 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 224 | +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" | |
| 225 | + | |
| 226 | +[[package]] | |
| 227 | +name = "itoa" | |
| 228 | +version = "1.0.18" | |
| 229 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 230 | +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" | |
| 231 | + | |
| 232 | +[[package]] | |
| 233 | +name = "libc" | |
| 234 | +version = "0.2.190" | |
| 235 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 236 | +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" | |
| 237 | + | |
| 238 | +[[package]] | |
| 239 | +name = "linux-raw-sys" | |
| 240 | +version = "0.12.1" | |
| 241 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 242 | +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" | |
| 243 | + | |
| 244 | +[[package]] | |
| 245 | +name = "memchr" | |
| 246 | +version = "2.8.3" | |
| 247 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 248 | +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" | |
| 249 | + | |
| 250 | +[[package]] | |
| 251 | +name = "once_cell" | |
| 252 | +version = "1.21.4" | |
| 253 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 254 | +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" | |
| 255 | + | |
| 256 | +[[package]] | |
| 257 | +name = "once_cell_polyfill" | |
| 258 | +version = "1.70.2" | |
| 259 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 260 | +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" | |
| 261 | + | |
| 262 | +[[package]] | |
| 263 | +name = "proc-macro2" | |
| 264 | +version = "1.0.107" | |
| 265 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 266 | +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" | |
| 267 | +dependencies = [ | |
| 268 | + "unicode-ident", | |
| 269 | +] | |
| 270 | + | |
| 271 | +[[package]] | |
| 272 | +name = "quote" | |
| 273 | +version = "1.0.47" | |
| 274 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 275 | +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" | |
| 276 | +dependencies = [ | |
| 277 | + "proc-macro2", | |
| 278 | +] | |
| 279 | + | |
| 280 | +[[package]] | |
| 281 | +name = "r-efi" | |
| 282 | +version = "6.0.0" | |
| 283 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 284 | +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" | |
| 285 | + | |
| 286 | +[[package]] | |
| 287 | +name = "rustix" | |
| 288 | +version = "1.1.5" | |
| 289 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 290 | +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" | |
| 291 | +dependencies = [ | |
| 292 | + "bitflags", | |
| 293 | + "errno", | |
| 294 | + "libc", | |
| 295 | + "linux-raw-sys", | |
| 296 | + "windows-sys", | |
| 297 | +] | |
| 298 | + | |
| 299 | +[[package]] | |
| 300 | +name = "serde" | |
| 301 | +version = "1.0.229" | |
| 302 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 303 | +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" | |
| 304 | +dependencies = [ | |
| 305 | + "serde_core", | |
| 306 | +] | |
| 307 | + | |
| 308 | +[[package]] | |
| 309 | +name = "serde_core" | |
| 310 | +version = "1.0.229" | |
| 311 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 312 | +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" | |
| 313 | +dependencies = [ | |
| 314 | + "serde_derive", | |
| 315 | +] | |
| 316 | + | |
| 317 | +[[package]] | |
| 318 | +name = "serde_derive" | |
| 319 | +version = "1.0.229" | |
| 320 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 321 | +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" | |
| 322 | +dependencies = [ | |
| 323 | + "proc-macro2", | |
| 324 | + "quote", | |
| 325 | + "syn", | |
| 326 | +] | |
| 327 | + | |
| 328 | +[[package]] | |
| 329 | +name = "serde_json" | |
| 330 | +version = "1.0.154" | |
| 331 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 332 | +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" | |
| 333 | +dependencies = [ | |
| 334 | + "itoa", | |
| 335 | + "memchr", | |
| 336 | + "serde", | |
| 337 | + "serde_core", | |
| 338 | + "zmij", | |
| 339 | +] | |
| 340 | + | |
| 341 | +[[package]] | |
| 342 | +name = "shlex" | |
| 343 | +version = "2.0.1" | |
| 344 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 345 | +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" | |
| 346 | + | |
| 347 | +[[package]] | |
| 348 | +name = "strsim" | |
| 349 | +version = "0.11.1" | |
| 350 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 351 | +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" | |
| 352 | + | |
| 353 | +[[package]] | |
| 354 | +name = "syn" | |
| 355 | +version = "3.0.9" | |
| 356 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 357 | +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" | |
| 358 | +dependencies = [ | |
| 359 | + "proc-macro2", | |
| 360 | + "quote", | |
| 361 | + "unicode-ident", | |
| 362 | +] | |
| 363 | + | |
| 364 | +[[package]] | |
| 365 | +name = "tempfile" | |
| 366 | +version = "3.27.0" | |
| 367 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 368 | +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" | |
| 369 | +dependencies = [ | |
| 370 | + "fastrand", | |
| 371 | + "getrandom", | |
| 372 | + "once_cell", | |
| 373 | + "rustix", | |
| 374 | + "windows-sys", | |
| 375 | +] | |
| 376 | + | |
| 377 | +[[package]] | |
| 378 | +name = "unicode-ident" | |
| 379 | +version = "1.0.27" | |
| 380 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 381 | +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" | |
| 382 | + | |
| 383 | +[[package]] | |
| 384 | +name = "utf8parse" | |
| 385 | +version = "0.2.2" | |
| 386 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 387 | +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" | |
| 388 | + | |
| 389 | +[[package]] | |
| 390 | +name = "windows-link" | |
| 391 | +version = "0.2.1" | |
| 392 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 393 | +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" | |
| 394 | + | |
| 395 | +[[package]] | |
| 396 | +name = "windows-sys" | |
| 397 | +version = "0.61.2" | |
| 398 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 399 | +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" | |
| 400 | +dependencies = [ | |
| 401 | + "windows-link", | |
| 402 | +] | |
| 403 | + | |
| 404 | +[[package]] | |
| 405 | +name = "zmij" | |
| 406 | +version = "1.0.23" | |
| 407 | +source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 408 | +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" |
added Cargo.toml +33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +[workspace] | |
| 2 | +resolver = "3" | |
| 3 | +members = ["crates/*"] | |
| 4 | + | |
| 5 | +[workspace.package] | |
| 6 | +version = "0.0.1" | |
| 7 | +edition = "2024" | |
| 8 | +rust-version = "1.89" | |
| 9 | +license = "Apache-2.0" | |
| 10 | +repository = "https://github.com/KikoCis/elffuss-braid" | |
| 11 | +homepage = "https://elffuss.com" | |
| 12 | +publish = false | |
| 13 | + | |
| 14 | +[workspace.dependencies] | |
| 15 | +braid-format = { package = "elffuss-braid-format", path = "crates/format" } | |
| 16 | +anyhow = "1.0" | |
| 17 | +blake3 = "1.8" | |
| 18 | +clap = { version = "4.6", features = ["derive"] } | |
| 19 | +serde_json = "1.0" | |
| 20 | +tempfile = "3" | |
| 21 | + | |
| 22 | +[workspace.lints.rust] | |
| 23 | +unsafe_code = "deny" | |
| 24 | +missing_debug_implementations = "warn" | |
| 25 | + | |
| 26 | +[workspace.lints.clippy] | |
| 27 | +dbg_macro = "deny" | |
| 28 | +todo = "deny" | |
| 29 | + | |
| 30 | +[profile.release] | |
| 31 | +codegen-units = 1 | |
| 32 | +lto = "thin" | |
| 33 | +strip = "symbols" |
added LICENSE +202 −0
| @@ -0,0 +1,202 @@ | ||
| 1 | + | |
| 2 | + Apache License | |
| 3 | + Version 2.0, January 2004 | |
| 4 | + http://www.apache.org/licenses/ | |
| 5 | + | |
| 6 | + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
| 7 | + | |
| 8 | + 1. Definitions. | |
| 9 | + | |
| 10 | + "License" shall mean the terms and conditions for use, reproduction, | |
| 11 | + and distribution as defined by Sections 1 through 9 of this document. | |
| 12 | + | |
| 13 | + "Licensor" shall mean the copyright owner or entity authorized by | |
| 14 | + the copyright owner that is granting the License. | |
| 15 | + | |
| 16 | + "Legal Entity" shall mean the union of the acting entity and all | |
| 17 | + other entities that control, are controlled by, or are under common | |
| 18 | + control with that entity. For the purposes of this definition, | |
| 19 | + "control" means (i) the power, direct or indirect, to cause the | |
| 20 | + direction or management of such entity, whether by contract or | |
| 21 | + otherwise, or (ii) ownership of fifty percent (50%) or more of the | |
| 22 | + outstanding shares, or (iii) beneficial ownership of such entity. | |
| 23 | + | |
| 24 | + "You" (or "Your") shall mean an individual or Legal Entity | |
| 25 | + exercising permissions granted by this License. | |
| 26 | + | |
| 27 | + "Source" form shall mean the preferred form for making modifications, | |
| 28 | + including but not limited to software source code, documentation | |
| 29 | + source, and configuration files. | |
| 30 | + | |
| 31 | + "Object" form shall mean any form resulting from mechanical | |
| 32 | + transformation or translation of a Source form, including but | |
| 33 | + not limited to compiled object code, generated documentation, | |
| 34 | + and conversions to other media types. | |
| 35 | + | |
| 36 | + "Work" shall mean the work of authorship, whether in Source or | |
| 37 | + Object form, made available under the License, as indicated by a | |
| 38 | + copyright notice that is included in or attached to the work | |
| 39 | + (an example is provided in the Appendix below). | |
| 40 | + | |
| 41 | + "Derivative Works" shall mean any work, whether in Source or Object | |
| 42 | + form, that is based on (or derived from) the Work and for which the | |
| 43 | + editorial revisions, annotations, elaborations, or other modifications | |
| 44 | + represent, as a whole, an original work of authorship. For the purposes | |
| 45 | + of this License, Derivative Works shall not include works that remain | |
| 46 | + separable from, or merely link (or bind by name) to the interfaces of, | |
| 47 | + the Work and Derivative Works thereof. | |
| 48 | + | |
| 49 | + "Contribution" shall mean any work of authorship, including | |
| 50 | + the original version of the Work and any modifications or additions | |
| 51 | + to that Work or Derivative Works thereof, that is intentionally | |
| 52 | + submitted to Licensor for inclusion in the Work by the copyright owner | |
| 53 | + or by an individual or Legal Entity authorized to submit on behalf of | |
| 54 | + the copyright owner. For the purposes of this definition, "submitted" | |
| 55 | + means any form of electronic, verbal, or written communication sent | |
| 56 | + to the Licensor or its representatives, including but not limited to | |
| 57 | + communication on electronic mailing lists, source code control systems, | |
| 58 | + and issue tracking systems that are managed by, or on behalf of, the | |
| 59 | + Licensor for the purpose of discussing and improving the Work, but | |
| 60 | + excluding communication that is conspicuously marked or otherwise | |
| 61 | + designated in writing by the copyright owner as "Not a Contribution." | |
| 62 | + | |
| 63 | + "Contributor" shall mean Licensor and any individual or Legal Entity | |
| 64 | + on behalf of whom a Contribution has been received by Licensor and | |
| 65 | + subsequently incorporated within the Work. | |
| 66 | + | |
| 67 | + 2. Grant of Copyright License. Subject to the terms and conditions of | |
| 68 | + this License, each Contributor hereby grants to You a perpetual, | |
| 69 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable | |
| 70 | + copyright license to reproduce, prepare Derivative Works of, | |
| 71 | + publicly display, publicly perform, sublicense, and distribute the | |
| 72 | + Work and such Derivative Works in Source or Object form. | |
| 73 | + | |
| 74 | + 3. Grant of Patent License. Subject to the terms and conditions of | |
| 75 | + this License, each Contributor hereby grants to You a perpetual, | |
| 76 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable | |
| 77 | + (except as stated in this section) patent license to make, have made, | |
| 78 | + use, offer to sell, sell, import, and otherwise transfer the Work, | |
| 79 | + where such license applies only to those patent claims licensable | |
| 80 | + by such Contributor that are necessarily infringed by their | |
| 81 | + Contribution(s) alone or by combination of their Contribution(s) | |
| 82 | + with the Work to which such Contribution(s) was submitted. If You | |
| 83 | + institute patent litigation against any entity (including a | |
| 84 | + cross-claim or counterclaim in a lawsuit) alleging that the Work | |
| 85 | + or a Contribution incorporated within the Work constitutes direct | |
| 86 | + or contributory patent infringement, then any patent licenses | |
| 87 | + granted to You under this License for that Work shall terminate | |
| 88 | + as of the date such litigation is filed. | |
| 89 | + | |
| 90 | + 4. Redistribution. You may reproduce and distribute copies of the | |
| 91 | + Work or Derivative Works thereof in any medium, with or without | |
| 92 | + modifications, and in Source or Object form, provided that You | |
| 93 | + meet the following conditions: | |
| 94 | + | |
| 95 | + (a) You must give any other recipients of the Work or | |
| 96 | + Derivative Works a copy of this License; and | |
| 97 | + | |
| 98 | + (b) You must cause any modified files to carry prominent notices | |
| 99 | + stating that You changed the files; and | |
| 100 | + | |
| 101 | + (c) You must retain, in the Source form of any Derivative Works | |
| 102 | + that You distribute, all copyright, patent, trademark, and | |
| 103 | + attribution notices from the Source form of the Work, | |
| 104 | + excluding those notices that do not pertain to any part of | |
| 105 | + the Derivative Works; and | |
| 106 | + | |
| 107 | + (d) If the Work includes a "NOTICE" text file as part of its | |
| 108 | + distribution, then any Derivative Works that You distribute must | |
| 109 | + include a readable copy of the attribution notices contained | |
| 110 | + within such NOTICE file, excluding those notices that do not | |
| 111 | + pertain to any part of the Derivative Works, in at least one | |
| 112 | + of the following places: within a NOTICE text file distributed | |
| 113 | + as part of the Derivative Works; within the Source form or | |
| 114 | + documentation, if provided along with the Derivative Works; or, | |
| 115 | + within a display generated by the Derivative Works, if and | |
| 116 | + wherever such third-party notices normally appear. The contents | |
| 117 | + of the NOTICE file are for informational purposes only and | |
| 118 | + do not modify the License. You may add Your own attribution | |
| 119 | + notices within Derivative Works that You distribute, alongside | |
| 120 | + or as an addendum to the NOTICE text from the Work, provided | |
| 121 | + that such additional attribution notices cannot be construed | |
| 122 | + as modifying the License. | |
| 123 | + | |
| 124 | + You may add Your own copyright statement to Your modifications and | |
| 125 | + may provide additional or different license terms and conditions | |
| 126 | + for use, reproduction, or distribution of Your modifications, or | |
| 127 | + for any such Derivative Works as a whole, provided Your use, | |
| 128 | + reproduction, and distribution of the Work otherwise complies with | |
| 129 | + the conditions stated in this License. | |
| 130 | + | |
| 131 | + 5. Submission of Contributions. Unless You explicitly state otherwise, | |
| 132 | + any Contribution intentionally submitted for inclusion in the Work | |
| 133 | + by You to the Licensor shall be under the terms and conditions of | |
| 134 | + this License, without any additional terms or conditions. | |
| 135 | + Notwithstanding the above, nothing herein shall supersede or modify | |
| 136 | + the terms of any separate license agreement you may have executed | |
| 137 | + with Licensor regarding such Contributions. | |
| 138 | + | |
| 139 | + 6. Trademarks. This License does not grant permission to use the trade | |
| 140 | + names, trademarks, service marks, or product names of the Licensor, | |
| 141 | + except as required for reasonable and customary use in describing the | |
| 142 | + origin of the Work and reproducing the content of the NOTICE file. | |
| 143 | + | |
| 144 | + 7. Disclaimer of Warranty. Unless required by applicable law or | |
| 145 | + agreed to in writing, Licensor provides the Work (and each | |
| 146 | + Contributor provides its Contributions) on an "AS IS" BASIS, | |
| 147 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | |
| 148 | + implied, including, without limitation, any warranties or conditions | |
| 149 | + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | |
| 150 | + PARTICULAR PURPOSE. You are solely responsible for determining the | |
| 151 | + appropriateness of using or redistributing the Work and assume any | |
| 152 | + risks associated with Your exercise of permissions under this License. | |
| 153 | + | |
| 154 | + 8. Limitation of Liability. In no event and under no legal theory, | |
| 155 | + whether in tort (including negligence), contract, or otherwise, | |
| 156 | + unless required by applicable law (such as deliberate and grossly | |
| 157 | + negligent acts) or agreed to in writing, shall any Contributor be | |
| 158 | + liable to You for damages, including any direct, indirect, special, | |
| 159 | + incidental, or consequential damages of any character arising as a | |
| 160 | + result of this License or out of the use or inability to use the | |
| 161 | + Work (including but not limited to damages for loss of goodwill, | |
| 162 | + work stoppage, computer failure or malfunction, or any and all | |
| 163 | + other commercial damages or losses), even if such Contributor | |
| 164 | + has been advised of the possibility of such damages. | |
| 165 | + | |
| 166 | + 9. Accepting Warranty or Additional Liability. While redistributing | |
| 167 | + the Work or Derivative Works thereof, You may choose to offer, | |
| 168 | + and charge a fee for, acceptance of support, warranty, indemnity, | |
| 169 | + or other liability obligations and/or rights consistent with this | |
| 170 | + License. However, in accepting such obligations, You may act only | |
| 171 | + on Your own behalf and on Your sole responsibility, not on behalf | |
| 172 | + of any other Contributor, and only if You agree to indemnify, | |
| 173 | + defend, and hold each Contributor harmless for any liability | |
| 174 | + incurred by, or claims asserted against, such Contributor by reason | |
| 175 | + of your accepting any such warranty or additional liability. | |
| 176 | + | |
| 177 | + END OF TERMS AND CONDITIONS | |
| 178 | + | |
| 179 | + APPENDIX: How to apply the Apache License to your work. | |
| 180 | + | |
| 181 | + To apply the Apache License to your work, attach the following | |
| 182 | + boilerplate notice, with the fields enclosed by brackets "[]" | |
| 183 | + replaced with your own identifying information. (Don't include | |
| 184 | + the brackets!) The text should be enclosed in the appropriate | |
| 185 | + comment syntax for the file format. We also recommend that a | |
| 186 | + file or class name and description of purpose be included on the | |
| 187 | + same "printed page" as the copyright notice for easier | |
| 188 | + identification within third-party archives. | |
| 189 | + | |
| 190 | + Copyright [yyyy] [name of copyright owner] | |
| 191 | + | |
| 192 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
| 193 | + you may not use this file except in compliance with the License. | |
| 194 | + You may obtain a copy of the License at | |
| 195 | + | |
| 196 | + http://www.apache.org/licenses/LICENSE-2.0 | |
| 197 | + | |
| 198 | + Unless required by applicable law or agreed to in writing, software | |
| 199 | + distributed under the License is distributed on an "AS IS" BASIS, | |
| 200 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 201 | + See the License for the specific language governing permissions and | |
| 202 | + limitations under the License. |
added NOTICE +5 −0
| @@ -0,0 +1,5 @@ | ||
| 1 | +elffuss-braid | |
| 2 | +Copyright 2026 UtopiaIA | |
| 3 | + | |
| 4 | +This product includes software developed as part of the Elffuss project. | |
| 5 | +Licensed under the Apache License, Version 2.0. |
added README.md +213 −0
| @@ -0,0 +1,213 @@ | ||
| 1 | +<div align="center"> | |
| 2 | + | |
| 3 | +<img src="docs/assets/braid.svg" alt="Three strands braided together" width="320"> | |
| 4 | + | |
| 5 | +# ✳ Elffuss Braid | |
| 6 | + | |
| 7 | +**Version control for repositories where many agents land changes at the same time.** | |
| 8 | + | |
| 9 | +A from-scratch version control system in Rust. Creating a change costs what the | |
| 10 | +change touches, not what the repository weighs. Landing on `main` is one short | |
| 11 | +step per branch, with no repository-wide lock. Git stays at the edges, so GitHub | |
| 12 | +keeps working. | |
| 13 | + | |
| 14 | +[](LICENSE) | |
| 15 | +[](https://github.com/KikoCis/elffuss-braid/actions/workflows/ci.yml) | |
| 16 | +[](https://www.rust-lang.org) | |
| 17 | +[](#status-and-roadmap) | |
| 18 | + | |
| 19 | +[elffuss.com](https://elffuss.com) · [Code](https://code.elffuss.com) · [Claw](https://claw.elffuss.com) · [Translator](https://translator.elffuss.com) · [Copilot](https://copilot.elffuss.com) · [Blog](https://elffuss.com/blog/) · [Hugging Face](https://huggingface.co/KikoCis) · [Dev log](https://bitacora.utopiaia.com/) | |
| 20 | + | |
| 21 | +</div> | |
| 22 | + | |
| 23 | +--- | |
| 24 | + | |
| 25 | +**In this repository:** [why braid](#why-braid) · [how it works](#how-it-works) · [quick start](#quick-start) · [working with git](#working-with-git) · [design](#design) · [status](#status-and-roadmap) · [what is honest about this](#what-is-honest-about-this) · [credits](#prior-art-and-credits) | |
| 26 | + | |
| 27 | +--- | |
| 28 | + | |
| 29 | +## Why braid | |
| 30 | + | |
| 31 | +Git was designed for people who work offline and sync now and then. Agents work | |
| 32 | +differently: there are many of them, each change is small, they are always | |
| 33 | +connected, and they all want to land on `main` at once. In git that shows up as: | |
| 34 | + | |
| 35 | +- **Shared mutable state.** One index per working tree, and a push that is | |
| 36 | + rejected whenever someone else landed first, so every agent ends up in a | |
| 37 | + fetch, rebase, push and retry loop. | |
| 38 | +- **Costs that grow with the repository.** Status and commit walk the whole | |
| 39 | + index, and a directory with many files is rewritten whole on every change. | |
| 40 | +- **Transfers built per client.** Each fetch negotiates and builds its own pack, | |
| 41 | + so a cache in front of the server cannot help. | |
| 42 | +- **Large files need a side system.** | |
| 43 | + | |
| 44 | +Braid starts from the opposite assumptions: | |
| 45 | + | |
| 46 | +| | git | braid | | |
| 47 | +|---|---|---| | |
| 48 | +| Unit of change | a commit: a full tree snapshot | a changeset: the files that changed against the first parent, plus the root tree id | | |
| 49 | +| Landing on `main` | the client pushes and is rejected if behind | `land` rebases in one short serial step per branch, at a cost that follows the change | | |
| 50 | +| Many writers | one index per working tree | one workspace per agent over a shared append-only store; creating a change takes no repository lock | | |
| 51 | +| Fetching | negotiated packs, unique per client | immutable objects by id, so any cache (local daemon, nginx, CDN) can serve them | | |
| 52 | +| Large directories | rewritten whole on every change | split into content-defined nodes; an edit rewrites only its path | | |
| 53 | +| Large files | a separate extension | content-defined chunks, deduplicated across versions | | |
| 54 | +| Hash | SHA-1 | BLAKE3 | | |
| 55 | +| For agents | parse human output | `--json` everywhere; changes can be created through the API without a checkout | | |
| 56 | + | |
| 57 | +This is the design. [Status](#status-and-roadmap) says what exists today. | |
| 58 | + | |
| 59 | +## How it works | |
| 60 | + | |
| 61 | +```mermaid | |
| 62 | +flowchart LR | |
| 63 | + subgraph machine["One machine"] | |
| 64 | + A1["agent 1 · workspace"] --> ST | |
| 65 | + A2["agent 2 · workspace"] --> ST | |
| 66 | + A3["agent N · workspace"] --> ST | |
| 67 | + ST[("shared store<br/>immutable objects + op log")] | |
| 68 | + end | |
| 69 | + ST -- "land: one short step per branch" --> MAIN(["main"]) | |
| 70 | + ST <-- "objects by id" --> SRV["braid server (optional)"] | |
| 71 | + ST <-- "import / export" --> GIT["git bridge"] | |
| 72 | + GIT <--> GH["GitHub · Gitea"] | |
| 73 | +``` | |
| 74 | + | |
| 75 | +1. **Everything is an immutable object named by its BLAKE3 hash:** file | |
| 76 | + contents, directories, and changesets. Nothing is ever rewritten in place. | |
| 77 | +2. **A changeset records what changed against its first parent,** plus the | |
| 78 | + root tree it produces. History, blame and rebase read the short list; the | |
| 79 | + root id commits to the whole repository. | |
| 80 | +3. **Landing is one short serial step per branch.** If the change was built on | |
| 81 | + the current head it fast-forwards. If not, braid rebases it path by path and | |
| 82 | + merges only the files both sides touched. Conflicts come back as data that | |
| 83 | + an agent can act on. | |
| 84 | +4. **Many processes share one store without a daemon.** Segments are leased | |
| 85 | + with locks the kernel releases if a process dies, objects are published | |
| 86 | + before anything refers to them, and an append-only op log records every | |
| 87 | + operation so it can be undone. | |
| 88 | +5. **The same API at every tier.** A local store, a per-machine daemon, a | |
| 89 | + cache and a server answer the same requests, so a client never cares which | |
| 90 | + one it talks to. | |
| 91 | + | |
| 92 | +## Quick start | |
| 93 | + | |
| 94 | +Today braid computes object ids. Everything else arrives milestone by milestone. | |
| 95 | + | |
| 96 | +```bash | |
| 97 | +git clone https://github.com/KikoCis/elffuss-braid | |
| 98 | +cd elffuss-braid | |
| 99 | +cargo build --release | |
| 100 | +./target/release/braid --version | |
| 101 | +./target/release/braid hash-object README.md | |
| 102 | +./target/release/braid hash-object --json README.md | |
| 103 | +``` | |
| 104 | + | |
| 105 | +Ids can be checked with any BLAKE3 implementation, for example the reference | |
| 106 | +[`b3sum`](https://github.com/BLAKE3-team/BLAKE3/tree/master/b3sum) tool: | |
| 107 | + | |
| 108 | +```bash | |
| 109 | +b3sum --derive-key "elffuss-braid 2026 blob v1" README.md | |
| 110 | +``` | |
| 111 | + | |
| 112 | +## Working with git | |
| 113 | + | |
| 114 | +Repositories come in with their whole history and keep a git mirror. | |
| 115 | + | |
| 116 | +- `braid git import` reads a git repository through | |
| 117 | + [gitoxide](https://github.com/GitoxideLabs/gitoxide). Each commit is exported | |
| 118 | + again and compared with the original, so the round trip is bit for bit. | |
| 119 | +- `braid git export` and `braid git sync` keep GitHub or Gitea up to date as a | |
| 120 | + fast-forward with a lease. Braid never force-pushes. | |
| 121 | +- Braid contains no code from git itself, which is GPLv2. It reads and writes | |
| 122 | + git data with gitoxide (MIT or Apache-2.0) and runs the `git` binary only as | |
| 123 | + a subprocess to push. | |
| 124 | + | |
| 125 | +## Design | |
| 126 | + | |
| 127 | +- [Design overview](docs/design.md): store, landing, workspaces, the git | |
| 128 | + bridge, the server, and how it is tested. | |
| 129 | +- [Format v1](docs/spec/format-v1.md): the exact bytes of ids, trees and | |
| 130 | + changesets, with golden vectors. | |
| 131 | + | |
| 132 | +## Status and roadmap | |
| 133 | + | |
| 134 | +| Milestone | Scope | State | | |
| 135 | +|---|---|---| | |
| 136 | +| 0 | Public repository, CI, object ids, `braid hash-object` | ✅ done | | |
| 137 | +| 1 | Format v1: canonical codec, trees (flat and split), changesets, name rules; then frozen | in progress | | |
| 138 | +| 2 | Local store and op log: many processes, crash-safe, `fsck`, `undo` | planned | | |
| 139 | +| 3 | History and the git bridge: import, export, `log`, `show`, `diff`, `blame` | planned | | |
| 140 | +| 4 | Many agents on one machine: workspaces, `land`, conflicts, `git sync` | planned | | |
| 141 | +| 5 | Performance: deltas, chunking, derived indexes, benchmarks against git | planned | | |
| 142 | +| 6 | Server: lazy sparse clones, tokens, caching tiers | planned | | |
| 143 | +| 7 | Daemon, virtual file system, WebAssembly core | planned | | |
| 144 | + | |
| 145 | +Each milestone ships when its tests pass: golden vectors and fuzzing for the | |
| 146 | +format, crash and many-process tests for the store, bit-for-bit round trips and | |
| 147 | +differential tests against git for the bridge, deterministic simulation for | |
| 148 | +landing. | |
| 149 | + | |
| 150 | +## What is honest about this | |
| 151 | + | |
| 152 | +- **It is pre-alpha.** Today it computes object ids and nothing else. Do not | |
| 153 | + keep anything in it that you cannot afford to lose. | |
| 154 | +- **No performance claims yet.** When benchmarks land they will be ratios | |
| 155 | + against git on the same machine, with the script that reproduces them, never | |
| 156 | + numbers nobody can check. | |
| 157 | +- **The format can still change** until milestone 1 freezes it. | |
| 158 | +- **Braid is not Scion.** It starts from the ideas Anthropic described in | |
| 159 | + public about its own source control system. It is an independent | |
| 160 | + implementation, contains no code from Anthropic, and is not affiliated with | |
| 161 | + or endorsed by Anthropic. | |
| 162 | +- **Platforms.** CI tests Linux and other Unix-like systems. Windows is not tested yet. | |
| 163 | + | |
| 164 | +## Part of Elffuss | |
| 165 | + | |
| 166 | +Braid is part of [Elffuss](https://elffuss.com), a family of tools for building | |
| 167 | +software with agents. | |
| 168 | + | |
| 169 | +- [elffuss](https://github.com/KikoCis/elffuss): the shared browser-agent core behind Code and Claw. | |
| 170 | +- [elffuss-code](https://github.com/KikoCis/elffuss-code): an IDE with an AI agent that runs entirely in your browser ([Space](https://huggingface.co/spaces/KikoCis/elffuss-code)). | |
| 171 | +- [elffuss-claw](https://github.com/KikoCis/elffuss-claw): an agentic OS in your browser, with apps generated on demand ([Space](https://huggingface.co/spaces/KikoCis/elffuss-claw)). | |
| 172 | +- [elffuss-engine](https://github.com/KikoCis/elffuss-engine): an LLM runtime that runs GGUF models on WebGPU. | |
| 173 | +- [elffuss-translator](https://github.com/KikoCis/elffuss-translator): real-time conversation translation in the browser. | |
| 174 | + | |
| 175 | +## Prior art and credits | |
| 176 | + | |
| 177 | +- Anthropic, [Redesigning source control at Anthropic](https://www.anthropic.com/engineering/redesigning-source-control): | |
| 178 | + changesets stored against the first parent, server-side merges, minimal | |
| 179 | + branch state, immutable objects served by any cache tier. | |
| 180 | +- [Jujutsu](https://github.com/jj-vcs/jj): the operation log and undo. | |
| 181 | +- [Sapling](https://sapling-scm.com): history served at scale, and compressing | |
| 182 | + a file version against the previous one. | |
| 183 | +- [gitoxide](https://github.com/GitoxideLabs/gitoxide): the git bridge. | |
| 184 | +- [BLAKE3](https://github.com/BLAKE3-team/BLAKE3), [FastCDC](https://www.usenix.org/conference/atc16/technical-sessions/presentation/xia), | |
| 185 | + [prolly trees](https://docs.dolthub.com/architecture/storage-engine/prolly-tree) | |
| 186 | + and [imara-diff](https://github.com/pascalkuthe/imara-diff). | |
| 187 | + | |
| 188 | +## Contributing and security | |
| 189 | + | |
| 190 | +- [CONTRIBUTING.md](CONTRIBUTING.md): how to build, test and propose changes. | |
| 191 | +- [SECURITY.md](SECURITY.md): how to report a vulnerability privately. | |
| 192 | + | |
| 193 | +## License | |
| 194 | + | |
| 195 | +[Apache-2.0](LICENSE). Copyright 2026 UtopiaIA. See [NOTICE](NOTICE). | |
| 196 | + | |
| 197 | +--- | |
| 198 | + | |
| 199 | +## En castellano | |
| 200 | + | |
| 201 | +Braid es un sistema de control de versiones escrito de cero en Rust, para | |
| 202 | +repositorios en los que muchos agentes aterrizan cambios a la vez. | |
| 203 | + | |
| 204 | +- Crear un cambio cuesta lo que toca el cambio, no lo que pesa el repositorio. | |
| 205 | +- Aterrizar en `main` es un paso corto por rama, sin cerrojo global. | |
| 206 | +- Git se queda en los bordes, así que GitHub y Gitea siguen funcionando. | |
| 207 | + | |
| 208 | +Parte de las ideas que Anthropic contó en público sobre Scion, su sistema interno. | |
| 209 | +Es una implementación independiente, sin código de Anthropic y sin relación con | |
| 210 | +la empresa. | |
| 211 | + | |
| 212 | +Hoy está en pre-alfa: solo calcula ids de objetos. Las [fases](#status-and-roadmap) | |
| 213 | +dicen qué llega después y qué pruebas tiene que pasar cada una. |
added SECURITY.md +33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +# Security policy | |
| 2 | + | |
| 3 | +Braid stores other people's code, so a bug in it can be a security bug: a | |
| 4 | +checkout that writes outside the working copy, a crafted object that crashes or | |
| 5 | +exhausts the reader, a merge that silently drops a change, or a token that | |
| 6 | +grants more than it should. | |
| 7 | + | |
| 8 | +## Reporting a vulnerability | |
| 9 | + | |
| 10 | +Please report it privately through GitHub: | |
| 11 | +[**Report a vulnerability**](https://github.com/KikoCis/elffuss-braid/security/advisories/new). | |
| 12 | +Do not open a public issue for it. | |
| 13 | + | |
| 14 | +Include what you can: the version or commit, the steps or a minimal repository | |
| 15 | +that reproduces it, and what an attacker gains. We will confirm that we | |
| 16 | +received it, keep you informed while we fix it, and credit you in the advisory | |
| 17 | +unless you prefer otherwise. | |
| 18 | + | |
| 19 | +## Supported versions | |
| 20 | + | |
| 21 | +Braid is pre-alpha. Fixes go to the `main` branch only. | |
| 22 | + | |
| 23 | +## Scope | |
| 24 | + | |
| 25 | +In scope: | |
| 26 | + | |
| 27 | +- Path handling when writing a working copy: traversal, symlinks, names that | |
| 28 | + collide on case-insensitive or normalising file systems, and aliases of | |
| 29 | + `.braid` or `.git`. | |
| 30 | +- Decoding objects, records, indexes and anything received over the network. | |
| 31 | +- Importing from or exporting to git. | |
| 32 | +- Authentication and authorisation in the server. | |
| 33 | +- Any way to make braid lose or corrupt data that it acknowledged as stored. |
added crates/cli/Cargo.toml +26 −0
| @@ -0,0 +1,26 @@ | ||
| 1 | +[package] | |
| 2 | +name = "elffuss-braid-cli" | |
| 3 | +description = "The braid command-line tool." | |
| 4 | +version.workspace = true | |
| 5 | +edition.workspace = true | |
| 6 | +rust-version.workspace = true | |
| 7 | +license.workspace = true | |
| 8 | +repository.workspace = true | |
| 9 | +homepage.workspace = true | |
| 10 | +publish.workspace = true | |
| 11 | + | |
| 12 | +[[bin]] | |
| 13 | +name = "braid" | |
| 14 | +path = "src/main.rs" | |
| 15 | + | |
| 16 | +[dependencies] | |
| 17 | +braid-format.workspace = true | |
| 18 | +anyhow.workspace = true | |
| 19 | +clap.workspace = true | |
| 20 | +serde_json.workspace = true | |
| 21 | + | |
| 22 | +[dev-dependencies] | |
| 23 | +tempfile.workspace = true | |
| 24 | + | |
| 25 | +[lints] | |
| 26 | +workspace = true |
added crates/cli/src/main.rs +112 −0
| @@ -0,0 +1,112 @@ | ||
| 1 | +// SPDX-License-Identifier: Apache-2.0 | |
| 2 | +// Copyright (c) 2026 UtopiaIA | |
| 3 | + | |
| 4 | +//! `braid`, the command-line tool. | |
| 5 | + | |
| 6 | +use std::fs::File; | |
| 7 | +use std::io::{self, Read, Write}; | |
| 8 | +use std::path::{Path, PathBuf}; | |
| 9 | +use std::process::ExitCode; | |
| 10 | + | |
| 11 | +use anyhow::{Context, Result}; | |
| 12 | +use braid_format::{IdHasher, Kind, ObjectId}; | |
| 13 | +use clap::{Parser, Subcommand}; | |
| 14 | + | |
| 15 | +/// Version control for many agents landing changes at once. | |
| 16 | +#[derive(Debug, Parser)] | |
| 17 | +#[command(name = "braid", version, about, long_about = None)] | |
| 18 | +struct Cli { | |
| 19 | + /// Print machine-readable JSON instead of text. | |
| 20 | + #[arg(long, global = true)] | |
| 21 | + json: bool, | |
| 22 | + | |
| 23 | + #[command(subcommand)] | |
| 24 | + command: Command, | |
| 25 | +} | |
| 26 | + | |
| 27 | +#[derive(Debug, Subcommand)] | |
| 28 | +enum Command { | |
| 29 | + /// Print the braid blob id of each file ("-" reads standard input). | |
| 30 | + HashObject { | |
| 31 | + /// Files to hash. | |
| 32 | + #[arg(required = true)] | |
| 33 | + paths: Vec<PathBuf>, | |
| 34 | + }, | |
| 35 | +} | |
| 36 | + | |
| 37 | +fn main() -> ExitCode { | |
| 38 | + let cli = Cli::parse(); | |
| 39 | + match run(cli) { | |
| 40 | + Ok(()) => ExitCode::SUCCESS, | |
| 41 | + Err(err) => { | |
| 42 | + eprintln!("braid: error: {err:#}"); | |
| 43 | + ExitCode::FAILURE | |
| 44 | + } | |
| 45 | + } | |
| 46 | +} | |
| 47 | + | |
| 48 | +fn run(cli: Cli) -> Result<()> { | |
| 49 | + match cli.command { | |
| 50 | + Command::HashObject { paths } => hash_object(&paths, cli.json), | |
| 51 | + } | |
| 52 | +} | |
| 53 | + | |
| 54 | +struct Hashed<'a> { | |
| 55 | + path: &'a Path, | |
| 56 | + id: ObjectId, | |
| 57 | + size: u64, | |
| 58 | +} | |
| 59 | + | |
| 60 | +fn hash_object(paths: &[PathBuf], json: bool) -> Result<()> { | |
| 61 | + let mut hashed = Vec::with_capacity(paths.len()); | |
| 62 | + for path in paths { | |
| 63 | + let (id, size) = if path.as_os_str() == "-" { | |
| 64 | + hash_blob(io::stdin().lock()).context("cannot read standard input")? | |
| 65 | + } else { | |
| 66 | + let file = | |
| 67 | + File::open(path).with_context(|| format!("cannot open {}", path.display()))?; | |
| 68 | + hash_blob(file).with_context(|| format!("cannot read {}", path.display()))? | |
| 69 | + }; | |
| 70 | + hashed.push(Hashed { path, id, size }); | |
| 71 | + } | |
| 72 | + | |
| 73 | + let mut out = io::stdout().lock(); | |
| 74 | + if json { | |
| 75 | + let items: Vec<serde_json::Value> = hashed | |
| 76 | + .iter() | |
| 77 | + .map(|h| { | |
| 78 | + serde_json::json!({ | |
| 79 | + "path": h.path.to_string_lossy(), | |
| 80 | + "kind": Kind::Blob.name(), | |
| 81 | + "id": h.id.to_hex(), | |
| 82 | + "size": h.size, | |
| 83 | + }) | |
| 84 | + }) | |
| 85 | + .collect(); | |
| 86 | + serde_json::to_writer(&mut out, &items)?; | |
| 87 | + writeln!(out)?; | |
| 88 | + } else { | |
| 89 | + for h in &hashed { | |
| 90 | + writeln!(out, "{} {}", h.id, h.path.display())?; | |
| 91 | + } | |
| 92 | + } | |
| 93 | + Ok(()) | |
| 94 | +} | |
| 95 | + | |
| 96 | +/// Hashes a stream as a blob without holding it in memory. | |
| 97 | +fn hash_blob(mut reader: impl Read) -> io::Result<(ObjectId, u64)> { | |
| 98 | + let mut hasher = IdHasher::new(Kind::Blob); | |
| 99 | + let mut buf = vec![0u8; 256 * 1024]; | |
| 100 | + let mut size = 0u64; | |
| 101 | + loop { | |
| 102 | + let n = match reader.read(&mut buf) { | |
| 103 | + Ok(0) => break, | |
| 104 | + Ok(n) => n, | |
| 105 | + Err(err) if err.kind() == io::ErrorKind::Interrupted => continue, | |
| 106 | + Err(err) => return Err(err), | |
| 107 | + }; | |
| 108 | + hasher.update(&buf[..n]); | |
| 109 | + size += n as u64; | |
| 110 | + } | |
| 111 | + Ok((hasher.finalize(), size)) | |
| 112 | +} |
added crates/cli/tests/cli.rs +86 −0
| @@ -0,0 +1,86 @@ | ||
| 1 | +// SPDX-License-Identifier: Apache-2.0 | |
| 2 | +// Copyright (c) 2026 UtopiaIA | |
| 3 | + | |
| 4 | +//! End-to-end tests of the `braid` binary. | |
| 5 | + | |
| 6 | +use std::io::Write; | |
| 7 | +use std::process::{Command, Stdio}; | |
| 8 | + | |
| 9 | +use braid_format::{Kind, ObjectId}; | |
| 10 | + | |
| 11 | +fn braid() -> Command { | |
| 12 | + Command::new(env!("CARGO_BIN_EXE_braid")) | |
| 13 | +} | |
| 14 | + | |
| 15 | +#[test] | |
| 16 | +fn version_prints_name_and_version() { | |
| 17 | + let out = braid().arg("--version").output().unwrap(); | |
| 18 | + assert!(out.status.success()); | |
| 19 | + let text = String::from_utf8(out.stdout).unwrap(); | |
| 20 | + assert_eq!(text.trim(), format!("braid {}", env!("CARGO_PKG_VERSION"))); | |
| 21 | +} | |
| 22 | + | |
| 23 | +#[test] | |
| 24 | +fn hash_object_matches_the_library() { | |
| 25 | + let dir = tempfile::tempdir().unwrap(); | |
| 26 | + let path = dir.path().join("hello.txt"); | |
| 27 | + std::fs::write(&path, b"hello\n").unwrap(); | |
| 28 | + | |
| 29 | + let out = braid().arg("hash-object").arg(&path).output().unwrap(); | |
| 30 | + assert!(out.status.success()); | |
| 31 | + let text = String::from_utf8(out.stdout).unwrap(); | |
| 32 | + let expected = ObjectId::hash(Kind::Blob, b"hello\n"); | |
| 33 | + assert_eq!(text, format!("{expected} {}\n", path.display())); | |
| 34 | +} | |
| 35 | + | |
| 36 | +#[test] | |
| 37 | +fn hash_object_json() { | |
| 38 | + let dir = tempfile::tempdir().unwrap(); | |
| 39 | + let path = dir.path().join("big.bin"); | |
| 40 | + let payload: Vec<u8> = (0..1_000_000u32).map(|i| (i % 253) as u8).collect(); | |
| 41 | + std::fs::write(&path, &payload).unwrap(); | |
| 42 | + | |
| 43 | + let out = braid() | |
| 44 | + .args(["hash-object", "--json"]) | |
| 45 | + .arg(&path) | |
| 46 | + .output() | |
| 47 | + .unwrap(); | |
| 48 | + assert!(out.status.success()); | |
| 49 | + let value: serde_json::Value = serde_json::from_slice(&out.stdout).unwrap(); | |
| 50 | + let item = &value[0]; | |
| 51 | + assert_eq!(item["kind"], "blob"); | |
| 52 | + assert_eq!(item["size"], payload.len() as u64); | |
| 53 | + assert_eq!( | |
| 54 | + item["id"], | |
| 55 | + ObjectId::hash(Kind::Blob, &payload).to_hex().as_str() | |
| 56 | + ); | |
| 57 | +} | |
| 58 | + | |
| 59 | +#[test] | |
| 60 | +fn hash_object_reads_standard_input() { | |
| 61 | + let mut child = braid() | |
| 62 | + .args(["hash-object", "-"]) | |
| 63 | + .stdin(Stdio::piped()) | |
| 64 | + .stdout(Stdio::piped()) | |
| 65 | + .spawn() | |
| 66 | + .unwrap(); | |
| 67 | + child.stdin.take().unwrap().write_all(b"hello\n").unwrap(); | |
| 68 | + let out = child.wait_with_output().unwrap(); | |
| 69 | + assert!(out.status.success()); | |
| 70 | + let text = String::from_utf8(out.stdout).unwrap(); | |
| 71 | + let expected = ObjectId::hash(Kind::Blob, b"hello\n"); | |
| 72 | + assert_eq!(text, format!("{expected} -\n")); | |
| 73 | +} | |
| 74 | + | |
| 75 | +#[test] | |
| 76 | +fn missing_file_is_an_error() { | |
| 77 | + let dir = tempfile::tempdir().unwrap(); | |
| 78 | + let out = braid() | |
| 79 | + .arg("hash-object") | |
| 80 | + .arg(dir.path().join("does-not-exist")) | |
| 81 | + .output() | |
| 82 | + .unwrap(); | |
| 83 | + assert!(!out.status.success()); | |
| 84 | + let err = String::from_utf8(out.stderr).unwrap(); | |
| 85 | + assert!(err.starts_with("braid: error: cannot open"), "{err}"); | |
| 86 | +} |
added crates/format/Cargo.toml +19 −0
| @@ -0,0 +1,19 @@ | ||
| 1 | +[package] | |
| 2 | +name = "elffuss-braid-format" | |
| 3 | +description = "Object model and canonical on-disk format of elffuss-braid. No I/O." | |
| 4 | +version.workspace = true | |
| 5 | +edition.workspace = true | |
| 6 | +rust-version.workspace = true | |
| 7 | +license.workspace = true | |
| 8 | +repository.workspace = true | |
| 9 | +homepage.workspace = true | |
| 10 | +publish.workspace = true | |
| 11 | + | |
| 12 | +[lib] | |
| 13 | +name = "braid_format" | |
| 14 | + | |
| 15 | +[dependencies] | |
| 16 | +blake3.workspace = true | |
| 17 | + | |
| 18 | +[lints] | |
| 19 | +workspace = true |
added crates/format/src/id.rs +351 −0
| @@ -0,0 +1,351 @@ | ||
| 1 | +// SPDX-License-Identifier: Apache-2.0 | |
| 2 | +// Copyright (c) 2026 UtopiaIA | |
| 3 | + | |
| 4 | +//! Object ids: BLAKE3 in key-derivation mode, with one context string per kind. | |
| 5 | +//! | |
| 6 | +//! Hashing under a per-kind context gives a blob and a tree with the same bytes | |
| 7 | +//! different ids, without a type prefix inside the payload, so a payload can be | |
| 8 | +//! hashed while it streams in. A blob id is always the hash of the blob's full | |
| 9 | +//! content, however the store happens to keep it (whole, delta, or chunked). | |
| 10 | + | |
| 11 | +use core::fmt; | |
| 12 | +use core::str::FromStr; | |
| 13 | + | |
| 14 | +/// What an object is. The numeric code is part of the on-disk format. | |
| 15 | +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | |
| 16 | +#[repr(u8)] | |
| 17 | +pub enum Kind { | |
| 18 | + /// File contents. | |
| 19 | + Blob = 1, | |
| 20 | + /// A directory listing: a flat directory, or one node of a large one. | |
| 21 | + Tree = 2, | |
| 22 | + /// One change to the repository: parents, root tree and per-file changes. | |
| 23 | + Changeset = 3, | |
| 24 | + /// The list of chunks a large blob is stored as. | |
| 25 | + ChunkList = 4, | |
| 26 | + /// A value computed from other objects, such as an index or a mapping. | |
| 27 | + Derived = 5, | |
| 28 | +} | |
| 29 | + | |
| 30 | +impl Kind { | |
| 31 | + /// Every kind, in code order. | |
| 32 | + pub const ALL: [Kind; 5] = [ | |
| 33 | + Kind::Blob, | |
| 34 | + Kind::Tree, | |
| 35 | + Kind::Changeset, | |
| 36 | + Kind::ChunkList, | |
| 37 | + Kind::Derived, | |
| 38 | + ]; | |
| 39 | + | |
| 40 | + /// The BLAKE3 key-derivation context for this kind. Changing one of these | |
| 41 | + /// strings changes every id of that kind, so they are frozen with format v1. | |
| 42 | + pub const fn context(self) -> &'static str { | |
| 43 | + match self { | |
| 44 | + Kind::Blob => "elffuss-braid 2026 blob v1", | |
| 45 | + Kind::Tree => "elffuss-braid 2026 tree v1", | |
| 46 | + Kind::Changeset => "elffuss-braid 2026 changeset v1", | |
| 47 | + Kind::ChunkList => "elffuss-braid 2026 chunklist v1", | |
| 48 | + Kind::Derived => "elffuss-braid 2026 derived v1", | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + /// The one-byte code stored in object records. | |
| 53 | + pub const fn code(self) -> u8 { | |
| 54 | + self as u8 | |
| 55 | + } | |
| 56 | + | |
| 57 | + /// The kind with this record code, if there is one. | |
| 58 | + pub const fn from_code(code: u8) -> Option<Kind> { | |
| 59 | + match code { | |
| 60 | + 1 => Some(Kind::Blob), | |
| 61 | + 2 => Some(Kind::Tree), | |
| 62 | + 3 => Some(Kind::Changeset), | |
| 63 | + 4 => Some(Kind::ChunkList), | |
| 64 | + 5 => Some(Kind::Derived), | |
| 65 | + _ => None, | |
| 66 | + } | |
| 67 | + } | |
| 68 | + | |
| 69 | + /// The lowercase name used on the command line and in JSON output. | |
| 70 | + pub const fn name(self) -> &'static str { | |
| 71 | + match self { | |
| 72 | + Kind::Blob => "blob", | |
| 73 | + Kind::Tree => "tree", | |
| 74 | + Kind::Changeset => "changeset", | |
| 75 | + Kind::ChunkList => "chunklist", | |
| 76 | + Kind::Derived => "derived", | |
| 77 | + } | |
| 78 | + } | |
| 79 | +} | |
| 80 | + | |
| 81 | +impl fmt::Display for Kind { | |
| 82 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 83 | + f.write_str(self.name()) | |
| 84 | + } | |
| 85 | +} | |
| 86 | + | |
| 87 | +/// A 32-byte object id. Its text form is 64 lowercase hex digits. | |
| 88 | +#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | |
| 89 | +pub struct ObjectId([u8; 32]); | |
| 90 | + | |
| 91 | +impl ObjectId { | |
| 92 | + /// Length of an id in bytes. | |
| 93 | + pub const LEN: usize = 32; | |
| 94 | + | |
| 95 | + /// Number of hex digits in the short form shown to people. | |
| 96 | + pub const SHORT_HEX: usize = 12; | |
| 97 | + | |
| 98 | + /// Wraps raw id bytes. | |
| 99 | + pub const fn from_bytes(bytes: [u8; 32]) -> Self { | |
| 100 | + Self(bytes) | |
| 101 | + } | |
| 102 | + | |
| 103 | + /// The raw id bytes. | |
| 104 | + pub const fn as_bytes(&self) -> &[u8; 32] { | |
| 105 | + &self.0 | |
| 106 | + } | |
| 107 | + | |
| 108 | + /// Hashes a complete payload as an object of `kind`. | |
| 109 | + pub fn hash(kind: Kind, payload: &[u8]) -> Self { | |
| 110 | + Self(blake3::derive_key(kind.context(), payload)) | |
| 111 | + } | |
| 112 | + | |
| 113 | + /// The full text form: 64 lowercase hex digits. | |
| 114 | + pub fn to_hex(&self) -> String { | |
| 115 | + self.to_string() | |
| 116 | + } | |
| 117 | + | |
| 118 | + /// The first [`Self::SHORT_HEX`] hex digits. | |
| 119 | + pub fn short(&self) -> String { | |
| 120 | + let mut text = self.to_hex(); | |
| 121 | + text.truncate(Self::SHORT_HEX); | |
| 122 | + text | |
| 123 | + } | |
| 124 | +} | |
| 125 | + | |
| 126 | +const HEX_DIGITS: &[u8; 16] = b"0123456789abcdef"; | |
| 127 | + | |
| 128 | +impl fmt::Display for ObjectId { | |
| 129 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 130 | + let mut text = [0u8; 64]; | |
| 131 | + for (i, byte) in self.0.iter().enumerate() { | |
| 132 | + text[2 * i] = HEX_DIGITS[usize::from(byte >> 4)]; | |
| 133 | + text[2 * i + 1] = HEX_DIGITS[usize::from(byte & 0x0f)]; | |
| 134 | + } | |
| 135 | + // Every byte written above is an ASCII hex digit. | |
| 136 | + f.write_str(core::str::from_utf8(&text).map_err(|_| fmt::Error)?) | |
| 137 | + } | |
| 138 | +} | |
| 139 | + | |
| 140 | +impl fmt::Debug for ObjectId { | |
| 141 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 142 | + write!(f, "ObjectId({self})") | |
| 143 | + } | |
| 144 | +} | |
| 145 | + | |
| 146 | +/// Why a string is not an object id. | |
| 147 | +#[derive(Clone, Debug, PartialEq, Eq)] | |
| 148 | +pub enum ParseIdError { | |
| 149 | + /// The text is not 64 characters long. | |
| 150 | + Length(usize), | |
| 151 | + /// The character at this byte position is not a lowercase hex digit. | |
| 152 | + Digit(usize), | |
| 153 | +} | |
| 154 | + | |
| 155 | +impl fmt::Display for ParseIdError { | |
| 156 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 157 | + match self { | |
| 158 | + ParseIdError::Length(len) => { | |
| 159 | + write!( | |
| 160 | + f, | |
| 161 | + "an object id has 64 hex digits, this has {len} characters" | |
| 162 | + ) | |
| 163 | + } | |
| 164 | + ParseIdError::Digit(pos) => { | |
| 165 | + write!(f, "character {pos} is not a lowercase hex digit") | |
| 166 | + } | |
| 167 | + } | |
| 168 | + } | |
| 169 | +} | |
| 170 | + | |
| 171 | +impl std::error::Error for ParseIdError {} | |
| 172 | + | |
| 173 | +fn hex_value(digit: u8) -> Option<u8> { | |
| 174 | + match digit { | |
| 175 | + b'0'..=b'9' => Some(digit - b'0'), | |
| 176 | + b'a'..=b'f' => Some(digit - b'a' + 10), | |
| 177 | + _ => None, | |
| 178 | + } | |
| 179 | +} | |
| 180 | + | |
| 181 | +impl FromStr for ObjectId { | |
| 182 | + type Err = ParseIdError; | |
| 183 | + | |
| 184 | + /// Parses the full 64-digit form. Only lowercase is accepted, so two equal | |
| 185 | + /// ids always have equal text. | |
| 186 | + fn from_str(text: &str) -> Result<Self, Self::Err> { | |
| 187 | + let digits = text.as_bytes(); | |
| 188 | + if digits.len() != 64 { | |
| 189 | + return Err(ParseIdError::Length(digits.len())); | |
| 190 | + } | |
| 191 | + let mut bytes = [0u8; 32]; | |
| 192 | + for (i, pair) in digits.chunks_exact(2).enumerate() { | |
| 193 | + let high = hex_value(pair[0]).ok_or(ParseIdError::Digit(2 * i))?; | |
| 194 | + let low = hex_value(pair[1]).ok_or(ParseIdError::Digit(2 * i + 1))?; | |
| 195 | + bytes[i] = (high << 4) | low; | |
| 196 | + } | |
| 197 | + Ok(Self(bytes)) | |
| 198 | + } | |
| 199 | +} | |
| 200 | + | |
| 201 | +/// Incremental hashing, for payloads that arrive in pieces. | |
| 202 | +#[derive(Clone)] | |
| 203 | +pub struct IdHasher { | |
| 204 | + inner: blake3::Hasher, | |
| 205 | +} | |
| 206 | + | |
| 207 | +impl IdHasher { | |
| 208 | + /// Starts hashing an object of `kind`. | |
| 209 | + pub fn new(kind: Kind) -> Self { | |
| 210 | + Self { | |
| 211 | + inner: blake3::Hasher::new_derive_key(kind.context()), | |
| 212 | + } | |
| 213 | + } | |
| 214 | + | |
| 215 | + /// Feeds the next piece of the payload. | |
| 216 | + pub fn update(&mut self, bytes: &[u8]) -> &mut Self { | |
| 217 | + self.inner.update(bytes); | |
| 218 | + self | |
| 219 | + } | |
| 220 | + | |
| 221 | + /// The id of everything fed so far. The hasher can keep going afterwards. | |
| 222 | + pub fn finalize(&self) -> ObjectId { | |
| 223 | + ObjectId(*self.inner.finalize().as_bytes()) | |
| 224 | + } | |
| 225 | +} | |
| 226 | + | |
| 227 | +impl fmt::Debug for IdHasher { | |
| 228 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 229 | + f.debug_struct("IdHasher").finish_non_exhaustive() | |
| 230 | + } | |
| 231 | +} | |
| 232 | + | |
| 233 | +#[cfg(test)] | |
| 234 | +mod tests { | |
| 235 | + use super::*; | |
| 236 | + | |
| 237 | + /// Golden vectors. Each one can be checked independently with the `b3sum` | |
| 238 | + /// tool: `printf 'hello\n' | b3sum --derive-key "elffuss-braid 2026 blob v1"`. | |
| 239 | + const GOLDEN: &[(Kind, &[u8], &str)] = &[ | |
| 240 | + ( | |
| 241 | + Kind::Blob, | |
| 242 | + b"", | |
| 243 | + "ff9c212a7ef64fa38f0c411b3a68d523a20fd197ee3ba03fa4a44b7c5e99c958", | |
| 244 | + ), | |
| 245 | + ( | |
| 246 | + Kind::Blob, | |
| 247 | + b"hello\n", | |
| 248 | + "6acd5cdf880a325d2df716699943aae586ad77d54fb2ed0c5a3f53c76fa56f89", | |
| 249 | + ), | |
| 250 | + ( | |
| 251 | + Kind::Tree, | |
| 252 | + b"", | |
| 253 | + "46f1ab000b3145d2e28ff69f7570eb88065d76ef86905bb268699adb9c860c08", | |
| 254 | + ), | |
| 255 | + ( | |
| 256 | + Kind::Changeset, | |
| 257 | + b"", | |
| 258 | + "1be995db81f244ac5ea57f1ba45d9f9da94ad4edd6dbfa0979c16101a34d04ef", | |
| 259 | + ), | |
| 260 | + ( | |
| 261 | + Kind::ChunkList, | |
| 262 | + b"", | |
| 263 | + "f14231be43c0cc73e7c4850ec9d980e6952b56c57f7125d0c39d16874be2ab04", | |
| 264 | + ), | |
| 265 | + ( | |
| 266 | + Kind::Derived, | |
| 267 | + b"", | |
| 268 | + "6f101e23c531e6e3959878774beefb475944b2f0200e52eafb37fd80f97df172", | |
| 269 | + ), | |
| 270 | + ]; | |
| 271 | + | |
| 272 | + #[test] | |
| 273 | + fn golden_vectors() { | |
| 274 | + for (kind, payload, expected) in GOLDEN { | |
| 275 | + assert_eq!( | |
| 276 | + ObjectId::hash(*kind, payload).to_hex(), | |
| 277 | + *expected, | |
| 278 | + "{kind} {payload:?}" | |
| 279 | + ); | |
| 280 | + } | |
| 281 | + } | |
| 282 | + | |
| 283 | + #[test] | |
| 284 | + fn kinds_never_share_an_id() { | |
| 285 | + for payload in [&b""[..], b"hello\n", &[0u8; 1000]] { | |
| 286 | + let mut ids: Vec<ObjectId> = Kind::ALL | |
| 287 | + .iter() | |
| 288 | + .map(|kind| ObjectId::hash(*kind, payload)) | |
| 289 | + .collect(); | |
| 290 | + ids.sort(); | |
| 291 | + ids.dedup(); | |
| 292 | + assert_eq!(ids.len(), Kind::ALL.len()); | |
| 293 | + } | |
| 294 | + } | |
| 295 | + | |
| 296 | + #[test] | |
| 297 | + fn streaming_matches_one_shot() { | |
| 298 | + // Long enough to cross BLAKE3's 1 KiB chunk and SIMD batch boundaries. | |
| 299 | + let payload: Vec<u8> = (0..300_000u32).map(|i| (i * 31 % 251) as u8).collect(); | |
| 300 | + let whole = ObjectId::hash(Kind::Blob, &payload); | |
| 301 | + for piece in [1, 7, 1024, 4096, 65_537] { | |
| 302 | + let mut hasher = IdHasher::new(Kind::Blob); | |
| 303 | + for part in payload.chunks(piece) { | |
| 304 | + hasher.update(part); | |
| 305 | + } | |
| 306 | + assert_eq!(hasher.finalize(), whole, "pieces of {piece}"); | |
| 307 | + } | |
| 308 | + } | |
| 309 | + | |
| 310 | + #[test] | |
| 311 | + fn text_round_trip() { | |
| 312 | + let id = ObjectId::hash(Kind::Blob, b"round trip"); | |
| 313 | + let text = id.to_hex(); | |
| 314 | + assert_eq!(text.len(), 64); | |
| 315 | + assert_eq!(text.parse::<ObjectId>(), Ok(id)); | |
| 316 | + assert_eq!(id.short(), text[..ObjectId::SHORT_HEX]); | |
| 317 | + assert_eq!(format!("{id:?}"), format!("ObjectId({text})")); | |
| 318 | + } | |
| 319 | + | |
| 320 | + #[test] | |
| 321 | + fn rejects_bad_text() { | |
| 322 | + let good = ObjectId::hash(Kind::Blob, b"x").to_hex(); | |
| 323 | + assert_eq!("".parse::<ObjectId>(), Err(ParseIdError::Length(0))); | |
| 324 | + assert_eq!( | |
| 325 | + good[..63].parse::<ObjectId>(), | |
| 326 | + Err(ParseIdError::Length(63)) | |
| 327 | + ); | |
| 328 | + let mut upper = good.clone().into_bytes(); | |
| 329 | + upper[0] = b'A'; | |
| 330 | + assert_eq!( | |
| 331 | + String::from_utf8(upper).unwrap().parse::<ObjectId>(), | |
| 332 | + Err(ParseIdError::Digit(0)) | |
| 333 | + ); | |
| 334 | + let mut bad = good.clone().into_bytes(); | |
| 335 | + bad[10] = b'g'; | |
| 336 | + assert_eq!( | |
| 337 | + String::from_utf8(bad).unwrap().parse::<ObjectId>(), | |
| 338 | + Err(ParseIdError::Digit(10)) | |
| 339 | + ); | |
| 340 | + } | |
| 341 | + | |
| 342 | + #[test] | |
| 343 | + fn kind_codes_round_trip() { | |
| 344 | + for kind in Kind::ALL { | |
| 345 | + assert_eq!(Kind::from_code(kind.code()), Some(kind)); | |
| 346 | + } | |
| 347 | + for code in [0u8, 6, 7, 127, 255] { | |
| 348 | + assert_eq!(Kind::from_code(code), None); | |
| 349 | + } | |
| 350 | + } | |
| 351 | +} |
added crates/format/src/lib.rs +15 −0
| @@ -0,0 +1,15 @@ | ||
| 1 | +// SPDX-License-Identifier: Apache-2.0 | |
| 2 | +// Copyright (c) 2026 UtopiaIA | |
| 3 | + | |
| 4 | +//! The object model and canonical on-disk format of elffuss-braid. | |
| 5 | +//! | |
| 6 | +//! This crate does no I/O and must keep compiling for `wasm32-unknown-unknown`. | |
| 7 | +//! Everything that gets hashed is encoded by hand: those bytes are the format, | |
| 8 | +//! so they are specified in `docs/spec/format-v1.md` and pinned by golden | |
| 9 | +//! vectors in the tests. | |
| 10 | + | |
| 11 | +#![forbid(unsafe_code)] | |
| 12 | + | |
| 13 | +pub mod id; | |
| 14 | + | |
| 15 | +pub use id::{IdHasher, Kind, ObjectId, ParseIdError}; |
added deny.toml +42 −0
| @@ -0,0 +1,42 @@ | ||
| 1 | +# cargo-deny configuration: which licences, sources and crates braid accepts. | |
| 2 | + | |
| 3 | +[graph] | |
| 4 | +all-features = true | |
| 5 | + | |
| 6 | +[advisories] | |
| 7 | +yanked = "deny" | |
| 8 | + | |
| 9 | +[licenses] | |
| 10 | +# Everything here is compatible with Apache-2.0. GPL, LGPL and AGPL are not | |
| 11 | +# listed, so they fail the check. | |
| 12 | +allow = [ | |
| 13 | + "Apache-2.0", | |
| 14 | + "Apache-2.0 WITH LLVM-exception", | |
| 15 | + "MIT", | |
| 16 | + "BSD-2-Clause", | |
| 17 | + "BSD-3-Clause", | |
| 18 | + "ISC", | |
| 19 | + "Zlib", | |
| 20 | + "CC0-1.0", | |
| 21 | + "Unicode-3.0", | |
| 22 | + "BSL-1.0", | |
| 23 | + "Unlicense", | |
| 24 | +] | |
| 25 | +confidence-threshold = 0.9 | |
| 26 | +unused-allowed-license = "allow" | |
| 27 | + | |
| 28 | +[bans] | |
| 29 | +multiple-versions = "warn" | |
| 30 | +wildcards = "deny" | |
| 31 | +allow-wildcard-paths = true | |
| 32 | +deny = [ | |
| 33 | + # libgit2 is GPLv2 with a linking exception and C; braid uses gitoxide. | |
| 34 | + { crate = "git2", reason = "braid uses gitoxide for git interop" }, | |
| 35 | + { crate = "libgit2-sys", reason = "braid uses gitoxide for git interop" }, | |
| 36 | + { crate = "openssl-sys", reason = "use rustls" }, | |
| 37 | +] | |
| 38 | + | |
| 39 | +[sources] | |
| 40 | +unknown-registry = "deny" | |
| 41 | +unknown-git = "deny" | |
| 42 | +allow-registry = ["https://github.com/rust-lang/crates.io-index"] |
added docs/assets/braid.svg +35 −0
| @@ -0,0 +1,35 @@ | ||
| 1 | +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 96" width="320" height="96" role="img" aria-label="Three strands braided together"> | |
| 2 | +<title>elffuss-braid</title> | |
| 3 | +<defs> | |
| 4 | +<mask id="cut0" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"> | |
| 5 | +<rect x="0" y="0" width="320" height="96" fill="#fff"/> | |
| 6 | +<path d="M38.67,21.01 L39.17,21.04 L39.67,21.11 L40.17,21.21 L40.67,21.34 L41.17,21.50 L41.67,21.70 L42.17,21.92 L42.67,22.17 L43.17,22.46 L43.67,22.77 L44.17,23.11 L44.67,23.49 L45.17,23.89 L45.67,24.32 L46.17,24.77 L46.67,25.26 L47.17,25.77 L47.67,26.30 L48.17,26.86 L48.67,27.45 L49.17,28.06 L49.67,28.69 L50.17,29.35 L50.67,30.03 L51.17,30.72 L51.67,31.44 L52.17,32.18 L52.67,32.94 L53.17,33.71 L53.67,34.50 L54.17,35.31 L54.67,36.13 L55.17,36.96 L55.67,37.81 L56.17,38.67 L56.67,39.54 L57.17,40.42 L57.67,41.31 L58.17,42.21 L58.67,43.11 L59.17,44.02 L59.67,44.93 L60.17,45.85 L60.67,46.77 L61.17,47.69 L61.67,48.61 L62.17,49.54 L62.67,50.46 L63.17,51.37 L63.67,52.28 L64.17,53.19 L64.67,54.09 L65.17,54.99 L65.67,55.87 L66.17,56.75 L66.67,57.62 L67.17,58.47 L67.67,59.32 L68.17,60.15 L68.67,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 7 | +<path d="M84.67,74.99 L85.17,74.96 L85.67,74.89 L86.17,74.79 L86.67,74.66 L87.17,74.50 L87.67,74.30 L88.17,74.08 L88.67,73.83 L89.17,73.54 L89.67,73.23 L90.17,72.89 L90.67,72.51 L91.17,72.11 L91.67,71.68 L92.17,71.23 L92.67,70.74 L93.17,70.23 L93.67,69.70 L94.17,69.14 L94.67,68.55 L95.17,67.94 L95.67,67.31 L96.17,66.65 L96.67,65.97 L97.17,65.28 L97.67,64.56 L98.17,63.82 L98.67,63.06 L99.17,62.29 L99.67,61.50 L100.17,60.69 L100.67,59.87 L101.17,59.04 L101.67,58.19 L102.17,57.33 L102.67,56.46 L103.17,55.58 L103.67,54.69 L104.17,53.79 L104.67,52.89 L105.17,51.98 L105.67,51.07 L106.17,50.15 L106.67,49.23 L107.17,48.31 L107.67,47.39 L108.17,46.46 L108.67,45.54 L109.17,44.63 L109.67,43.72 L110.17,42.81 L110.67,41.91 L111.17,41.01 L111.67,40.13 L112.17,39.25 L112.67,38.38 L113.17,37.53 L113.67,36.68 L114.17,35.85 L114.67,35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 8 | +<path d="M130.67,21.01 L131.17,21.04 L131.67,21.11 L132.17,21.21 L132.67,21.34 L133.17,21.50 L133.67,21.70 L134.17,21.92 L134.67,22.17 L135.17,22.46 L135.67,22.77 L136.17,23.11 L136.67,23.49 L137.17,23.89 L137.67,24.32 L138.17,24.77 L138.67,25.26 L139.17,25.77 L139.67,26.30 L140.17,26.86 L140.67,27.45 L141.17,28.06 L141.67,28.69 L142.17,29.35 L142.67,30.03 L143.17,30.72 L143.67,31.44 L144.17,32.18 L144.67,32.94 L145.17,33.71 L145.67,34.50 L146.17,35.31 L146.67,36.13 L147.17,36.96 L147.67,37.81 L148.17,38.67 L148.67,39.54 L149.17,40.42 L149.67,41.31 L150.17,42.21 L150.67,43.11 L151.17,44.02 L151.67,44.93 L152.17,45.85 L152.67,46.77 L153.17,47.69 L153.67,48.61 L154.17,49.54 L154.67,50.46 L155.17,51.37 L155.67,52.28 L156.17,53.19 L156.67,54.09 L157.17,54.99 L157.67,55.87 L158.17,56.75 L158.67,57.62 L159.17,58.47 L159.67,59.32 L160.17,60.15 L160.67,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 9 | +<path d="M176.67,74.99 L177.17,74.96 L177.67,74.89 L178.17,74.79 L178.67,74.66 L179.17,74.50 L179.67,74.30 L180.17,74.08 L180.67,73.83 L181.17,73.54 L181.67,73.23 L182.17,72.89 L182.67,72.51 L183.17,72.11 L183.67,71.68 L184.17,71.23 L184.67,70.74 L185.17,70.23 L185.67,69.70 L186.17,69.14 L186.67,68.55 L187.17,67.94 L187.67,67.31 L188.17,66.65 L188.67,65.97 L189.17,65.28 L189.67,64.56 L190.17,63.82 L190.67,63.06 L191.17,62.29 L191.67,61.50 L192.17,60.69 L192.67,59.87 L193.17,59.04 L193.67,58.19 L194.17,57.33 L194.67,56.46 L195.17,55.58 L195.67,54.69 L196.17,53.79 L196.67,52.89 L197.17,51.98 L197.67,51.07 L198.17,50.15 L198.67,49.23 L199.17,48.31 L199.67,47.39 L200.17,46.46 L200.67,45.54 L201.17,44.63 L201.67,43.72 L202.17,42.81 L202.67,41.91 L203.17,41.01 L203.67,40.13 L204.17,39.25 L204.67,38.38 L205.17,37.53 L205.67,36.68 L206.17,35.85 L206.67,35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 10 | +<path d="M222.67,21.01 L223.17,21.04 L223.67,21.11 L224.17,21.21 L224.67,21.34 L225.17,21.50 L225.67,21.70 L226.17,21.92 L226.67,22.17 L227.17,22.46 L227.67,22.77 L228.17,23.11 L228.67,23.49 L229.17,23.89 L229.67,24.32 L230.17,24.77 L230.67,25.26 L231.17,25.77 L231.67,26.30 L232.17,26.86 L232.67,27.45 L233.17,28.06 L233.67,28.69 L234.17,29.35 L234.67,30.03 L235.17,30.72 L235.67,31.44 L236.17,32.18 L236.67,32.94 L237.17,33.71 L237.67,34.50 L238.17,35.31 L238.67,36.13 L239.17,36.96 L239.67,37.81 L240.17,38.67 L240.67,39.54 L241.17,40.42 L241.67,41.31 L242.17,42.21 L242.67,43.11 L243.17,44.02 L243.67,44.93 L244.17,45.85 L244.67,46.77 L245.17,47.69 L245.67,48.61 L246.17,49.54 L246.67,50.46 L247.17,51.37 L247.67,52.28 L248.17,53.19 L248.67,54.09 L249.17,54.99 L249.67,55.87 L250.17,56.75 L250.67,57.62 L251.17,58.47 L251.67,59.32 L252.17,60.15 L252.67,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 11 | +<path d="M268.67,74.99 L269.17,74.96 L269.67,74.89 L270.17,74.79 L270.67,74.66 L271.17,74.50 L271.67,74.30 L272.17,74.08 L272.67,73.83 L273.17,73.54 L273.67,73.23 L274.17,72.89 L274.67,72.51 L275.17,72.11 L275.67,71.68 L276.17,71.23 L276.67,70.74 L277.17,70.23 L277.67,69.70 L278.17,69.14 L278.67,68.55 L279.17,67.94 L279.67,67.31 L280.17,66.65 L280.67,65.97 L281.17,65.28 L281.67,64.56 L282.17,63.82 L282.67,63.06 L283.17,62.29 L283.67,61.50 L284.17,60.69 L284.67,59.87 L285.17,59.04 L285.67,58.19 L286.17,57.33 L286.67,56.46 L287.17,55.58 L287.67,54.69 L288.17,53.79 L288.67,52.89 L289.17,51.98 L289.67,51.07 L290.17,50.15 L290.67,49.23 L291.17,48.31 L291.67,47.39 L292.17,46.46 L292.67,45.54 L293.17,44.63 L293.67,43.72 L294.17,42.81 L294.67,41.91 L295.17,41.01 L295.67,40.13 L296.17,39.25 L296.67,38.38 L297.17,37.53 L297.67,36.68 L298.00,36.13" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 12 | +</mask> | |
| 13 | +<mask id="cut1" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"> | |
| 14 | +<rect x="0" y="0" width="320" height="96" fill="#fff"/> | |
| 15 | +<path d="M22.00,32.94 L22.50,33.71 L23.00,34.50 L23.50,35.31 L24.00,36.13 L24.50,36.96 L25.00,37.81 L25.50,38.67 L26.00,39.54 L26.50,40.42 L27.00,41.31 L27.50,42.21 L28.00,43.11 L28.50,44.02 L29.00,44.93 L29.50,45.85 L30.00,46.77 L30.50,47.69 L31.00,48.61 L31.50,49.54 L32.00,50.46 L32.50,51.37 L33.00,52.28 L33.50,53.19 L34.00,54.09 L34.50,54.99 L35.00,55.87 L35.50,56.75 L36.00,57.62 L36.50,58.47 L37.00,59.32 L37.50,60.15 L38.00,60.96 L38.00,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 16 | +<path d="M54.00,74.99 L54.50,74.96 L55.00,74.89 L55.50,74.79 L56.00,74.66 L56.50,74.50 L57.00,74.30 L57.50,74.08 L58.00,73.83 L58.50,73.54 L59.00,73.23 L59.50,72.89 L60.00,72.51 L60.50,72.11 L61.00,71.68 L61.50,71.23 L62.00,70.74 L62.50,70.23 L63.00,69.70 L63.50,69.14 L64.00,68.55 L64.50,67.94 L65.00,67.31 L65.50,66.65 L66.00,65.97 L66.50,65.28 L67.00,64.56 L67.50,63.82 L68.00,63.06 L68.50,62.29 L69.00,61.50 L69.50,60.69 L70.00,59.87 L70.50,59.04 L71.00,58.19 L71.50,57.33 L72.00,56.46 L72.50,55.58 L73.00,54.69 L73.50,53.79 L74.00,52.89 L74.50,51.98 L75.00,51.07 L75.50,50.15 L76.00,49.23 L76.50,48.31 L77.00,47.39 L77.50,46.46 L78.00,45.54 L78.50,44.63 L79.00,43.72 L79.50,42.81 L80.00,41.91 L80.50,41.01 L81.00,40.13 L81.50,39.25 L82.00,38.38 L82.50,37.53 L83.00,36.68 L83.50,35.85 L84.00,35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 17 | +<path d="M100.00,21.01 L100.50,21.04 L101.00,21.11 L101.50,21.21 L102.00,21.34 L102.50,21.50 L103.00,21.70 L103.50,21.92 L104.00,22.17 L104.50,22.46 L105.00,22.77 L105.50,23.11 L106.00,23.49 L106.50,23.89 L107.00,24.32 L107.50,24.77 L108.00,25.26 L108.50,25.77 L109.00,26.30 L109.50,26.86 L110.00,27.45 L110.50,28.06 L111.00,28.69 L111.50,29.35 L112.00,30.03 L112.50,30.72 L113.00,31.44 L113.50,32.18 L114.00,32.94 L114.50,33.71 L115.00,34.50 L115.50,35.31 L116.00,36.13 L116.50,36.96 L117.00,37.81 L117.50,38.67 L118.00,39.54 L118.50,40.42 L119.00,41.31 L119.50,42.21 L120.00,43.11 L120.50,44.02 L121.00,44.93 L121.50,45.85 L122.00,46.77 L122.50,47.69 L123.00,48.61 L123.50,49.54 L124.00,50.46 L124.50,51.37 L125.00,52.28 L125.50,53.19 L126.00,54.09 L126.50,54.99 L127.00,55.87 L127.50,56.75 L128.00,57.62 L128.50,58.47 L129.00,59.32 L129.50,60.15 L130.00,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 18 | +<path d="M146.00,74.99 L146.50,74.96 L147.00,74.89 L147.50,74.79 L148.00,74.66 L148.50,74.50 L149.00,74.30 L149.50,74.08 L150.00,73.83 L150.50,73.54 L151.00,73.23 L151.50,72.89 L152.00,72.51 L152.50,72.11 L153.00,71.68 L153.50,71.23 L154.00,70.74 L154.50,70.23 L155.00,69.70 L155.50,69.14 L156.00,68.55 L156.50,67.94 L157.00,67.31 L157.50,66.65 L158.00,65.97 L158.50,65.28 L159.00,64.56 L159.50,63.82 L160.00,63.06 L160.50,62.29 L161.00,61.50 L161.50,60.69 L162.00,59.87 L162.50,59.04 L163.00,58.19 L163.50,57.33 L164.00,56.46 L164.50,55.58 L165.00,54.69 L165.50,53.79 L166.00,52.89 L166.50,51.98 L167.00,51.07 L167.50,50.15 L168.00,49.23 L168.50,48.31 L169.00,47.39 L169.50,46.46 L170.00,45.54 L170.50,44.63 L171.00,43.72 L171.50,42.81 L172.00,41.91 L172.50,41.01 L173.00,40.13 L173.50,39.25 L174.00,38.38 L174.50,37.53 L175.00,36.68 L175.50,35.85 L176.00,35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 19 | +<path d="M192.00,21.01 L192.50,21.04 L193.00,21.11 L193.50,21.21 L194.00,21.34 L194.50,21.50 L195.00,21.70 L195.50,21.92 L196.00,22.17 L196.50,22.46 L197.00,22.77 L197.50,23.11 L198.00,23.49 L198.50,23.89 L199.00,24.32 L199.50,24.77 L200.00,25.26 L200.50,25.77 L201.00,26.30 L201.50,26.86 L202.00,27.45 L202.50,28.06 L203.00,28.69 L203.50,29.35 L204.00,30.03 L204.50,30.72 L205.00,31.44 L205.50,32.18 L206.00,32.94 L206.50,33.71 L207.00,34.50 L207.50,35.31 L208.00,36.13 L208.50,36.96 L209.00,37.81 L209.50,38.67 L210.00,39.54 L210.50,40.42 L211.00,41.31 L211.50,42.21 L212.00,43.11 L212.50,44.02 L213.00,44.93 L213.50,45.85 L214.00,46.77 L214.50,47.69 L215.00,48.61 L215.50,49.54 L216.00,50.46 L216.50,51.37 L217.00,52.28 L217.50,53.19 L218.00,54.09 L218.50,54.99 L219.00,55.87 L219.50,56.75 L220.00,57.62 L220.50,58.47 L221.00,59.32 L221.50,60.15 L222.00,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 20 | +<path d="M238.00,74.99 L238.50,74.96 L239.00,74.89 L239.50,74.79 L240.00,74.66 L240.50,74.50 L241.00,74.30 L241.50,74.08 L242.00,73.83 L242.50,73.54 L243.00,73.23 L243.50,72.89 L244.00,72.51 L244.50,72.11 L245.00,71.68 L245.50,71.23 L246.00,70.74 L246.50,70.23 L247.00,69.70 L247.50,69.14 L248.00,68.55 L248.50,67.94 L249.00,67.31 L249.50,66.65 L250.00,65.97 L250.50,65.28 L251.00,64.56 L251.50,63.82 L252.00,63.06 L252.50,62.29 L253.00,61.50 L253.50,60.69 L254.00,59.87 L254.50,59.04 L255.00,58.19 L255.50,57.33 L256.00,56.46 L256.50,55.58 L257.00,54.69 L257.50,53.79 L258.00,52.89 L258.50,51.98 L259.00,51.07 L259.50,50.15 L260.00,49.23 L260.50,48.31 L261.00,47.39 L261.50,46.46 L262.00,45.54 L262.50,44.63 L263.00,43.72 L263.50,42.81 L264.00,41.91 L264.50,41.01 L265.00,40.13 L265.50,39.25 L266.00,38.38 L266.50,37.53 L267.00,36.68 L267.50,35.85 L268.00,35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 21 | +</mask> | |
| 22 | +<mask id="cut2" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"> | |
| 23 | +<rect x="0" y="0" width="320" height="96" fill="#fff"/> | |
| 24 | +<path d="M23.33,74.99 L23.83,74.96 L24.33,74.89 L24.83,74.79 L25.33,74.66 L25.83,74.50 L26.33,74.30 L26.83,74.08 L27.33,73.83 L27.83,73.54 L28.33,73.23 L28.83,72.89 L29.33,72.51 L29.83,72.11 L30.33,71.68 L30.83,71.23 L31.33,70.74 L31.83,70.23 L32.33,69.70 L32.83,69.14 L33.33,68.55 L33.83,67.94 L34.33,67.31 L34.83,66.65 L35.33,65.97 L35.83,65.28 L36.33,64.56 L36.83,63.82 L37.33,63.06 L37.83,62.29 L38.33,61.50 L38.83,60.69 L39.33,59.87 L39.83,59.04 L40.33,58.19 L40.83,57.33 L41.33,56.46 L41.83,55.58 L42.33,54.69 L42.83,53.79 L43.33,52.89 L43.83,51.98 L44.33,51.07 L44.83,50.15 L45.33,49.23 L45.83,48.31 L46.33,47.39 L46.83,46.46 L47.33,45.54 L47.83,44.63 L48.33,43.72 L48.83,42.81 L49.33,41.91 L49.83,41.01 L50.33,40.13 L50.83,39.25 L51.33,38.38 L51.83,37.53 L52.33,36.68 L52.83,35.85 L53.33,35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 25 | +<path d="M69.33,21.01 L69.83,21.04 L70.33,21.11 L70.83,21.21 L71.33,21.34 L71.83,21.50 L72.33,21.70 L72.83,21.92 L73.33,22.17 L73.83,22.46 L74.33,22.77 L74.83,23.11 L75.33,23.49 L75.83,23.89 L76.33,24.32 L76.83,24.77 L77.33,25.26 L77.83,25.77 L78.33,26.30 L78.83,26.86 L79.33,27.45 L79.83,28.06 L80.33,28.69 L80.83,29.35 L81.33,30.03 L81.83,30.72 L82.33,31.44 L82.83,32.18 L83.33,32.94 L83.83,33.71 L84.33,34.50 L84.83,35.31 L85.33,36.13 L85.83,36.96 L86.33,37.81 L86.83,38.67 L87.33,39.54 L87.83,40.42 L88.33,41.31 L88.83,42.21 L89.33,43.11 L89.83,44.02 L90.33,44.93 L90.83,45.85 L91.33,46.77 L91.83,47.69 L92.33,48.61 L92.83,49.54 L93.33,50.46 L93.83,51.37 L94.33,52.28 L94.83,53.19 L95.33,54.09 L95.83,54.99 L96.33,55.87 L96.83,56.75 L97.33,57.62 L97.83,58.47 L98.33,59.32 L98.83,60.15 L99.33,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 26 | +<path d="M115.33,74.99 L115.83,74.96 L116.33,74.89 L116.83,74.79 L117.33,74.66 L117.83,74.50 L118.33,74.30 L118.83,74.08 L119.33,73.83 L119.83,73.54 L120.33,73.23 L120.83,72.89 L121.33,72.51 L121.83,72.11 L122.33,71.68 L122.83,71.23 L123.33,70.74 L123.83,70.23 L124.33,69.70 L124.83,69.14 L125.33,68.55 L125.83,67.94 L126.33,67.31 L126.83,66.65 L127.33,65.97 L127.83,65.28 L128.33,64.56 L128.83,63.82 L129.33,63.06 L129.83,62.29 L130.33,61.50 L130.83,60.69 L131.33,59.87 L131.83,59.04 L132.33,58.19 L132.83,57.33 L133.33,56.46 L133.83,55.58 L134.33,54.69 L134.83,53.79 L135.33,52.89 L135.83,51.98 L136.33,51.07 L136.83,50.15 L137.33,49.23 L137.83,48.31 L138.33,47.39 L138.83,46.46 L139.33,45.54 L139.83,44.63 L140.33,43.72 L140.83,42.81 L141.33,41.91 L141.83,41.01 L142.33,40.13 L142.83,39.25 L143.33,38.38 L143.83,37.53 L144.33,36.68 L144.83,35.85 L145.33,35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 27 | +<path d="M161.33,21.01 L161.83,21.04 L162.33,21.11 L162.83,21.21 L163.33,21.34 L163.83,21.50 L164.33,21.70 L164.83,21.92 L165.33,22.17 L165.83,22.46 L166.33,22.77 L166.83,23.11 L167.33,23.49 L167.83,23.89 L168.33,24.32 L168.83,24.77 L169.33,25.26 L169.83,25.77 L170.33,26.30 L170.83,26.86 L171.33,27.45 L171.83,28.06 L172.33,28.69 L172.83,29.35 L173.33,30.03 L173.83,30.72 L174.33,31.44 L174.83,32.18 L175.33,32.94 L175.83,33.71 L176.33,34.50 L176.83,35.31 L177.33,36.13 L177.83,36.96 L178.33,37.81 L178.83,38.67 L179.33,39.54 L179.83,40.42 L180.33,41.31 L180.83,42.21 L181.33,43.11 L181.83,44.02 L182.33,44.93 L182.83,45.85 L183.33,46.77 L183.83,47.69 L184.33,48.61 L184.83,49.54 L185.33,50.46 L185.83,51.37 L186.33,52.28 L186.83,53.19 L187.33,54.09 L187.83,54.99 L188.33,55.87 L188.83,56.75 L189.33,57.62 L189.83,58.47 L190.33,59.32 L190.83,60.15 L191.33,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 28 | +<path d="M207.33,74.99 L207.83,74.96 L208.33,74.89 L208.83,74.79 L209.33,74.66 L209.83,74.50 L210.33,74.30 L210.83,74.08 L211.33,73.83 L211.83,73.54 L212.33,73.23 L212.83,72.89 L213.33,72.51 L213.83,72.11 L214.33,71.68 L214.83,71.23 L215.33,70.74 L215.83,70.23 L216.33,69.70 L216.83,69.14 L217.33,68.55 L217.83,67.94 L218.33,67.31 L218.83,66.65 L219.33,65.97 L219.83,65.28 L220.33,64.56 L220.83,63.82 L221.33,63.06 L221.83,62.29 L222.33,61.50 L222.83,60.69 L223.33,59.87 L223.83,59.04 L224.33,58.19 L224.83,57.33 L225.33,56.46 L225.83,55.58 L226.33,54.69 L226.83,53.79 L227.33,52.89 L227.83,51.98 L228.33,51.07 L228.83,50.15 L229.33,49.23 L229.83,48.31 L230.33,47.39 L230.83,46.46 L231.33,45.54 L231.83,44.63 L232.33,43.72 L232.83,42.81 L233.33,41.91 L233.83,41.01 L234.33,40.13 L234.83,39.25 L235.33,38.38 L235.83,37.53 L236.33,36.68 L236.83,35.85 L237.33,35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 29 | +<path d="M253.33,21.01 L253.83,21.04 L254.33,21.11 L254.83,21.21 L255.33,21.34 L255.83,21.50 L256.33,21.70 L256.83,21.92 L257.33,22.17 L257.83,22.46 L258.33,22.77 L258.83,23.11 L259.33,23.49 L259.83,23.89 L260.33,24.32 L260.83,24.77 L261.33,25.26 L261.83,25.77 L262.33,26.30 L262.83,26.86 L263.33,27.45 L263.83,28.06 L264.33,28.69 L264.83,29.35 L265.33,30.03 L265.83,30.72 L266.33,31.44 L266.83,32.18 L267.33,32.94 L267.83,33.71 L268.33,34.50 L268.83,35.31 L269.33,36.13 L269.83,36.96 L270.33,37.81 L270.83,38.67 L271.33,39.54 L271.83,40.42 L272.33,41.31 L272.83,42.21 L273.33,43.11 L273.83,44.02 L274.33,44.93 L274.83,45.85 L275.33,46.77 L275.83,47.69 L276.33,48.61 L276.83,49.54 L277.33,50.46 L277.83,51.37 L278.33,52.28 L278.83,53.19 L279.33,54.09 L279.83,54.99 L280.33,55.87 L280.83,56.75 L281.33,57.62 L281.83,58.47 L282.33,59.32 L282.83,60.15 L283.33,60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/> | |
| 30 | +</mask> | |
| 31 | +</defs> | |
| 32 | +<path d="M22.00,74.94 L24.00,74.94 L26.00,74.44 L28.00,73.44 L30.00,71.97 L32.00,70.06 L34.00,67.73 L36.00,65.04 L38.00,62.03 L40.00,58.76 L42.00,55.28 L44.00,51.68 L46.00,48.00 L48.00,44.32 L50.00,40.72 L52.00,37.24 L54.00,33.97 L56.00,30.96 L58.00,28.27 L60.00,25.94 L62.00,24.03 L64.00,22.56 L66.00,21.56 L68.00,21.06 L70.00,21.06 L72.00,21.56 L74.00,22.56 L76.00,24.03 L78.00,25.94 L80.00,28.27 L82.00,30.96 L84.00,33.97 L86.00,37.24 L88.00,40.72 L90.00,44.32 L92.00,48.00 L94.00,51.68 L96.00,55.28 L98.00,58.76 L100.00,62.03 L102.00,65.04 L104.00,67.73 L106.00,70.06 L108.00,71.97 L110.00,73.44 L112.00,74.44 L114.00,74.94 L116.00,74.94 L118.00,74.44 L120.00,73.44 L122.00,71.97 L124.00,70.06 L126.00,67.73 L128.00,65.04 L130.00,62.03 L132.00,58.76 L134.00,55.28 L136.00,51.68 L138.00,48.00 L140.00,44.32 L142.00,40.72 L144.00,37.24 L146.00,33.97 L148.00,30.96 L150.00,28.27 L152.00,25.94 L154.00,24.03 L156.00,22.56 L158.00,21.56 L160.00,21.06 L162.00,21.06 L164.00,21.56 L166.00,22.56 L168.00,24.03 L170.00,25.94 L172.00,28.27 L174.00,30.96 L176.00,33.97 L178.00,37.24 L180.00,40.72 L182.00,44.32 L184.00,48.00 L186.00,51.68 L188.00,55.28 L190.00,58.76 L192.00,62.03 L194.00,65.04 L196.00,67.73 L198.00,70.06 L200.00,71.97 L202.00,73.44 L204.00,74.44 L206.00,74.94 L208.00,74.94 L210.00,74.44 L212.00,73.44 L214.00,71.97 L216.00,70.06 L218.00,67.73 L220.00,65.04 L222.00,62.03 L224.00,58.76 L226.00,55.28 L228.00,51.68 L230.00,48.00 L232.00,44.32 L234.00,40.72 L236.00,37.24 L238.00,33.97 L240.00,30.96 L242.00,28.27 L244.00,25.94 L246.00,24.03 L248.00,22.56 L250.00,21.56 L252.00,21.06 L254.00,21.06 L256.00,21.56 L258.00,22.56 L260.00,24.03 L262.00,25.94 L264.00,28.27 L266.00,30.96 L268.00,33.97 L270.00,37.24 L272.00,40.72 L274.00,44.32 L276.00,48.00 L278.00,51.68 L280.00,55.28 L282.00,58.76 L284.00,62.03 L286.00,65.04 L288.00,67.73 L290.00,70.06 L292.00,71.97 L294.00,73.44 L296.00,74.44 L298.00,74.94" fill="none" stroke="#c8a06a" stroke-width="9.5" stroke-linecap="round" stroke-linejoin="round" mask="url(#cut0)"/> | |
| 33 | +<path d="M22.00,36.13 L24.00,32.94 L26.00,30.03 L28.00,27.45 L30.00,25.26 L32.00,23.49 L34.00,22.17 L36.00,21.34 L38.00,21.01 L40.00,21.17 L42.00,21.84 L44.00,23.00 L46.00,24.62 L48.00,26.67 L50.00,29.13 L52.00,31.93 L54.00,35.04 L56.00,38.38 L58.00,41.91 L60.00,45.54 L62.00,49.23 L64.00,52.89 L66.00,56.46 L68.00,59.87 L70.00,63.06 L72.00,65.97 L74.00,68.55 L76.00,70.74 L78.00,72.51 L80.00,73.83 L82.00,74.66 L84.00,74.99 L86.00,74.83 L88.00,74.16 L90.00,73.00 L92.00,71.38 L94.00,69.33 L96.00,66.87 L98.00,64.07 L100.00,60.96 L102.00,57.62 L104.00,54.09 L106.00,50.46 L108.00,46.77 L110.00,43.11 L112.00,39.54 L114.00,36.13 L116.00,32.94 L118.00,30.03 L120.00,27.45 L122.00,25.26 L124.00,23.49 L126.00,22.17 L128.00,21.34 L130.00,21.01 L132.00,21.17 L134.00,21.84 L136.00,23.00 L138.00,24.62 L140.00,26.67 L142.00,29.13 L144.00,31.93 L146.00,35.04 L148.00,38.38 L150.00,41.91 L152.00,45.54 L154.00,49.23 L156.00,52.89 L158.00,56.46 L160.00,59.87 L162.00,63.06 L164.00,65.97 L166.00,68.55 L168.00,70.74 L170.00,72.51 L172.00,73.83 L174.00,74.66 L176.00,74.99 L178.00,74.83 L180.00,74.16 L182.00,73.00 L184.00,71.38 L186.00,69.33 L188.00,66.87 L190.00,64.07 L192.00,60.96 L194.00,57.62 L196.00,54.09 L198.00,50.46 L200.00,46.77 L202.00,43.11 L204.00,39.54 L206.00,36.13 L208.00,32.94 L210.00,30.03 L212.00,27.45 L214.00,25.26 L216.00,23.49 L218.00,22.17 L220.00,21.34 L222.00,21.01 L224.00,21.17 L226.00,21.84 L228.00,23.00 L230.00,24.62 L232.00,26.67 L234.00,29.13 L236.00,31.93 L238.00,35.04 L240.00,38.38 L242.00,41.91 L244.00,45.54 L246.00,49.23 L248.00,52.89 L250.00,56.46 L252.00,59.87 L254.00,63.06 L256.00,65.97 L258.00,68.55 L260.00,70.74 L262.00,72.51 L264.00,73.83 L266.00,74.66 L268.00,74.99 L270.00,74.83 L272.00,74.16 L274.00,73.00 L276.00,71.38 L278.00,69.33 L280.00,66.87 L282.00,64.07 L284.00,60.96 L286.00,57.62 L288.00,54.09 L290.00,50.46 L292.00,46.77 L294.00,43.11 L296.00,39.54 L298.00,36.13" fill="none" stroke="#54dcc6" stroke-width="9.5" stroke-linecap="round" stroke-linejoin="round" mask="url(#cut1)"/> | |
| 34 | +<path d="M22.00,32.94 L24.00,36.13 L26.00,39.54 L28.00,43.11 L30.00,46.77 L32.00,50.46 L34.00,54.09 L36.00,57.62 L38.00,60.96 L40.00,64.07 L42.00,66.87 L44.00,69.33 L46.00,71.38 L48.00,73.00 L50.00,74.16 L52.00,74.83 L54.00,74.99 L56.00,74.66 L58.00,73.83 L60.00,72.51 L62.00,70.74 L64.00,68.55 L66.00,65.97 L68.00,63.06 L70.00,59.87 L72.00,56.46 L74.00,52.89 L76.00,49.23 L78.00,45.54 L80.00,41.91 L82.00,38.38 L84.00,35.04 L86.00,31.93 L88.00,29.13 L90.00,26.67 L92.00,24.62 L94.00,23.00 L96.00,21.84 L98.00,21.17 L100.00,21.01 L102.00,21.34 L104.00,22.17 L106.00,23.49 L108.00,25.26 L110.00,27.45 L112.00,30.03 L114.00,32.94 L116.00,36.13 L118.00,39.54 L120.00,43.11 L122.00,46.77 L124.00,50.46 L126.00,54.09 L128.00,57.62 L130.00,60.96 L132.00,64.07 L134.00,66.87 L136.00,69.33 L138.00,71.38 L140.00,73.00 L142.00,74.16 L144.00,74.83 L146.00,74.99 L148.00,74.66 L150.00,73.83 L152.00,72.51 L154.00,70.74 L156.00,68.55 L158.00,65.97 L160.00,63.06 L162.00,59.87 L164.00,56.46 L166.00,52.89 L168.00,49.23 L170.00,45.54 L172.00,41.91 L174.00,38.38 L176.00,35.04 L178.00,31.93 L180.00,29.13 L182.00,26.67 L184.00,24.62 L186.00,23.00 L188.00,21.84 L190.00,21.17 L192.00,21.01 L194.00,21.34 L196.00,22.17 L198.00,23.49 L200.00,25.26 L202.00,27.45 L204.00,30.03 L206.00,32.94 L208.00,36.13 L210.00,39.54 L212.00,43.11 L214.00,46.77 L216.00,50.46 L218.00,54.09 L220.00,57.62 L222.00,60.96 L224.00,64.07 L226.00,66.87 L228.00,69.33 L230.00,71.38 L232.00,73.00 L234.00,74.16 L236.00,74.83 L238.00,74.99 L240.00,74.66 L242.00,73.83 L244.00,72.51 L246.00,70.74 L248.00,68.55 L250.00,65.97 L252.00,63.06 L254.00,59.87 L256.00,56.46 L258.00,52.89 L260.00,49.23 L262.00,45.54 L264.00,41.91 L266.00,38.38 L268.00,35.04 L270.00,31.93 L272.00,29.13 L274.00,26.67 L276.00,24.62 L278.00,23.00 L280.00,21.84 L282.00,21.17 L284.00,21.01 L286.00,21.34 L288.00,22.17 L290.00,23.49 L292.00,25.26 L294.00,27.45 L296.00,30.03 L298.00,32.94" fill="none" stroke="#8272ff" stroke-width="9.5" stroke-linecap="round" stroke-linejoin="round" mask="url(#cut2)"/> | |
| 35 | +</svg> |
added docs/design.md +166 −0
| @@ -0,0 +1,166 @@ | ||
| 1 | +# Design | |
| 2 | + | |
| 3 | +Braid is a version control system for repositories where many agents create | |
| 4 | +and land changes at the same time. This document explains the architecture and | |
| 5 | +the reasons behind it. The byte-level format is in | |
| 6 | +[`spec/format-v1.md`](spec/format-v1.md). | |
| 7 | + | |
| 8 | +## Goals | |
| 9 | + | |
| 10 | +- **Cost follows the change, not the repository.** Creating, rebasing and | |
| 11 | + landing a change costs time proportional to the files it touches. | |
| 12 | +- **Many writers, no repository-wide lock.** Agents create changes in parallel; | |
| 13 | + the only serial step is moving a branch, and it is short. | |
| 14 | +- **Correct without a daemon.** Any number of `braid` processes, of any version | |
| 15 | + that understands the format, can share one store. A daemon may speed things | |
| 16 | + up but is never needed for correctness. | |
| 17 | +- **Immutable, content-addressed data.** Any cache can serve any object, and | |
| 18 | + nothing is ever rewritten in place. | |
| 19 | +- **Git at the edges.** Existing repositories come in with their full history, | |
| 20 | + and GitHub or Gitea keep working as mirrors. | |
| 21 | +- **Built for agents.** Every command has a JSON form, and a change can be | |
| 22 | + created through the API without a working copy. | |
| 23 | + | |
| 24 | +## Non-goals | |
| 25 | + | |
| 26 | +- Being a drop-in replacement for the `git` command line. | |
| 27 | +- Offline-first distributed workflows with many equal peers. Braid works | |
| 28 | + offline on one machine, and a server is the authority when several machines | |
| 29 | + share a repository. | |
| 30 | +- Preventing semantic conflicts: two changes can merge cleanly and still break | |
| 31 | + the build together. Braid records what landed so CI can find out. | |
| 32 | + | |
| 33 | +## Data model | |
| 34 | + | |
| 35 | +- **Blob:** file content. **Tree:** a directory (flat, or split into | |
| 36 | + content-defined nodes when large). **Changeset:** parents, the root tree, and | |
| 37 | + the files that changed relative to the first parent. | |
| 38 | +- Ids are BLAKE3 hashes in key-derivation mode, one context per kind. | |
| 39 | +- A changeset stores both the per-file change list and the root tree id, and | |
| 40 | + the store checks that they agree before accepting it. The change list makes | |
| 41 | + history, blame and rebase cheap; the root tree id makes the changeset commit | |
| 42 | + to the whole repository state. | |
| 43 | +- Large directories are split with a rule that depends only on entry names, so | |
| 44 | + an edit rewrites a few small nodes instead of the whole directory, and equal | |
| 45 | + contents always have equal ids. | |
| 46 | + | |
| 47 | +## Store | |
| 48 | + | |
| 49 | +A store is a directory of files that several processes share. Its correctness | |
| 50 | +rests only on guarantees every local file system gives: exclusive create, | |
| 51 | +appends protected by checksums, advisory locks that the kernel releases when a | |
| 52 | +process dies, atomic rename, and ordered syncs. | |
| 53 | + | |
| 54 | +- **Segments.** Objects are appended to segment files. A writer leases an open | |
| 55 | + segment with a non-blocking lock, or creates a new one. Segments are never | |
| 56 | + truncated: after a crash, the next writer appends after the last valid record. | |
| 57 | +- **Journals and indexes.** Each open segment has a journal of fixed-size, | |
| 58 | + checksummed entries, so readers find new objects without scanning payloads. A | |
| 59 | + full segment is sealed with a sorted index; compaction can merge indexes. | |
| 60 | + Only files that can no longer change are memory-mapped. | |
| 61 | +- **Op log.** Branch heads and the history of operations live in an | |
| 62 | + append-only log behind a short lock. Every record names the agent that wrote | |
| 63 | + it, so `braid op log` shows who did what and `braid undo` can step back. | |
| 64 | +- **Publish order.** Objects, then their journal entries, then a barrier, then | |
| 65 | + the op log record that refers to them. The op log never points at an object | |
| 66 | + that is not durable. | |
| 67 | +- **Durability modes.** `ordered` (local default) may lose the last operations | |
| 68 | + on power loss but is never inconsistent; `full` (server default) syncs fully | |
| 69 | + before acknowledging. | |
| 70 | +- **Derived data** (generation numbers, ancestry skip pointers, changed-path | |
| 71 | + filters, blame, git mappings) is stored as records keyed by their inputs, and | |
| 72 | + can always be recomputed. | |
| 73 | + | |
| 74 | +## Landing on a branch | |
| 75 | + | |
| 76 | +`land` takes a changeset `C` built on base `B` and moves a branch to include it. | |
| 77 | +Bases are always ids, never branch names, so nothing is resolved late. | |
| 78 | + | |
| 79 | +1. If the request for `(branch, C)` already landed, return that result. A lost | |
| 80 | + acknowledgement is retried safely. | |
| 81 | +2. `B` must be on the branch's first-parent chain. | |
| 82 | +3. If `B` is the head, fast-forward. | |
| 83 | +4. Otherwise rebase `C` onto the head, path by path: unchanged since `B` takes | |
| 84 | + `C`'s value; changed on both sides goes through a three-way merge. The cost | |
| 85 | + follows the size of `C`. | |
| 86 | +5. Write the new objects, append the landing record, sync, then publish the new | |
| 87 | + head. | |
| 88 | + | |
| 89 | +Locally this step runs under the op log lock; on a server, one task per branch | |
| 90 | +runs it in order, grouping several landings into one sync. | |
| 91 | + | |
| 92 | +Conflicts are reported as data, not as markers in a file: the path, the kind, | |
| 93 | +the base, ours and theirs, and the hunks. Braid is stricter than git about | |
| 94 | +structural conflicts: a file against a directory, two names that differ only in | |
| 95 | +case or Unicode normalisation, a directory removed under a new file, and the | |
| 96 | +same file renamed two ways. | |
| 97 | + | |
| 98 | +**Invariants.** A branch only moves forward. A branch never contains a | |
| 99 | +conflict. No value is overwritten except by a change whose base already | |
| 100 | +contained it. An acknowledged landing is durable. Readers only see durable | |
| 101 | +heads. | |
| 102 | + | |
| 103 | +## Workspaces | |
| 104 | + | |
| 105 | +- One workspace per agent, all sharing one store. No staging area: tracked | |
| 106 | + files are snapshotted as they are. | |
| 107 | +- New files that look like secrets (`.env*`, `*.pem`, `id_*`) or are larger than | |
| 108 | + 1 MiB need an explicit `braid track`. | |
| 109 | +- Status uses a stat cache, with the usual guard against files modified in the | |
| 110 | + same instant the cache was written. A daemon can add a file system watcher. | |
| 111 | +- Checkouts never follow symlinks while walking or writing, write through a | |
| 112 | + temporary file and a rename, refuse names that would collide on the file | |
| 113 | + system, and never run anything from repository content. | |
| 114 | + | |
| 115 | +## Git bridge | |
| 116 | + | |
| 117 | +- Built on [gitoxide](https://github.com/GitoxideLabs/gitoxide). Braid contains | |
| 118 | + no code from git itself, which is GPLv2. | |
| 119 | +- Import keeps the raw bytes of commits, tags and non-canonical trees, and | |
| 120 | + verifies each commit by exporting it again and comparing ids. | |
| 121 | +- Sync fetches and imports first, then pushes with a lease, as a fast-forward. | |
| 122 | + Braid never force-pushes. The push itself runs the `git` binary as a | |
| 123 | + subprocess, since gitoxide does not push yet. | |
| 124 | + | |
| 125 | +## Server and caches | |
| 126 | + | |
| 127 | +- HTTP, with immutable objects served by id so that a daemon, a regional cache, | |
| 128 | + nginx or a CDN can all answer the same request. | |
| 129 | +- The daemon, the cache tier and the server implement the same API, so a client | |
| 130 | + does not know which one answers. | |
| 131 | +- Writes go to the authority: one ordered landing task per branch. | |
| 132 | +- Background work (derived data, compaction, git export) runs under an I/O | |
| 133 | + budget, so a small server's disk is never saturated. | |
| 134 | + | |
| 135 | +## Testing | |
| 136 | + | |
| 137 | +- **Deterministic simulation.** The core runs over clock, randomness, disk and | |
| 138 | + network traits. Simulated agents, servers and git remotes run with injected | |
| 139 | + faults: lost acknowledgements, crashes between any two writes, partitions. | |
| 140 | + Every seed reproduces its run, and the invariants above are checked after | |
| 141 | + every step against a simple reference model. | |
| 142 | +- **Crash tests.** Failpoints and repeated `kill -9` of real processes, plus a | |
| 143 | + file system shim that drops unsynced writes. | |
| 144 | +- **Properties.** Encodings round-trip canonically; incremental tree updates | |
| 145 | + equal building from scratch; disjoint landings commute; a changeset's change | |
| 146 | + list equals the diff of its trees. | |
| 147 | +- **Fuzzing** of every decoder, the git importer, path validation and merges. | |
| 148 | +- **Differential tests with git as the oracle** on real histories: tree diffs, | |
| 149 | + path history, merge bases and three-way merges. Braid merging cleanly where | |
| 150 | + git reports a conflict is treated as a critical bug. | |
| 151 | +- **Round trips** of real public repositories through import and export, bit | |
| 152 | + for bit. | |
| 153 | + | |
| 154 | +## Performance targets | |
| 155 | + | |
| 156 | +Stated as complexity and as ratios against git on the same machine. Braid's | |
| 157 | +published benchmarks will only ever be ratios with the script that reproduces | |
| 158 | +them. | |
| 159 | + | |
| 160 | +- Commit and land: proportional to the changed paths times the tree depth. | |
| 161 | +- `log -- path`: proportional to the changes that touched the path. | |
| 162 | +- Ancestry and merge base: logarithmic, using skip pointers and generation | |
| 163 | + numbers. | |
| 164 | +- A lazy sparse clone: proportional to the objects under the requested paths. | |
| 165 | +- Store size: at most twice a garbage-collected git repository of the same | |
| 166 | + history. |
added docs/spec/format-v1.md +235 −0
| @@ -0,0 +1,235 @@ | ||
| 1 | +# Braid format v1 | |
| 2 | + | |
| 3 | +**Status: draft.** Sections marked *implemented* exist in code and are pinned by | |
| 4 | +golden vectors in the tests. Everything else is the design that milestone 1 | |
| 5 | +implements. The format freezes when milestone 1 closes; after that, any change | |
| 6 | +to hashed bytes needs a new format version. | |
| 7 | + | |
| 8 | +This document covers what is **hashed**: ids, trees, changesets and names. How | |
| 9 | +the store keeps objects on disk (records, indexes, compression, deltas, chunks) | |
| 10 | +is not part of any id and has its own, separately versioned, section at the end. | |
| 11 | + | |
| 12 | +## 1. Conventions | |
| 13 | + | |
| 14 | +- Integers are little-endian. | |
| 15 | +- `uv` is an unsigned LEB128 integer of at most 64 bits. Encoders write the | |
| 16 | + shortest form; decoders reject overlong forms (such as `80 00`) and values | |
| 17 | + that do not fit in 64 bits. | |
| 18 | +- `sv` is a signed integer, zigzag-mapped and then written as `uv`. | |
| 19 | +- `bytes` is a `uv` length followed by that many raw bytes. | |
| 20 | +- `[32]` is exactly 32 raw bytes: an object id. | |
| 21 | +- A decoder rejects any bytes left over after the last field. | |
| 22 | +- Names and paths are byte strings, not text. A path joins names with `/`. | |
| 23 | + | |
| 24 | +## 2. Object ids (implemented) | |
| 25 | + | |
| 26 | +An object id is BLAKE3 in key-derivation mode, with one context string per kind: | |
| 27 | + | |
| 28 | +| Kind | Code | Context string | | |
| 29 | +|---|---|---| | |
| 30 | +| blob | 1 | `elffuss-braid 2026 blob v1` | | |
| 31 | +| tree | 2 | `elffuss-braid 2026 tree v1` | | |
| 32 | +| changeset | 3 | `elffuss-braid 2026 changeset v1` | | |
| 33 | +| chunklist | 4 | `elffuss-braid 2026 chunklist v1` | | |
| 34 | +| derived | 5 | `elffuss-braid 2026 derived v1` | | |
| 35 | + | |
| 36 | +``` | |
| 37 | +id = BLAKE3-derive-key(context(kind), payload) 32 bytes | |
| 38 | +``` | |
| 39 | + | |
| 40 | +- The context separates kinds, so the payload carries no type prefix and can be | |
| 41 | + hashed while it streams in. | |
| 42 | +- A **blob id is always the hash of the complete file content**, however the | |
| 43 | + store keeps it (whole, as a delta, or in chunks). | |
| 44 | +- The text form is 64 lowercase hex digits; the short form is the first 12. | |
| 45 | + Parsers accept lowercase only, so equal ids always have equal text. | |
| 46 | + | |
| 47 | +Golden vectors (pinned in `crates/format/src/id.rs`): | |
| 48 | + | |
| 49 | +| Kind | Payload | Id | | |
| 50 | +|---|---|---| | |
| 51 | +| blob | empty | `ff9c212a7ef64fa38f0c411b3a68d523a20fd197ee3ba03fa4a44b7c5e99c958` | | |
| 52 | +| blob | `hello\n` | `6acd5cdf880a325d2df716699943aae586ad77d54fb2ed0c5a3f53c76fa56f89` | | |
| 53 | +| tree | empty | `46f1ab000b3145d2e28ff69f7570eb88065d76ef86905bb268699adb9c860c08` | | |
| 54 | +| changeset | empty | `1be995db81f244ac5ea57f1ba45d9f9da94ad4edd6dbfa0979c16101a34d04ef` | | |
| 55 | +| chunklist | empty | `f14231be43c0cc73e7c4850ec9d980e6952b56c57f7125d0c39d16874be2ab04` | | |
| 56 | +| derived | empty | `6f101e23c531e6e3959878774beefb475944b2f0200e52eafb37fd80f97df172` | | |
| 57 | + | |
| 58 | +Anyone can check them with the reference [`b3sum`](https://github.com/BLAKE3-team/BLAKE3/tree/master/b3sum) tool: | |
| 59 | + | |
| 60 | +```bash | |
| 61 | +printf 'hello\n' | b3sum --derive-key "elffuss-braid 2026 blob v1" | |
| 62 | +``` | |
| 63 | + | |
| 64 | +## 3. Trees | |
| 65 | + | |
| 66 | +A tree describes one directory. Small directories are one flat node. Large ones | |
| 67 | +are split into a balanced tree of nodes whose boundaries depend only on the | |
| 68 | +entry names, so the same set of entries always produces the same root id, no | |
| 69 | +matter in which order it was edited. | |
| 70 | + | |
| 71 | +``` | |
| 72 | +u8 format = 1 | |
| 73 | +u8 node_type 0 flat, 1 leaf, 2 internal | |
| 74 | + | |
| 75 | +flat | leaf: | |
| 76 | + uv n | |
| 77 | + n × entry strictly ascending by name bytes | |
| 78 | + | |
| 79 | +entry: | |
| 80 | + bytes name | |
| 81 | + u8 kind 0 file, 1 executable, 2 symlink, 3 tree, 4 gitlink | |
| 82 | + (5 is reserved for conflict entries in a later version) | |
| 83 | + kind 0–2: [32] blob id, uv size in bytes | |
| 84 | + kind 3: [32] tree id | |
| 85 | + kind 4: u8 algorithm (1 = SHA-1, 2 = SHA-256), raw git id (20 or 32 bytes) | |
| 86 | + | |
| 87 | +internal: | |
| 88 | + u8 level 1 for the nodes just above the leaves | |
| 89 | + uv n | |
| 90 | + n × (bytes last_name, [32] child id, uv entry_count) | |
| 91 | +``` | |
| 92 | + | |
| 93 | +- A symlink's target is stored as a blob. | |
| 94 | +- File sizes live in the tree, so a listing or a virtual file system can report | |
| 95 | + sizes without fetching any content. | |
| 96 | +- An empty directory is the tree with zero entries. It can be represented, but | |
| 97 | + checkouts never create one from scratch. | |
| 98 | + | |
| 99 | +**Splitting rule.** A directory with **1,024 entries or fewer must be one flat | |
| 100 | +node.** A larger one must be split: | |
| 101 | + | |
| 102 | +1. Walk the sorted entries left to right, filling a leaf. After adding entry | |
| 103 | + `e` to a leaf that now holds `c` entries, end the leaf if | |
| 104 | + `c ≥ 32` and `u32le(H(0, e.name)[0..4]) < 2³² / 128`, or if `c = 512`. | |
| 105 | +2. Build the next level the same way over the children, using each child's | |
| 106 | + `last_name`, with level numbers 1, 2, …, until one node remains: the root. | |
| 107 | + | |
| 108 | +`H(level, name) = BLAKE3-derive-key("elffuss-braid 2026 tree-split v1", u8 level ‖ name)`. | |
| 109 | + | |
| 110 | +Boundaries depend only on names, so changing a file's content never moves them, | |
| 111 | +and an edit only rewrites the nodes on its path. An incremental update must | |
| 112 | +always produce the same bytes as building the directory from scratch; the tests | |
| 113 | +check this for random edit sequences. | |
| 114 | + | |
| 115 | +## 4. Changesets | |
| 116 | + | |
| 117 | +A changeset is one change to the repository: its parents, the root tree it | |
| 118 | +produces, and the list of files that changed relative to its **first** parent. | |
| 119 | + | |
| 120 | +``` | |
| 121 | +u8 format = 1 | |
| 122 | +uv parent_count | |
| 123 | +parent_count × [32] changeset id parent[0] is the base of the change list | |
| 124 | +[32] root tree id | |
| 125 | +u8 changes_mode 0 inline, 1 external | |
| 126 | + mode 0: uv n, n × change | |
| 127 | + mode 1: [32] blob id of the encoded change list, uv n | |
| 128 | +author: bytes name, bytes email, sv seconds since the Unix epoch, sv offset in minutes | |
| 129 | +committer: same layout | |
| 130 | +bytes message raw bytes, no normalisation | |
| 131 | +uv extra_count | |
| 132 | +extra_count × (bytes key, bytes value) order and duplicates preserved | |
| 133 | +u8 git_origin 0 none; 1 followed by [32] blob id of the raw git commit bytes | |
| 134 | + | |
| 135 | +change: | |
| 136 | + bytes path | |
| 137 | + u8 op 0 delete, 1 file, 2 executable, 3 symlink, 4 gitlink | |
| 138 | + op 1–3: [32] blob id, uv size | |
| 139 | + op 4: u8 algorithm, raw git id | |
| 140 | +``` | |
| 141 | + | |
| 142 | +Rules: | |
| 143 | + | |
| 144 | +- The change list is **exactly** the set of paths whose entry differs from the | |
| 145 | + first parent's tree (different kind or different id), sorted by path bytes, | |
| 146 | + without duplicates and without no-op entries. A changeset with no parents is | |
| 147 | + compared against the empty tree. | |
| 148 | +- Changes are per file. A directory replaced by a file is a delete for every | |
| 149 | + file below it plus one set for the new file. | |
| 150 | +- The list is stored inline when its encoding is at most 64 KiB, and as a | |
| 151 | + separate blob otherwise, so a huge import does not make every history walk | |
| 152 | + read a huge object. | |
| 153 | +- **Admission check.** A store accepts a changeset only if applying its change | |
| 154 | + list to `parent[0]`'s root tree yields exactly `root_tree`, every referenced | |
| 155 | + object is present, and every parent was already accepted. The check costs | |
| 156 | + time proportional to the change, not to the repository. | |
| 157 | +- A merge has two or more parents; its change list is still relative to | |
| 158 | + `parent[0]`. | |
| 159 | +- `git_origin` points at the original commit bytes for changesets imported from | |
| 160 | + git, so export can reproduce the commit bit for bit. The reference is part of | |
| 161 | + the hash. | |
| 162 | + | |
| 163 | +## 5. Names | |
| 164 | + | |
| 165 | +The store is permissive, close to what `git fsck` accepts; checkouts are | |
| 166 | +strict, per file system. | |
| 167 | + | |
| 168 | +A name in a tree is rejected if it: | |
| 169 | + | |
| 170 | +- is empty, longer than 4,096 bytes, or contains `/` or NUL; | |
| 171 | +- is `.` or `..`; | |
| 172 | +- aliases `.braid` or `.git` once these are removed or folded: the code points | |
| 173 | + that HFS+ ignores (U+200C–U+200F, U+202A–U+202E, U+206A–U+206F, U+FEFF), | |
| 174 | + trailing dots and spaces (NTFS), letter case, and Unicode normalisation (NFC); | |
| 175 | + this includes the 8.3 short forms `BRAID~1` and `GIT~1`; | |
| 176 | +- is `.gitmodules`, `.gitignore`, `.gitattributes` or `.braidignore` with kind | |
| 177 | + symlink. | |
| 178 | + | |
| 179 | +When writing a working copy, braid also refuses names that would collide on | |
| 180 | +that file system (letter case, Unicode normalisation), never follows a symlink | |
| 181 | +while walking or writing, and never runs anything found in repository content. | |
| 182 | + | |
| 183 | +## 6. Git mapping | |
| 184 | + | |
| 185 | +- Every imported git object has a two-way mapping between its git id and its | |
| 186 | + braid id, stored as derived records. | |
| 187 | +- Imported commits and tags keep their raw bytes (`git_origin`), which preserves | |
| 188 | + header order, signatures, encodings, unknown headers and odd author lines. | |
| 189 | +- A git tree that cannot be regenerated exactly from the braid tree (unsorted or | |
| 190 | + duplicate entries, non-canonical modes such as `100664`) keeps its raw bytes as | |
| 191 | + well. | |
| 192 | +- Git sorts a directory entry as if its name ended in `/`; braid sorts by raw | |
| 193 | + name bytes. Export reorders. | |
| 194 | +- During import, every commit is exported again and its git id compared with | |
| 195 | + the original. Any difference stops the import. | |
| 196 | + | |
| 197 | +## 7. Storage (not hashed, versioned on its own) | |
| 198 | + | |
| 199 | +This section describes the planned on-disk layout of the local store. It can | |
| 200 | +change without changing any id. | |
| 201 | + | |
| 202 | +``` | |
| 203 | +.braid/store/format object-format=blake3-dk-v1 | |
| 204 | +.braid/store/seg/<uuid>.seg object records, append-only | |
| 205 | +.braid/store/seg/<uuid>.jrn live journal of a segment that is still open | |
| 206 | +.braid/store/seg/<uuid>.idx sorted index of a sealed segment | |
| 207 | +.braid/store/midx/<id>.midx merged index written by compaction | |
| 208 | +.braid/store/oplog/ lock, log and checkpoints for refs and operations | |
| 209 | +.braid/ws/<name>/ one workspace per agent | |
| 210 | +``` | |
| 211 | + | |
| 212 | +Object record (8-byte aligned): | |
| 213 | + | |
| 214 | +``` | |
| 215 | +u32 sync = 0xB7A1D5E9 | u8 kind | u8 codec (0 raw, 1 zstd, 2 zstd + dictionary, 3 zstd + reference) | |
| 216 | +u16 flags | u32 stored_len | u64 raw_len | [32] id | |
| 217 | +codec 2–3: [32] dictionary or reference object id | |
| 218 | +payload | u32 crc32c over everything from sync to the end of the payload | |
| 219 | +``` | |
| 220 | + | |
| 221 | +Journal entry, 64 bytes, each with its own CRC: | |
| 222 | +`[32] id, u64 offset, u32 stored_len, u8 kind, u8 codec, u16 0, u64 raw_len, u32 record crc, u32 entry crc`. | |
| 223 | + | |
| 224 | +Index (`.idx`, `.midx`): header, a fan-out table, sorted ids, locations, kinds, | |
| 225 | +a binary fuse filter for fast misses, and a footer with offsets and a BLAKE3 | |
| 226 | +checksum. | |
| 227 | + | |
| 228 | +Storage policy (tunable at any time): | |
| 229 | + | |
| 230 | +- Payloads up to 64 bytes are stored raw. | |
| 231 | +- Blobs under 4 MiB and all trees are zstd-compressed, or stored as a one-level | |
| 232 | + zstd delta against the same path in the first parent when that is at most half | |
| 233 | + the standalone size. Delta chains never exceed one level. | |
| 234 | +- Blobs of 4 MiB or more are split with FastCDC (16/64/256 KiB chunks; larger | |
| 235 | + chunks above 256 MiB). Chunks that do not compress are stored raw. |
added scripts/build-release.sh +24 −0
| @@ -0,0 +1,24 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# SPDX-License-Identifier: Apache-2.0 | |
| 3 | +# Copyright (c) 2026 UtopiaIA | |
| 4 | +# | |
| 5 | +# Builds the release binary with every build path remapped, then checks that | |
| 6 | +# the home directory does not appear anywhere inside it. Published binaries are | |
| 7 | +# built by CI; use this for local release builds. | |
| 8 | +set -euo pipefail | |
| 9 | +cd "$(dirname "$0")/.." | |
| 10 | + | |
| 11 | +cargo_home="${CARGO_HOME:-$HOME/.cargo}" | |
| 12 | +rustup_home="${RUSTUP_HOME:-$HOME/.rustup}" | |
| 13 | +# When several prefixes match, rustc applies the last one, so the most general | |
| 14 | +# goes first. | |
| 15 | +export RUSTFLAGS="${RUSTFLAGS:-} --remap-path-prefix=$HOME=~ --remap-path-prefix=$rustup_home=/rustup --remap-path-prefix=$cargo_home=/cargo --remap-path-prefix=$PWD=." | |
| 16 | + | |
| 17 | +cargo build --release --locked -p elffuss-braid-cli | |
| 18 | + | |
| 19 | +bin=target/release/braid | |
| 20 | +if strings "$bin" | grep -qF "$HOME"; then | |
| 21 | + echo "build-release: $bin still contains the home directory path" >&2 | |
| 22 | + exit 1 | |
| 23 | +fi | |
| 24 | +echo "build-release: $bin contains no home-directory path" |
added scripts/privacy-check.sh +39 −0
| @@ -0,0 +1,39 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# SPDX-License-Identifier: Apache-2.0 | |
| 3 | +# Copyright (c) 2026 UtopiaIA | |
| 4 | +# | |
| 5 | +# Fails if the repository would publish data that identifies a machine or a | |
| 6 | +# person: home-directory paths in tracked files, co-author or tool-attribution | |
| 7 | +# trailers in history, or maintainer commits without the noreply address. | |
| 8 | +# CI runs it on every push; run it locally before pushing too. | |
| 9 | +set -euo pipefail | |
| 10 | + | |
| 11 | +status=0 | |
| 12 | +report() { | |
| 13 | + echo "privacy-check: $1" >&2 | |
| 14 | + status=1 | |
| 15 | +} | |
| 16 | + | |
| 17 | +# 1. Home-directory paths in tracked text files. CI runner paths are fine. | |
| 18 | +if hits=$(git grep -nIE '/(Users|home)/[A-Za-z0-9._-]+/' -- . ':(exclude)scripts/privacy-check.sh' | | |
| 19 | + grep -vE '/[h]ome/runner/'); then | |
| 20 | + echo "$hits" >&2 | |
| 21 | + report "home-directory paths in tracked files" | |
| 22 | +fi | |
| 23 | + | |
| 24 | +# 2. Co-author and tool-attribution trailers anywhere in history. | |
| 25 | +if git log --format=%B | grep -qiE '^co-authored-by:|generated with .*claude'; then | |
| 26 | + report "attribution trailer in a commit message" | |
| 27 | +fi | |
| 28 | + | |
| 29 | +# 3. The maintainer account commits with its noreply address only. | |
| 30 | +if bad=$(git log --format='%an <%ae>%n%cn <%ce>' | sort -u | grep -E '^KikoCis <' | | |
| 31 | + grep -v '<KikoCis@users.noreply.github.com>$'); then | |
| 32 | + echo "$bad" >&2 | |
| 33 | + report "maintainer identity without the noreply address" | |
| 34 | +fi | |
| 35 | + | |
| 36 | +if [ "$status" -eq 0 ]; then | |
| 37 | + echo "privacy-check: clean" | |
| 38 | +fi | |
| 39 | +exit "$status" |