Fix Neo4j query returning zero events for REQ filters (v0.49.1)
Some checks are pending
Go / build-and-release (push) Waiting to run

- Fix zero-value timestamp filter bug: since/until with value 0 were
  being added as WHERE clauses, causing queries to match no events
- Fix event parsing: use direct slice assignment instead of copy() on
  nil slices for ID, Pubkey, and Sig fields

Files modified:
- pkg/neo4j/query-events.go: Fix buildCypherQuery and parseEventsFromResult

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
woikos
2026-01-14 10:56:31 +01:00
parent 9da1784b1b
commit a0af5bb45e
2 changed files with 9 additions and 9 deletions

View File

@@ -130,11 +130,13 @@ func (n *N) buildCypherQuery(f *filter.F, includeDeleteEvents bool) (string, map
}
// Time range filters - for temporal queries
if f.Since != nil {
// Note: Check both pointer and value - a zero timestamp (Unix epoch 1970) is almost
// certainly not a valid constraint as Nostr events didn't exist then
if f.Since != nil && f.Since.V > 0 {
params["since"] = f.Since.V
whereClauses = append(whereClauses, "e.created_at >= $since")
}
if f.Until != nil {
if f.Until != nil && f.Until.V > 0 {
params["until"] = f.Until.V
whereClauses = append(whereClauses, "e.created_at <= $until")
}
@@ -300,19 +302,17 @@ func (n *N) parseEventsFromResult(result *CollectedResult) ([]*event.E, error) {
_ = tags.UnmarshalJSON([]byte(tagsStr))
}
// Create event
// Create event with decoded binary fields
e := &event.E{
ID: id,
Pubkey: pubkey,
Kind: uint16(kind),
CreatedAt: createdAt,
Content: []byte(content),
Tags: tags,
Sig: sig,
}
// Copy fixed-size arrays
copy(e.ID[:], id)
copy(e.Sig[:], sig)
copy(e.Pubkey[:], pubkey)
events = append(events, e)
}

View File

@@ -1 +1 @@
v0.49.0
v0.49.1