fix(ingress): stabilize non-finite limiter key and count once

Merged
RM
15d ago
+163-11

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

  1. Stable limiter key (discussion): record_non_finite_rejection keys diagnostics.non_finite on the fixed category rejected non-finite ingress instead of hashing the formatted warning. The warning text still includes the offending index; an alternating-index NaN source can no longer reset OccurrenceLimiter.

  2. Count already-rejected non-finite packets once (discussion): after the existing rejected_batches increment, an already-rejected packet 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 + no network.step) for direct BoundedIngress enqueue of non-finite packets.

Tests

  • non_finite_limiter_is_stable_across_alternating_indices
  • already_rejected_non_finite_packet_is_counted_once
  • already_rejected_finite_packet_is_counted_once_and_still_ticks

Local gate: cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo test --locked (146 passed / 1 ignored). --all-features clippy + test with CC=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.

Open in Web Open in Cursor 

Devin Review

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.

  • Keys the non-finite diagnostic limiter on a fixed category instead of the hashed warning text, which included the offending index and reset OccurrenceLimiter on every index change.
  • Drops already-rejected packets that also carry a non-finite payload after the initial rejected_batches increment so the drained-packet gate cannot count them again; these packets also no longer refresh input_freshness. Finite rejected packets still admit and tick unchanged.
  • Adds tests covering stable limiter behavior across alternating indices, single-counting of rejected non-finite and finite packets, tick continuity, and freshness handling.

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

  • Rejected packets containing NaN or infinity are dropped without being admitted or counted twice.
  • Rejected non-finite packets no longer refresh input freshness, while finite rejected packets continue normal tick processing and freshness updates.
  • Non-finite warnings now share one stable category, so changing the offending input position cannot bypass warning rate limits.

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:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

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:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

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.