Cleanup: count via COUNT(*), minor simplifications - #59
Merged
Conversation
Cleanup pass over the API backend (reuse review came back clean): - status.py + hrp doctor counted recommendations/positions by fetching up to 1000 rows and len()-ing them; use COUNT(*) instead. status is polled by the staleness banner on every page load, so this avoids a large fetch per request. - settings.py: collapse a needlessly-split SQL string literal to one line. - status.py: drop redundant `or 0` default. Skipped (noted): the screens.py `direction` ternary is a deliberate guard on an interpolated SQL value (not redundant); the screens filter-builder and cli dispatch-dict abstractions would be premature for 2 filters / 5 trivial commands. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011BFeBAuxWTFRayNGMD7VDn
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.
/simplifycleanup pass over the authored API backend (4 parallel review agents: reuse / simplification / efficiency / altitude).Applied
status.pyandhrp doctorcounted recommendations/positions by fetching up to 1000 rows thenlen()-ing them →COUNT(*). The staleness banner polls/api/statuson every page load, so this avoids a large fetch per request.settings.pysplit SQL string literal → one line;status.pyredundantor 0removed.Skipped (with reason)
screens.pydirectionternary — a deliberate guard on an interpolated SQL value, not redundancy.screens.pyfilter-builder /cli.pydispatch-dict abstractions — premature for 2 filters / 5 trivial commands (the altitude agent itself rated these acceptable).70 tests pass; ruff/black clean;
/api/statusre-verified against the real DB.🤖 Generated with Claude Code
https://claude.ai/code/session_011BFeBAuxWTFRayNGMD7VDn
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.