Skip to content

fix(health): exclude uninstalled repos from /api/v1/health#133

Open
leonaIee wants to merge 1 commit into
entrius:testfrom
leonaIee:fix/health-exclude-uninstalled-repos
Open

fix(health): exclude uninstalled repos from /api/v1/health#133
leonaIee wants to merge 1 commit into
entrius:testfrom
leonaIee:fix/health-exclude-uninstalled-repos

Conversation

@leonaIee
Copy link
Copy Markdown

Summary

GET /api/v1/health returned every row in the repos table, including repos whose GitHub App installation has been removed or uninstalled. Those rows are intentionally kept (soft-cleared to installation_id = NULL, registered = false in installation.handler.ts) so historical scoring evidence isn't lost, but they are no longer tracked. The endpoint's own description advertises "the list of tracked repos", so the inclusion of soft-cleared rows is a contract bug; it also misleads downstream consumers (e.g. gittensor-ui) that read /health as an active-installation signal before allowing registration.

This PR filters listRepoHealth() to installation_id IS NOT NULL using the same Not(IsNull()) idiom already used in fetch.processor.ts. Top-level status, DB/Redis probes, the 503-on-failure behavior, and the stalest-first sort are unchanged. Newly-added-but-not-yet-registered repos (installed but registered = false) remain visible, which is the semantic the UI's "is the App installed?" probe actually needs.

Related Issues

Fixes #132

Type of Change

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

Testing

Reproduction steps from the linked issue, executed against a local mirror with the Gittensor Mirror App installed:

  1. Install the App on a test repo → row appears in repos with installation_id set; repo is listed in /api/v1/health.
  2. Remove the repo from the installation (or uninstall the App) → row remains in repos with installation_id = NULL and registered = false; the repo is no longer in the /api/v1/health repos array.
  3. Confirmed unchanged: top-level status: "ok", db / redis sections, 503 behavior when a dep is down, and the stalest-first / nulls-last ordering for the remaining tracked repos.

Build / lint / format on the changed file: npm run build, eslint, and prettier --check all clean.

Checklist

  • I have read the Contributing Guide
  • Code builds without errors
  • New and existing tests pass (if applicable) — packages/das has no automated test suite; manual verification per the steps above (CONTRIBUTING: "Confirm manual testing performed")
  • Documentation updated (if applicable) — none required; the existing endpoint description already reads "the list of tracked repos"
  • No unnecessary dependencies added

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/health lists repositories after GitHub App removal, causing stale installed-repo checks

1 participant