chore(ci): Sprint 31 — ruff linting + shared DB module #112

Closed
jpmschweitzer wants to merge 0 commits from sprint-31/ci into main
Owner

Summary

  • Extract shared tooling/db/common.py from duplicated DB path resolution, config loading, and connection setup across 4 consumer scripts (#777)
  • Add ensure_venv() auto-activation for Python scripts with third-party dependencies — friendly error when .venv is missing
  • Add pyproject.toml with ruff config (ruff==0.15.9, CVE-clean), make lint-python target, and Python/ruff block in pre-push hook
  • Fix pre-existing NameError in decisions_sync.py (missing import os) and remove unused imports across 3 tooling scripts

Changes

  • New: tooling/db/common.pyresolve_db_path(), load_config(), get_connection(), ensure_venv()
  • New: pyproject.toml — ruff config + dev dependencies
  • Updated: ticket, sprint, sqlite_connector.py, decisions_sync.py — import from common
  • Updated: 5 connector scripts — ensure_venv() wiring
  • Updated: Makefilelint-python, setup-venv targets
  • Updated: .config/hooks/pre-push — Python/ruff lint block

Test plan

  • ruff check tooling/ — 0 errors
  • tooling/db/ticket list --sprint 31 — works
  • tooling/db/ticket show 777 — works
  • tooling/db/sprint status — works
  • tooling/db/sqlite-query "SELECT count(*) FROM tickets" — works
  • make lint-python — works
  • ensure_venv() friendly error when .venv missing — verified
## Summary - Extract shared `tooling/db/common.py` from duplicated DB path resolution, config loading, and connection setup across 4 consumer scripts (#777) - Add `ensure_venv()` auto-activation for Python scripts with third-party dependencies — friendly error when `.venv` is missing - Add `pyproject.toml` with ruff config (ruff==0.15.9, CVE-clean), `make lint-python` target, and Python/ruff block in pre-push hook - Fix pre-existing `NameError` in `decisions_sync.py` (missing `import os`) and remove unused imports across 3 tooling scripts ## Changes - **New:** `tooling/db/common.py` — `resolve_db_path()`, `load_config()`, `get_connection()`, `ensure_venv()` - **New:** `pyproject.toml` — ruff config + dev dependencies - **Updated:** `ticket`, `sprint`, `sqlite_connector.py`, `decisions_sync.py` — import from `common` - **Updated:** 5 connector scripts — `ensure_venv()` wiring - **Updated:** `Makefile` — `lint-python`, `setup-venv` targets - **Updated:** `.config/hooks/pre-push` — Python/ruff lint block ## Test plan - [x] `ruff check tooling/` — 0 errors - [x] `tooling/db/ticket list --sprint 31` — works - [x] `tooling/db/ticket show 777` — works - [x] `tooling/db/sprint status` — works - [x] `tooling/db/sqlite-query "SELECT count(*) FROM tickets"` — works - [x] `make lint-python` — works - [x] `ensure_venv()` friendly error when `.venv` missing — verified
jpmschweitzer added 5 commits 2026-04-05 09:41:54 +02:00
Create tooling/db/common.py with resolve_db_path(), load_config(),
get_connection(), and ensure_venv(). Update ticket, sprint,
sqlite_connector.py, and decisions_sync.py to import from common
instead of duplicating. Fixes pre-existing NameError in
decisions_sync.py (missing import os). Add pyproject.toml with
ruff config (ruff==0.15.9, CVE-clean) and dev dependencies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add venv auto-activation to audio_batch, audio_connector,
image_connector, qdrant_connector, and trellis_connector.
Scripts re-exec into .venv/bin/python when invoked outside
the venv, with a friendly error if .venv is missing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Drop unused hashlib, math, and os imports from assign-astro-ids,
generate-star-map, and test_quaternius_raw to pass ruff clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Python/ruff block to .config/hooks/pre-push (runs on tooling/
changes). Add lint-python and setup-venv Makefile targets, wire
both into make lint and make setup respectively.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
Owner

Review: sprint-31/ci -> main (type: code)

Reviewers: Hoshe (code quality), Tyre (architecture)

Hoshe (Code Quality): APPROVE

Shared module correctly extracts duplicated patterns. All consumers updated. Ruff config sensible. DB access verified.

# File Severity Issue
1 qdrant_connector.py, audio_connector.py suggestion Still have local load_config() — incomplete adoption. Follow-up ticket.
2 Makefile pre-pr-lint suggestion lint-python not included in pre-pr-lint — ruff findings won't block pre-PR checklist.
3 sprint script try/finally suggestion cmd_start/cmd_stop call conn.close() inline without try/finally — pre-existing but inconsistent.

Tyre (Architecture): APPROVE

Clean structural refactor. common.py architecture appropriate for scale. ensure_venv() well-scoped. Ruff rule selection minimal and correct.

# File Severity Issue
1 pre-push hook suggestion Skip message says pip install 'ruff>=0.9' but should say make setup-venv.
2 common.py ensure_venv() suggestion Missing -> NoReturn return type annotation on os.execv path.

Verdict: APPROVED

## Review: sprint-31/ci -> main (type: code) Reviewers: Hoshe (code quality), Tyre (architecture) ### Hoshe (Code Quality): APPROVE Shared module correctly extracts duplicated patterns. All consumers updated. Ruff config sensible. DB access verified. | # | File | Severity | Issue | |---|------|----------|-------| | 1 | qdrant_connector.py, audio_connector.py | suggestion | Still have local `load_config()` — incomplete adoption. Follow-up ticket. | | 2 | Makefile pre-pr-lint | suggestion | `lint-python` not included in `pre-pr-lint` — ruff findings won't block pre-PR checklist. | | 3 | sprint script try/finally | suggestion | `cmd_start`/`cmd_stop` call `conn.close()` inline without try/finally — pre-existing but inconsistent. | ### Tyre (Architecture): APPROVE Clean structural refactor. `common.py` architecture appropriate for scale. `ensure_venv()` well-scoped. Ruff rule selection minimal and correct. | # | File | Severity | Issue | |---|------|----------|-------| | 1 | pre-push hook | suggestion | Skip message says `pip install 'ruff>=0.9'` but should say `make setup-venv`. | | 2 | common.py ensure_venv() | suggestion | Missing `-> NoReturn` return type annotation on `os.execv` path. | ### Verdict: APPROVED
jpmschweitzer closed this pull request 2026-04-05 09:55:00 +02:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jpmschweitzer/settled-reach#112