Skip to content

v3.7.1 — Phase 5 Part 5: Configurable Consistency Levels + Isolated Test Runner

Choose a tag to compare

@Jovancoding Jovancoding released this 25 Feb 16:25
· 351 commits to main since this release
v3.7.1 — Phase 5 Part 5: Configurable Consistency Levels + Isolated Test Runner
## What's New

### Configurable Consistency Levels
A `ConsistentBackend` wrapper that enforces a `ConsistencyLevel` on any `BlackboardBackend` — no changes to existing backends required.

```typescript
import { ConsistentBackend, MemoryBackend } from 'network-ai';

const backend = new ConsistentBackend(new MemoryBackend(), 'session');
const board = orchestrator.getBlackboard('shared', { backend });

// This process always reads its own writes immediately
board.write('task', 'processing', 'agent-1');
board.read('task'); // 'processing' — guaranteed, even before backend sync

Three Consistency Modes

Mode Behaviour
eventual Reads/writes go directly to the backend — no session overhead
session Read-your-writes — writes cached locally so the current process always sees its own latest writes; call clearSession() to flush the cache
strong Synchronous durability — writeAsync() calls flush() on any FlushableBackend (e.g. RedisBackend) after each write before returning

New Exports

Export Description
ConsistentBackend Wraps any BlackboardBackend with consistency semantics
ConsistencyLevel 'eventual' | 'session' | 'strong'
FlushableBackend Interface for backends with explicit flush(): Promise<void>
isFlushable(backend) Type guard — true if backend implements FlushableBackend

Isolated Test Runner

run-tests.ts replaces the old chained && command in test:all. Each suite now runs as an isolated child process (spawnSync + --max-old-space-size=512), fully cleaned up before the next starts — no more VS Code terminal crashes on full test runs.

npm run test:all   # or: npx ts-node run-tests.ts

Testing

  • 87 new tests (test-phase5e.ts) — all three modes, session overlay/delete/listKeys/snapshot, strong flush integration, TTL, instance independence, export verification
  • 847 total passing tests

No Breaking Changes

All existing backends (FileBackend, MemoryBackend, RedisBackend, CrdtBackend) are unchanged. ConsistentBackend is opt-in.

Full Changelog

See CHANGELOG.md for details.