Skip to content

id(block-list): surface failed lookups separately from unblocked #8750

Closed

Description

@dezren39

Evidence

BlockList::is_blocked returns only bool (pkgs/id/crates/id-core/src/block_list.rs:61-64), so callers cannot distinguish an unblocked entry from a failed lookup. The underlying EventStore::active_block/is_blocked operations are fallible and document storage errors and StoreError::Corrupt (pkgs/id/crates/id-events/src/event_store/mod.rs:135-170). However, both concrete BlockList implementations erase failures: EventStore uses unwrap_or(false) at lines 369-374, while SharedEventStore also maps storage errors and poisoned-lock errors to false at pkgs/id/crates/id-store/src/store_traits.rs:390-400.

Enforcement consumers treat false as a successful allow decision. For example, AbuseEvaluator::open_connection_inner refuses only when the peer/IP predicate is true (pkgs/id/crates/id-core/src/abuse.rs:1141-1152), and PullGate::admits proceeds when both block predicates are false and policy admits (pkgs/id/crates/id-events/src/pull_policy.rs:102-130). A corrupt block row or transient read/lock failure therefore makes the check indeterminate but indistinguishable from “not blocked”; the caller gets no diagnostic to surface to the operator.

The current fail-open behavior is explicitly documented and may be a deliberate availability choice. This issue is about making lookup failure observable and the enforcement policy explicit, not unilaterally changing it to fail-closed. Related history: closed #2245 implemented the operator block list but does not track error visibility.

Suggested fix

Preserve a distinguishable error/indeterminate outcome at the block-list boundary (or provide an equivalent structured reporting hook). Let each enforcement seam explicitly apply its documented fail-open/fail-closed policy, and report the failed check to the operator without leaking storage details to remote peers.

Acceptance criteria

  • Successful active, absent, and expired-block lookups retain their existing semantics.
  • Injected storage/decode errors and poisoned-lock failures are distinguishable from an ordinary unblocked result and produce an operator-visible diagnostic.
  • Enforcement callers explicitly choose what to do with an indeterminate result; no caller silently treats it as an ordinary successful “not blocked” check.
  • Tests cover the error oracle and the chosen per-surface policy; the default availability behavior is documented.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/mMedium: expected under 1 day of work
    on Nov 11, 2026
  2. developing-today commented on Nov 11, 2026

    @developing-today
    Contributor
  3. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 11, 2026
  4. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

    • Agent: triage-step
    • State: triaged
    • Work kind: task/small-fix — a bounded code fix: preserve a distinguishable error/indeterminate outcome at the BlockList boundary (id-core block_list.rs, the id-events and id-store implementations) and make each enforcement seam apply its policy explicitly, with tests specified in the issue. This replaces task/triage.
    • Priority: priority/normal (already on the issue; kept) — Priorities brief line 5: everything else by usefulness. A well-evidenced id bug where failed block-list lookups are silently treated as allows, but it does not stall the fleet (line 1) and is not one of the named ID design tracks / expedite set in line 2 (the pkgs/id: split the monolith crate into sub-crates along module seams (prioritized by Drew 2026-11-01) #3447 crate split, the id: design+PoC: sticky-notes / did-it tracker — the first ID app #2031 phase work), so normal band.
    • Effort: effort/m (already on the issue; kept) — the boundary change spans id-core, id-events, and id-store plus the AbuseEvaluator and PullGate seams and their tests; expected under a day.
    • Kind: kind/bug (already on the issue; kept).
    • First concrete step: Add a failing test at the block-list boundary: inject a storage/decode error (and a poisoned-lock case for SharedEventStore) and show the lookup currently returns the same false as an ordinary unblocked result.
    • Acceptance check: Active, absent, and expired-block lookups keep their existing semantics; injected storage/decode and poisoned-lock failures are distinguishable from an ordinary unblocked result and produce an operator-visible diagnostic; enforcement callers explicitly choose what to do with an indeterminate result (no silent treat-as-allow) and no storage details leak to remote peers; the documented default availability behavior is not changed unilaterally to fail-closed.
    • Fix packet: task 15007 in repo-health-code-pilot (dedupe repo-health:v1:fix:developing-today/code:issue:8750, priority 40, kind small_fix, queued; signal refreshed).
  5. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    state: picked-up
    task: 15007
    lane: code-a
    stage: claimed

    Picked up task 15007 (small_fix for #8750). Revalidated fresh: issue #8750 OPEN, labels kind/bug, task/small-fix, priority/normal, effort/m, app/id — no hard-stop labels, no status/needs-triage (triage already applied by the triage step; the packet's work kind stands).

    Plan: read the block-list boundary and both implementations plus the two enforcement seams (BlockList in id-core, EventStore in id-events, SharedEventStore in id-store, AbuseEvaluator in id-core/src/abuse.rs, PullGate in id-events/src/pull_policy.rs); add failing error-oracle tests first (injected storage/decode error, poisoned lock), then introduce a distinguishable indeterminate outcome with an operator-visible diagnostic and an explicit per-surface policy — without changing active/absent/expired semantics or silently flipping the documented default availability behavior.

  6. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    state: done
    task: 15007
    lane: code-a
    stage: done

    Done — fixed_merged. PR #8761 squash-merged as 703f0d6; issue #8750 CLOSED.

    What changed: BlockList gained a distinguishing lookup outcome — BlockLookup (Blocked / Unblocked / Indeterminate(BlockLookupFailure::{Corrupt, Storage, Unavailable})) in id-core, re-exported through id-store/id-events. EventStore and SharedEventStore override lookup() with their real results (a poisoned lock is Unavailable) and log a tracing::warn! operator diagnostic; their is_blocked now delegates to lookup() == Blocked so the seams cannot diverge. Enforcement callers state their indeterminate policy explicitly — all fail-open per the documented default, each with a warn diagnostic: AbuseEvaluator (peer + IP), PullGate::admits (plus new peer_lookup/topic_tag_lookup accessors), blob_gate::decide_with_blocks, and the log_sync topic-tag check. LocalEvents::lookup_block exposes the answer to operator surfaces. Failure categories only cross the seam — no storage details leak to peers. Design record: doc/2026-11-11T19-15-00Z_design_block_lookup/ (pkgs/id/docs symlink).

    Verification (oracle: a failed lookup is distinguishable from an ordinary unblocked result):

    • New corrupt-row oracle test (id-events): undecodable block row -> Indeterminate(Corrupt); healthy row -> Blocked; absent -> Unblocked; bool seam still fails open.
    • New id-store integration test: SharedEventStore Blocked/Unblocked distinguished; poisoned lock -> Indeterminate(Unavailable).
    • New policy tests: abuse connection seam fails open on an always-indeterminate list; pull gate surfaces Some(Indeterminate(Storage)) and admits under the stated policy.
    • Suites on the laptop: id-core abuse 30/30; id-events block 10/10, pull 13/13; id-groups blob 10/10; cargo check clean for id-core/id-store/id-events/id-groups/id-sync. Existing active/absent/expired semantics tests pass unmodified.
    • Codex: one P1 (missing dated design record) — fixed by adding the record, replied on the thread, re-review at ddd8159 clean ("Didn't find any major issues").

    Pre-existing, not caused here: cargo test -p id-sync --lib does not compile standalone on clean main (id_core::connectivity::silent feature) — filed as #8760. PR checks stayed QUEUED in the ongoing Actions runner stall; local laptop tests were the operative gate.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions