Repository navigation
fix(notion): normalize malformed success responses (#2340 to stage) - #2359
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
🤖 Internal: Discord sync markerAuto-managed by the Discord notification workflow. Stores the linked Discord message ID and forum thread ID. Do not edit or delete. |
asclearuc
left a comment
There was a problem hiding this comment.
Thanks @kgarg2468 — correct fix. resp.json() raising on a non-empty success body used to escape notion_client.request as a bare JSONDecodeError, which is neither the node's error envelope nor anything an agent can act on; converting it to NotionAPIError puts it back inside the contract. Catching ValueError is the right width, since requests.exceptions.JSONDecodeError and simplejson's both subclass it. Raising rather than continue keeps it out of the retry loop, which is the safe choice given the three write functions have no idempotency key. The message is built only from a fixed string and resp.status_code, so no response body can leak through it, and the two tests cover both the client layer and the public envelope.
This is the byte-identical port of #2340 onto stage (I compared the two diffs; they match exactly), so the review below is the same one I left on #2340.
Approve
No inline comments. The README note about a write whose response could not be decoded possibly having succeeded anyway is the right thing to have written down.
Summary
stagefor the current release.NotionAPIError.Type
fix
Testing
70 passedinnodes/test/tool_notion./builder testpasses — not run; focused node tests were usedChecklist
Paired Pull Requests
Linked Issue
Fixes #2336