Skip to content

fix(listdisputes): use NOSTR_DISPUTE_EVENT_KIND for dispute filter#168

Merged
grunch merged 1 commit into
mainfrom
fix/listdisputes-event-kind
May 13, 2026
Merged

fix(listdisputes): use NOSTR_DISPUTE_EVENT_KIND for dispute filter#168
grunch merged 1 commit into
mainfrom
fix/listdisputes-event-kind

Conversation

@grunch
Copy link
Copy Markdown
Member

@grunch grunch commented May 13, 2026

Summary

  • listdisputes always returned an empty table even when disputes existed on the configured relays.
  • Root cause: create_seven_days_filter in src/util/events.rs hardcoded NOSTR_ORDER_EVENT_KIND (38383) as the Nostr kind for every list kind it served. Dispute events are published by mostrod under NOSTR_DISPUTE_EVENT_KIND (38386), so the #z=dispute filter never matched anything.
  • Fix: pass the event kind into create_seven_days_filter and select the right constant per ListKind (orders → 38383, disputes → 38386).

Reproduction

With a Mostro instance that has at least one dispute (any status), and MOSTRO_PUBKEY pointing at it:

$ mostro-cli -v listdisputes
...
│                📭 No Disputes                │

But querying the same relay directly returns the event:

$ nostreq --kinds 38386 --authors <mostro-pubkey> | nostcat --stream wss://relay.mostro.network
[ "EVENT", "...", { "kind": 38386, "tags": [["d","..."],["s","initiated"],["z","dispute"], ...] } ]

After the fix, listdisputes renders the row.

Test plan

  • cargo build --release passes.
  • mostro-cli listdisputes against a Mostro instance with at least one dispute returns the dispute(s).
  • mostro-cli listorders still works (regression check — same helper, different kind).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Improved internal event filtering logic for orders and disputes functionality.

Review Change Stack

`listdisputes` returned no results because `create_seven_days_filter`
hardcoded `NOSTR_ORDER_EVENT_KIND` (38383) for every list kind. Dispute
events are published by mostrod under `NOSTR_DISPUTE_EVENT_KIND` (38386),
so the filter never matched and the public dispute queue always rendered
as empty even when disputes existed on the relays.

Pass the event kind into `create_seven_days_filter` and select the right
constant per `ListKind` (orders → 38383, disputes → 38386).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8ebcaf68-351d-4c9d-8f5a-9a71a7dadbf8

📥 Commits

Reviewing files that changed from the base of the PR and between 76fb814 and a0145b2.

📒 Files selected for processing (1)
  • src/util/events.rs

Walkthrough

The PR refactors create_seven_days_filter to accept an event_kind parameter instead of using a hardcoded kind, and updates the two call sites to pass the appropriate event kind constants for orders and disputes respectively.

Changes

Event kind parameterization

Layer / File(s) Summary
Parameterize event kind in seven-day filter
src/util/events.rs
Function signature adds event_kind: u16 parameter, filter construction uses the parameter to set .kind(nostr_sdk::Kind::Custom(event_kind)), and call sites for ListKind::Orders and ListKind::Disputes pass NOSTR_ORDER_EVENT_KIND and NOSTR_DISPUTE_EVENT_KIND.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • Catrya

Poem

🐰 The filter now knows what kind to seek,
No hardcoding makes it more unique,
Orders and disputes both play their part,
A refactor simple, yet smart! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title specifically addresses the main fix: using NOSTR_DISPUTE_EVENT_KIND for the dispute filter, which directly aligns with the core bug fix described in the objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/listdisputes-event-kind

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 and usage tips.

@grunch grunch merged commit 940b8d3 into main May 13, 2026
6 checks passed
@grunch grunch deleted the fix/listdisputes-event-kind branch May 13, 2026 20:40
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