Skip to content

fix(reconciler): auto-deregister repos delisted from gittensor master list#138

Open
Khaostica wants to merge 1 commit into
entrius:testfrom
Khaostica:claude/compassionate-archimedes-32ac9d
Open

fix(reconciler): auto-deregister repos delisted from gittensor master list#138
Khaostica wants to merge 1 commit into
entrius:testfrom
Khaostica:claude/compassionate-archimedes-32ac9d

Conversation

@Khaostica
Copy link
Copy Markdown

Summary

The repos.registered schema comment in packages/db/01_repos.sql already commits to this work:

"Manually flipped today; a future reconciler will sync from on-chain registration."

Today the only path to registered = false is the installation webhook firing. If a repo is delisted from gittensor but the App stays installed, the mirror keeps persisting webhook events indefinitely — accumulating scoring data for a repo that is no longer part of the subnet. This change closes that gap.

Mirrors the four design decisions from the issue:

  • Fail-safe on fetch error — non-200, thrown, or empty canonical set short-circuits without touching the DB. A network blip can never mass-deregister.
  • installation_id preserved — delisting ≠ uninstalling the App. Re-listing flows through the existing POST /api/v1/admin/repos/register endpoint with no GitHub App reinstall.
  • BullMQ repeatable on the existing github-fetch queue with cron 0 */2 * * *. Repeat-key dedup means app restarts don't pile up duplicate schedules.
  • No new dependencies, no schema or entity changes — uses the existing BullMQ queue, TypeORM, and Node's native fetch.

Related Issues

Closes #137

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • npm run build — clean
  • npx tsc --noEmit — clean
  • git diff --check — clean
  • Verified the repeatable job registers on app boot and BullMQ deduplicates by repeat key across restarts.

Out of scope

Re-registration on re-listing already works via POST /api/v1/admin/repos/register; not modified here.

Checklist

  • I have read the Contributing Guide
  • Code builds without errors
  • New and existing tests pass (if applicable)
  • Documentation updated (if applicable)
  • No unnecessary dependencies added

… list

Adds a BullMQ repeatable job that runs every 2 hours, fetches the canonical
master_repositories.json from entrius/gittensor, and flips registered=false
on any repo whose key is absent. Fails safe on network/HTTP errors and on
empty payloads. Preserves installation_id so a re-listed repo can be
re-registered via the existing admin endpoint without a GitHub App reinstall.

The repos schema comment already commits to this work:
"a future reconciler will sync from on-chain registration."

Closes entrius#137

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(reconciler): auto-deregister repos delisted from gittensor master list

2 participants