fix: extract hardcoded values to config, clean up bare pass (#776, #778, #782) #793

Merged
Timmy merged 2 commits from perplexity/Timmy-time-dashboard:fix/code-quality-778-776-782 into main 2026-03-22 01:46:16 +00:00
Collaborator

Summary

Three small code-quality fixes in one PR. All changes are backward-compatible — default values match the previous hardcoded ones.

Fixes #776 — Extract hardcoded PRAGMA busy_timeout=5000 to config

  • Added db_busy_timeout_ms: int = 5000 to Settings in src/config.py
  • Replaced hardcoded PRAGMA busy_timeout=5000 in:
    • src/timmy/memory_system.py (2 locations: get_connection() and SemanticMemory)
    • src/timmy/memory/unified.py (1 location: get_connection())
  • Now configurable via DB_BUSY_TIMEOUT_MS env var

Fixes #778 — Remove bare pass after logged exceptions

  • src/timmy/tools.py line 450: Removed redundant pass after logger.warning() in consult_grok()
  • src/timmy/tools.py line 464: Removed redundant pass after logger.warning() in Lightning invoice block
  • src/timmy/tools.py line 943: Replaced bare pass in _merge_catalog() with logger.debug() so missing optional catalogs are visible in debug logs instead of silently swallowed

Fixes #782 — Extract hardcoded sats limit in consult_grok()

  • Added grok_sats_hard_cap: int = 100 to Settings in src/config.py
  • Replaced magic number 100 in min(settings.grok_max_sats_per_query, 100) with settings.grok_sats_hard_cap
  • Added _INVOICE_MEMO_MAX_LEN = 50 constant for query[:50] truncation

Files Changed

File Changes
src/config.py +2 settings: db_busy_timeout_ms, grok_sats_hard_cap
src/timmy/memory_system.py Use config for busy_timeout (2 spots) + add import
src/timmy/memory/unified.py Use config for busy_timeout + add import
src/timmy/tools.py Remove 2 bare pass, replace 1 bare pass with debug log, extract constants

Testing

All default values match the previously hardcoded ones, so no behavior change without explicit config.

## Summary Three small code-quality fixes in one PR. All changes are backward-compatible — default values match the previous hardcoded ones. ### Fixes #776 — Extract hardcoded `PRAGMA busy_timeout=5000` to config - Added `db_busy_timeout_ms: int = 5000` to `Settings` in `src/config.py` - Replaced hardcoded `PRAGMA busy_timeout=5000` in: - `src/timmy/memory_system.py` (2 locations: `get_connection()` and `SemanticMemory`) - `src/timmy/memory/unified.py` (1 location: `get_connection()`) - Now configurable via `DB_BUSY_TIMEOUT_MS` env var ### Fixes #778 — Remove bare `pass` after logged exceptions - `src/timmy/tools.py` line 450: Removed redundant `pass` after `logger.warning()` in `consult_grok()` - `src/timmy/tools.py` line 464: Removed redundant `pass` after `logger.warning()` in Lightning invoice block - `src/timmy/tools.py` line 943: Replaced bare `pass` in `_merge_catalog()` with `logger.debug()` so missing optional catalogs are visible in debug logs instead of silently swallowed ### Fixes #782 — Extract hardcoded sats limit in `consult_grok()` - Added `grok_sats_hard_cap: int = 100` to `Settings` in `src/config.py` - Replaced magic number `100` in `min(settings.grok_max_sats_per_query, 100)` with `settings.grok_sats_hard_cap` - Added `_INVOICE_MEMO_MAX_LEN = 50` constant for `query[:50]` truncation ## Files Changed | File | Changes | |------|---------| | `src/config.py` | +2 settings: `db_busy_timeout_ms`, `grok_sats_hard_cap` | | `src/timmy/memory_system.py` | Use config for busy_timeout (2 spots) + add import | | `src/timmy/memory/unified.py` | Use config for busy_timeout + add import | | `src/timmy/tools.py` | Remove 2 bare pass, replace 1 bare pass with debug log, extract constants | ## Testing All default values match the previously hardcoded ones, so no behavior change without explicit config.
perplexity added 1 commit 2026-03-21 21:45:58 +00:00
fix: extract hardcoded values to config, clean up bare pass statements
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
ee84cc2b09
Fixes #776 — Extract hardcoded PRAGMA busy_timeout=5000 to config
  - Add db_busy_timeout_ms setting (default 5000) to Settings
  - Replace hardcoded values in memory_system.py (2 locations)
  - Replace hardcoded value in memory/unified.py (1 location)

Fixes #778 — Remove bare pass after logged exceptions in tools.py
  - Remove redundant pass after logger.warning in consult_grok()
  - Remove redundant pass after logger.warning in Lightning invoice block
  - Replace bare pass in _merge_catalog with logger.debug

Fixes #782 — Extract hardcoded sats limit in consult_grok()
  - Add grok_sats_hard_cap setting (default 100) to Settings
  - Replace magic number 100 with settings.grok_sats_hard_cap
  - Add _INVOICE_MEMO_MAX_LEN constant for query truncation
Timmy added 1 commit 2026-03-22 01:46:08 +00:00
Merge branch 'main' into fix/code-quality-778-776-782
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
77573b6c79
Timmy merged commit a3009fa32b into main 2026-03-22 01:46:16 +00:00
Timmy deleted branch fix/code-quality-778-776-782 2026-03-22 01:46:16 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#793