Skip to content

refactor(poll_descriptor): split debug_log_throttle submodule (#4404 inc 1) - #4644

Merged
psaab merged 1 commit into
masterfrom
refactor/4404-increment-1
Jul 8, 2026
Merged

refactor(poll_descriptor): split debug_log_throttle submodule (#4404 inc 1)#4644
psaab merged 1 commit into
masterfrom
refactor/4404-increment-1

Conversation

@psaab

@psaab psaab commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Addresses #4404 (increment 1: extract/split debug_log_throttle; further increments tracked).

What

Pure code-motion split of the cold-path debug-log throttle unit out of
userspace-dp/src/afxdp/poll_descriptor/mod.rs into a new sibling submodule
poll_descriptor/debug_log_throttle.rs.

Moved verbatim:

mod.rs gains a mod debug_log_throttle; declaration + a use import.

Why this unit / why pure code-motion

This unit has zero cross-references back into mod.rs — the predicates depend on no
dataplane type — so it is the cleanest available boundary, and it directly matches the
issue's stated fix of outlining the cold-path debug logging. Behavior, the public
visibility surface, and all three test cases are identical; the bodies move verbatim.

The poll_binding_process_descriptor god-function itself (session-hit / session-miss /
flowless arm fusion) is not touched — per the issue it needs /triple-review because
it carries the single-recycle, CoS guarantee-guard, and packet-range/verifier-sensitive
invariants. Those further increments remain tracked on #4404.

Validation

Full cargo test (CARGO_TARGET_DIR=/tmp/cargo-4404) passes across every binary:

  • main lib: 3739 passed / 0 failed (the 3 moved tests now run as afxdp::poll_descriptor::debug_log_throttle::debug_log_throttle_tests::*)
  • other binaries: 60 + 8 + 22 + 1 passed, 0 failed

New file is rustfmt-clean at edition 2024; mod.rs changed lines match surrounding style.
Module doc (mod.rs header) + _Log.md updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_015oARShYtiJJ2H4UB4nXGqi

…inc 1)

#4404 asks for the decomposition of poll_descriptor/mod.rs and its
poll_binding_process_descriptor god-function. The god-function itself
fuses the session-hit / session-miss / flowless arms and is guarded by
load-bearing invariants (single-recycle, CoS guarantee-guard,
packet-range/verifier-sensitive logic); per the issue it needs
/triple-review and is left untouched here. This is a bounded first
increment of pure code-motion.

Move the cold-path debug-log throttle unit out of mod.rs into a new
sibling submodule poll_descriptor/debug_log_throttle.rs:

  - the two #4120 interval caps SESSION_MISS_DEBUG_LOG_CAP and
    POLICY_DENY_DEBUG_LOG_CAP (kept module-private, only referenced
    inside the moved code),
  - the two pure u64 -> bool predicates session_miss_debug_log_allowed
    and policy_deny_debug_log_allowed (now pub(super) so the mod.rs call
    sites in poll_binding_process_descriptor still reach them),
  - the debug_log_throttle_tests pinned-contract test module (the #4120
    RED-on-revert guard that proves the throttle takes no topology
    input).

mod.rs gains a `mod debug_log_throttle;` declaration and a `use` import.
This unit was chosen because it has ZERO cross-references back into
mod.rs — the predicates depend on no dataplane type, so it is the
cleanest available boundary — and it directly matches the issue's stated
fix of outlining the cold-path debug logging. Behavior, the public
visibility surface, and all three test cases are identical; the bodies
move verbatim.

Validation: full `cargo test` (CARGO_TARGET_DIR=/tmp/cargo-4404) passes
across every binary — main lib 3739 passed / 0 failed (the 3 moved tests
now run as afxdp::poll_descriptor::debug_log_throttle::debug_log_throttle_tests::*),
plus 60 + 8 + 22 + 1 in the other binaries, 0 failed. The new file is
rustfmt-clean at edition 2024; mod.rs changed lines match surrounding
style. Module doc (mod.rs header) and _Log.md updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015oARShYtiJJ2H4UB4nXGqi
Copilot AI review requested due to automatic review settings July 8, 2026 09:58
@psaab
psaab merged commit c729771 into master Jul 8, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the afxdp::poll_descriptor module by extracting the cold-path debug-log throttle caps/predicates (and their pinned-contract tests) into a dedicated sibling submodule, keeping poll_binding_process_descriptor logic unchanged while reducing local clutter and isolating a dependency-free unit.

Changes:

  • Added poll_descriptor::debug_log_throttle submodule and re-exported the two throttle predicates to the parent module via pub(super).
  • Removed the throttle caps/predicates and their tests from poll_descriptor/mod.rs, wiring call sites through a use import.
  • Logged the refactor increment in _Log.md per repository practice.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
userspace-dp/src/afxdp/poll_descriptor/mod.rs Declares/imports the new debug_log_throttle module and removes the inlined throttle unit/tests (pure code motion).
userspace-dp/src/afxdp/poll_descriptor/debug_log_throttle.rs New module containing the throttle caps, predicates, and the pinned-contract tests moved verbatim.
_Log.md Records the #4404 increment-1 refactor action and validation summary.

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.

2 participants