Skip to content

feat(relay): chat, push and email sinks and a watch mode with no webhook document (DX-08) - #370

Merged
PastaPastaPasta merged 8 commits into
masterfrom
feat/relay-sinks
Oct 5, 2026
Merged

PastaPastaPasta merged 8 commits into
masterfrom
feat/relay-sinks

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

What

DX-08: forge-relay can now deliver repository activity to Discord, Slack, Matrix, ntfy and email (SMTP) from its own private config, and it has a watch mode that polls public repositories with no on-chain webhook document.

  • [[sink]] blocks in relay.toml. Every URL, token and password is an env: or keychain: reference (the storage-profile scheme); a literal is refused, Discord/Slack webhook URLs included, since the URL is the credential. Nothing goes on chain.
  • [watch] with repos = [...] and/or identity = "<id or DPNS name>"; the identity's public watch documents are re-read at every discovery (paged, up to 1,000), so a newly watched repo is picked up within a minute and read from that moment.
  • Notices are rendered from untrusted public text: control, bidi and zero-width characters are stripped and lengths capped; each channel escapes its own markup and never pings (Discord allowed_mentions: [], Slack &lt; escaping, Matrix m.notice with empty m.mentions, plain-text email with Auto-Submitted).
  • Each sink has its own worker, a 256-notice queue, a per-minute cap (default 20) and 3 retries that honour Retry-After. Logs never carry a URL, token, address or body.
  • forge-relay is now a library as well as the binary: daemon::run_with(cfg, Embed { sinks, watch_feed, watch_events }) lets the coming forge-notify service drive the same ingest with its own EventSink and a watch set it changes at runtime.
  • Private repositories are refused once and skipped from then on, whichever subscription named them. A watch-only relay doesn't lock the default state dir and doesn't warn about hookless repos.

Tests

  • cargo test -p forge-relay: 124 pass, including new tests for sink config validation, secret references, per-channel escaping, the hub's repo and event filters, 429 retried and 403 not, SMTP to a local stub, and watch event-filter union.
  • cargo clippy -p forge-relay --all-targets -D warnings and cargo fmt are clean.
  • Live on sakura, replay: I ran watch mode on forge-v2-demo with --lookback 2 and all five sinks (an HTTP stub for Discord, Slack and Matrix, a local ntfy, and Mailpit for SMTP). 31 HTTP posts, the ntfy messages and 12 emails arrived with the expected shapes.
  • Live on sakura, fresh activity: I ran watch mode with [watch] identity = "svcn-bob-7" (bob watches svcn-alice-7/svc-notify-e2e), then bob opened issue build: make the Rust workspace buildable and pin the Platform SDK #1 and alice commented. Both notices reached ntfy and Mailpit about 10 s after each write, with DPNS names resolved.
  • Evidence (logs, configs, ntfy and Mailpit dumps): dash-forge-qa/evidence/svc-notify/relay-sinks/.

Review

I ran a code review on the first commit. I fixed its valid findings in the second commit:

  • the watched-repo read was a single page with no timeout;
  • the event filters were not merged when a repo is in two watch sets;
  • a watch-only relay locked the default state dir;
  • a private repo named by a webhook document was retried;
  • zero-width characters and U+2028 passed through;
  • Matrix room v12 ids were rejected.

The README now notes that SMTP recipients see each other and that --lookback replays to sinks.

🤖 Generated with Claude Code

PastaPastaPasta and others added 3 commits October 4, 2026 12:23
…ook document (DX-08)

forge-relay gets [[sink]] blocks (discord, slack, matrix, ntfy, smtp) in its private config, with every URL, token and password given as an env: or keychain: reference, and a [watch] block that polls listed repos, or the repos an identity watches, with no on-chain webhook document. Notices are plain text with control and bidi characters removed; each channel escapes its own markup and never pings. Each sink has a bounded queue, a per-minute cap and retries with Retry-After.

The crate is now a library as well as the binary, so forge-notify can drive the same ingest through daemon::run_with with its own EventSink and watch feed. Private repositories are refused once and skipped.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ilters, refuse private repos for good

Review fixes: [watch] identity reads every page of its watch documents (up to 1,000) within the discovery timeout; a repo in both the identity's and an embedder's watch set is polled for the union of their events; a watch-only relay never locks the default state dir; a private repo is skipped whichever subscription named it; titles drop zero-width and bidi format characters and excerpts split on Unicode line separators; Matrix room ids of room version 12 (no server part) are accepted. The README says that email recipients see each other and that --lookback replays to sinks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ebc29d01-c226-4cbf-9a96-431073a75cb4
📥 Commits

Reviewing files that changed from the base of the PR and between 40da852 and c502049.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • crates/forge-relay/Cargo.toml
  • crates/forge-relay/README.md
  • crates/forge-relay/src/config.rs
  • crates/forge-relay/src/daemon.rs
  • crates/forge-relay/src/deliver.rs
  • crates/forge-relay/src/error.rs
  • crates/forge-relay/src/lib.rs
  • crates/forge-relay/src/main.rs
  • crates/forge-relay/src/sinks/mod.rs
  • crates/forge-relay/src/sinks/render.rs
  • crates/forge-relay/src/sinks/send.rs
  • crates/forge-relay/src/sinks/tests.rs
  • crates/forge-relay/src/subscriptions.rs
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

PastaPastaPasta and others added 3 commits October 5, 2026 00:12
A [[sink]] with no repos used to accept every repo the relay served, including repos found
only through on-chain webhook documents addressed to the relay identity. Anyone can create a
repo and such a document, so strangers could post into the operator's Discord, Slack or mail
and fill the sink's queue.

Such a sink now covers only the repos chosen in the config or by an embedder ([watch], [wake],
[[webhook]], the sinks' repos, the embed feed), recomputed at every discovery. Those repos are
also polled for its events, so an unscoped sink no longer silently misses events nothing else
polls for, and a start-up warning says when it can get nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	crates/forge-relay/README.md
@PastaPastaPasta
PastaPastaPasta merged commit 08815bc into master Oct 5, 2026
28 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the feat/relay-sinks branch October 5, 2026 07:23
PastaPastaPasta added a commit that referenced this pull request Oct 5, 2026
Now that the sinks (#370) are on master, a notice for a members-only
event says what happened ("alice posted a members-only comment on
issue #12", "alice opened members-only pull request #4", "approved
... in a members-only review") and never quotes the empty text or a
members-only thread's missing title. Also formats the previous commit's
test call sites.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.

1 participant