Repository navigation
fix(ingress): stabilize non-finite limiter key and count once - #73
Conversation
Key the non-finite diagnostic limiter by a fixed error category so an alternating-index NaN source cannot reset OccurrenceLimiter. Drop already-rejected packets that also carry a non-finite payload so the drained-packet gate cannot increment rejected_batches twice. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (1)
📝 SummarySummary by CodeRabbit
WalkthroughThe daemon now uses a stable rate-limiter key for non-finite ingress warnings. It also admits already-rejected packets only when their payload is finite, with tests covering rejection counts and continued tick processing. ChangesIngress rejection handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: 🔵 Low · up to Discarded non-finite input can incorrectly appear fresh in health reporting. The change is otherwise mergeable with awareness of this bounded issue; exclude these packets from the freshness update. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
✨ Simplify code
Comment |
There was a problem hiding this comment.
The changes correctly implement the two fixes described in the PR:
-
Stable limiter key (lines 748, 841): Uses
NON_FINITE_DIAGNOSTIC_CATEGORYconstant instead of hashing the formatted message, preventing alternating-index NaN sources from bypassing rate limiting. -
Count once (lines 960-965): Already-rejected non-finite packets are now dropped before admission, preventing double-counting by the drained-packet gate while finite rejected packets continue to be admitted.
Both fixes are well-tested with three new comprehensive test cases covering alternating indices and various rejection scenarios. The implementation maintains the existing behavior for finite rejected packets and includes clear inline documentation explaining the logic.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 14 |
| Duplication | 6 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
CodeAnt Nitpicks1 code suggestion1. Stimulus and modulator failures share one limiter key, so a newly occurring failure type can be suppressed and never emit its first diagnostic.Api mismatch · |
Extract observes_ingress and account_and_admit_backend_packet so already-rejected NaN/Inf packets do not refresh input_freshness and run_tick does not gain cyclomatic complexity from the double-count drop. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
| // `rejected_batches` accounting below and is not admitted when it also | ||
| // carries a non-finite payload, so the drained-packet gate cannot count | ||
| // it a second time. Finite inputs are untouched. |
There was a problem hiding this comment.
Fixed in 3c0e7af. The extra first_non_finite branch is now in account_and_admit_backend_packet, and freshness uses observes_ingress, so run_tick does not gain cyclomatic complexity from this follow-up. Fail-closed drained-gate early return is unchanged.
|
Dismissed: a single non-finite limiter category is the intended P2 fix. Splitting stimulus vs modulator keys would reintroduce |
There was a problem hiding this comment.
Code Health Improved
(1 files improve in Code Health)
Gates Passed
6 Quality Gates Passed
See analysis details in CodeScene
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| daemon.rs | 5.76 → 6.04 | Complex Method, Large Method, Bumpy Road Ahead |
Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
User description
Follow-up to #72 (merged while this review-fix was in flight) for the two actionable Codex P2 comments on issue #66.
Changes
Stable limiter key (discussion):
record_non_finite_rejectionkeysdiagnostics.non_finiteon the fixed categoryrejected non-finite ingressinstead of hashing the formatted warning. The warning text still includes the offending index; an alternating-index NaN source can no longer resetOccurrenceLimiter.Count already-rejected non-finite packets once (discussion): after the existing
rejected_batchesincrement, an already-rejectedpacket that also carries a non-finite payload is dropped (not admitted) so the drained-packet gate cannot increment the counter again. Finite rejected packets still admit and tick.Intentional #72 design is unchanged: drained-gate early return (
TickSucceeded+ nonetwork.step) for directBoundedIngressenqueue of non-finite packets.Tests
non_finite_limiter_is_stable_across_alternating_indicesalready_rejected_non_finite_packet_is_counted_oncealready_rejected_finite_packet_is_counted_once_and_still_ticksLocal gate:
cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo test --locked(146 passed / 1 ignored).--all-featuresclippy + test withCC=gcc CXX=g++(161 unit + 9 integration passed / 1 ignored).Replies posted as Fixed on both Codex threads on #72. Do not merge this until CI is green.
Summary by cubic
Stabilizes non-finite ingress rejection accounting so an alternating-index NaN source can no longer bypass the diagnostic limiter, and already-rejected packets are no longer double-counted.
OccurrenceLimiteron every index change.rejected_batchesincrement so the drained-packet gate cannot count them again; these packets also no longer refreshinput_freshness. Finite rejected packets still admit and tick unchanged.Written for commit 3c0e7af. Summary will update on new commits.
Release qualification tracking — 2026-09-30
This existing follow-up is part of 02 — v0.3.0 release qualification. Authoritative acceptance and release dependency: LIM-1322; delivered core implementation remains #66 / PR #72. No duplicate implementation assignment is needed.
PR #73 remains open at
d941383504dbe39e7c109e6391dcefd76a5afca1. Its functional CI passes. CodeScene fails its run_tick complexity gate; DeepSource is skipped for quota, and cubic is neutral for its review limit. No claim that every check passed or every review is resolved.The freshness review and CodeScene review are unresolved. Record fixes or explicit dispositions and final regression/CI evidence before closing the canonical qualification issue. This tracking update does not resolve reviews, merge this PR or authorize publication.
CodeAnt-AI Description
Prevent duplicate handling of rejected non-finite ingress and stabilize warnings
What Changed
Impact
✅ Accurate rejected-packet counts✅ No stale non-finite input marked as fresh✅ Controlled non-finite warning volume💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.