Files
alkstore/docs/architecture
glm-5.3-flash 029f885aa1 general review 004 (pre-release, whole workspace): one HIGH slot-poisoning fix, two contract-observable divergence fixes, robustness + doc corrections — all gates re-run green
- sqlite scheduler tick: a failed COMMIT (or ROLLBACK) left the connection
  released with a stuck-open transaction, wedging the writer slot forever —
  the one commit site missing the drop-+-reopen-replenish arm; tick now
  takes the conn by value with a poisoned disposition (drop + replenish),
  the commit-fault seam reaches the tick, and
  failed_tick_commit_replenishes_the_writer_slot pins the arm
- pg save_offset_tx stored GREATEST($3,0) where the wave-8 gate's
  negative-seed fix (raw seed, ADR-023 §2 2026-10-11 annotation) covered
  only the auto-commit form; mem's merged in-tx read clamped a staged
  negative seed against a phantom zero; both fixed and the tx-form
  totality pinned by a new stamped suite leg (in_tx_reads_see_own_writes)
  green on all three columns vs the live harness server
- pg: a failed forwarder register leaked the channel refcount forever
  (no receiver to drop it) — listen/spawn_bridge now unregister on the
  register error, mirroring the subscribe-failure arm; register doc
  corrected to put the failure disposition at the call site
- pg forwarder: nine poisoned-mutex expect() panics converted to the
  mem crate's into_inner recovery idiom (no-expect-outside-tests rule)
- core encode_payload: a deeply-nested Value aborted the process in
  serde_json's unguarded serializer recursion and the fuzz pin blessed
  storing bytes no decoder could read back; encode now rejects nesting
  past 127 containers (the empirically-verified decode limit) with typed
  Codec — decode-aligned boundary pins added to the fuzz invariant and
  value_type_tests, applied pre-publish within the open class-1 window
- scheduler sleep deadlines: Instant + Duration overflow caps (MAX_SLEEP_S,
  tick-and-resleep) on all three engines for far-future boundaries;
  sqlite tick claim stamp now saturating_add
- docs read true again: Error::Closed scope (stream try_recv arm),
  validation whitespace wording, sqlite lib.rs phantom durability knobs,
  pg lock.rs honest autocommit wording, mem tx/stream merge + wake-
  granularity wording; wakes.rs stale allow(dead_code) removed
- tests: value_type_tests exercised its own map_err instead of the
  function under test (fixed); unwrap_or_default reference encodes
  panic with cause
- docs/reviews/004-pre-release-general-review.md records nine fixed +
  sixteen parked findings (sqlite seam panic-safety armor, watcher
  post-death-subscribe hang + initial-stat self-kill, pg forwarder
  TOCTOU/hang/diagnosability, pg BIGINT server-side stamp overflow, mem
  growth/outbox notes, pg identifier-truncation doc note, smaller) and
  two false positives caught on verification; implementation.md
  review-rounds entry + core-contract backlog rows updated
- gates: build, workspace tests (sqlite 194, core 27, suite legs new),
  full live pg column 127+25+9, clippy -D warnings, fmt, fuzz replay
  6/6, wasm32 check, doc gate -D warnings — all green
2026-10-11 09:25:59 +00:00
..

status, last_updated
status last_updated
stable 2026-10-11 (the wave-8 review gate passed — pre-release freeze: the release-facing spec set flipped stable, Current State refreshed through wave 8; the class-1 window's dispositions complete, the window terminates at first publish)

alkstore — Architecture

Architecture documentation for the alkstore project: one reactive store interface (notify, streams, queues, locks, scheduler, outbox) over SQLite, Postgres, and the in-process mem engine, with each engine native underneath (see overview.md).

Current State

Phase 1 (Implementation) — waves 1–8 implemented and reviewed; the pre-release gate passed (2026-10-11). Phase 0 is complete (docs/research/phase-0.md): both POCs ran and passed, the scope inventory is confirmed, and the crate split, drivers, and ownership postures are decided. All open questions are resolved (through ADR-023), and the engine specs flipped stable at the wave-5 review gate, the mem spec at wave 6. Waves 1–7 (core, substrate fork, SQLite engine, Postgres engine, contract suite, mem engine, fuzzing) are implemented and reviewed; wave 8 (release readiness: crate docs, the deployment matrix's final pass, the README, publish prep — with N-1's growth-posture acceptance, review 003 Findings 2–3, the flake investigation, and the class-1 window's last dispositions riding it) passed its review gate on 2026-10-11. ADR-024 adopted the mem engine as a third engine (2026-10-10, ADR-024). The class-1 amend-in-place window (ADR-017 §2) dispositions are complete; the window terminates permanently at the first cargo publish of alkstore — the gate's blessing covers publishing.

Architecture Documents

Doc Status Purpose Key OQs
overview.md stable Crate family, feature surface, non-goals, evidence base —
core-contract.md stable The unified trait surface, delivery guarantees, tx seam OQ-10 (resolved)
engine-sqlite.md stable SQLite engine: forked-substrate/rusqlite mapping OQ-06 (resolved), OQ-12 (resolved), OQ-13 (resolved)
engine-postgres.md stable Postgres engine: tokio-postgres/LISTEN mapping OQ-08 (resolved), OQ-12 (resolved), OQ-13 (resolved)
engine-mem.md stable Mem engine: in-process ephemeral mapping of the contract (ADR-024) —
queues.md stable Queue/scheduler/outbox semantics depth (resolved: ADR-009/ADR-010) OQ-05 (resolved), OQ-09 (resolved), OQ-06 (resolved)
deployment.md stable Host semantics, connection budgets, knobs, matrix OQ-08 (resolved)
open-questions.md draft OQ tracker (promoted from OQ-ST register) — the register's own lifecycle; the question set is closed —

Architecture Decision Records

ADR Title Status
001 Reactive-core crate + per-engine crates Accepted
002 Feature scope — inventory-confirmed surface Accepted
003 SQLite engine — rusqlite + honker-core lineage, bridged seam (ownership: ADR-011) Accepted
004 Postgres engine — tokio-postgres + deadpool, hand-rolled LISTEN Accepted
005 Published libraries by default, named fork triggers Accepted
006 Wake contract — opaque wake + re-read; notify-vs-streams split Accepted
007 Transactional seam — caller-held TxHandle, *_tx methods Accepted
008 Contract v1 surface pinning — surface partition, TxHandle shape, wake type, reserved strings, error taxonomy Accepted
009 Scheduler collapse — queues + schedule()/run_schedules, @every-only v1, boundary guarantee row Accepted
010 Queue semantics depth — visibility/renewal, backoff curve, dead-letter, no-stranded-rows sweep, schema layout Accepted
011 SQLite substrate — fork honker-core into owned code Accepted
012 Forked substrate design — contract-blind boundary, fidelity posture, port deltas Accepted
013 Fold the forked substrate into alkstore-sqlite — no fourth crate Accepted
014 Transactional outbox enqueue — outbox_enqueue_tx on the TxHandle trait Accepted
015 Streams depth — carried-metadata keys, global-FIFO ordering row, StreamEvent shape, publish_with_key_tx, trim_to Accepted
016 Deployment honesty — no runtime capability surface; compile-time engine identity + documented matrix Accepted
017 Contract versioning — core crate's semver is the contract version; change classes, pairing carriers, lockstep duties Accepted
018 Substrate provenance register and cherry-pick procedure — PROVENANCE.md in-tree, per-delta category-tagged entries, five-step adoption discipline Accepted
019 Mechanism-handle surfaces — handle traits (Queue/StreamHandle/Outbox/Lock/JobHandle), Job/Schedule shapes, worker_id identity, core StopToken Accepted
020 Enqueue-option semantics — delay/run_at precedence, relative expires, scheduler stamp source, serde_json payload encoding Accepted
021 Third review round — tx-read methods on TxHandle, Job.claimed_at, schedule() queue-argument validation, drop = rollback, receiver close/error arms Accepted
022 Contract-suite layout — shared internal suite crate, properties parameterized over a store factory (discharges ADR-017 §4.2's deferral) Accepted
023 Fourth review round — encode_payload typed (Codec), numeric-argument domains by kind (extents clamp empty, durations reject, boundaries total), plain-path SQLite open (URI flag dropped), watcher cadence 1 ms default + SqliteOpts knob Accepted
024 The mem engine — a third engine (alkstore-mem), full contract v1, honest-ephemeral posture (collapses + amends ADR-001 §4's deferral) Accepted

Open Questions

Tracked in open-questions.md (OQ-01..NN; the Phase 0 register's OQ-ST-01..08 promote one-to-one — OQ-NN mirrors OQ-ST-NN — with new Phase 1 questions appended after). The open question set is empty — all thirteen OQs are resolved (2026-10-04 through 2026-10-06, ADR-001 through ADR-018).

Resolved (kept with resolutions): OQ-01 (feature scope), OQ-02 (crate split), OQ-03 (drivers), OQ-07 (extension surface cut), OQ-04 (contract v1 pinning — ADR-008), OQ-09 (scheduler collapse — ADR-009; scheduler guarantee row pinned), OQ-05 (queue semantics depth — ADR-010), OQ-06 (honker-core quality read — fork fired, ADR-011), OQ-08 (capability-surface shape — none, by default ever; ADR-016), OQ-13 (transactional outbox enqueue shape — ADR-014), OQ-12 (streams depth — ADR-015), OQ-10 (contract versioning — ADR-017), OQ-11 (fork follow-through — provenance register + cherry-pick procedure, ADR-018).

No deferred OQs. The question set closed with OQ-11 (2026-10-06); the 2026-10-06 second review round, the 2026-10-07 third review round, and the 2026-10-08 fourth review round (the waves-1–2 general review) resolved their findings directly as ADR-019/ADR-020 and ADR-021 and ADR-023 respectively, rather than as new OQs. Phase 1 moves to architecture review closure and the implementation-phase gates.

Document Lifecycle

Status Meaning Transitions
draft Under active development; may change significantly → reviewed when the doc's OQs are resolved
reviewed Architecture final; implementation may begin → stable when implementation verified
stable Locked; changes need review, may warrant an ADR → deprecated when superseded
deprecated Superseded; kept for reference Removed when unreferenced

All spec documents carry YAML frontmatter (status, last_updated); ADRs carry a ## Status section (Accepted/Proposed/Superseded).

Provenance of decisions

Phase 1 inherits its decisions from Phase 0's evidence base — every Accepted ADR above cites its POC findings and register record. The research documents remain the deep background:

  • docs/research/phase-0.md — vision, prior art, OQ-ST register, convergence.
  • docs/research/consumer-inventory.md — per-feature scope evidence.
  • docs/research/poc-sqlite-posture-findings.md / docs/research/poc-pg-posture-findings.md — measured ground.