Skip to content

feat(redis): fault injection in pub/sub and MONITOR push streams - #17

Merged
pingedbrain merged 1 commit into
mainfrom
feat/redis-push-stream-injection
Oct 28, 2026
Merged

pingedbrain merged 1 commit into
mainfrom
feat/redis-push-stream-injection

Conversation

@pingedbrain

Copy link
Copy Markdown
Owner

What

After a forwarded SUBSCRIBE/PSUBSCRIBE/SSUBSCRIBE/MONITOR, redis mode spliced the sockets and stopped deciding — pushes were pure passthrough. Now the upstream→client direction decides per pushed frame while c→u stays a raw splice.

  • _push_facts maps message frames (message/pmessage/smessage, RESP2 * or RESP3 >) to operation: = frame head, resource: = channel; MONITOR +lines decide as operation: monitor, gated on the +<ts> [<db> <cli>] shape so +PONG/+OK mid-mode replies never get decided.
  • Effects in push mode: latency/timeout_ms delay delivery, timeout: true latches the stream dead, reset and cut_reply: {after_messages: N} abort the link, error: writes a -ERR frame in the message's place, and the new drop: true rule fault swallows the push.
  • Subscribe acks, RESP3 | attribute frames and interleaved command replies relay un-decided. Every decided push emits a FiredEvent — same observability as the command path.
  • drop wired through the rule DSL: from_dict/to_dict/describe.

Closes #16. Part of #6 — subscribe/stream-mode injection. Next on #6: TLS termination.

Why

#6 tracks extracting the protocol-agnostic core across wire transports; stream-mode injection is the remaining functional gap for redis mode (pub/sub + MONITOR are the only un-decidable traffic left).

How verified

  • 8 new integration tests in tests/test_resp_server.py (fake upstream gained a MONITOR push mode): drop, error-replaces-push, reset mid-stream, cut_reply.after_messages, per-push latency, channel-selective resource: matching, MONITOR passthrough + drop with +PONG shape disambiguation.
  • pytest: 1690 passed, 2 skipped.
  • ruff check src/ tests/: clean. pyright: 0 errors.

After a forwarded SUBSCRIBE/PSUBSCRIBE/SSUBSCRIBE/MONITOR the proxy used
to splice the sockets and stop deciding. The upstream->client direction
now decides per pushed frame instead:

- `_push_facts` maps pub/sub message arrays and RESP3 `>` pushes to
  `operation:` = frame head and `resource:` = channel; MONITOR `+lines`
  decide as `operation: monitor`, gated on the `+<ts> [<db> <cli>]`
  shape so mid-mode command replies (+PONG/+OK) stay un-decided.
- Effects in push mode: latency/timeout_ms delay delivery, `timeout:
  true` latches the stream dead, `reset` and `cut_reply.after_messages`
  abort the link, `error:` writes a -ERR frame in the message's place,
  and the new `drop: true` fault swallows the push.
- c->u stays a raw splice; acks and non-message frames relay un-decided.
- Every decided push emits a FiredEvent — same observability as the
  command path.

Closes #16. Part of #6 (subscribe/stream-mode injection).
@pingedbrain
pingedbrain merged commit f6ec4e6 into main Oct 28, 2026
5 checks passed
@pingedbrain
pingedbrain deleted the feat/redis-push-stream-injection branch October 28, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(redis): fault injection in pub/sub and MONITOR push streams

1 participant