Skip to content

Re-introduce registry/sync.ts self-host scoping to gittensor-opted-in repos (final step) #5027

Description

@JSONbored

Part of #5016. Depends on #5028, #5019, #5020, #5021, #5022, #5023, #5024 — this is the final step and is only safe once nothing else reads isRegistered for a non-gittensor purpose.

Context

This is the piece originally attempted first (before this epic existed) and reverted once testing proved it unsafe: scoping persistRegistrySnapshot (src/registry/sync.ts) so a self-host instance only writes isRegistered=true / subnet economics fields (emissionShare, maintainerCut, issueDiscoveryShare, labelMultipliersJson, registryConfigJson) for repos that have explicitly opted into the experimental.gittensor plugin (src/review/gittensor-wire.ts's gittensorEnabledRepoFullNames, landing separately from this epic).

It was reverted because, at the time, isRegistered was still load-bearing for fidelity repair, signal snapshots, the regate sweep, ops-alerts, selftune, maintainer-recap, and RAG indexing — scoping it down immediately broke 130 tests, and would have broken those same features in production for a self-host operator's OWN repos the moment refresh-registry next ran.

Target

Once #5028#5024 land (nothing CORE depends on isRegistered anymore — everything reads isInstalled instead), re-apply the self-host scoping to persistRegistrySnapshot:

  • Self-host (isSelfHostedReviewRuntime(env)): filter snapshot.repositories to gittensorEnabledRepoFullNames(env) before the upsert loop and the stale-deregister comparison, so only explicitly-opted-in repos ever get isRegistered=true or subnet economics data written locally.
  • Cloud: unchanged, full unfiltered snapshot (cloud legitimately wants the whole-subnet view).
  • registry_snapshots/payloadJson (the raw fetched snapshot bookkeeping) can stay unfiltered even on self-host — it's audit/history, not per-repo tracking, and gives an operator visibility into the full subnet if they want to opt more repos in later.

Requirements

  • A self-host instance with zero repos opted into the gittensor plugin never sets isRegistered=true for any repo, and any pre-existing isRegistered=true rows self-heal to false on the next refresh-registry run (reusing the existing stale-deregister logic — no separate cleanup path needed).
  • A self-host instance with N repos opted in gets exactly those N repos' economics data, nothing else.
  • Cloud behavior fully unchanged.

Deliverables

  • The scoping change (design reference: the reverted commit in the plugin-toggle PR branch history has a working implementation to start from).
  • Full regression suite green — specifically re-run the tests that broke the first time (fidelity repair, signal-snapshot fan-out, regate-sweep idempotency) to confirm they're unaffected now that they read isInstalled.
  • Full local gate green, 99% patch coverage on the diff.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions