Repository navigation
fix(import): apply an imported deletion's a tags, as the live relay does - #1165
Conversation
The event import applied only a kind-5's e ids, so a request naming an article by address was stored while the article stayed readable, and an import built a different store than the relay would for the same events. delete.rs now exposes deletion_targets(), the one reading of a request's tags: distinct e ids and the author's own (kind, d) addresses, refused whole past either per-request cap. The live arm and the importer both call it. The importer applies ids and addresses (bounded by the request's created_at) before storing the request; a request over a cap is neither applied nor stored and counts as skipped. InMemoryEventRepository records delete_by_addresses calls so the import tests can assert them. Closes #1097 Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 3f81da0)
🦋 Changeset detectedLatest commit: 3628663 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
[High impact] The PR appears safe to merge; no actionable issues were found.
|
What
An imported kind-5 that names its target by
aaddress was stored, its counters reported theimport succeeded, and the article it named stayed readable:
event_import_serviceapplied onlythe request's
eids. The live relay's delete arm already handleda; the two writers of thesame store disagreed about what one request means (issue #1097).
delete.rs'sdeletion_targetsreturnsDeletionTargets { ids, addresses }— distincteids in first-seen order, and the author's ownparameterized-replaceable addresses — or a
DeletionRefusalwhoseDisplayis theOK falsemessage the live arm sends. The address cap is checked first, as it always has been.
unchanged; the relay: a kind-5 delete's
e-id arm is uncapped and unbounded at the storage seam #1090 tests that pin the caps and the dedupe still pass untouched.aaddresses go throughdelete_by_addresses(author, addresses, request.created_at), exactly the arguments the live armpasses, so a newer article survives an imported deletion as it survives a live one. A request
over either cap is neither applied nor stored: the rows buffered before it are flushed, the
request is skipped, and the import continues.
Evidence
The repository's five
cargochecks on this branch, in order:Six new tests in
crates/nostream-services/tests/event_import.rs. They are not decorative: with theimporter put back to its pre-fix shape, all six fail —
and with the fix restored, all six pass. The refusal tests also pin the accounting: a skipped
request is not counted as inserted, and the regular rows around it still import.
docs/rewrite/nip-parity.mdrecords the change as a deliberate divergence from the capture's ownimport (which applies
eonly,event-import-service.ts:107-118) and names the six tests.Authorship
Work by @AgrimTawani, from
their fork branch.
They cannot open a pull request on this repository, so it was carried with
git cherry-pick -x—the authorship and the source commit are in the history, and this body is the review trail.
Implements #1097. (
Closesis not used: closing keywordsdo not fire against a non-default base branch, so the issue is closed by hand after the merge.)