Repository navigation
Fix Sentinel watchlist item uploads and request bodies - #962
Open
Behzad Motaghi (Motaghi) wants to merge 1 commit into
Open
Behzad Motaghi (Motaghi) wants to merge 1 commit into
Behzad Motaghi (Motaghi) wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes three problems in
sentinel_watchlists.pythat sit on the same upload path.create_watchlistandadd_watchlist_itemsendstr()of a Python dict as the request body, so it uses single quotes and isn't valid JSON, although the request declaresContent-Type: application/json. Both now pass the payload through HTTPX'sjsonparameter.add_watchlist_itemturns Series and DataFrame input into row dictionaries, then puts the originalitemin every request, so a two-row DataFrame sent the whole frame's text in both PUTs. Each PUT now sends its own row.With
overwrite=True, the item ID lookup matched any row containing any of the new item's values. If an earlier row shared one value, for example the sameType, that row was overwritten with the new item, so its original values were lost and the watchlist ended up with two identical rows. The lookup now uses the same all-column comparison as the existence check.Each fix has a respx test that fails on main and passes here: Both request bodies decode as JSON with quotes and newlines intact (including CSV content), dict, Series and DataFrame input send one row per PUT, and an overwrite with a partial match ahead of the exact row targets the exact row. All 12 watchlist tests, the focused pre-commit hooks and mypy pass. Full disclosure, I haven't run this against a live workspace.
numpy int64 and NaN values aren't JSON serializable so I left these alone, so rows like that now raise before the request instead of sending an unreadable body.
I used gpt-6.1-sol via Codex, run from T3 Code, to write the patch and tests, and Claude Opus 5.5 reviewed the change independently. I've read and verified the diff myself.