Skip to content

fix: harden search_tasks against non-dict rows (v0.3.2) - #12

Merged
jschfflr merged 1 commit into
mainfrom
fix/robust-task-row-guard
Jul 8, 2026
Merged

jschfflr merged 1 commit into
mainfrom
fix/robust-task-row-guard

Conversation

@jschfflr

@jschfflr jschfflr commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Addresses the automated review on #9.

The unparseable-row skip path in search_tasks() called raw.get("id") assuming raw was a dict. But a non-dict row (a stray null) makes resolve_task(raw) raise AttributeError, not ValidationError — so it wasn't caught at all, and the intended "skip one bad row" became a whole-page crash.

Fix

  • Skip non-dict rows up front (before resolve_task), with a warning.
  • Tolerate a null tasks value (result.get("tasks") or []).
  • Tests: non-dict rows (None, a string) are skipped; null tasks yields an empty page.
  • Test nit from the review: added a positive status == TaskStatus.SCHEDULED equality check alongside the inequality one.

ruff ✓ · ruff format --check ✓ · pyright src/ 0 errors ✓ · pytest 181 passed ✓

🤖 Generated with Claude Code

Addresses the review on #9. The unparseable-row skip path called
`raw.get("id")` assuming `raw` was a dict — but a non-dict row (e.g. a
stray null) makes `resolve_task(raw)` raise AttributeError (not
ValidationError), so it wasn't even caught: the intended "skip one bad
row" became a whole-page crash. Now non-dict rows are skipped up front,
and iteration tolerates a null `tasks` value. Tests for both, plus a
positive status-enum equality assertion (test nit from the review).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
peqy[bot]
peqy Bot approved these changes Jul 8, 2026

@peqy peqy Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The upfront isinstance(raw, dict) guard prevents the AttributeError crash path, result.get("tasks") or [] handles null/missing tasks cleanly, and the added tests cover both cases. Ship it.

@jschfflr
jschfflr merged commit 355c518 into main Jul 8, 2026
4 checks passed
@jschfflr
jschfflr deleted the fix/robust-task-row-guard branch July 8, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant