feat(relay): add NIP-ER push scheduler with cross-pod delivery#957
Draft
wpfleger96 wants to merge 1 commit into
Draft
feat(relay): add NIP-ER push scheduler with cross-pod delivery#957wpfleger96 wants to merge 1 commit into
wpfleger96 wants to merge 1 commit into
Conversation
… advertisement The relay now proactively delivers due reminders via Redis pub/sub. Cross-pod dedup uses an atomic delivered_at claim (mirrors the reaper's archived_at guard). Ingest relaxed to allow kind:30300 without not_before (bookmarks/terminal states). max_not_before_delta enforced to prevent unbounded-future scheduling abuse. Schema: nullable not_before + delivered_at columns on events, partial index for scheduler queries. NIP-11: supported_extensions ["nip-er"], due_delivery_mode "push", max_not_before_delta advertised. Spec (NIP-ER.md) amended: not_before optional on kind:30300, required only for pending reminders that may become due. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
Stack: #934 → this PR
This PR stacks on #934 (NIP-ER core: kind registration, validation, read-path filtering). Merge #934 first.
Adds the NIP-ER push scheduler — a background loop that queries for due reminders (
not_before <= now) and publishes them to Redis pub/sub for cross-pod fan-out.Changes
Push scheduler (
main.rs)SPROUT_REMINDER_SCHEDULER_INTERVAL_SECS, default 10s) and batch limit (SPROUT_REMINDER_SCHEDULER_BATCH_LIMIT, default 100)delivered_atclaim, preventing silent reminder loss on publish failure. Duplicate delivery on claim failure is harmless (subscribers dedup by event ID)Privacy enforcement (
event.rs)filter_fanout_by_accessnow enforces author-only kinds (AUTHOR_ONLY_KINDS) as its first check, before channel-based access gating. This ensures kind:30300 events are delivered only to the event's author across all delivery paths: local dispatch, cross-podsubscribe_local, and scheduler-published eventsauthor_only_kind_delivers_only_to_authorverifies the filter rejects non-author subscribers for kind:30300Ingest relaxation
not_beforeis now optional on kind:30300 — allows bookmarks and terminal-state reminders without a schedulemax_not_before_deltaenforced viaSPROUT_MAX_NOT_BEFORE_DELTAto prevent unbounded-future scheduling abuseSchema
not_before+delivered_atcolumns on events tableNIP-11 advertisement
supported_extensions: ["nip-er"],due_delivery_mode: "push",max_not_before_deltaadvertised in relay info document