Skip to content

docs(adr): add ADR 029 peer-table eviction policy - #443

Merged
thiras merged 4 commits into
mainfrom
docs/adr-029-peer-table-eviction
May 6, 2026
Merged

thiras merged 4 commits into
mainfrom
docs/adr-029-peer-table-eviction

Conversation

@thiras

@thiras thiras commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds ADR 029 closing the missing-decision gap tracked in ADR gap: peer table eviction policy #401: TTL-based eviction (default 600 s on last_seen_us, 30 s sweep), no hard size cap by default with an optional gossip.max_peer_entries safety ceiling, active eviction on NodeDeregistered/NodeAutoEjected, and explicit exclusion of reputation from the eviction decision.
  • Codifies what crates/gossip/src/peer_table.rs already does and specifies the additional peer-table-removal step the registry-cache subscriber from ADR 019 § Step 3.3 must perform once implemented.
  • Cross-references added in ADR 001 (peer-table paragraph + Registry cache paragraph) and ADR 011 (origin-blacklist exclusion bullet). ADR 029 added to the Chapter 1 reading order, the numeric Architectural Decisions index, and the pandoc reading-order build in adr/README.md. Next-ADR counter in CLAUDE.md bumped 029 → 030.

Test plan

  • pre-commit run --all-files passes (markdownlint, cargo fmt/clippy/doc/deny — no Rust changed)
  • grep -rn "ADR 029\|029-peer-table" adr/ confirms inbound links from 001-network.md, 011-content-takedown.md, architecture.md, README.md
  • All cited code anchors verified (DEFAULT_PEER_TTL_SEC, resolve_gossip > 0 check, ttl_sweeper_task, evict_expired)
  • All cited cross-ADR claims verified (ADR 011 ejectNode → NodeAutoEjected, ADR 008 0.1 reputation floor, ADR 019 phase 3 / step 4.3, ADR 001 reputation 100× table)

🤖 Generated with Claude Code

Closes #401. Codifies the existing TTL-based peer-table eviction
(default 600 s on last_seen_us, sweep every 30 s) and resolves the four
open policy questions from the issue: no hard size cap (the staking
registry bounds growth via gossip validation rule 2), age-based expiry,
offline handling, and active eviction on NodeDeregistered /
NodeAutoEjected events. Reputation is explicitly excluded from the
eviction decision — selection-time only. Adds an optional
gossip.max_peer_entries safety ceiling that surfaces overflow via the
existing decdn_gossip_messages_rejected_total{reason=table_full} counter.

Cross-references: ADR 001 peer-table and Registry cache paragraphs;
ADR 011 origin-blacklisting bullet; both indexes in architecture.md;
the pandoc reading-order build in adr/README.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 6, 2026 18:54
@thiras thiras linked an issue May 6, 2026 that may be closed by this pull request

Copilot AI 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.

Pull request overview

Adds ADR 029 to formally specify the peer-table eviction policy (TTL-based, registry-driven removals, no default size cap, reputation excluded), and wires it into the ADR corpus via reading order and cross-references.

Changes:

  • Introduces ADR 029 documenting current TTL eviction behavior and defining future registry-event-driven removals and optional gossip.max_peer_entries.
  • Updates ADR reading order / indices to include ADR 029.
  • Cross-references ADR 029 from ADR 001 (peer table + registry cache) and ADR 011 (origin blacklisting implications).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
CLAUDE.md Bumps the “next ADR number” note to 030 after adding ADR 029.
adr/README.md Inserts ADR 029 into the pandoc reading-order build list.
adr/architecture.md Adds ADR 029 to Chapter 1 reading order and the numeric ADR index.
adr/029-peer-table-eviction-policy.md New ADR defining peer-table eviction policy, rationale, and observability expectations.
adr/011-content-takedown.md Cross-references ADR 029 for peer-table removal on NodeAutoEjected.
adr/001-network.md Cross-references ADR 029 for peer-table lifecycle and registry-cache-driven peer-table removal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread adr/029-peer-table-eviction-policy.md Resolved
Comment thread adr/029-peer-table-eviction-policy.md Resolved

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces ADR 029, which establishes the Peer-Table Eviction Policy. The policy specifies that peer table entries are evicted based on a 600-second TTL and through active removal triggered by registry deregistration or origin blacklisting. It also clarifies that reputation scores do not influence eviction and that the table has no default hard size cap, as growth is naturally limited by the staking registry. Related ADRs and documentation have been updated to reflect these changes. I have no feedback to provide.

thiras and others added 3 commits May 6, 2026 22:07
Bot review on #443 noted that ADR 029 referenced metric updates to
appendix-observability.md without actually amending the appendix. Add
the new label value and counters there now so the observability spec
stays self-consistent in a single PR:

- decdn_gossip_messages_rejected_total: add reason=table_full
- decdn_peer_table_evicted_ttl_total: new counter (TTL sweeper)
- decdn_peer_table_evicted_registry_total: new counter, labeled by
  reason={deregistered,ejected}

ADR 029 §2 prose tightened from "extending the label set in" to
"label registered in" since the appendix now lists it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Reviewer flagged that the two new gossip-metrics rows in
appendix-observability.md §2.6 used "[ADR 029 §1]" / "[ADR 029 §3]"
link text without section-anchor URLs, inconsistent with the existing
"[ADR 026 §8](…#8-slashing-and-burn)" precedent elsewhere in the
appendix. Add the matching anchors so the §-style references resolve.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Apply two stale-prone-phrasing suggestions from the latest review:

- §2: "label registered in" → "per". "Registered in" implies a one-time
  act and would lie if the label were ever removed from the appendix;
  "per" simply frames the appendix as authoritative.
- §6: "§2 adds the new label value reason=table_full" → "§2 specifies
  when the reason=table_full label value fires". Once the appendix
  records the label, "adds" reads as a stale change-log entry rather
  than a present-tense pointer.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@thiras
thiras merged commit 0764180 into main May 6, 2026
9 checks passed
@thiras
thiras deleted the docs/adr-029-peer-table-eviction branch May 6, 2026 19:27
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.

ADR gap: peer table eviction policy

2 participants