Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

bug: deleteDeprecatedKind4 pagination cursor drops events with identical timestamps #16

Description

@coderabbitai

marmot

Summary

In js/actions.js, the deleteDeprecatedKind4() function paginates kind-4 events using an until cursor. When advancing the cursor, it does:

const oldest = page.reduce((min, ev) =>
    ev.created_at < min ? ev.created_at : min, page[0].created_at);
until = oldest - 1;

Subtracting 1 from the oldest timestamp means any additional events that share that same created_at value — but were not included in the current full page — are silently skipped on the next iteration. On a relay with many events at the same second (e.g., bulk imports), this can leave kind-4 events undeleted.

Suggested fix

Keep until = oldest (no subtraction) and rely on the kind4Ids Set for deduplication. Add a stall-detection check: if no new IDs were added during the last page fetch, break to avoid an infinite loop.

const previousSize = kind4Ids.size;
until = oldest;
if (kind4Ids.size === previousSize) {
    break;
}

References

Reported by @dannym-arx.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions