Files
alkgit/substrate/README.md
T
glm-5.3-flash 380e705681 docs(substrate): w10 — release readiness (crate docs, feature matrix, CHANGELOG/README, the dispositions, publish dry-run)
- Crate docs: cargo doc --no-deps 0 warnings; the D-1 crate map
  rewritten for the placement split (migrations.rs entry — the
  co-tenant handles/runners/pg plumbing together in the ADR-024
  home) + the parity landing (the LFS twins carry the wrap), two
  broken doc-link typos fixed; the missing-pin public items stamped
  (LfsAdapter, LfsDownload, MaintenanceChain, LOCKED_OUT_RETRY_SECS,
  key_to_oid, the four channel constants, AnnouncingRegistry).
- F-w10-B4 dropped: the constructor's dead OpsConfig.fetch_max_total_bytes
  setting removed (the adapter registers only stat_pair and budgets
  downloads adapter-side); the stat-only posture stated on new.
- F-w10-B5: ADR-022 Status/Consequences + lfs.md's model paragraph
  made tier-accurate (the large tier re-derives nothing at read;
  the oid conclusion is the adapter's whole-span oid check); the
  test door's doubled info/lfs/lfs route form now unrouted 404,
  pinned by a binary-independent real_lfs.rs row.
- N-3 swept: the core's five stale later-waves sentences rewritten
  present-tense (limits/substrate/duplex/stateless/backend).
- The feature matrix green end to end: documented combos (default
  186, +postgres 212/0-skip live-pg, pg-pure 137, lfs-without-
  postgres 144, lfs-less 153, all-features 379) + the now-clean
  off-matrix combos (engine-less 117; lfs-alone/postgres-alone
  clippies); both clippies -D warnings, fmt, the fuzz corpus gate
  (13); the three assembly shapes' doc list confirmed current.
- substrate/CHANGELOG.md (the honest 0.1.0 founding entry, waves
  6-10) + substrate/README.md (posture, seam table, engine matrix,
  usage sketch, sibling pointer, license) created.
- Publish dry-run green; the member's packaging shape recorded in
  the manifest comment (no excludes needed; the family LICENSE
  files copied into the member; package -l = 32 files, no strays).

Task: substrate/w10-release-readiness; verification per AGENTS.md
(test/both clippies/fmt/doc/fuzz-gate/live-pg 212/0-skip,
taskgraph validate 90 tasks).
2026-10-24 18:14:38 +00:00

5.4 KiB

alkgit-substrate

The shipped backend composition for alkgit (https://git.alk.dev/alkdev/alkgit): the complete ADR-019 storage composition implementing alkgit's five-trait backend seam over the alkstore + alkblobs substrate — reactive by default, engine-twinned, schema-migrated, GC-wired, with the LFS surface under lfs (ADR-022).

The wire layer is not this crate's: alkgit serves the git smart protocol (fetch/receive-pack) through backend-neutral machines, and the doors (the alkhttp git/lfs features, alkssh) are family infrastructure. This crate composes the storage underneath — git objects in alkblobs, refs/registry in co-tenant rows, reactive halves wired, no opt-out (ADR-019 §5). No binary; a downstream app embeds alkgit, composes these backends, and brings its own door.

The seams it implements

alkgit trait The composition's implements
GitRegistry all three engines through CachedRegistryProvider (whole-table snapshot, wake/reconcile invalidation)
GitRegistryStore in-memory adapter + the sqlite/postgres twins (one transaction per mutation, the registry_seq watermark transactionally exact)
GitRefs the row-CAS tables (InMemoryRefTable + engine twins), each carrying the VersionedRefTable epoch wrap
GitPackGen PackGen — ADR-004's pipeline over the real Find front; direct streaming or through-store ranged windows over the shared PackCache
GitPackIngest PackIngest — budgeted index, unpack-to-loose, full-graph connectivity; every failure the unpack ng leg

The engine matrix (the three assembly shapes)

Engine choice is one assembly-level statement (substrate.md §assembly shapes); the composition entry (SubstrateAssembly) opens each shape with a single fallible constructor — migrations run at construction and a half-migrated store refuses service (ADR-024 §1):

Shape Constructor The row
Ephemeral (tests / completeness) SubstrateAssembly::mem(store, blobs, options) in-memory engines; the complete reactive/GC machinery composes
Single-host (the default) SubstrateAssembly::sqlite(path, options) (sqlite feature, default-on) one co-tenant file: registry/ref/LFS rows + the alkstore-sqlite engine + the alkblobs kv tier (+ local large tier when LFS or through-store packs)
Fleet / durable-shared SubstrateAssembly::postgres(dsn, PgRegistryOptions, options) (postgres feature) schema-namespaced postgres: the same co-tenant tables over alkstore-postgres/alkblobs pg shapes
use alkgit_substrate::{AssemblyOptions, PackServing, SubstrateAssembly};

// the single-host shape — one co-tenant sqlite file:
let assembly = SubstrateAssembly::sqlite(
    "repo.db",
    AssemblyOptions::new(work_root, large_root),
).await?;

// hand the faces to the core's serving machines (serve_duplex and
// friends take the marker + these trait objects):
let refs = assembly.refs();       // &Arc<dyn GitRefs>
let packgen = assembly.packgen(); // &Arc<dyn GitPackGen>
let ingest = assembly.ingest();   // &Arc<dyn GitPackIngest>
let registry = assembly.registry(); // &Arc<dyn GitRegistry>

The assembly manages as much of the machinery as exists to wire: the reactor (post-commit announce + wake runner + stream consumer + reconcile sweep), both liveness registrations (the ref-table closure and, under lfs, the media rows), and the maintenance chain (the sweep schedule, the supervised runner, PackHousekeeping). Working assemblies: substrate/tests/real_git.rs (real git push/clone/fetch), substrate/tests/replication.rs, substrate/tests/real_lfs.rs (real git-lfs).

LFS

Under the lfs feature (default-on — the fail-safe posture, ADR-022 §6): the pointer-lifecycle row store (LfsRows + engine twins), the media liveness source (LfsMedia) wired into the sweep chain, and the batch/transfer adapter (LfsAdapter) — the storage-side surface the alkhttp lfs door consumes, with per-window slice-digest verification plus the whole-span oid check and the wired ownership provider (never the static fallback). An unregistered liveness source is the dangerous default; there is no construction that composes LFS rows without their sweep registration.

Status

The composition is at its first release candidate posture; the architecture docs are the authoritative contract — substrate.md (the composition), lfs.md, and the ADRs (019/020/022/024/025) pin every trait binding and public member the publish freezes. The protocol core's README covers the wire layer and the serving/consumer sketches.

Documentation

License

MIT OR Apache-2.0