# Goal — in-process `gix` BranchStore + true-latency bench

Build a new Rust crate `pilot-gix/` that implements a **BranchStore** (a git
branch used as a versioned key/value store) **in-process with the `gix`
crate**, plus a self-asserting benchmark. This is the SPIKE-07 follow-up for
spt-core ADR-0011: the prior spike measured the *git-CLI* upper bound
(~60 ms/commit on Windows, ~2 process spawns per commit). This pilot measures
the **true in-process latency**, which is expected to be far lower.

## Hard constraints
- Use the **`gix`** crate (gitoxide), in-process. **Do NOT shell out to the
  `git` CLI. Do NOT use `git2`/libgit2.** The whole point is the in-process number.
- Crate layout: `pilot-gix/Cargo.toml` (edition 2021, `[[bin]] name = "bench"`,
  dependency on `gix` — pick a recent version) and `pilot-gix/src/main.rs`.
- Operate on a throwaway repo created under the system temp dir; remove it at the end.
- All assertions must **panic on failure** (so a failed run exits non-zero and
  the workflow's verify gate sees FAILURE).

## BranchStore behaviors to implement (mirror spike-07)
On a branch `spt-state` in a freshly-init'd repo:
1. **ensure_branch** — init repo + an empty root commit on `spt-state`.
2. **put(key, value)** — write the blob at `key` and create **one commit** whose
   tree = previous tree + that modification. One commit == one write.
3. **get(rev, key)** — read the blob at `<rev>:<key>` (tree lookup at that commit);
   return None if absent.
4. **history** — number of commits reachable from the branch tip.
5. **atomic multi-key put** — write 3 keys (e.g. `a/x.json`, `a/y.json`,
   `b/z.json`) in **one** commit; verify all three are present at the tip and
   **none** are present at its parent (all-or-nothing).
6. **cold-recover** — re-open the repo from its path (fresh handle) and read the
   tip; it must equal the last value written (commit = checkpoint, tip = resume).

## Benchmark
- `N` single-key snapshot commits (default 300; accept an optional CLI arg to
  override). Each value is a ~2 KB toy registry-JSON snapshot whose content
  starts with the iteration index so the read-back assertion can check it.
- Time each `put`. Report: **avg, p50, p95, max ms/commit**, and **commits/sec**.

## Assertions (panic on any failure)
- read-back: the tip's value == the last snapshot written.
- history count == number of writes (account for the root commit).
- atomic multi-key: all 3 keys at tip, none at parent.
- cold-recover: fresh-handle tip read == last value.

## Output
Print the latency table, the check results, and a one-line **verdict** comparing
to spike-07's CLI upper bound (~60 ms/commit) — i.e. state the measured
in-process avg and that it confirms ADR-0011's coarse/durable boundary with even
more margin.

## Done when
`cargo run --release --manifest-path pilot-gix/Cargo.toml` builds cleanly and
exits 0 with all assertions passing and the latency table printed.
