Files
alkstore/docs/architecture/decisions/005-dependency-ownership.md
T
glm-5.3-flash 2949612e2c ADR-012: forked-substrate design — contract-blind boundary, fidelity posture, port deltas
Follow-through on OQ-06/ADR-011: pin the fork's structural decisions
(alkstore-substrate as a vendored path-dep crate, contract-blind API
boundary with contract formulas computed engine-side and pinned
equivalent by the contract suite, keep-the-kept-half API fidelity for
cheap cherry-picks, the W-1/W-2/dead-man's-switch/W-4 port deltas
decided per item, bootstrap re-keying off error-string matching, no
rename migration, deliberate upstream tracking).

Consistency sweep across the doc set for the fork: annotate ADR-003/
005/009/010 and core-contract for superseded ownership facts, fix
schedule-storage table naming (ADR-009 §5, queues.md), re-key ADR-010
§6's notifications hygiene to the at-attach cap the fork scope
realizes, add OQ-11 (scaffold-time residue), and complete both ADR
indexes. Independent review: 0 critical, warnings addressed.
2026-10-05 05:00:55 +00:00

4.5 KiB

ADR-005: Dependency ownership — published libraries by default, named fork triggers

Status

Accepted (posture); fork triggers are live assessments tracked in OQ-06

Context

The crate's reactive machinery sits on third-party work: honker (SQLite side) and, conceptually, pgboss-rs (Postgres queue family). Neither is adopted-by-adjacency — per guiding principle 3, ownership of each subsystem is a deliberate per-question decision. The workspace precedent is the targeted fork (alksocks' fast-socks5 extraction), but a fork is expensive (especially when the forked code is sync and the family standard is tokio — a fork of honker-rs is already a serious port).

Two POCs (2026-10-04) measured the relevant postures per subsystem; each carries its own record. This ADR fixes the default calculus and the per-subsystem resolutions so Phase 1 design work starts from stable ground.

Decision

Default posture: consume published libraries. Fork or vendor only when a named trigger fires. Per subsystem:

Subsystem Posture Notes
honker-core (SQLite engine machinery) published library, honker-core = 0.5 — trigger fired 2026-10-05: forked per [ADR-011] Fork trigger: the Phase 1 quality read of the watcher/transactional core finds a defect, OR a needed change upstream won't take. OQ-06 tracked the read; the read fired the trigger (published 0.5.0 carries the unreleased-fix-train defect class + ADR-010's queue depth requires engine-owned queue SQL in any posture).
rusqlite published, riding honker-core's pin pin ours after the fork Post-fork ([ADR-011]), the rusqlite generation is moved deliberately in our own substrate crate, not by upstream releases ([ADR-003]'s annotated negative consequence; [ADR-012] ports the substrate onto the family standard).
tokio-postgres + deadpool-postgres published library, as-is Clean, zero conflicts, actively maintained (POC #2).
postgres-notify not adopted (derive-not-adopt) Lazy reconnect, connect_script skipped at initial connect, unquoted-identifier LISTENs, single maintainer. Hand-rolled forwarder instead ([ADR-004]). Fallback if upstream improves materially.
pg-boss queue machinery (pgboss-rs / node pg-boss) re-derived on our driver; schema family as design reference only pgboss-rs brings sqlx (second driver per binary) and has no LISTEN/NOTIFY (verified); the push half is ours either way, so queue-machinery reuse value is the honest comparison point and it loses on that arithmetic. Semantics depth: [queues.md], OQ-05.
honker-rs interface shape design reference, not a dependency Sync-only (no tokio); the surface is prior art for contract pinning ([ADR-006]), not code to ship.

If any fork fires, forking is normal work we own (license/provenance recorded per AGENTS.md §3 at adoption time) — it is not an exception to this posture.

Consequences

Positive

  • Zero vendored code in the tree by default; upgrades are cargo update work, not patch-management work. (Exception now live: the [ADR-011] fork is a vendored family crate — the named trigger, not a posture change.)
  • The fork triggers are concrete and named before the quality read, so the read produces a decision, not a debate.
  • Per-subsystem votes are recorded with evidence, so no future discussion re-litigates from scratch.

Negative

  • honker-core 0.5 remains alpha-quality software per its own README in the link graph; the quality read (OQ-06) is the mitigation gate. (Resolved 2026-10-05: the read fired the trigger — [ADR-011]. This row's negative consequence is retired with it; the "zero vendored code" positive consequence now carries ADR-011's named exception.)
  • The pg queue machinery is written by us — the pg-boss family's battle-tested edge cases must be re-earned by design + tests ([queues.md]).

References

  • docs/research/poc-sqlite-posture-findings.md §"What feeds where" (posture votes), docs/research/poc-pg-posture-findings.md §"Dependency postures".
  • OQ-ST-05, OQ-ST-06 (docs/research/phase-0.md) — the resolution records.
  • ADR-003, ADR-004 — the per-engine driver decisions applying this posture.
  • OQ-06 (docs/architecture/open-questions.md) — the quality-read tracker (resolved: [ADR-011], designed per [ADR-012]). [ADR-003]: 003-sqlite-driver.md [ADR-004]: 004-postgres-driver.md [ADR-006]: 006-wake-and-delivery-contract.md [ADR-011]: 011-sqlite-substrate-fork.md [ADR-012]: 012-forked-substrate-design.md [queues.md]: ../queues.md