feat(hub): read-only KB subscriptions — federate search without copying (#610) - #718
feat(hub): read-only KB subscriptions — federate search without copying (#610)#718Tet-9 wants to merge 3 commits into
Conversation
Federate search and context across KBs without copying, per ditto's subscription model. A subscribed KB's approved knowledge joins local kb.search / kb.context results, live and read-only, without becoming a local artifact. - subscriptions.py: subscribe/unsubscribe/list, budget_share config, read-only by construction (federated ids are namespaced <kb_id>:<artifact_id> and never resolve against the local store) - vouch subscribe / unsubscribe / subscriptions list CLI commands - search_kb and build_context_pack merge in federated hits, capped by a budget share that only fills leftover slots -- a subscription can never displace an already-ranked local result - every federated hit carries origin_kb_id/name and trust_level so it renders as visibly foreign, reusing the existing origin-tag mechanism from gated hub imports - one hop only: a federated call never itself federates - tests: subscribe/unsubscribe/list, one-hop enforcement, budget cap, dead-subscription handling, origin/trust tagging
86829ae to
fc4de4f
Compare
Unrelated to vouchdev#610. The prior merge from fix/config-numeric-coercion landed the coerce_numeric import but never wired it into min_observations/dedup_window_seconds -- they still called int()/ float() directly, so a malformed config value (e.g. a non-numeric string) crashed load_config instead of falling back to the default, exactly the case that import was meant to guard against.
… errors Unrelated to vouchdev#610. CI installs '.[dev,web]' only (no 'embeddings' extra), so these four files' module-level 'import numpy as np' was a hard collection error rather than a clean skip -- matches the guarded pattern already used in test_context.py.
b902b50 to
8572874
Compare
|
closing this — it is not finished by its own account, and the unfinished parts are the ones that decide whether it is safe. the PR's own checklist has the design instinct is right and i want to say so clearly: subscription really is the safer primitive than import for a review-gated system, and "a federated search hit is not a write, so there is nothing for the gate to guard" is the correct framing. one-hop-only, budget-capped so federated hits can never displace a ranked local result, and read-only end to end are all the right constraints. but the thing i would need to convince myself of before merging is the one the description asserts rather than demonstrates: that a federated id can never reach a write path. so: get the matrix and coverage green, finish the CHANGELOG entry, settle the VEP question, and add the tests that pin a federated id being refused by every write surface. i will review it properly then — #610 is a good issue and this is a credible answer to it. |
You may reopen it now please, just had something to deal with was why it was left uncompleted |
Then I'd complete everything that has do with it asap |
What changed
Adds read-only KB subscriptions:
vouch subscribe <kb>,vouch unsubscribe <kb>, andvouch subscriptions list. A subscribed KB's approved knowledge is queried alongside the local KB inkb.searchandkb.contextand merged into results — live, read-only, never copied. Federated hits are namespaced (<kb_id>:<artifact_id>), tagged withorigin_kb_id/origin_kb_name/trust_level, and capped by abudget_shareconfig knob so they only fill leftover slots and can never displace an already-ranked local result. Subscriptions are one hop only — a federated call never itself federates.Why
Today sharing knowledge between KBs means copying it via
vouch hubexport/import: the same fact ends up duplicated, drifts independently, and needs re-review on every upstream edit. For a review-gated system, subscription is the safer primitive than import — a federated search hit is not a write, so there's nothing for the review gate to guard, no new bypass risk. Closes #610.What might break
ContextItemgains one new optional field,trust_level(defaultNone) — additive, not a breaking change to the existing shape.kb.search/kb.contextcan now return additional hits (taggedfederated: true) when the KB has subscriptions configured — opt-in and off by default, so behavior for any KB with nosubscriptions.jsonis unchanged.kb.propose_*/kb.approve/ review-gate semantics — federated artifacts are read-only end to end (not proposable, not approvable, not supersedable locally).VEP
Not yet — checking whether this qualifies as a surface change requiring one before merge.
Tests
make checkpasses locally (lint + mypy + pytest)tests/test_subscriptions.py, 14 tests: subscribe/unsubscribe/list, one-hop enforcement, budget cap, dead-subscription handling, origin/trust tagging)CHANGELOG.mdupdated under## [Unreleased]