Commit Graph
11 Commits
Author SHA1 Message Date
glm-5.3-flash 3a51bb43fc feat(store): the fleet GC protocol — the sweep lease, SQL arbitration, pin reaping, and the fleet liveness verb (wave 6)
Grow the sweep and delete paths into their fleet forms under fleet: true
(ADR-008 §2, ADR-010 §2, ADR-012 §1/§5/§6.6/§6.7, ADR-013 §2); the
non-fleet forms are byte-unchanged.

- the sweep lease: sweep() composes the in-process single-flight flag
  with the SQL lease (sweep_lock_acquire on the fleet host), both held
  for the whole sweep and released on every exit path; contention at
  either domain aborts as SweeperLock report data, nothing deleted;
  the pool-sizing composition enforced (max_size >= 2 at the fleet
  constructors' entry — the lease holds one checkout; the body's
  clauses ride further checkouts)
- SQL-level delete arbitration: arbitrated_delete composes the two
  domains (in-process first — cheap, local; the engine's arbitrate
  second — fleet-authoritative) on the direct path (GcRefuse) and the
  window execution's re-arbitration; a foreign instance's un-expired
  pin row or liveness-table row refuses cross-instance
- the maintenance step: EngineFleetState::pin_reap (the seam as the
  named clause home) reaps exactly the expired pin rows, one statement
  on the postgres host, contract-tested, driven under the lease before
  the overdue execution
- the fleet liveness verb: register_liveness_source takes the
  fleet-shaped LivenessRegistration argument (ADR-012 §6.6's same-verb
  wording) — the named-table form registers the embedder's own table
  (schema-ownership rule holds; idempotent; deregistration composes
  via a new engine-side unregister), the in-process form stays legal
  (instance-local protection, documented); Registration carries its
  kind; the verb is fallible (the fleet form's error surface)
- the protect callback's fleet posture recorded: single-node-only,
  instance-local consult remains, materialization is the embedder's
  duty — no new machinery
- the fleet sweep body: protect consult → reap → execute overdue
  (two-domain re-arbitration, fall-through delete across both tiers)
  → mark (pool + in-process sources; SQL liveness consulted at
  arbitration time, never enumerated) → stage → release; counts exact
  relative to the schedule
- tests: lease contention/reaping between two instances, the
  foreign-row GcRefuse, the exact-set reap, the embedder-table
  protection + correction flow + malformed and fleet:false
  rejections, the two-instance exact-count shape, and the delay race
  in its fleet form; the wave-6 inert-machinery construction test
  rewritten to the now-live fleet semantics

Verification: cargo test (default) green; cargo test --features
postgres green server-less (skipping) and against pglo-poc :15432;
cargo test --all-features green; cargo clippy --all-targets -D
warnings green (default, postgres, all-features); cargo fmt --check
green; cargo doc --no-deps clean (postgres-feature warnings
unchanged at the pre-existing 21).
2026-10-12 16:54:21 +00:00
glm-5.3-flash aa96f8b981 feat(tests): the conformance suite's pg-lo column — the LO-medium SKIP-posture column green (wave 5)
- tests/conformance/pg_lo_column.rs (new): the two pair-gated factories
  (DualTierMemPgLoFactory on all(mem, pg-lo) — the one-window-host rule's
  named test topology; DualTierPostgresPgLoFactory on
  all(postgres, pg-lo) — the consolidation posture, two schemas per open,
  carrying the dormancy row), a fresh dedicated database per open with
  the engine-owned schemas minted inside, teardown reaping tracked LOIDs
  (lo_unlink) then dropping the minted schemas then the database
  (WITH (FORCE)) with per-open drop-guard janitors for the abandoned
  paths, and the rows: the verbatim form-independent mirror (INV-1, INV-6,
  the two no-op abort shapes), the schedule-relative INV-2/3, the
  two-sweep exact counts over the full protection set across each
  factory's observed window host, the window-delay race, the
  holder-stages-only lease, INV-5's durable row, the three dispatch rows
  over the LO-medium placement oracle, the INV-1 extension (window-edge
  ranged reads + the planted-overclaim beyond-length clean failure), the
  virgin-store rows, and the dormancy row; structural isolation +
  panicking-row tests probing zero orphan residue (no kv-only rejection
  row — recorded; pg-lo is a large engine)
- the LO-isolation corollary carried in the engine task's recorded
  per-test-database shape (the C7 lesson): zero LO residue on the shared
  harness database is structural, so the engine suite's
  shared_harness_db_holds_zero_lo_residue gate stays green alongside the
  column under --all-features
- main.rs: the pg_lo_column gate (feature pg-lo, default-off) + the
  columns' doc paragraph
- README: the pg-lo rows table in §Columns beyond the reference set, the
  SKIP-posture note naming the second landed column and the per-factory
  feature-pair gating, current state = five columns
- store.rs: one mechanical gate fix — the PgOpts import was unused in the
  sqlite+pg-lo config (tripping clippy --features pg-lo -D warnings);
  the gate now names the configs that consume it

Verification (harness server live 2026-10-12): --all-features against the
server fully green (188 lib + 106 conformance + 4 git-interop; zero
LO/schema/database residue after the run); default test green (69/19/3);
--features "pg-lo,mem" and "postgres,pg-lo" green server-less
(skipping cleanly) and --features pg-lo alone; clippy -D warnings green
on default, pg-lo, pg-lo+mem, postgres+pg-lo, all-features; fmt --check
green; cargo doc --no-deps clean.
2026-10-12 08:47:55 +00:00
glm-5.3-flash 0fb05fce3a feat(tests): the conformance suite's postgres column — the first SKIP-posture column green (wave 4)
- The column (tests/conformance/postgres_column.rs, feature `postgres`,
  default-off): the factories are the alkstore pg-factory pattern reused —
  `dual-tier postgres+local` (kv = postgres + large = local at the
  column-declared threshold 1024, window delay `Duration::ZERO`) and
  `kv-only(postgres)` at 1024 (the rejection row's host); a fresh
  engine-owned schema per `open()` (unique per call, seeded per
  tag/pid/time — racing opens included), registry-tracked per instance,
  teardown `DROP SCHEMA IF EXISTS … CASCADE` over exactly the minted
  schemas + the vended temp roots (idempotent, owned, panicking-row-safe)
- The SKIP posture: connection settings ride the environment
  (ALKBLOBS_PG_HOST/PORT/USER/PASSWORD/DB), every runner gates behind a
  reachability probe, server-less runs skip cleanly (a skip is not a
  failure); the acceptance run is green against the harness server
  (dockerized `pglo-poc`, :15432 — the alkstore harness's same server)
- Rows: the form-independent reference rows mirror verbatim (INV-1,
  INV-6, the NoLivenessSources/ProtectFailed abort shapes, the kv-only
  rejection row); the sqlite column's durable-schedule sweep family
  mirrors (schedule-relative INV-2/INV-3 readings, the two-sweep exact
  counts over the full protection set, the race across the window
  delay, the holder-stages-only lease shape, INV-5 list correctness);
  the dispatch rows adapt the placement oracle by medium (independent-
  connection counts of the schema's rows vs the root's committed files)
  plus the virgin-store row; every row ADR-stamped, traced to the
  backlog
- Structural factory tests: fresh isolated opens (two opens mint
  distinct schemas and share nothing) and teardown against a panicking
  row (schemas really dropped, pg_namespace-verified)
- README amended: the postgres rows table in §Columns beyond the
  reference set; the column plan's SKIP-posture note names the landed
  column; current state (four columns, waves 2–4)

Verification: cargo test (default) 69/19/3 ok — the column compiles
out; cargo test --features postgres 102/36/3 ok against the harness
server (and green skipping server-less); cargo clippy --all-targets --
-D warnings green (default, postgres, all-features); cargo fmt --check
green; pg_namespace verified schema-clean after live runs.
2026-10-12 06:43:00 +00:00
glm-5.3-flash 97cdf682c4 docs(review): the wave-3 review gate — every gate check green
Reviewed the wave-3 commits (engine-sqlite, engine-sqlite-window,
store-sqlite-construction, store-sweep-durable-window,
suite-column-sqlite) against the cited ADR/spec text line by line:
ADR-003/007/008 §2, ADR-010 §2, ADR-012 §1/§5/§6.7, store-api.md,
implementation.md §Review gates — the engine-vs-contract conformance
(suite column green server-less in the default build; the window
family contract-tested per its applicability row; virgin-store
semantics incl. the no-tables-yet form; the size metadata-only
discipline proven index-riding), the durability posture (WAL +
synchronous=NORMAL verified at open; the single-writer ceiling posture,
not hedge), the durable sweep form vs ADR-008 §2/ADR-012 §6.7 (stage at
mark_end + window; next-sweep execution with raced execution-time
re-arbitration; schedule-relative exact counts; aborts stage and
execute nothing), the seam reduction (gc_window only; no pin rows, no
sweep-lock body, no EngineFleetState), and the blocking discipline
(all rusqlite in spawn_blocking). Named design points audited as
resolved; family conventions clean; no wave-4 amendments arise.

Inline fixes (review-of-record):
- src/gc.rs: the seam's window_stage doc retired the wave-1
  lazy-create hedge for the shipped constructor-at-open posture
  (a tableless database surfaces the engine error on stage;
  per-engine tolerances are each engine's recorded posture)
- tasks/engine-sqlite-window, store-sweep-durable-window,
  suite-column-sqlite: stray placeholder lines above the filled
  Notes/Summary removed (the wave-2 gate's same cleanup)
- tests/conformance/README.md: trailing newline added

Verification (all re-run green after the fixes):
- cargo test (default): 69 lib + 19 conformance + 3 git-interop
- cargo test --features mem / --all-features: 124 lib + 54
  conformance + 4 git-interop each
- cargo clippy --all-targets -- -D warnings (default + all-features)
- cargo fmt --check
- cargo doc --no-deps at the pre-existing warning baseline (26)

Wave 4 (postgres) decomposition is unblocked.
2026-10-12 05:22:29 +00:00
glm-5.3-flash 3f8e8158a7 feat(tests): the conformance suite's sqlite column — the durable-schedule SQL-backed column green (wave 3)
- The first SQL-backed column: the default-build production shape
  (kv = sqlite + large = local, feature sqlite default-on) runs the
  form-independent reference rows verbatim (INV-1, INV-6, the
  NoLivenessSources/ProtectFailed abort shapes, the kv-only rejection
  row against kv-only(sqlite)) and grows the durable-schedule sweep
  rows — exact counts asserted relative to the staged schedule
  (ADR-012 §6.7): two-sweep counts over the full protection set, the
  race across the window delay (a re-put landing during the window
  survives the executing sweep), the holder-stages-only lease shape,
  INV-5 through durable-schedule outcomes, and the schedule-relative
  INV-2/INV-3 readings
- Dispatch rows mirror the local column's family with the placement
  oracle adapted by medium: the sqlite file's pool/window rows vs the
  root's committed files; virgin-store reads as no-ops on a fresh file
  (the no-tables-yet tolerance engine-instrumented, this row its
  facade form)
- Factories: dual-tier sqlite+local and kv-only(sqlite), instance-
  tracked temp sites (fresh sqlite file + private root per open;
  idempotent panicking-row-safe teardown), the column-tuned threshold
  and the test window-delay tuning (Duration::ZERO — execute-on-next-
  sweep); the module is cfg(feature = "sqlite"), default-on — the
  column runs in every default cargo test, server-less, never skips
- Shared fixtures moved to rows.rs (committed_file_count,
  staging_file_count, slice_digest, LatchProtect pub(crate)) so the
  columns share them without the mem gate
- README: the schedule-relative reading for SQL-backed columns
  recorded (citing ADR-012 §6.7), the sqlite rows table inventory,
  Current state (three columns)

Verification: cargo test (default) green — 69 lib + 19 conformance +
3 git-interop; cargo test --features mem green (124 lib + 54
conformance); cargo check --all-features --tests green; cargo clippy
--all-targets -- -D warnings green; cargo fmt --check green.
2026-10-12 05:14:58 +00:00
glm-5.3-flash 45c456989f feat(tests): the conformance suite's local column — the dual-tier dispatch-coverage shape green (wave 2)
- tests/conformance/local_column.rs: the first dual-tier column, run
  against the kv = mem + large = local factory (ADR-012 §6.3) — fresh
  temp-root store per open, per-instance tracked roots, idempotent
  teardown safe against abandoned/panicking rows (structural tests
  included); never skips (mem-gated — the dual-tier constructor rides
  feature mem until wave 3 provides an ungated kv engine)
- the reference INV row set (rows.rs) mirrored against the dual-tier
  factory at a column-declared tuned threshold (1024), so the shared
  matrix and race fixtures exercise both tiers' bodies (INV-7)
- dispatch rows grown: pure-function routing across put paths and
  re-puts with an on-disk placement oracle (tier residency is
  facade-invisible; with kv = mem the medium is the oracle), threshold
  boundary legs at the tuned and shipped-default thresholds with the
  constructor-tuned re-route leg, and fall-through per op with
  both-tier miss shapes (ADR-003/ADR-012 §6.1/§6.3/§6.5)
- local-specific rows: on-disk stage-hygiene exact counts over both
  put paths (the real stage form, INV-3), pread windows over committed
  files with slice digests verified independently (ADR-006/ADR-010),
  virgin-store no-ops on a fresh root, and exact sweep counts over a
  both-tiers pool (INV-4/INV-5's both-tiers form)
- rows.rs shared fixtures made pub(crate); README records the column's
  row inventory (§Columns beyond the reference set), the declared-
  threshold posture, and the new current state
- stat-as-stat rides the mirrored INV-6 row's over-threshold legs;
  the Drop-cancellation hygiene form stays per-engine (recorded)

Verification: cargo test (default) green; cargo test --features mem
green (97 lib + 37 conformance + 4 git-interop); cargo test
--all-features green; clippy --all-targets -D warnings green in both
feature shapes (default + all-features); cargo fmt --check green;
cargo doc --no-deps shows only the pre-existing warning class
2026-10-11 23:30:31 +00:00
glm-5.3-flash f86e20a217 feat(tests): the conformance suite's mem column — the reference row set green (wave 2)
- rows.rs: the reference row set (INV-1…6 + two constructor-mode rows),
  factory-generic and engine-uniform, every row ADR-stamped and traced
  to the backlog: round-trips over the content matrix on both put
  paths, dedup (same/cross-path), stage hygiene (both paths, both
  injectable failure modes, kv-degenerate residue via sweep outcomes),
  sweep safety (full-protection-set happy shape, all three
  GcAbortCause abort shapes incl. the single-flight SweeperLock lease,
  the sweep-vs-pinned-put race), list correctness through exact sweep
  outcomes only, stat discipline, mem-only posture, and kv-only
  put-time rejection (threshold discovered by free probes; immediate/
  mid-stream rejections and at-threshold-lands legs)
- mem_column.rs: the column's factories — mem-only (reference host)
  and kv-only(mem) at a declared threshold — fresh isolated opens,
  no-op idempotent teardown; structural factory-contract tests cover
  isolation and teardown against a panicking row
- README: the reference row set recorded (INV-7's basis — what other
  columns mirror), the row-lifecycle convention, column plan and
  current state updated
- task suite-column-mem: status completed, notes and summary filled

Verification: cargo test --features mem (97 lib + 18 conformance +
4 git-interop), cargo test (default), cargo test --all-features,
clippy --all-features --all-targets -D warnings, fmt --check, and
cargo doc --no-deps — all green
2026-10-11 23:19:59 +00:00
glm-5.3-flash 539dabcbf7 feat(store): the put seam — two internal paths, the three numbered rules, Batch, kv-only rejection
- `put(len: Option<u64>, stream: impl AsyncRead + Unpin + Send) -> (Key, Pin)`:
  known-length one-pass flow; unknown-length buffer-to-threshold flow with
  the mid-stream fresh-stage flush (ADR-003 option (d), three numbered rules:
  flush-and-continue, derivation over the eventual stored artifact as a
  whole via buffer form and StagingCursor read-back form, zero residue on
  stream error)
- staged-put seam amended (operator sign-off): `put_staged()` keyless
  handout, `StagingCursor::commit(self, key)` publishes under the
  store-core-resolved key — the canonical key completes at stream end and
  the wave-1 handout shape could not express the commit-rename flow
- pin-before-publish rides the arbitration lock on both paths and both
  tiers; dedup re-puts refcount the existing entry
- Batch seam: `Store::batch()` + `put_in_batch()`, members publish pin-
  before-publish, group pins drop together on `Batch::commit` (new public
  verb) or drop
- kv-only rejection (ADR-012 §6.2): known-length over-threshold rejects
  immediately (stream never read), unknown-length at mid-stream overflow;
  zero residue; error carrier `Io(String)` (named design point)
- declared-len mismatch rejects `Verification` zero-residue (named design
  point); stream shape generic-no-dyn (named design point)
- incremental BlobHasher (pinned byte-equal to Algorithm::derive);
  AnyStaging cursor dispatch; git-interop put-path leg against
  git hash-object; eleven put-path behavior tests

Verification: cargo test (default/--features mem/--all-features) green;
clippy --all-targets -D warnings green in all three feature shapes;
cargo fmt --check green; cargo doc --no-deps at the 24-warning baseline.
2026-10-11 23:00:14 +00:00
glm-5.3-flash 532adfa707 feat(store): the Store facade — constructor modes, size-threshold dispatch, the factory binding
The wave-2 facade skeleton and routing (tasks/store-construction.md):
the public surface consumers program against, with the ops methods
still to land against it in store-read-paths/gc-protocol/store-put-paths.

- src/store.rs — the public `Store` type (engine-blind, ADR-007/008/
  010) over crate-internal tier enums (`KvEngine`{mem}, `LargeEngine`{
  local}): the engine-representation design point decided as concrete
  + enum dispatch, generic rejected (pub(crate) engines, no dyn);
  the three constructor modes as named constructors — `mem_only`,
  `kv_only_mem`, `dual_tier_mem_local` (the ADR-012 §6.3
  dispatch-coverage shape) — with `StoreMode` introspection; the
  write-side routing seam (`tier_for`), the read-side fall-through
  order (`kv()` then `large()`, ADR-012 §6.1), and the `GcHome`
  GC-state field; the ADR-012 §3 fleet declaration ruled deferred to
  the engine waves (nothing fleet-valid is constructible yet)
- src/dispatch.rs — the pure routing function (`route`, at-or-below
  → kv), `DEFAULT_DISPATCH_THRESHOLD` (128 KiB) exported at the
  crate root, boundary-value unit tests (exactly-at-threshold,
  degenerate tunings, purity)
- src/gc.rs — `GcHome`: the store-instance GC-state home the
  gc-protocol task fills (in-process; fleet state stays on the
  engine-state seam per ADR-010 §2/ADR-012 §4)
- tests/conformance — the wave-2 binding made as anticipated: the
  factory's `Store` associated type collapsed into the concrete
  `alkblobs::Store` (`open` vends it directly), recorded in
  factory.rs + README; the wave-1 mock probe retired, replaced by
  mem-gated binding demo factories (binding.rs) over both
  constructible shapes

Verification: `cargo test` (default), `cargo test --features mem`,
`cargo test --all-features` green (41/53/53 unit + conformance
targets green in all three shapes); `cargo clippy --all-targets
-- -D warnings` green in all three feature shapes; `cargo fmt
--check` green; `cargo doc --no-deps` adds no warnings beyond the
pre-existing private-intra-doc-links class.
2026-10-11 22:18:32 +00:00
glm-5.3-flash 327b952e4d feat(tests): the conformance suite's home — conventions, invariant backlog, harness skeleton (wave 1)
- tests/conformance/README.md: the convention doc — row naming (property-
  stated names, engine dimension is the column), the Contract stamp:
  format (the alkstore ADR-017 §4.2 convention adapted), the one-
  normative-owner-per-property rule, the factory contract (fresh
  isolated instance per open, idempotent teardown, safe over an
  abandoned instance), the SKIP posture (SQL-attached columns skip
  cleanly server-less; acceptance requires green against the server),
  the invariant backlog (the seven store-api.md §Invariants registered
  as the rows-to-grow table with pinning citations), and the mem-first
  column plan (mem is the contract-reference engine, ADR-011 §2)
- harness skeleton, compile-able with zero rows: StoreFactory (fresh
  + isolated + idempotent-teardown contract; the Store associated type
  is wave 2's binding point for the facade type), stamp.rs (the
  marker + convention anchor), backlog.rs (in-code registry with a
  traceability gate asserting INV-1..7 mirror §Invariants in order)
- no engine-specific code; no dependencies added

Verification: cargo test (33 passed across lib + 3 targets),
cargo clippy --all-targets -- -D warnings, cargo fmt --check
2026-10-11 18:44:04 +00:00
glm-5.3-flash fef05b4ec5 feat(keys): the content-address layer — canonical hash derivation and key encoding (ADR-002)
Wave 1 task core-hashing-keys: the crate's declared one-way door,
implemented byte-exact to ADR-002.

- src/hashing.rs: Algorithm (exactly GitBlobSha256 canonical /
  GitBlobSha1 tolerated; BLAKE3 absent), Digest (known-length
  derivation H("blob <len>\0" + content) as primary constructor;
  from_git_oid_hex interop constructor, lowercase-only acceptance),
  and the hashing::registry constants (0x01/0x02, 0x00 reserved; new
  algorithm = new ADR)
- src/keys.rs: typed Key wrapper; as_bytes/from_bytes are the only
  backend-boundary conversions; 1 algorithm byte + digest bytes
  (33/21 total); rejects-never-guesses validation -> Error::KeyInvalid
- tests/git_interop.rs: the load-bearing test — byte-exact derivation
  against the `git hash-object` CLI, both algorithms, small and
  75-KiB content; external-oid round-trip into pool keys; both oid
  formats coexisting in one flat pool
- named design point (oid hex policy): lowercase-only acceptance,
  recorded in the task Notes and on from_git_oid_hex

Verified: cargo test (15 passed), cargo clippy --all-targets -- -D
warnings, cargo fmt --check, cargo test --all-features — all green.
2026-10-11 18:20:12 +00:00