Repository navigation
feat: add Hive Mode pooled memory - #924
Conversation
|
Reviewed — solid, privacy-first design. I pushed fixes for two correctness bugs directly to the branch: Fixed (blocking):
Both ship with regression tests (concurrent Non-blocking follow-ups:
|
Two correctness fixes in the Hive aggregator: - SQLiteHiveStore shares one connection across the worker threads that asyncio.to_thread dispatches store calls onto. sqlite3 is not thread-safe for concurrent use of a single connection, so guard every access with a threading.RLock (fixes a data race under concurrent submit/suggestions). - suggestions() computed contributor_count as len(values), counting observations rather than distinct contributors; a single contributor can submit multiple envelopes per day, inflating the count and the derived confidence. Track distinct contributor_ids per pattern key instead. Adds regression tests for both (concurrent to_thread writes; one contributor submitting the same pattern twice). Fixes SynapseKit#927 Fixes SynapseKit#928 Co-authored-by: Dhruv Garg <[email protected]>
a805422 to
7576299
Compare
Hive Mode (SynapseKit#748) published nothing to the Live EventBus, leaving pooled-memory activity invisible in the glass-box dashboard. Auto-instrument HiveClient the same way every other subsystem is wired: contribute/withdraw/suggestions_for publish hive.contribute / hive.withdraw / hive.suggestions events (with scope). Async contract preserved; no-op when Live is off. Adds a no-mock test driving a real HiveClient over a real in-process aggregator + SQLite store. Records the feature and both Hive bug fixes in the changelog. Co-authored-by: Dhruv Garg <[email protected]>
|
Follow-up: wired Hive Mode into SynapseKit Live (commit |
Adds the HTTP-boundary coverage the transport layer was missing (no mocks): - create_hive_app via Starlette TestClient — routes, bearer auth (401/403), query params, and JSON round-trips against a real aggregator. - HttpHiveTransport (stdlib urllib, so respx can't intercept it) driven against a real localhost http.server on an ephemeral port — real submit/suggestions/ withdraw/transparency round-trip over TCP, asserting the bearer header and the _quote'd query string cross the socket. The round-trip test surfaced a real bug: SQLiteHiveStore.revoke() updates the `revoked` column, but list() rebuilt envelopes from the stored JSON blob (still `revoked: false`) and ignored the column, so transparency() reported withdrawn=false even after a withdrawal. list() now overlays the column onto the reconstructed envelope. Fixes SynapseKit#931 Co-authored-by: Dhruv Garg <[email protected]>
|
Added the HTTP-boundary coverage that was missing (commit That round-trip surfaced a real bug (#931): |
|
Merged into |
Summary
Implements #748 with opt-in local, team, and community scopes; bounded pattern mining; MeshPrivacyFilter redaction; pseudonymization; local differential privacy and epsilon accounting; Ed25519 signatures; optional AES-GCM envelopes; SQLite aggregation; cohort-gated suggestions; withdrawals; transparency reporting; offline cache fallback; a dependency-light HTTP client; an optional FastAPI service; and a local SQLite-backed CLI.
Tests
Closes #748