Introduce a wal abstraction: local append, witness ack, S3 as source of truth #46
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 288 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #46"
general
weight: 0.35
justinsb
This PR implements the write-ahead log (WAL) abstraction: local append-first durability, witness acknowledgment via a WAL buffer service, and S3 as the ultimate source of truth.
Summary of Changes
1. Protocol (
proto/wal.proto&pkg/api/wal/v1alpha1):-
WalBufferservice withAppend(bidi streaming withHello/HelloAckhandshake andAck),Flush, andTailRPCs.- Go protobuf and gRPC bindings.
2. WAL Record & Segment Storage (
pkg/wal):- 52-byte record header with Castagnoli CRC32C checksums and binary serialization.
-
LocalSegmentStoresupporting automatic rotation at 64MB and scanning on open that automatically detects and drops torn trailing records.3. WAL Buffer Service (
pkg/wal/buffer&cmd/wal-buffer):- Startup epoch incrementing and manifest management (
wal/manifest.json).- Group commit engine batching incoming records (up to 5ms or 1MB) with fsync to local disk before sending witness acks.
- Preserves
(epoch, global_seq)ordering on client replay of previously acked records.- Periodic, size-based, and RPC-triggered S3 flushes writing segment objects (
wal/segments/<epoch>-<first_seq>-<last_seq>.wal), updating manifest, and broadcasting S3 acks.-
Tailstreaming from S3 segments, memory tail cache, and live group commits.4. Client Library (
pkg/wal/client):- Implements
Streaminterface (Append,Wait,Flush,Watermarks,Close).- Append writes and fsyncs locally first before network transmission.
- Background replication loop with automatic reconnection and replaying unacknowledged records.
- Degraded mode / backpressure when retained bytes exceed
--max-retained-bytes.- Local segment cleanup only after records are S3-acknowledged.
5. Kubernetes Manifests, Dockerfiles, and Tests:
-
k8s/wal.yamldefiningStatefulSet(replicas: 1,emptyDir), headlessService, andPodDisruptionBudget(maxUnavailable: 0).-
cmd/wal-client-testclient test runner utility.- Dockerfiles for
wal-bufferandwal-client-test.- Comprehensive unit tests in
pkg/wal,pkg/wal/buffer, andpkg/wal/client.- E2E test in
tests/e2e/wal_e2e_test.goverifying client append, buffer restart with emptyDir, and tail ordering.Fixes #45