Skip to content

feat(admin): doctor framework + missing-manifest check - #555

Merged
neuromechanist merged 1 commit into
mainfrom
554-admin-doctor-framework-for-diagnosingfixing-stuck-datasets
May 18, 2026
Merged

neuromechanist merged 1 commit into
mainfrom
554-admin-doctor-framework-for-diagnosingfixing-stuck-datasets

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • New admin "doctor" framework: each stuck-dataset pattern is a self-contained check with a scan (read-only diagnostic) and a fix (idempotent remediation)
  • Two new endpoints: `POST /admin/doctor/scan`, `POST /admin/doctor/fix` (supports `check`, `dataset_id`, `dry_run` body params)
  • First check: `missing-manifest` — finds datasets where the `dataset_versions` row exists but the S3 `manifest.json` is absent
  • Fixes ~10 currently-stuck datasets including on005261, nm000103, nm000106, nm000166, on004362

Closes #554.

Why this shape

We've added one-off endpoints for each stuck-dataset symptom as we hit them (`/admin/catalog/sync-local`, `/admin/datasets/:id/manifest/:version`, etc.). Each follows the same loop: query, fix, deploy, run, archive. The doctor framework moves new patterns to a 30-line addition (one check module + register) instead of a new endpoint + tests + docs.

Follow-up checks queued for separate PRs: `missing-version-row`, `null-subject-count`, `missing-catalog-row`, `stale-catalog`, `failed-nemar-sync`, `stuck-publish-request`, `orphaned-github-tag` (full list in #554 description).

Test plan

  • `bun test test/doctor-*` — registry + SQL pin tests pass (9/9)
  • `bun test` full suite — same pass/fail counts as main (no new regressions; the 3 pre-existing fails on main are not related to this PR)
  • `bun run typecheck` — clean
  • `bunx biome check` — clean
  • After merge + deploy: `curl POST /admin/doctor/scan?check=missing-manifest` returns the ~10 known-stuck datasets
  • `curl POST /admin/doctor/fix?check=missing-manifest&dry_run=true` matches scan results
  • `curl POST /admin/doctor/fix?check=missing-manifest` recovers all stuck manifests; `data.nemar.org///manifest.json` returns 200 for every recovered dataset

Notes on idempotency

`fix()` re-checks S3 immediately before write. If the manifest is already present (parallel job, prior successful retry), it returns `status: "skipped"` rather than re-uploading or failing.

Introduces an admin diagnostic framework where each "stuck dataset"
pattern is a self-contained check exposing a scan (read-only diagnostic)
and a fix (idempotent remediation). New checks plug into a registry; no
new routes per check.

Two new admin endpoints:
  POST /admin/doctor/scan   - run checks, return findings (no writes)
  POST /admin/doctor/fix    - apply fix, optional dry_run + dataset_id

First check: missing-manifest. Finds datasets where the dataset_versions
row exists but the S3 manifest.json is absent (current symptom on ~10
datasets including on005261, nm000103, nm000106, nm000166, on004362
where data.nemar.org/<id>/<version>/manifest.json returns 404). Fix
reuses the existing generateManifest + uploadManifest helpers.

Closes #554.

This branch had an error being deployed

1 failed deployment
npm — 2dc7654a Deployed May 18, 2026 by neuromechanist via publish #1016
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.

Admin doctor framework for diagnosing/fixing stuck datasets

1 participant