feat(orb): export a signed, anonymized federated calibration bundle (opt-in) - #6505
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…opt-in) Adds the export side of federated fleet intelligence (JSONbored#1970): buildFederatedBundle packages this instance's own calibration signals into a signed, anonymized bundle an operator can hand to a peer. Opt-in via a new .loopover.yml federatedIntelligence: block, cloning the draftFlow/upstreamDriftIssues config-as-code pattern (JSONbored#6275). Absent or disabled => the builder returns null having read no database and made no network call, so an instance that has not opted in is byte-identical to before. The bundle carries aggregate figures only -- gate precision, fp/fn, reversal/slop/copycat rates and cycle percentiles over a window. The privacy floor is structural rather than a filtering step: the aggregate query never SELECTs project or target_id, so no identifier can reach a bundle even by mistake. Below MIN_DECIDED the precision figures publish as null rather than as a number the fleet would refuse to count. Reuses the existing pipeline rather than reimplementing it: foldInstance for the confusion matrix (so a bundle's precision is defined identically to the peer median JSONbored#6481 compares it against), instanceId for the opaque handle, bucketReasonCode, cycleTimeMs, and the createHmac signing idiom. Export side only -- transport is JSONbored#6479, import/trust-gating is JSONbored#6480. The signing key is a documented TODO(JSONbored#6477) placeholder rather than an invented peer-trust scheme. Closes JSONbored#6478
2b62531 to
f8cadb3
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6505 +/- ##
=======================================
Coverage 95.56% 95.57%
=======================================
Files 589 590 +1
Lines 47121 47170 +49
Branches 14989 15007 +18
=======================================
+ Hits 45032 45081 +49
Misses 1297 1297
Partials 792 792
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-16 11:58:47 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Closes #6478. Export side of federated fleet intelligence (#1970).
buildFederatedBundle(src/orb/federated-bundle.ts) packages this instance's own calibration signals into a signed, anonymized bundle an operator can choose to hand to a peer. Export only — transport is #6479, import/trust-gating is #6480.Not a duplicate of the Orb export (#1255)
exportOrbBatch(src/selfhost/orb-collector.ts:155) also "exports calibration", so to be explicit — this is distinct on five axes, and none of them can be retrofitted onto that path:orb-collector.ts:6-7); onlyORB_AIR_GAPsuppresses it (:157).loopover.yml, default off:168,https://api.loopover.ai/v1/orb/ingest)repo_hash/pr_hashper event (:187-188)Enumerated bundle fields (auditable, per the issue's requirement)
Aggregate-only. No source, diffs, logins, repo names, PR ids, commit SHAs, raw gate reason text, or per-PR rows.
schemaVersioninstanceIdorb-collector.ts:59) — reused, not a second identitygeneratedAtwindowDaysdecidedmergePrecision/closePrecisionMIN_DECIDEDfpRate/fnRateMIN_DECIDEDreversalRatecycleP50Ms/cycleP95MsslopRate/copycatRatesignatureThe privacy floor is structural, not a filtering step:
LOCAL_CALIBRATION_QUERYjoins onproject/target_idbut neverSELECTs them, so no identifier can reach a bundle even by mistake. A test asserts the exact key set, so a new field cannot land without review.Choices worth flagging
federatedIntelligence:block, notfeatures:— cloned fromdraftFlow/upstreamDriftIssues(epic: migrate fleet-wide feature-toggle env vars to .loopover.yml config-as-code #6275).features:' allowlist default would mean an un-opted-in instance is not byte-identical, which this issue requires.foldInstanceis exported and reused rather than copied. This is semantic, not just DRY: Dashboard benchmark view: gate precision vs peer median for federated fleet intelligence #6481 renders "your gate precision vs peer median", so both sides must use one definition or the comparison is apples-to-oranges. Same forinstanceId,bucketReasonCode,cycleTimeMs, and thecreateHmacidiom.MIN_DECIDEDgate — below it, precision publishes asnullrather than a number the fleet would refuse to count anyway.TODO(#6477)placeholder (the existing per-instance anon secret). Per the issue, Design: trust-gating/anti-poisoning scoring rules for federated signal-bundle import #6477's peer-trust scheme is deliberately not invented here; it makes the bundle tamper-evident but does not yet establish peer trust — which is exactly why Implement signature-bundle import + trust-gating validation for federated fleet intelligence #6480 is blocked on Design: trust-gating/anti-poisoning scoring rules for federated signal-bundle import #6477.fetchis never called even when opted in. Transport is Opt-in collector client for federated fleet intelligence (push/pull transport) #6479.node:crypto, already used across the repo.Verification
typecheck(whole repo),docs:drift-check,engine-parity:drift-check,manifest:drift-check,command-reference:check,selfhost:env-reference:check,ui:openapi:check— all pass.federated-bundle.test.ts, 8 new config cases infocus-manifest.test.ts).src/orb/federated-bundle.ts33/33 statements, 41/41 branches; every added line inanalytics.ts,orb-collector.ts, and the enginefocus-manifest.tscovered. Branches covered include opted-out, opted-in, the sub-MIN_DECIDEDnull arm, zero-decided, reverted vs reopened vs none, window default/clamp/reject, and the fail-safe error path.Rebased onto current
main(2caac30). The earlier red shards were a transiently-red base, not this diff:backfill.test.ts,queue-5.test.tsandapi.test.tsfailed on untouchedmainat the previous base and all pass on2caac30both with and without this change (364/364).