snipe/tests/db
pyr0ball e34c2b9982 feat(db): wire Postgres shared backend into main.py and extend protocol
SharedTableProtocol now covers the full shared-table surface:
  - sellers, market_comps, reported_sellers (already in SnipeSharedStore)
  - scammer_blocklist (new — is_blocklisted, add/remove/list_blocklist)
  - refresh_seller_categories (reads per-user SQLite, writes to Postgres)

TrustScorer updated to accept SharedTableProtocol (was Store).

api/main.py:
  - _pg_shared_store global + _make_shared_store(path) helper
  - Lifespan init: SNIPE_SHARED_DB_URL → SnipeSharedDB + SnipeSharedStore
  - All Store(shared_db) calls for shared tables replaced with
    _make_shared_store(shared_db) or shared_store.clone()
  - Blocklist endpoints use _make_shared_store (Postgres when configured)
  - Community signals stay SQLite-only (low-write, not in protocol)

Postgres migration 001: scammer_blocklist table added.
8 blocklist tests added (gated behind SNIPE_SHARED_DB_URL / @pytest.mark.postgres).
.env.example: SNIPE_SHARED_DB_URL documented.
compose.cloud.yml: GPU_SERVER_URL + SNIPE_SHARED_DB_URL comment added.

248 passed, 8 skipped (postgres-gated).

Closes: #45
2026-05-22 15:47:36 -07:00
..
__init__.py feat: add data models, migrations, and store 2026-03-25 13:08:55 -07:00
test_pg_shared.py feat(db): wire Postgres shared backend into main.py and extend protocol 2026-05-22 15:47:36 -07:00
test_protocol.py refactor(adapters): accept SharedTableProtocol; replace thread-local Store pattern with clone() 2026-05-18 09:12:00 -07:00
test_store.py feat: snipe beta backlog batch (tickets #22/#28/#30/#34/#35/#36/#37/#38) 2026-04-13 19:32:50 -07:00