Skip to content

feat(miner-manage): add optional anonymized Orb telemetry export for miner outcomes (#4277) - #4476

Closed
andriypolanski wants to merge 3 commits into
JSONbored:mainfrom
andriypolanski:feat/miner-orb-export-4277
Closed

feat(miner-manage): add optional anonymized Orb telemetry export for miner outcomes (#4277)#4476
andriypolanski wants to merge 3 commits into
JSONbored:mainfrom
andriypolanski:feat/miner-orb-export-4277

Conversation

@andriypolanski

@andriypolanski andriypolanski commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Closes #4277

Summary

  • Add packages/gittensory-miner/lib/orb-export.js: opt-in (default OFF) exporter that reads miner-local pr_outcome events from the injected event ledger via readEvents({ since }), HMAC-anonymizes repo/PR identifiers with a dedicated per-miner secret persisted in local SQLite, buckets rejection reasons with the same taxonomy as src/selfhost/orb-collector.ts, and POSTs signed batches to the hosted Orb collector.
  • Mirror self-host export headers (x-orb-signature, x-orb-instance) and the no-PII contract (verdict/outcome/bucketed reason/cycle time only — no diffs, code, logins, or SHAs).
  • Respect ORB_AIR_GAP for air-gapped deployments; enable via GITTENSORY_MINER_ORB_EXPORT=1 or config.orbExport === true.

Depends on the sibling #4274 pr-outcome.js writer (already on main) as the export source.

Scope

  • Opt-in gating (disabled → no network)
  • Dedicated local anonymization secret (never GitHub tokens)
  • Seq-based cursor via event-ledger since pattern
  • Shared bucketReasonCode taxonomy (ported verbatim from orb-collector)
  • Injected fetchFn unit tests (no real network)
  • No UI changes — UI Evidence not required

Test plan

  • test/unit/miner-orb-export.test.ts — opt-in / air-gap gating, anonymization (no plaintext repo/PR in payload), cursor advancement, fetch failure does not advance cursor
  • npm run build:miner
  • npm run test:ci green
  • npm audit --audit-level=moderate clean

Validation

git diff --check
npm run typecheck
npx vitest run test/unit/miner-orb-export.test.ts
npm run build:miner
npm run test:ci
npm audit --audit-level=moderate

Changed files

File Change
packages/gittensory-miner/lib/orb-export.js New: opt-in Orb export + local secret/cursor store
packages/gittensory-miner/lib/orb-export.d.ts Type declarations
packages/gittensory-miner/package.json Syntax-check new module (+ pr-outcome)
test/unit/miner-orb-export.test.ts Unit tests with injected fetch

Env / config

Variable Purpose
GITTENSORY_MINER_ORB_EXPORT=1 Explicit opt-in (default OFF)
ORB_AIR_GAP=true Suppress all outbound telemetry
ORB_ANONYMIZE=true HMAC repo/PR before export (default true)
ORB_COLLECTOR_URL Collector endpoint override
ORB_COLLECTOR_TOKEN Bearer token for hosted collector
GITTENSORY_MINER_ORB_EXPORT_STATE_DB Override secret/cursor SQLite path
GITTENSORY_MINER_CONFIG_DIR Same resolution chain as other miner stores
config.orbExport === true Programmatic opt-in (for tests / future CLI wiring)

Notes

  • Miner rows omit gate_verdict / cycle time (no local gate_decision stream yet) — payload still matches the collector's fleet event shape with nulls where unknown.
  • Wiring exportMinerOrbBatch() into the miner loop / CLI is follow-up; this PR delivers the library primitive and tests per issue deliverables.
  • Future follow-up: extract bucketReasonCode into @jsonbored/gittensory-engine so self-host and miner import one module (currently ported verbatim with sync comment).

@andriypolanski
andriypolanski requested a review from JSONbored as a code owner July 9, 2026 21:09
@andriypolanski
andriypolanski marked this pull request as draft July 9, 2026 21:10
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. labels Jul 9, 2026
@loopover-orb

loopover-orb Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-09 21:33:43 UTC

4 files · 1 blocker · readiness 96/100 · CI pending · blocked

🛑 Suggested Action - Reject/Close

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.

Why this is blocked

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
Signal Result Evidence
Code review ❌ 1 blocker No AI review summary
Linked issue ✅ Linked #4277
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (draft PR; 1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 136 registered-repo PR(s), 82 merged, 25 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 136 PR(s), 25 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Linked issue satisfaction

Addressed
The PR adds orb-export.js with default-OFF gating via GITTENSORY_MINER_ORB_EXPORT/config.orbExport, a locally-persisted dedicated anonymization secret (getOrCreateAnonSecret) separate from GitHub tokens, a ported bucketReasonCode taxonomy, a seq-based cursor built on event-ledger's readEvents({since}) pattern, ORB_AIR_GAP respect, HMAC'd repo/PR identifiers with no PII in the payload, and unit tes

Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 136 PR(s), 25 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Mark ready when done.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.03%. Comparing base (453c5d4) to head (91ca9e2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4476   +/-   ##
=======================================
  Coverage   94.03%   94.03%           
=======================================
  Files         420      420           
  Lines       37521    37521           
  Branches    13701    13701           
=======================================
  Hits        35282    35282           
  Misses       1583     1583           
  Partials      656      656           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb

loopover-orb Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (Linked issue overlaps another open PR; duplicate of another open PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 9, 2026
@andriypolanski

andriypolanski commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Hi @JSONbored,

I submitted this PR earlier than #4479, but it is closed by using the draft functionality. If that’s the reason it wasn’t recognized, I think ORB may need to be updated to handle this case properly.

@andriypolanski
andriypolanski deleted the feat/miner-orb-export-4277 branch July 16, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(miner-manage): optional anonymized Orb telemetry export for miner outcomes

1 participant