Extract supervise types, eliminate get_supervise_mod() #329

Merged
didericis-claude merged 2 commits from supervise-types-extraction into sqlite-local-storage 2026-07-06 14:54:16 -04:00
Collaborator

Closes #319 (follow-up to issuecomment-2872 on PR #320).

Summary

  • New bot_bottle/_supervise_types.py holds Proposal, Response, AuditEntry, bot_bottle_root, host_db_path, and shared constants/helpers
  • queue_store and audit_store import directly from _supervise_typesget_supervise_mod() is gone
  • supervise.py re-exports everything from _supervise_types; host_db_path() is re-defined there so patches on supervise.bot_bottle_root still propagate for callers that go through the supervise module
  • _supervise_types.host_db_path() uses sys.modules[__name__].bot_bottle_root() so patches on _supervise_types.bot_bottle_root propagate through it
  • Test fixtures that create stores without an explicit db_path now patch _sv_types.bot_bottle_root alongside supervise.bot_bottle_root; the server test patches both flat and package _supervise_types
  • Dockerfile.sidecars gains a COPY for _supervise_types.py

1515 unit tests pass.

Closes #319 (follow-up to [issuecomment-2872](https://gitea.dideric.is/didericis/bot-bottle/pulls/320/files#issuecomment-2872) on PR #320). ## Summary - New `bot_bottle/_supervise_types.py` holds `Proposal`, `Response`, `AuditEntry`, `bot_bottle_root`, `host_db_path`, and shared constants/helpers - `queue_store` and `audit_store` import directly from `_supervise_types` — `get_supervise_mod()` is gone - `supervise.py` re-exports everything from `_supervise_types`; `host_db_path()` is re-defined there so patches on `supervise.bot_bottle_root` still propagate for callers that go through the supervise module - `_supervise_types.host_db_path()` uses `sys.modules[__name__].bot_bottle_root()` so patches on `_supervise_types.bot_bottle_root` propagate through it - Test fixtures that create stores without an explicit `db_path` now patch `_sv_types.bot_bottle_root` alongside `supervise.bot_bottle_root`; the server test patches both flat and package `_supervise_types` - `Dockerfile.sidecars` gains a `COPY` for `_supervise_types.py` 1515 unit tests pass.
didericis reviewed 2026-07-06 14:19:52 -04:00
@@ -68,6 +68,7 @@ COPY bot_bottle/dlp_detectors.py /app/dlp_detectors.py
COPY bot_bottle/yaml_subset.py /app/yaml_subset.py
COPY bot_bottle/migrations.py /app/migrations.py
COPY bot_bottle/db_store.py /app/db_store.py
COPY bot_bottle/_supervise_types.py /app/_supervise_types.py
Owner

Probably shouldn't be prepended by a _/should treat this as public.

Probably shouldn't be prepended by a `_`/should treat this as public.
didericis requested changes 2026-07-06 14:21:55 -04:00
Dismissed
didericis left a comment
Owner

Minor nit, but should remove the underscore for _supervise_types

Minor nit, but should remove the underscore for `_supervise_types`
Author
Collaborator

Done — renamed _supervise_types.pysupervise_types.py and updated all imports. Also cleaned up the test aliases (_sv_typessv_types, _svt_flat/_svt_pkgsvt_flat/svt_pkg) since they followed the module name.

Done — renamed `_supervise_types.py` → `supervise_types.py` and updated all imports. Also cleaned up the test aliases (`_sv_types` → `sv_types`, `_svt_flat`/`_svt_pkg` → `svt_flat`/`svt_pkg`) since they followed the module name.
didericis approved these changes 2026-07-06 14:26:20 -04:00
didericis added 2 commits 2026-07-06 14:54:08 -04:00
Proposal, Response, AuditEntry, host_db_path, bot_bottle_root, and their
shared constants/helpers are moved to a new _supervise_types.py module.
queue_store and audit_store now import these directly instead of deferring
through get_supervise_mod() at call time.

host_db_path() in _supervise_types uses sys.modules[__name__].bot_bottle_root()
so monkey-patches on _supervise_types.bot_bottle_root propagate through it.
supervise.host_db_path() is re-defined to call bot_bottle_root() through
supervise's own globals, preserving patchability for callers that go through
the supervise module.

Test fixtures that create stores without an explicit db_path now patch
_sv_types.bot_bottle_root alongside supervise.bot_bottle_root. The server
test patches both flat and package _supervise_types since handle_tools_call
runs in the package context while the responder thread uses the flat module.

Dockerfile.sidecars gets a COPY for _supervise_types.py so the sidecar
bundle retains its flat import chain.

Follow-up to issuecomment-2872 on PR #320.
refactor: rename _supervise_types → supervise_types (treat as public)
lint / lint (push) Successful in 2m1s
test / unit (pull_request) Successful in 56s
test / integration (pull_request) Successful in 20s
test / coverage (pull_request) Successful in 1m6s
9fb83ef1b0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
didericis force-pushed supervise-types-extraction from 5722f34f05 to 9fb83ef1b0 2026-07-06 14:54:08 -04:00 Compare
didericis-claude merged commit 9fb83ef1b0 into sqlite-local-storage 2026-07-06 14:54:16 -04:00
didericis-claude deleted branch supervise-types-extraction 2026-07-06 14:54:19 -04:00
Sign in to join this conversation.