feat(miner-discovery-plane): add anonymized telemetry event schema for the hosted plane (#4301) - #4438
Conversation
…r the hosted plane (JSONbored#4301) Add packages/gittensory-engine/src/miner-telemetry.ts: the typed, pure schema/validator for the optional hosted discovery-index service's telemetry (query issued, candidates returned, soft-claim attempted/succeeded/collided) so that shared service can be operated and debugged without ever holding source, diffs, or credentials. Mirrors governor-ledger.ts's fail-closed normalize shape (fixed event-type + outcome-bucket vocabularies, unknown values throw) and copies orb-collector.ts's anonymization posture: repo/issue identifiers are the exporter's per-instance HMAC hashes (never raw owner/repo), free-text-adjacent fields collapse to a fixed low-cardinality outcome bucket, and metrics are count-only. An anti-leak guard in normalizeMinerTelemetryEvent rejects a repoHash/issueHash that looks like a raw identifier (contains '/' or whitespace), and metrics reject any non-finite-number value, so no de-anonymizing or free-text data can slip onto the wire. Schema/types only, per the issue: no exporter, no HMAC execution (the exporter does that at JSONbored#4250's boundary), no endpoint wiring. Re-exported from the barrel. Closes JSONbored#4301
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4438 +/- ##
=======================================
Coverage 93.95% 93.95%
=======================================
Files 412 413 +1
Lines 37212 37233 +21
Branches 13591 13602 +11
=======================================
+ Hits 34963 34984 +21
Misses 1594 1594
Partials 655 655
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-09 18:56:28 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Adds
packages/gittensory-engine/src/miner-telemetry.ts— the typed, pure schema/validator for the optional hosted discovery-index service's (#4250) telemetry, so that shared service can be operated and debugged without ever holding source, diffs, or credentials.Design
governor-ledger.ts):MINER_TELEMETRY_EVENT_TYPES(query issued, candidates returned, soft-claim attempted/succeeded/collided) andMINER_TELEMETRY_OUTCOME_BUCKETS— an unknown value throws rather than silently recording malformed data.orb-collector.ts(the one shipped precedent):repoHash/issueHashare the exporter's per-instance HMAC hashes, never a rawowner/repo; free-text-adjacent fields collapse to a fixed low-cardinality outcome bucket;metricsis count-only.normalizeMinerTelemetryEvent: rejects a hash that looks like a raw identifier (contains/or whitespace), and rejects any non-finite-number metric — so no de-anonymizing or free-text data can slip onto the wire.orb-collector.ts's style.Tests
test/unit/miner-telemetry.test.ts: frozen vocabularies, a full normalize round-trip, absent/null identifier defaulting, fail-closed on unknown type/outcome + non-object, the anti-leak guard (rawowner/repo, whitespace, non-string, empty), metric validation (non-number/NaN/array/null), and barrel re-export. 100% branch coverage on the new file; typecheck clean; the engine's own suite (321 tests) and the engine-parity drift-check are green.Closes #4301