8000 refactor(minvmd): move the drop limiter core into its own module by gominimal-aw-bot[bot] · Pull Request #2349 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

refactor(minvmd): move the drop limiter core into its own module - #2349

Merged
norrietaylor merged 1 commit into
mainfrom
inbox-patch/drop-limiter-core-3af259cc6d866fc3
Oct 20, 2026
Merged

norrietaylor merged 1 commit into
mainfrom
inbox-patch/drop-limiter-core-3af259cc6d866fc3

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Oct 19, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABYJPq9w

The daemon's drop limiter lived in net::egress_gate while the DNS
pins imported it, and the gate's refusal paths reached back through
net::dns_pins — a non-test import cycle between the two modules.

The limiter's core is shared policy machinery, not gate logic, so it
now lives in its own net::drop_limiter module: the warn-cadence
constants, the DropKey and WarnDecision enums, and DropLimiter
with its window bookkeeping and the DNS refusal emitter, moved
verbatim with only the visibility raises the net subtree needs.

dns_pins and egress_gate each import the limiter now without
importing each other; the only remaining references between them are
cfg(test) test-support calls. No behavior changes.

Verification

  • cargo fmt --all --check — clean
  • cargo clippy --workspace --all-targets --locked -- -D warnings — clean
  • cargo test --locked -p minvmd — 575 passed, 3 failed
  • The 3 failures are pre-existing on main (verified by re-running
    on the stashed clean tree: the same 2 answerer global-subscriber
    races and 1 sock path assertion fail identically without this
    change; none touch the modules moved here)
  • All 134 dns_pins/egress_gate/drop_limiter tests pass
  • grep egress_gate crates/minvmd/src/net/dns_pins.rs — only
    cfg(test) test_support::capture_log() lines remain
  • grep 'dns_pins\|egress_gate' crates/minvmd/src/net/drop_limiter.rs
    — no imports of either module

Summary by CodeRabbit

  • Improvements
    • Network drop and DNS-refusal warnings are now limited to one message per source and rule every 60 seconds, reducing repeated alerts.
    • Warning tracking is capped; when that limit is reached, warnings use a shared fallback rate limit. DNS refusal messages may be suppressed when the limit is reached.

dns_pins and egress_gate formed a non-test import cycle: the pins
imported DropLimiter from egress_gate, and the gate's refusal lines
reached back through dns_pins. Move the limiter's generic core -- the
warn cadence constants, the DropKey and WarnDecision enums, and the
DropLimiter struct with its window bookkeeping and the DNS refusal
emitter -- into a new net::drop_limiter module, verbatim, raising
visibility only as far as the net subtree needs.

Both modules now import the limiter without importing each other;
only cfg(test) test-support references remain between them. No
behavior changes; every existing test passes unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner October 19, 2026 08:59
@gominimal-aw-bot gominimal-aw-bot Bot added agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch labels Oct 19, 2026
@coderabbitai
coderabbitai Bot commented Oct 19, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 6facb69a-5ec1-4f82-9e43-f46e9746cbf1
📥 Commits

Reviewing files that changed from the base of the PR and between 2e67f8a and 51a10f8.

📒 Files selected for processing: 4
  • crates/minvmd/src/net.rs
  • crates/minvmd/src/net/dns_pins.rs
  • crates/minvmd/src/net/drop_limiter.rs
  • crates/minvmd/src/net/egress_gate.rs

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

📝 Walkthrough

The drop-warning limiter moves from egress_gate.rs into a dedicated drop_limiter module. The limiter retains its rate-limit decisions and DNS-refusal warning emission. Network and DNS pin code now import it from the new module.

Changes: Drop warning limiter

Layer / File(s) Summary
Limiter rules and warning emission
crates/minvmd/src/net/drop_limiter.rs, crates/minvmd/src/net/egress_gate.rs
The new module defines warning keys, 60-second intervals, a 1,024-key limit, and named, overflow, or suppressed decisions. It handles DNS-refusal warning emission. The corresponding local definitions and method are removed from egress_gate.rs.
Network module wiring
crates/minvmd/src/net.rs, crates/minvmd/src/net/egress_gate.rs, crates/minvmd/src/net/dns_pins.rs
net.rs declares drop_limiter. Egress and DNS pin code, including test imports, use the new module path.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: norrietaylor

Merge Risk: ⚪ Minimal · up to 51a10

No merge-blocking behavior change was established; the PR is ready to merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description explains the motivation, scope, behavior impact, and verification results. It includes a detailed verification section, but it does not use the template's exact Testing heading and omi…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: moving the drop limiter core into its own module.
Full details: Description check

Explanation

The description explains the motivation, scope, behavior impact, and verification results. It includes a detailed verification section, but it does not use the template's exact Testing heading and omits the Checklist section.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 too large.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the warning clock,
One minute passes on the rock.
The names take turns; the overflow waits,
The keys stay bounded at their gates.
A fresh module keeps the code in view,
Then hops away beneath the moon.

Comment @coderabbitai help to get the list of available commands.

@bryan-minimal bryan-minimal left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A verbatim move: constants, DropKey, WarnDecision and DropLimiter with decide/should_warn_*/warn_dns_refusal land in net::drop_limiter unchanged, the gate keeps its own emit arms in an impl block of its own, and dns_pins/egress_gate no longer import each other outside cfg(test). The three pre-existing minvmd test failures are the known answerer-subscriber races. Approving.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 20, 2026
@norrietaylor norrietaylor changed the title fix: refactor(minvmd): move the drop limiter core into its own module refactor(minvmd): move the drop limiter core into its own module Oct 20, 2026
Merged via the queue into main with commit 8d4e7c5 Oct 20, 2026
35 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/drop-limiter-core-3af259cc6d866fc3 branch October 20, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0