Repository navigation
Normalize malformed response failures across the remaining typed parsers - #352
Conversation
Todos, room todos, skills, groups, rooms topics/messages/roster/app tiles, artifacts, note comments, image details, blog, chat send, sign-in and whoami parsers now raise ApiError (status 200) naming the shape or field instead of leaking KeyError/TypeError. Lists a poller reads (groups, group messages, artifacts, todos) skip and count a bad row; other lists fail whole. Optional fields keep their defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QNDehAurHo1CzCzisi6nYx
Vycari ReviewRound 5 on 2377ebf. The verdict is the Vycari Review check run, and each open finding is an inline thread. Reply on every P0 and P1 thread: Open: P0 0 · P1 0 · P2 0 · disputed 0 · confirmed fixed 0 · withdrawn 0 Hand-off: Covered: no Greptile round needed (Greptile's passing review of 2377ebf still covers this head). No open findings this round. P2s, judge's notes and closed findingsJudge's notes Capped: hunter:cross-file-contract (partial output kept). One candidate survived: a sent room message that the server stored could show as failed if the reply has a null field. I dropped it, because it needs the server to break its own contract, and turning a malformed reply into an error is what this PR is meant to do. The blog changes since the hand-off are simple pass-through parsers, and no P0 or P1 findings remain. |
|
Deferred gaps (a non-JSON 200 body, the raw-dict passthroughs, and showing skip counts in the TUI) are filed as #353. Generated by Claude Code |
… of errors Every list parser is strict again: a malformed group, group message, artifact or todo row fails the whole read with ApiError(200), as it did before this PR, so the rail never commits an ETag for a partial list, a note or room lookup cannot miss a row, and a stale-message refresh is retried. The unread `skipped` fields, TodoList, ArtifactListPage and the skip_bad_rows flag go with it. Room todos keep their older tolerance for non-object rooms and items. Showing partial lists is #353. _malformed no longer puts the raw value in ApiError.body: a device-poll body can carry the approved token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QNDehAurHo1CzCzisi6nYx
|
VR-5d29bd61: Fixed in 8135293: skip-and-count removed from this PR; a malformed row now fails the read as it did before, so nothing is hidden. Showing partial lists is tracked in #353. A refresh that hits a malformed row now gets ApiError(200), which is not a permanent refusal, so the row is retried with backoff rather than left stale. Generated by Claude Code |
|
@greptileai review |
_note_comments_from_dict called int() on resolved_count, so an object or list value escaped as TypeError. A new _wire_opt helper returns the default for a missing or null value and raises the malformed-response ApiError for any other wrong type (a bool is never an int). It is used for resolved_count and for the bare str() coercions in this PR's typed parsers: a note comment's body, created_at and author name, the note comments artifact_id, the room todos name and the blog publish/withdraw card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QNDehAurHo1CzCzisi6nYx
|
@greptileai review |
Keep main's stricter device-start validator (#346) and drop this branch's now-redundant device-start test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QNDehAurHo1CzCzisi6nYx
Take main's raw-dict blog methods, send their shape checks through _wire_row so a malformed reply carries no body, keep list_apps on _wire_list, and retarget the blog test at withdraw_blog_post. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QNDehAurHo1CzCzisi6nYx
Human overview
Finishes the parser audit from #348: the remaining typed parsers in
api_client.pynow turn a malformed 200 into anApiError(status 200) that names the field or shape, instead of leakingKeyError/TypeError. Every list fails whole on a bad row (no silent partial lists); opt-in skip-and-count with a visible marker is follow-up #353. Fixes #310.AI reviewer
Details for agents: what the diff does, invariants, verification, checklist
What changed. Helpers
_wire_field,_wire_list,_wire_rows(fail-whole) and_wire_opt(optional field: default when missing or null, malformed on any other type, bool included) beside #348's_wire_row/_wire_get;_wire_getwith no types is a presence check. Converted: todos and room todos, skills and room skills, device start/poll and whoami (shared_whoami_from), group list/summary/topic/message/card/roster/app tile, artifact list/detail/create/edit, note comments and threads, image details, blog publish/withdraw, chat send, scheduled-task thread, trajectory list, upload, and the.json()["key"]accessors. The generic"malformed response"raises now name the response.Fail-whole everywhere. Skip-and-count was removed after VR round 1: every list, including the ones the TUI polls, raises the malformed
ApiErroron one bad row, which was already the behaviour at the base. Room todos keep their existing tolerance for non-object rooms/items, but a malformed todo object or a wrong-typed room name fails the read (the TUI falls back to your own todos). Malformed-response errors carry an emptybody, so a device-poll PAT never reaches it. OnlyApiErroris caught, neverException.Compat. Optional fields keep defaults (
merged_from, formats,person_id,toolsets,labels,topics,features, ...).last_activity_atstays nullable.Not done. A non-JSON 200 body still raises the JSON decode
ValueErrorfromresp.json(). Raw-dict passthrough endpoints only get a top-level object/list check. View modules (feed, brief, following) were already defensive and are unchanged. Opt-in skip-and-count for the polled lists, with a visible partial marker, is #353.Verification (actual).
ruff format --checkclean,ruff checkclean,ty check src/pepper_cli/clean,pytest -n auto --cov: 3881 passed, 2 skipped, 95% coverage (floor 88), at b5fc6e3. New tests:tests/test_api_client_malformed_parsers.py; one assertion intest_api_client_room_skills.pynow checks themalformed responseprefix.Checklist (repo-specific)
uv run ruff format --checkanduv run ruff checkclean (no new lint ignores)uv run ty check src/pepper_cli/cleanuv run pytestpasses; coverage floor in.claude/maintainerd.jsonnot lowered/api/v1usage stays additive-only,# MIRROR:comments updated, unknown fields and frames still tolerated (contract test green, no mirrored dataclass changed)SKILL.mdupdated: not needed, no command or output changedhelp/cli.mdnot user-facing because only error handling on malformed responses changedFixes #310
Generated by Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues were found.Summary
The PR makes malformed successful replies raise
ApiErrorwith a field or shape name across the remaining typed parsers.Reviews (7) · Last reviewed commit: "Merge main (blog commands #337) into cli..." · Reviewed by Greptile