Share server submit option parsing#20
Conversation
There was a problem hiding this comment.
PR Review
PR: Share server submit option parsing
Important
Verdict: Request changes - 1 actionable finding, highest severity P1.
Findings (1)
cache option overrides explicit false to true
src/cashet/_client_base.py:91
The shared helper uses data.get("cache") or True, which treats a client-supplied false as falsy and replaces it with True. The original inline code used data.get("cache", True), which correctly preserved an explicit False. This silently re-enables caching when the client explicitly requested no caching, potentially returning stale results.
How To Recheck
Reply @ds-review recheck under the relevant inline finding after pushing a fix.
| def resolve_submit_options( | ||
| data: Mapping[str, Any], | ||
| ) -> tuple[bool, dict[str, str], int, bool, Any, Any]: | ||
| cache = data.get("cache") or True |
There was a problem hiding this comment.
cache option overrides explicit false to true
The shared helper uses data.get("cache") or True, which treats a client-supplied false as falsy and replaces it with True. The original inline code used data.get("cache", True), which correctly preserved an explicit False. This silently re-enables caching when the client explicitly requested no caching, potentially returning stale results.
| cache = data.get("cache") or True | |
| cache = data.get("cache", True) |
There was a problem hiding this comment.
Thank you! I'm glad the review helped. Once you apply the fix to use data.get("cache", True), the caching behavior will correctly respect an explicit False.
|
Closing this test PR; opening a clean follow-up. |
Summary
/submittask option extraction into a shared helperTesting
.venv/bin/ruff check src/cashet/_client_base.py src/cashet/server.py.venv/bin/pytest tests/test_server.py -q.venv/bin/pytest tests/ -q