fix(caido): normalize string null and sentinels for scopeId and parentId (#1140) - #1151
fix(caido): normalize string null and sentinels for scopeId and parentId (#1140)#1151vardhans07 wants to merge 1 commit into
Conversation
Greptile SummaryThis PR normalizes optional Caido scope and sitemap-parent identifiers, treating common string null sentinels as absent and validating supplied IDs as signed 32-bit integers.
Confidence Score: 4/5The PR appears safe to merge, with a non-blocking test-coverage gap around the production query-building paths. The normalization and call-site wiring are internally consistent, but the tests exercise only the helper and therefore do not protect the agent-facing filter and sitemap-query behavior. Files Needing Attention: tests/test_caido_api.py Important Files Changed
Prompt To Fix All With AI### Issue 1
tests/test_caido_api.py:8-9
**Call-site normalization remains untested**
These tests invoke only `_normalize_optional_id`, so they do not verify that sentinel scope IDs omit the request filter or that sentinel parent IDs select the sitemap roots query. Add call-site tests to protect the agent-facing behavior this change is intended to fix.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(caido): normalize string null and se..." | Re-trigger Greptile |
0c165f4 to
36f2df6
Compare
|
Hi , Just wanted to check in on this. I added those call-site tests a couple of days ago for list_requests_with_client and list_sitemap_with_client to address the bot feedback. Everything is passing cleanly, so please let me know if this looks good or if you need any other changes. Thank you. |
Closes #1140
Context & Fix
Some LLMs serialize omitted or null arguments as literal strings like
"null","none", or"undefined"instead of actualnull/None. Inlist_requestsandlist_sitemap, we were checking truthiness directly (if scope_id:), which allowed these strings to pass through to the Caido GraphQL query, throwing anInvalid ID format, should be an i32error.To fix this, I added a
_normalize_optional_idhelper incaido_api.pythat:None.scope_idandparent_idbefore building the requests.Also added test cases in

tests/test_caido_api.pyto cover these sentinel strings, valid numeric IDs, invalid non-integers, and integer overflow.