Skip to content

feat(validator): load repo hyperparameters from the das API#1511

Open
anderdc wants to merge 1 commit into
testfrom
feat/hyperparam-api
Open

feat(validator): load repo hyperparameters from the das API#1511
anderdc wants to merge 1 commit into
testfrom
feat/hyperparam-api

Conversation

@anderdc

@anderdc anderdc commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Flips the validator's source of truth for repository hyperparameters from the bundled master_repositories.json to the das-gittensor API. Part of the coordinated hyperparameter-API migration:

  • das-gittensor#82 — authed editing endpoints + GET /repos registry
  • gittensor-db#50repository_config_edits audit/cooldown table
  • gt-utils (feat/hyperparam-api) — stop clobbering the API-authoritative repositories table
  • this PR — validator reads the API

Change

load_master_repo_weights() now:

  1. GET https://api.gittensor.io/repos (requests + retry/backoff), parses + validates.
  2. On any failure (unreachable, or data that violates the registry contract), falls back to the bundled master_repositories.json seed — a transient outage or a bad push can't brick scoring.
  3. Returns {} only if both the API and the seed are unavailable. A broken seed still raises (real bug).

Parsing/validation was extracted into _parse_registry() and is shared by both paths, so the contract is identical regardless of source. Return type (Dict[str, RepositoryConfig]) is unchanged — no call site or downstream consumer moves.

master_repositories.json is retained only as the fallback seed (regenerate from the DB via gt-utils fetch_master_data.py).

Tests

  • Autouse fixture defaults validator tests to the seed (offline, deterministic) — all 185 existing load/blend tests pass unchanged.
  • Added explicit tests: API success, fallback on API failure, fallback on contract-violating API data, empty when both gone, broken-seed-still-raises.
  • ruff check/ruff format clean; pyright 0 errors; CLI miner score tests pass.

Notes for review

  • Per-epoch fetch hits one endpoint; GET /repos is @NoCache on the API so edits propagate immediately. Consider signing/versioning the payload later (a central live source is weaker than git-pinned commits) — fallback seed mitigates availability, not authenticity.

Flip load_master_repo_weights() to fetch the repository registry from the
das-gittensor API (GET api.gittensor.io/repos), the new source of truth for
repository hyperparameters (maintainer/admin edits land there).

- Extract parse+validate into _parse_registry(); add _fetch_registry_from_api()
  (requests + retry/backoff) and _load_registry_from_file().
- API-first with a bundled master_repositories.json fallback: a transient API
  outage or a contract-violating push falls back to the seed instead of
  bricking scoring. A broken bundled seed still raises.
- Tests default to the seed via an autouse fixture (offline/deterministic);
  added explicit API-path + fallback tests.

master_repositories.json is retained only as the fallback seed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant