Revise PR #246: nan and inf walk straight through the new since guard - #269
Revise PR #246: nan and inf walk straight through the new since guard#269jaylfc wants to merge 1 commit into
Conversation
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
Warning Review limit reached
Next review available in: 56 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| since = float(since_raw) if since_raw is not None else None | ||
| except (TypeError, ValueError) as exc: | ||
| raise _BadRequest("'since' must be a float timestamp") from exc | ||
| if since is not None and since < 1_000_000_000: |
There was a problem hiding this comment.
CRITICAL: nan and inf bypass this guard — PR title claims to fix them but the check doesn't catch them
float('nan') < 1_000_000_000 is False in Python (NaN comparisons always return False), and float('inf') < 1_000_000_000 is also False. So since=nan and since=inf both pass through to archive.query(), where they are truthy and get injected into the SQL as timestamp >= nan/inf. The client receives a 200 with an empty (or wrong) result set instead of the expected 400.
Since math is already imported (line 167), use math.isnan(since) or math.isinf(since) to catch these before the range check.
This affects both this handler and the SSE handler at line 1566.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| last_ts = float(since_raw) if since_raw is not None else time.time() | ||
| except (TypeError, ValueError): | ||
| last_ts = time.time() | ||
| if since_raw is not None and last_ts < 1_000_000_000: |
There was a problem hiding this comment.
CRITICAL: Same nan/inf bypass as in _handle_a2a_messages
float('inf') < 1_000_000_000 is False, so since=inf reaches service.a2a_feed(since=inf, ...) and the SSE loop runs forever sending keepalives. since=nan causes m["ts"] > last_ts to always be False (NaN comparison), so every poll returns empty and the stream hangs.
Add math.isnan(last_ts) or math.isinf(last_ts) before or alongside the range check.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| assert status == 200 | ||
| msgs = body["messages"] | ||
| assert len(msgs) == 1 | ||
| assert msgs[0]["body"] == "after pivot" |
There was a problem hiding this comment.
WARNING: No test coverage for nan/inf rejection despite the PR title claiming to fix them
The PR title says "nan and inf walk straight through the new since guard" but no tests were added for since=nan or since=inf on either endpoint. Without these tests the claimed fix cannot be verified and may regress.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by step-3.7-flash · Input: 109.4K · Output: 16.2K · Cached: 1.2M |
|
Closing this as superseded, and the reason is not "master moved" - it is that this PR does not fix the defect in its own title, and master already does. Everything below was run, not read. 1.
|
Master already rejects a bad since on /a2a/stream via _parse_since, but no test covered it. Lift the stream rejection tests from PR #269 and extend to nan, inf, a message id (1444) and an unparseable value (abc), each asserting HTTP 400. Add a valid-epoch accept case (1786000000) that reads only the SSE status line over a raw socket, so the never-closing accept stream cannot hang the test. Covers the PR #269 regression where /a2a/stream?since=abc returned 200.
CARD TITLE (intent, not commit subject): Revise PR #246: nan and inf walk straight through the new since guard
Autonomous build of board card tsk-dx6fok.
Files:
taosmd/http_server.py | 14 ++++++++--
tests/test_a2a.py | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 2 deletions(-)
Summary by Gitar
sincetimestamp values below1_000_000_000with a 400 error in/a2a/messagesand/a2a/streamendpointstests/test_a2a.pyfor rejected and acceptedsinceparameter valuesThis will update automatically on new commits.