Files
alkstore/docs/architecture/decisions/005-dependency-ownership.md
T
glm-5.3-flash 8e68b44194 ADR-013: fold the forked substrate into alkstore-sqlite — no fourth crate
Operator review of ADR-012's fork design re-litigated §1's crate
identity. alkstore-substrate misdescribed what the code is (unpublished,
path-dep-only, one consumer, SQLite-only — not a family-wide substrate);
the mechanical-diff hope was gone at fork time regardless (port deltas,
renames, re-derived half); and the alksocks F-1 lesson applies — a
vendored region under a second, weaker instruction set is a defect seam.
The fork folds into alkstore-sqlite as a bounded module subtree
(src/substrate/); ADR-012 §3–§6 retained verbatim, §2 retained with its
enforcement re-sited from the crate graph to diff fence + review +
contract-suite equivalence pins. OQ-11 item (1) dissolved.
2026-10-05 11:56:01 +00:00

84 lines
4.7 KiB
Markdown

# 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 engine crate (the in-tree substrate module — [ADR-013]), 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 vendors honker-core's machinery into the
tree — carried in-tree inside the engine crate per [ADR-013], not
as a 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](003-sqlite-driver.md), [ADR-004](004-postgres-driver.md) —
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