Skip to content

feat(hub): read-only KB subscriptions — federate search without copying (#610) - #718

Closed
Tet-9 wants to merge 3 commits into
vouchdev:testfrom
Tet-9:feat/610-kb-subscriptions
Closed

feat(hub): read-only KB subscriptions — federate search without copying (#610)#718
Tet-9 wants to merge 3 commits into
vouchdev:testfrom
Tet-9:feat/610-kb-subscriptions

Conversation

@Tet-9

@Tet-9 Tet-9 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What changed

Adds read-only KB subscriptions: vouch subscribe <kb>, vouch unsubscribe <kb>, and vouch subscriptions list. A subscribed KB's approved knowledge is queried alongside the local KB in kb.search and kb.context and merged into results — live, read-only, never copied. Federated hits are namespaced (<kb_id>:<artifact_id>), tagged with origin_kb_id/origin_kb_name/trust_level, and capped by a budget_share config 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 hub export/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

  • No existing on-disk file changes shape, and no existing file moves.
  • ContextItem gains one new optional field, trust_level (default None) — additive, not a breaking change to the existing shape.
  • kb.search / kb.context can now return additional hits (tagged federated: true) when the KB has subscriptions configured — opt-in and off by default, so behavior for any KB with no subscriptions.json is unchanged.
  • No change to 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 check passes locally (lint + mypy + pytest)
  • New / changed behaviour has a test (tests/test_subscriptions.py, 14 tests: subscribe/unsubscribe/list, one-hop enforcement, budget cap, dead-subscription handling, origin/trust tagging)
  • CHANGELOG.md updated under ## [Unreleased]

@Tet-9
Tet-9 requested a review from plind-junior as a code owner July 31, 2026 07:43
@github-actions github-actions Bot added cli command line interface storage kb storage, migrations, schemas, and proposals retrieval context, search, synthesis, and evaluation tests tests and fixtures size: L 500-999 changed non-doc lines labels Jul 31, 2026
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
@Tet-9
Tet-9 force-pushed the feat/610-kb-subscriptions branch from 86829ae to fc4de4f Compare July 31, 2026 07:56
@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance schemas json schemas and generated schema assets labels Jul 31, 2026
Tet-9 added 2 commits July 31, 2026 14:47
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.
@Tet-9
Tet-9 force-pushed the feat/610-kb-subscriptions branch from b902b50 to 8572874 Compare July 31, 2026 13:55
@plind-junior

Copy link
Copy Markdown
Member

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 make check unticked and CHANGELOG.md unticked, diff coverage (100% of changed python) is failing on CI, and the VEP section reads "Not yet — checking whether this qualifies as a surface change requiring one before merge." that last one is not a formality here. this adds kb.search / kb.context results that are not local artifacts, namespaced ids (<kb_id>:<artifact_id>), and a new optional trust_level field on ContextItem. whether that needs a VEP is exactly the question to settle before review, not during.

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. kb.propose_* taking a <kb_id>:<artifact_id> as a claim or source reference, kb.supersede on a federated id, a page citing one — each needs to fail closed, and the 14 tests listed cover subscribe/unsubscribe/list, one-hop, budget, dead subscriptions and tagging, but not that. with 100% diff coverage failing, i cannot tell from CI either.

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.

@Tet-9

Tet-9 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

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 make check unticked and CHANGELOG.md unticked, diff coverage (100% of changed python) is failing on CI, and the VEP section reads "Not yet — checking whether this qualifies as a surface change requiring one before merge." that last one is not a formality here. this adds kb.search / kb.context results that are not local artifacts, namespaced ids (<kb_id>:<artifact_id>), and a new optional trust_level field on ContextItem. whether that needs a VEP is exactly the question to settle before review, not during.

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. kb.propose_* taking a <kb_id>:<artifact_id> as a claim or source reference, kb.supersede on a federated id, a page citing one — each needs to fail closed, and the 14 tests listed cover subscribe/unsubscribe/list, one-hop, budget, dead subscriptions and tagging, but not that. with 100% diff coverage failing, i cannot tell from CI either.

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

@Tet-9

Tet-9 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

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 make check unticked and CHANGELOG.md unticked, diff coverage (100% of changed python) is failing on CI, and the VEP section reads "Not yet — checking whether this qualifies as a surface change requiring one before merge." that last one is not a formality here. this adds kb.search / kb.context results that are not local artifacts, namespaced ids (<kb_id>:<artifact_id>), and a new optional trust_level field on ContextItem. whether that needs a VEP is exactly the question to settle before review, not during.
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. kb.propose_* taking a <kb_id>:<artifact_id> as a claim or source reference, kb.supersede on a federated id, a page citing one — each needs to fail closed, and the 14 tests listed cover subscribe/unsubscribe/list, one-hop, budget, dead subscriptions and tagging, but not that. with 100% diff coverage failing, i cannot tell from CI either.
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli command line interface docs documentation, specs, examples, and repo guidance retrieval context, search, synthesis, and evaluation schemas json schemas and generated schema assets size: L 500-999 changed non-doc lines storage kb storage, migrations, schemas, and proposals tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(hub): read-only kb subscriptions — federate search without copying

2 participants