feat(storage): add Redis RESP mailbox store, durable WAL recovery, and Prometheus /metrics
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- docker, prometheus, redis, rust
- Domain
- backend, database, observability
Research direction
Start with src/storage.rs (the NodeSnapshot capture code) and src/http_server.rs lines 105-265, where KeyTransparencyLog and RelayQueue live in memory. The work has three separable parts: WAL append and recovery, a RESP client in a new src/redis_store.rs, and a GET /metrics route. Done means tests/milestone6_test.rs passes, existing endpoint responses are unchanged, and cargo test is green. The issue is a multi-part feature tied to a coordinator meta-issue, so confirm scope with the maintainer before starting.
Written by the indexing model from the issue text.
Description
Problem
Tracked under Coordinator Meta-Issue alfonsodg/sonaraim#8 (Milestone 6).
In sonaraim-node (692a933), src/storage.rs:1-96 serializes point-in-time NodeSnapshot JSON lines in memory, and src/http_server.rs:105-265 stores KeyTransparencyLog and RelayQueue only in RAM without writing/recovering a durable write-ahead log (WAL) on disk, syncing mailbox TTLs with REDIS_URL, or exposing a Prometheus GET /metrics endpoint.
Affected Files & Locations
src/storage.rs:1-96src/redis_store.rs(new,< 180lines)src/http_server.rs:105-265src/lib.rs:1-14tests/milestone6_test.rs(new)
Evidence
// src/storage.rs:25-40
pub struct NodeSnapshot {
pub log_size: usize,
pub tree_head: String,
}
impl NodeSnapshot {
#[must_use]
pub fn capture(log: &KeyTransparencyLog) -> Self {
Self {
log_size: log.len(),
tree_head: log.tree_head(),
}
}
Impact and Blast Radius
Enables crash-recoverable Key Transparency identity logs, optional live Redis RESP mailbox persistence when REDIS_URL is reachable, and Prometheus metrics scraping (GET /metrics).
Historical Context and Anti-Regression
Builds on commit 692a933 (develop, Issues #1–#5 in status::review, 8/8 tests passing). All existing endpoints (/health, /v1/identity, /v1/relay/envelopes, /v1/relay/mailboxes/{id}, /v1/media/presign, /v1/contacts/psi) must preserve their exact response contracts.
Proposed Solution
- Extend
src/storage.rswith file-backed WAL append and recovery (append_wal_entry,load_wal_entries) using the directory ofNODE_SIGNING_KEY_PATH. - Create
src/redis_store.rsimplementing a zero-dependency TCP RESP client (RedisRespClient) supportingAUTH,SET key val EX ttl,GET, andDELagainstREDIS_URL. - Add
GET /metricsinsrc/http_server.rsreturning Prometheus text metrics (sonaraim_node_kt_entries_total,sonaraim_node_queued_envelopes).
Acceptance Criteria
- L1 (Unit TDD):
cargo fmt --check && cargo clippy -- -D warnings && cargo testpasses with allsrc/*.rsfiles< 300lines. - L2 (Integration): WAL file recovery restores
KeyTransparencyLogentries acrossNodeStatere-initialization, andGET /metricsreturns valid Prometheus counters. - L3 (Container / GHCR):
ghcr.io/alfonsodg/sonaraim-node:developbuilds in GitHub Actions and deploys onsandbox-ud-ord. - L4 (E2E Sandbox):
curl -fsS http://127.0.0.1:8031/metricsonsandbox-ud-ordreturns live counters matching registered identities.
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from alfonsodg/sonaraim-node
-
bug(node): SigV4 presign date applies the epoch offset twice — media uploads can never validateOpenarea::node effort::s impact::medium priority::medium source::auto status::review type::bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
alfonsodg/sonaraim-node#29 · 1 comment ·
-
area::node effort::xs impact::low priority::low source::auto status::review type::docs
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
alfonsodg/sonaraim-node#28 · 1 comment ·
-
area::node effort::s impact::medium priority::low source::auto status::review type::docs
Difficulty 3/5 1-2 days Newbie friendliness 72/100
alfonsodg/sonaraim-node#27 · 1 comment ·
-
area::node effort::m impact::medium priority::medium source::user status::review type::refactor
Difficulty 1/5 Under an hour Newbie friendliness 20/100
alfonsodg/sonaraim-node#26 · 1 comment ·
-
area::node effort::m impact::high priority::medium source::auto status::review type::bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
alfonsodg/sonaraim-node#25 · 2 comments ·
All issues in alfonsodg/sonaraim-node
Similar issues
-
O-windows relnotes relnotes-needs-review relnotes-tracking-issue T-libs
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
marketing
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
num_ode_rk4_adaptive rejects atol = 0 while accepting rtol = 0 and while num_ode_dopri5 accepts bothOpenarea/ode-pde good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#383 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
Maintainers usually reply within 1 day
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day