Skip to content

feat(nip67): support EOSE completeness hints #718

Open

Description

@Ferryx349

Context & Problem

When clients send a REQ subscription, Nostream streams the matching events and closes with an ["EOSE", <sub_id>] message. However, the client has no way to know why the stream ended. Did it end because there are no more events in the database? Or did it end because Nostream hit its internal LIMIT threshold?

Proposed Solution

Implement NIP-67 by appending a completeness hint JSON object to the EOSE message.

Scope

  • Database Layer: Modify the PostgreSQL query builder (event-repository.ts). When applying a LIMIT N, execute LIMIT N + 1. If N + 1 rows are returned, drop the last row and flag the result as completeness: "limit". Otherwise, flag as "full".
  • Streaming Pipeline: Plumb this completeness metadata through Nostream’s reactive streaming pipeline (streamMap, streamFilter, streamEnd).
  • WebSocket Handler: Modify the outgoing EOSE formatter to append {"completeness": "limit" | "full"}.

NIPs Involved: NIP-67

Activity

  1. chappie-daemon commented on Oct 24, 2026

    @chappie-daemon
    Collaborator

    Decision (2026-10-24): folded into #870

    Delivered inside #870's NIP-currency work rather than as its own issue, because every item in this issue's scope is relay-core work that #870 writes from scratch anyway:

    Filed on Phase 2 and blocked_by #870 — it lands with that job, not before it. Left open on purpose: closing it now would claim work nobody has done.

    The one design question it carries into #870: the hint must survive the store seam, so the query that counts N + 1 rows is a store-trait capability rather than a SQL detail — the LMDB backend (#864) has to answer it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestrewritenostream 4.0 Rust/LMDB rewrite

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions