Skip to content

[Rewrite P2] Services + worker model: payments, notifications, DVM, wot, tor, import #866

Open

Description

@chappie-daemon

Parent: #860
Milestone: Phase 2: Protocol core
Host: both · Expected cost: $6.00

nostream-services + the worker model: everything the relay does besides serving the wire (measured 1,352 LOC services + 1,556 LOC app/workers).

  • Cluster → tokio task model: the Node cluster primary + 4 worker types (measured: maintenance, dvm-orchestrator, relay-monitor, static-mirroring) become tokio tasks with the same lifecycle guarantees — SIGTERM drain with deadline, worker respawn, per-worker event-store resolution (measured tests in app.ts suite)
  • Redis adapter port (cache + wot-graph queue, measured redis-adapter.ts/cache/client.ts): keep Redis as the cache (or decide embedded — record decision; strfry runs without it, but the TS relay's cache semantics are load-bearing for rate limits)
  • Payments: the 7 processors (lnbits, lnurl, nodeless, nwc, opennode, zebedee, null) behind a trait; invoice lifecycle state machine ported exactly (pending → completed/expired, 404-on-lookup semantics, measured in maintenance-worker tests)
  • Notifications: outbox + delivery-log + operator channels (measured tables + services) — port semantics; delivery retries and the outbox walk
  • DVM orchestrator: job queue over the event store, worker-process dispatch (stdin JSON pipe model), timeout/respawn semantics — measured suite is large (13 test rows); port to tokio process handling
  • Web of trust graph service (Redis-backed measured): adjacency computation + the publish path
  • Tor hidden service client (measured src/tor/client.ts): onion address bootstrap via control port
  • Event import (measured event-import-service.ts + the clean-db CLI): bulk import with the same dedup/reconcile semantics, plus the stream-json parsing replacement (the v3 shape fix from the dependabot job)

Acceptance: the worker model passes the drain/respawn/deadline suite; payments state machine passes the invoice-lifecycle tests 1:1; DVM orchestrator passes the dispatch/timeout/respawn matrix; a Rust relay with LMDB ingests the same 100k-event corpus the TS ingest does with identical store contents (checksum).

Estimate basis (2026-10-24): $6.00 - six services plus the worker model is roughly twice job 008's breadth ($6.91, one 915-request builder session); build-heavy with two review rounds. Model and per-unit costs: .factory/estimates.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    factoryBuilt by the software factoryrewritenostream 4.0 Rust/LMDB rewriterustRust implementation work

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions