Skip to content

import: an imported kind-5 with only a tags leaves the article readable #1097

Closed

Description

@chappie-daemon

event_import_service applies a deletion request's e targets and nothing else:

let ids: Vec<EventId> = event.tags.iter()
    .filter(|tag| tag.len() >= 2 && tag[0] == "e")
    .filter_map(|tag| tag[1].parse::<EventId>().ok())
    .collect();
if !ids.is_empty() {
    self.events.delete_by_pubkey_and_ids(&event.pubkey, &ids).await?;
}

(crates/nostream-services/src/services/event_import_service.rs:535-549)

A kind-5 carrying only a address tags — the shape a replaceable or parameterized-replaceable deletion uses — is stored, its counters say the import succeeded, and the article it names stays readable. The live relay's own deletion path handles a through delete_by_addresses; an import into a fresh store therefore produces a store that differs from the one the relay would have produced for the same event stream.

Fix shape: route an imported deletion request through the same arm the live path uses — e targets by id, a targets by address, with the same author, kind and timestamp checks — rather than by id alone.

Surfaced by Greptile on #1094 (static/round-8.json). Pre-existing on rewrite/main; it is unrelated to the completeness work that PR carries.

Activity

  1. AgrimTawani commented on Nov 17, 2026

    @AgrimTawani
    Contributor

    Hey @cameri, is this one still open to be worked on? If so, I'd love to pick it up.

    Here's what I have in mind:

  2. cameri commented on Nov 17, 2026

    @cameri
    Owner

    Assigned to you @AgrimTawani . Thank you

  3. AgrimTawani commented on Nov 17, 2026

    @AgrimTawani
    Contributor

    Hey @cameri, the fix for this is ready on my fork. Same as before, I can't open the PR myself: rewrite/main...AgrimTawani:nostream:fix/1097-import-address-deletes

    • The import now reads deletions through the live delete arm, so a tags are applied and the same caps apply
    • 6 new import tests (a-only, mixed, live tag rules, dedupe, both caps); all fail before the fix
    • All five CLAUDE.md checks pass on the latest rewrite/main (1343 tests)
  4. chappie-daemon commented on Nov 18, 2026

    @chappie-daemon
    CollaboratorAuthor

    Merged as #1165.

    The import now reads a deletion request through the live delete arm's deletion_targets, so an
    imported kind-5 applies both of its targets: e ids, and the author's own a addresses bounded by
    the request's created_at — the same arguments the live arm passes, so a newer article survives an
    imported deletion exactly as it survives a live one. A request over either per-request cap is
    neither applied nor stored: the rows buffered before it are flushed, the request is skipped, and the
    import continues, which is what the relay would have done with the same event.

    Verified rather than asserted. Reverting the importer to its pre-fix shape fails all six new tests,
    so they pin the behaviour:

    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
    

    The five cargo checks the repository requires all pass locally on the branch. docs/rewrite/nip-parity.md
    records the change as a deliberate divergence from the capture's own import, which applies e only.

    Work by @AgrimTawani, carried with git cherry-pick -x so the authorship and the source commit are
    in the history. (This issue was closed by hand: closing keywords do not fire against
    rewrite/main, which is not the default branch.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions