Knotrel Docs

External source-of-truth integration contract

Status: Proposed (Candidate Design for Review — Awaiting Maintainer Approval).

Cross-reference: Normative Integration Contract.

Context

Knotrel v0.1.0 provides an in-memory dynamic connectivity accelerator for a single undirected graph. All mutations (POST /v1/operations, POST /v1/batch) apply directly to memory. State is strictly volatile: restart loses all graph data.

In production architectures, an external database or transactional event stream remains the authoritative source of truth. Knotrel must serve as a derived read accelerator. To prevent data corruption and divergence, Knotrel must never claim that applying an update in memory makes it durable in the authoritative source. Furthermore, untracked direct client writes must not bypass source ordering, and process restart must trigger a structured rebuild from the external source rather than presenting an empty graph as synchronized.

Feature 0.2.1 establishes the architectural contract for v0.2.0 (Integration & Graph Loading) prior to any runtime implementation.

Decision

1. Two Operating Modes

2. Identity, Instance Scoping, and Fencing

3. Synchronization Protocol ($S \to \text{Catch-up} \to B$)

4. Readiness and Freshness

5. Roadmap Decisions D1–D6 Resolution

Consequences & Compatibility

Deterministic Testing and Handoff

The contract specifies 34 deterministic traces (TR-01 through TR-34) covering happy paths, stale instance IDs, duplicate events, transient out-of-order sequences, worker timeouts with controlled interleavings, replacement during catch-up, fenced feeders, epoch changes, history expiration, process restart, verification-only barriers, progress-event retries, lease expiry vs synchronization proof, session takeovers during build, predecessor mismatches, hash collisions with 256-byte cursors, partial batch global sequences, declared gaps, equal barrier sequences with mismatching positions (TR-15), older superseded barriers (TR-24), rejected barriers preserving server states (TR-25), uncommitted event retry vs committed duplicate conflict (TR-26), prohibition of progress on failed required mutations (TR-27), import precondition failures vs ownership fencing (TR-28), exact barrier matches while uninitialized (TR-29), barriers during initial baseline loading (TR-30), barriers during replacement loading (TR-31), retained committed sequences with different event IDs (TR-32), retained event IDs reused at new sequences (TR-33), and evicted history boundaries (TR-34).

Feature 0.2.2 is handed an exact candidate interface definition for bounded atomic HTTP import (POST /v1/feeder/import) with preconditions, limits, and atomic publication invariants.