mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-12-06 19:24:41 +00:00
* feat(tagger): local UKMesh tagger backend with TypeSafe/Jev fallback Port of the tagger that has been running in production from the deployment tree but existed in no commit: it was an uncommitted local modification on the UKMesh VPS, so any deploy from origin/main would have silently reverted tagging to the TypeSafe cloud call. Changes carried over verbatim from the deployed tree: - `TAGGER_BACKEND` selects the backend: `local` (default) calls the UKMesh tagger (`ukmesh-tagger/run-base4`) on the pinned GPU lane through the GPU gateway; `jev` keeps the original TypeSafe call as a rollback lever. - Local responses are reshaped into the same `answers` structure `flatten()` already consumes, so tag storage is unchanged. - `TAGGER_URL` / `TAGGER_MODEL_ID` / `TAGGER_API_KEY` (or `TAGGER_API_KEY_FILE`) configure the local endpoint; startup fails loudly when the selected backend has no key instead of silently tagging nothing. - Every `message_tags` reference is qualified as `mesh.message_tags`, matching the schema move (migration 078). Unqualified references depended on the connection search_path. - `api_tag()` now takes `(sender, message)` and builds the state string itself. `docker-compose.yml` passes the four `TAGGER_*` variables through to the tagger-worker service with the same defaults the deployment uses. Verified: `python3 -m py_compile` clean; `docker compose config -q` clean; `test_tagger_candidates.py` collects (8 skipped without a database). * test(tagger): fixture mirrors the deployed schema (mesh.message_tags) The candidate-paging fixture built `public.message_tags`, which is exactly the stale duplicate the qualified worker exists to stop writing to. Migration 121 moved the table to `mesh`; the fixture now creates `mesh.message_tags` and addresses it fully qualified, so the test asserts the real target instead of the compatibility name. * test(tagger): follow api_tag's (sender, message) signature in the revocation case api_tag now takes the message parts rather than a pre-rendered state string, so the side_effect stub must accept two arguments. Passing one raised TypeError instead of the intended RuntimeError and the assertion read as a tagging bug.