Skip to content

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

Merged
dezren39 merged 2 commits into
mainfrom
queue/15007-8750-block-lookup
Nov 11, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/15007-8750-block-lookup

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Fixes #8750.

BlockList::is_blocked returned only bool, and both store implementations erased lookup failures to false (unwrap_or(false) in id-events, plus a second erasure for poisoned locks in id-store). Enforcement consumers treated that false as a successful "not blocked", so a corrupt block row, a transient storage failure, or a poisoned lock silently allowed connections and pulls with no diagnostic anywhere.

Change:

  • id-core block_list: new BlockLookup — Blocked / Unblocked / Indeterminate(BlockLookupFailure) with failure categories Corrupt / Storage / Unavailable (categories only; no storage details can leak to a peer). The trait gains lookup() plus peer_lookup / topic_tag_lookup / ip_lookup; the default derives from is_blocked so other implementations keep working, and the bool seam keeps its documented fail-open meaning.
  • EventStore (id-events) and SharedEventStore (id-store) override lookup() with their real results, mapping StoreError::Corrupt to Corrupt, other store errors to Storage, and a poisoned lock to Unavailable, and emit a tracing::warn! operator diagnostic at the failure. Their is_blocked now delegates to lookup() == Blocked, so the two seams can never diverge.
  • Enforcement seams state their indeterminate-result policy explicitly, all fail-open (the documented default availability behavior is unchanged) with a tracing::warn! diagnostic: AbuseEvaluator::open_connection_inner (peer + IP), PullGate::admits plus new PullGate::peer_lookup / topic_tag_lookup accessors, blob_gate::decide_with_blocks, and the log_sync topic-tag check. Only a definite Blocked refuses. LocalEvents::lookup_block exposes the distinguishing answer to operator surfaces.
  • Successful active/absent/expired lookup semantics are unchanged (existing block tests pass unmodified).

Tests (oracle: a failed lookup must be distinguishable from an ordinary unblocked result):

  • id-events: corrupt-row oracle — a raw undecodable block row yields Indeterminate(Corrupt) while a healthy row yields Blocked and an absent one Unblocked; bool seam still fails open.
  • id-store integration: SharedEventStore lookup distinguishes Blocked / Unblocked, and a poisoned lock yields Indeterminate(Unavailable).
  • id-core abuse: an always-indeterminate block list fails open at the connection seam (connection admitted, count 1); blocked peers/IPs still refused.
  • id-events pull policy: gate surfaces Some(Indeterminate(Storage)), bool seam false, admits true under the stated policy.

Verified on the laptop: id-core abuse 30/30, id-events block 10/10 + pull 13/13, id-store store_traits block/poison tests pass, id-groups blob 10/10, cargo check clean for id-core/id-store/id-events/id-groups/id-sync. Pre-existing on main, not caused here: cargo test -p id-sync --lib does not compile standalone (id_core::connectivity::silent feature) — filed as #8760; id-core's frames byte_refusal test failure is #8620.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 19:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T19:16:37.018787Z ddd8159 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

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

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.1)

Clippy execution timed out

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93ff717950

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// that cannot report failures answers only the definite outcomes;
/// the store implementations override it with their real errors,
/// and log the failure for the operator when it happens.
fn lookup(&self, kind: BlockKind, value: &[u8]) -> BlockLookup {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required design record for the block-lookup API

This introduces a public BlockList::lookup interface and explicit indeterminate-result policies across enforcement seams, but lacks the required dated design record. A repository-wide search of the target commit's documentation for 8750, BlockLookup, block-lookup terms, and fail-open policies found no record covering this change. pkgs/id/AGENTS.md explicitly requires documenting interface changes before implementation; add the prescribed document covering the intent, approach, and policy rationale rather than leaving that record only in Rust comments and the commit message.

AGENTS.md reference: pkgs/id/AGENTS.md:L159-L168

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 93ff717..HEAD: added the prescribed dated design record at pkgs/id/docs/2026-11-11T19-15-00Z_design_block_lookup/2026-11-11T19-15-00Z_design_block_lookup.md (through the docs symlink: doc/2026-11-11T19-15-00Z_design_block_lookup/), covering the intent, the BlockLookup approach, the failure-category/no-storage-leak decision, and the per-surface fail-open policy rationale. The design itself was settled in the #8750 issue and task packet before implementation; the record formalizes it in the protocol location and says so in its closing update section.

@dezren39

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: ddd8159227

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dezren39
dezren39 merged commit 703f0d6 into main Nov 11, 2026
2 of 12 checks passed
@dezren39
dezren39 deleted the queue/15007-8750-block-lookup branch November 11, 2026 19:18
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.

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

1 participant