bug(node): naive JSON string extractor truncates values — DID mailbox IDs break relay drain
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- backend-api-design
Research direction
Start by reading extract_json_str in src/storage.rs:264-270 and the replay parser in src/envelope_wal.rs:42-48, then trace the listed call sites in http_relay.rs, http_federation.rs, federation_client.rs, and did_web.rs. Check how JSON string parsing handles escapes and field order. Done means a DID mailbox ID survives POST, WAL replay, and drain under the full key, with the requested Rust checks passing.
Written by the indexing model from the issue text.
Description
Context
Found during the final sandbox E2E run (2026-11-20): a direct POST /v1/relay/envelopes with "recipient_mailbox_id":"did:sonaraim:relay<ts>" returned 202, but GET /v1/relay/mailboxes/did:sonaraim:relay<ts> drained empty. The WAL shows the stored key truncated ("recipient_mailbox_id":"did:sonaraim:e2e-").
Symptom and mechanism (evidence)
extract_json_str (src/storage.rs:264-270) scans for "key":" then takes everything up to the NEXT ". The envelope replay parser in src/envelope_wal.rs:42-48 uses the same naive scanner. Hand-rolled scanning is order- and content-fragile: key-order changes or quote-bearing values silently corrupt routing keys. The B2B→node path happened to work because its payload field order differs — luck, not correctness.
Impact
High: relay routing keys are silently mangled for DID-format mailbox IDs; delivery appears successful (202/wake token) while the message lands under a truncated key the recipient never drains. Data loss shaped as success.
Acceptance criteria
- Replace the naive scanners with a real JSON string parser (handle escapes, ignore key order) in
storage.rs+ all call sites (envelope_wal.rs,http_relay.rs,http_federation.rs,federation_client.rs,did_web.rs). - Regression test: envelope with colon-bearing
recipient_mailbox_id(DID form) round-trips POST → WAL replay → drain under the FULL key. -
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo testgreen.
- 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::s impact::low priority::low source::auto status::review type::feature
Difficulty 3/5 1-2 days Newbie friendliness 64/100
alfonsodg/sonaraim-node#24 ·
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