Skip to main content
Version: v0.9.0a2
Spec

Spec-18-Conformance-and-Failure-Modes

4 min readSpec contributor · Conformance testerDraft · v0.9.0aN

What this spec defines

Acceptance scenarios that exercise Stigmem's safety behavior under federation partitions, malicious peer input, partial replication failure, and replay attempts.

Extraction status

This file contains the ADR-010 prose extraction for failure-mode acceptance scenarios. It defines scenario intent and expected outcomes. Concrete test harness layout and fixture implementation remain implementation details.

Legacy version labels from archived source material are normalized to the current v0.9.0a1 protocol line here. Historical wording remains available in spec/archive/evolution/ and spec/EVOLUTION.md.

Conformance gate

A conforming federation-capable node MUST demonstrate the scenarios in this spec or equivalent tests.

Equivalent tests may use different fixture names, ports, or process orchestration, but MUST preserve the setup, fault, and expected safety outcomes. Failure-mode tests SHOULD run against the same public HTTP and federation surfaces that clients use. White-box shortcuts MAY be used only to simulate network partitions, process crashes, clock state, or replay caches.

Split-brain

Setup. Two nodes, A and B, are federated with scope=public. Both begin with the same public facts.

Scenario.

  1. Cut network connectivity between A and B.
  2. Write fact F_a to node A for a shared entity/relation/scope.
  3. Write conflicting fact F_b to node B for the same entity/relation/scope.
  4. Maintain the partition long enough for both nodes to continue serving local reads and writes.
  5. Restore connectivity.
  6. Allow replication to complete.

Expected outcomes.

Both facts retained

Both nodes retain both facts.

Contradiction detected

At least the node that ingests the second conflicting fact detects it.

Conflict queryable

Conflict query APIs expose the unresolved conflict.

Both returned

Fact queries with contradicted facts included return both facts with contradiction metadata.

No silent discard

No fact is silently discarded.

Malicious peer

Setup. Two nodes, A and B, are federated. A malicious process obtains or forges input for the B-to-A direction.

Scenario.

  1. The malicious process attempts to push a fact whose scope exceeds B's peer declaration.
  2. The malicious process attempts to push a fact whose source is outside B's declared namespace or authority.
  3. The malicious process replays a previously observed token within the active replay window.

Expected outcomes.

Over-scope rejected

Source-forgery rejected

In-window replay rejected

Audit captures reason

Rejections produce audit events with enough detail to diagnose.

Store uncorrupted

The receiving fact store is not corrupted by rejected input.

Partial replication failure

Setup. Node A pulls from node B. Node B has a larger public fact set than A has already replicated. A has persisted a cursor for the last fully accepted page.

Scenario.

  1. B fails after returning a later page but before A persists the cursor for that page.
  2. A attempts another pull while B is unreachable.
  3. A continues serving local reads and writes.
  4. B restarts.
  5. A's next pull cycle resumes.

Expected outcomes.

No crash on unavailability

A does not crash while B is unavailable.

Local reads/writes available

Resume from persisted cursor

Not from the beginning and not from an uncommitted future cursor.

No duplicates on re-ingest

Convergence on resume

Final convergence includes all eligible facts.

Replay attack

Setup. Two nodes, A and B, are federated. A valid peer token is observed by an attacker.

Scenario.

  1. The token is used legitimately once.
  2. The same token is replayed within the active nonce window.
  3. A new token is generated with the same nonce.
  4. A token is submitted after expiry.

Expected outcomes.

First use succeeds

Immediate replay fails

With a nonce-replay error.

Same-nonce reuse fails

A different token carrying the same nonce also fails.

Expired token fails

With an expiry error.

Failures audited

Replay and expiry failures are audited.

Out of scope

This spec does not define:

Performance/soak thresholds

Adapter ABI conformance vectors

Lint conformance vectors

Implementation fixture names

CI job topology

Experimental feature gates