Skip to content

nostr: preserve NIP-67 EOSE completeness hints - #1501

Merged
yukibtc merged 1 commit into
nostrdevkit:masterfrom
erskingardner:codex/nip67-eose-hints
Nov 2, 2026
Merged

yukibtc merged 1 commit into
nostrdevkit:masterfrom
erskingardner:codex/nip67-eose-hints

Conversation

@erskingardner

Copy link
Copy Markdown
Contributor

Problem

Relays can attach NIP-67 hints to EOSE to say whether a history request returned every matching stored event, left more to paginate, or may reveal more after authentication. The parser currently discards those hints, so applications repairing history cannot inspect them through the typed relay message.

Fix

Preserve the optional hint array alongside its subscription ID and expose typed Finish, More, Auth, and unknown hints. Parsing and serialization retain unknown strings, hint order, and the distinction between omitted and empty arrays. Existing SDK message notifications carry the hints through, while request exit policies keep their current behavior.

Related to #1500; this is the protocol stage and does not close the issue. Per-relay stream-result propagation is deferred until #1497 lands. Local-relay hint emission is also deferred.

Compatibility

RelayMessage::EndOfStoredEvents(id) becomes RelayMessage::EndOfStoredEvents { subscription_id, hints }, requiring callers to update pattern matches and direct construction. RelayMessage::eose(id) still emits the legacy two-element message; eose_with_hints emits the extended form.

Validation

  • Confirmed the new round-trip regression test fails on the original parser, then passes with the fix.
  • Added typed parsing, malformed hint, unknown/escaped string, trailing extension, and SDK subscription-correlation coverage.
  • just fmt and just precommit.
  • cargo test -p nostr-sdk --all-features.

Checklist

  • I followed the contribution guidelines.
  • I updated the relevant changelogs.
  • I understand and can explain all code in this PR.

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@erskingardner erskingardner left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata Value
Reviewed at (UTC) 2026-10-29T15:43:55Z
Commit reviewed 2feb2a14f5f000ebfb8cc0523fe8717b651f8f44
Model Grok 4.7
Reasoning level Not exposed by runtime
Recommended action Merge

Preserving the hint array on RelayMessage is the right slice of #1500. The parser keeps omitted, empty, known, duplicate, and unknown hints apart, ignores trailing extensions, and still rejects a malformed third element. Relay notifications forward that message unchanged, and exit policy still treats any EOSE as the end of stored events for the subscription that actually ended.

Leaving stream-result propagation and local-relay emission for later matches the stated scope. eose() still writes the two-element message, so existing relays stay compatible.

GitHub rejected an approval because this review is from the pull request author, so this is posted as a comment. The recommendation is still to merge.

Comment thread nostr/src/nips/nip67.rs Outdated
@@ -0,0 +1,64 @@
// Copyright (c) 2026 Nostr Dev Kit Developers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This header says Nostr Dev Kit Developers. The other files in this crate, including nip66.rs from this year, say Rust Nostr Developers.

@erskingardner erskingardner left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata Value
Reviewed at (UTC) 2026-10-29T15:56:40Z
Commit reviewed 2d4be72db26f35e4341bcb4556d96eb489a11edd
Model gpt-6.1-sol
Reasoning level max
Recommended action Merge

No blocking findings. The parser preserves known and unknown hints, order and duplicates, and omitted versus empty arrays. Legacy eose() output stays unchanged. Relay and client notifications retain the hints and subscription ID, while request exit policies keep their existing behavior. The enum-shape change is documented in the changelog; the deferred outcome propagation and relay emission match the stated scope.

CI and coverage passed for this exact SHA. The hosted logs confirm the NIP-67 parsing, round-trip, malformed-input, and SDK subscription-correlation regressions pass. Validation used remote source and hosted CI; no local tests were run.

GitHub rejected approval because the authenticated account is the PR author, so this is a comment review. The recommendation remains to merge.

@erskingardner
erskingardner marked this pull request as ready for review October 29, 2026 16:01
Keep optional completeness hints with their EOSE subscription ID instead of discarding them. Add typed hints and round-trip coverage, and adapt SDK matches while preserving request exit behavior.

Closes nostrdevkit#1500

Pull-Request: nostrdevkit#1501
Signed-off-by: Yuki Kishimoto <[email protected]>
@yukibtc
yukibtc force-pushed the codex/nip67-eose-hints branch from 2d4be72 to 6903660 Compare November 2, 2026 08:54
@yukibtc
yukibtc merged commit 6903660 into nostrdevkit:master Nov 2, 2026
42 checks passed
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.

2 participants