Skip to content

Cleanup: count via COUNT(*), minor simplifications - #59

Merged
digitalflanker-ux merged 1 commit into
mainfrom
cleanup/api-simplify
Jun 28, 2026
Merged

Cleanup: count via COUNT(*), minor simplifications#59
digitalflanker-ux merged 1 commit into
mainfrom
cleanup/api-simplify

Conversation

@digitalflanker-ux

@digitalflanker-ux digitalflanker-ux commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

/simplify cleanup pass over the authored API backend (4 parallel review agents: reuse / simplification / efficiency / altitude).

Applied

  • Efficiency: status.py and hrp doctor counted recommendations/positions by fetching up to 1000 rows then len()-ing them → COUNT(*). The staleness banner polls /api/status on every page load, so this avoids a large fetch per request.
  • Simplification: settings.py split SQL string literal → one line; status.py redundant or 0 removed.

Skipped (with reason)

  • screens.py direction ternary — a deliberate guard on an interpolated SQL value, not redundancy.
  • screens.py filter-builder / cli.py dispatch-dict abstractions — premature for 2 filters / 5 trivial commands (the altitude agent itself rated these acceptable).
  • Reuse review: clean — no existing helpers were re-implemented.

70 tests pass; ruff/black clean; /api/status re-verified against the real DB.

🤖 Generated with Claude Code

https://claude.ai/code/session_011BFeBAuxWTFRayNGMD7VDn


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

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
@digitalflanker-ux
digitalflanker-ux merged commit 468005d into main Jun 28, 2026
1 check passed
@digitalflanker-ux
digitalflanker-ux deleted the cleanup/api-simplify branch June 28, 2026 20: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