Skip to content

fix(import): apply an imported deletion's a tags, as the live relay does - #1165

Merged
cameri merged 1 commit into
rewrite/mainfrom
fix/1097-import-address-deletes
Nov 18, 2026
Merged

cameri merged 1 commit into
rewrite/mainfrom
fix/1097-import-address-deletes

Conversation

@chappie-daemon

@chappie-daemon chappie-daemon commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What

An imported kind-5 that names its target by a address was stored, its counters reported the
import succeeded, and the article it named stayed readable: event_import_service applied only
the request's e ids. The live relay's delete arm already handled a; the two writers of the
same store disagreed about what one request means (issue #1097).

  • The tag reading is now one function. delete.rs's deletion_targets returns
    DeletionTargets { ids, addresses } — distinct e ids in first-seen order, and the author's own
    parameterized-replaceable addresses — or a DeletionRefusal whose Display is the OK false
    message the live arm sends. The address cap is checked first, as it always has been.
  • The live arm calls it, so its behaviour, its refusal messages and its cap ordering are
    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.
  • The importer calls the same function. a addresses go through
    delete_by_addresses(author, addresses, request.created_at), exactly the arguments the live arm
    passes, 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 cargo checks on this branch, in order:

cargo fmt --all --check                                    -> clean
cargo clippy --workspace --all-targets --all-features      -> clean, -D warnings
cargo clippy --workspace --lib --bins (strict)             -> clean
cargo test --workspace --all-features                      -> clean, no failures (every suite ok)
cargo build --workspace --all-features --release           -> clean, 1m48s

Six new tests in crates/nostream-services/tests/event_import.rs. They are not decorative: with the
importer put back to its pre-fix shape, all six fail —

an_imported_deletion_with_only_a_tags_deletes_by_address ... FAILED
an_imported_deletion_with_e_and_a_tags_deletes_through_both_arms ... FAILED
an_imported_deletion_reads_a_tags_by_the_live_rules ... FAILED
an_imported_deletion_names_each_distinct_event_id_once ... FAILED
an_imported_deletion_over_the_event_id_cap_is_skipped ... FAILED
an_imported_deletion_over_the_address_cap_is_skipped ... FAILED

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.md records the change as a deliberate divergence from the capture's own
import (which applies e only, 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. (Closes is not used: closing keywords
do not fire against a non-default base branch, so the issue is closed by hand after the merge.)

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-bot

changeset-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3628663

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 691389a8-3f18-4327-a536-a21f2bf7ac8e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no actionable issues were found.

Summary

The importer now applies address-based deletion requests using the same rules as the live relay.

  • Imported deletions now remove articles named by their addresses.

No actionable issues found. Review was based on source inspection; tests were not run.

Reviews (1) · Last reviewed commit: "fix(import): apply an imported deletion'..." · Reviewed by Greptile

@cameri
cameri merged commit 3b7e2cb into rewrite/main Nov 18, 2026
19 checks passed
@cameri
cameri deleted the fix/1097-import-address-deletes branch November 18, 2026 01:22
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.

3 participants