Skip to content

Data integrity: 53 published datasets (with DOIs) have missing GitHub repos #883

Closed

Description

@neuromechanist

Summary

Surfaced during the #869 HED backfill: 54 datasets are active/public in D1 with a github_repo set, but the GitHub repo returns 404 (does not exist). Of the 54:

  • 53 have a concept DOI (with_doi=53) and 53 have published dataset_versions rows — i.e. they were genuinely published, not failed/empty uploads.
  • All 54 have file_size > 0.
  • source='openneuro' = 0 (all native nm).
  • Created in a tight window: 2026-03-18 to 2026-03-28.
  • The 54th is nm099999 (the disposable E2E test dataset — expected, ignore).

So this is a data-loss / integrity incident: 53 published datasets with permanent EZID DOIs lost their GitHub metadata repos. Their DOI landing pages and ww2 detail pages will break (the repo is the metadata source).

Affected ids

nm000192 nm000194-206 nm000208-219 nm000221-223 nm000227 nm000230-231 nm000234-237 nm000239-240 nm000242-249 nm000270-272 nm000342 nm000344-346 (+ nm099999 test).

Open questions / next steps

  1. S3 data: unknown — AWS session was expired at investigation time. If s3://nemar/<id>/objects + version/ manifests survive, the repos are likely RECONSTRUCTABLE (re-create repo from the S3 version manifest). Check first (aws s3 ls s3://nemar/nm000192/).
  2. GitHub 90-day recovery: created ~March, now June -> the 90-day deleted-repo window has likely expired, so GitHub-side restore is probably unavailable.
  3. How were they deleted? Window + native-only pattern resembles the prior stale-cron deletion incident (cron auto-deleted real nm datasets; fix fix(cron): warn owners before stale-nm deletion, never auto-delete (#662) #663 added warn + admin confirm). Worth confirming whether fix(cron): warn owners before stale-nm deletion, never auto-delete (#662) #663 fully closed this path or these predate it.
  4. DOIs: 53 live EZID DOIs currently resolve to broken datasets — decide recover-vs-tombstone.

HED note

For #869 these correctly stay has_hed=NULL (can't probe a missing repo); they do not affect the ?has_hed=1 filter. Not a HED bug.

Activity

  1. added
    bug
    on Jun 30, 2026
  2. neuromechanist commented on Jun 30, 2026

    @neuromechanist
    ContributorAuthor

    Good news: all 53 are RECOVERABLE — no data loss

    AWS re-authed; checked S3 for all 53 (excl. nm099999 test):

    • 53/53 have version manifests (s3://nemar/<id>/version/*.json)
    • 53/53 have git-annex objects (s3://nemar/<id>/objects/)
    • Also present: archives/ (zip snapshots) and zarr/ (viewer data)

    So only the GitHub metadata repos are gone; the data + version manifests + archives + zarr all survive in S3. The repos are reconstructable from the S3 version manifests (the same path used to restore nm000103-107).

    Revised recovery plan

    1. Recreate each nemarDatasets/<id> repo from its S3 version/ manifest (dataset_description.json + BIDS tree + git-annex pointers -> objects/). Re-point the existing concept DOI's metadata if needed.
    2. Then reset + re-run nemar admin hed-sweep so the recovered repos finally classify for HED.

    GitHub 90-day restore is likely expired, but it's moot — recreate-from-S3 is the better path and the data is intact.

  3. neuromechanist commented on Jun 30, 2026

    @neuromechanist
    ContributorAuthor

    Correction: deletion was RECENT — GitHub restore window likely still OPEN

    The D1 created_at (March) is when the dataset record was created, NOT when the repo was deleted. The S3 artifacts tell the real timeline:

    • nm000192/version/v1.0.0.json written 2026-06-02
    • nm000192/version/v1.0.0-records.json written 2026-06-07

    Both are generated from the live repo, so the repos existed in early June. The repos 404 now (June 30) -> deleted within the last ~3 weeks -> GitHub's 90-day deleted-repo restore is almost certainly still available.

    Recommended recovery (in order)

    1. Restore the deleted repos via GitHub (org Settings -> deleted repositories, or the restore endpoint) while the 90-day window is open. Cleanest — preserves full git history. Do this SOON.
    2. If any window has closed, reconstruct from the S3 version/ manifest (confirmed: every file -> git-annex SHA256E key + size + checksum, pointing at objects/).
    3. Then reset + re-run nemar admin hed-sweep so the recovered repos classify for HED.

    Prevent recurrence

    Repos deleted ~mid-June with no D1 cleanup is the signature of an automated deletion. Confirm whether the stale-cron path (#663 guard) or another job did this — 53 published, DOI'd datasets should never be auto-deletable.

  4. neuromechanist commented on Jun 30, 2026

    @neuromechanist
    ContributorAuthor

    Status update — repos restored + re-swept (issue stays OPEN: culprit not yet found)

    Recovery done

    • All 53 deleted repos restored via GitHub UI (Org → Settings → Deleted repositories), git history preserved.
    • Deleter credential PAT token_id 2058954005 rotated (kill switch). Prod is unaffected — it authenticates via the GitHub App, not this PAT.
    • D1 + S3 never lost anything; only the GitHub repos were deleted.

    HED re-sweep (the #869 backfill that surfaced this)

    Re-ran POST /admin/datasets/hed-sweep over the restored set. Clean finish — zero 404s, zero unknowns:

    • Restored 53: 50 has_hed=1, 5 has_hed=0 (as expected — the MOABB/BCI batch carries HEDVersion + HED-annotated events.json).
    • Final prod distribution: has_hed=1: 187, has_hed=0: 553, NULL/unclassified: 0 (740 datasets, 100% coverage).

    Still open — root cause NOT identified

    The actual deleter is a script run by a system crontab (not git-tracked), firing ~03:00 UTC daily, UA NEMAR-API, using the now-dead PAT. Rotating the PAT stops the damage, but the cron itself is still out there and must be found + removed:

    • ssh hallu "crontab -l"
    • ssh mcm "crontab -l"
    • look for a 0 3 * * * (or 0 20 PT) job doing gh repo delete / deleteRepository against the MOABB ids.

    Keeping this issue open until that job is located and deleted.

  5. neuromechanist commented on Jul 1, 2026

    @neuromechanist
    ContributorAuthor

    Root cause FOUND and eliminated

    The deleter was two leftover NEMAR backend Workers on the retired personal Cloudflare account (nemar-api + nemar-api-dev, serving legacy api.osc.earth/nemar), never torn down after the SCCN migration (#314). Each had:

    • a daily cron 0 3 * * * (UTC) → the 03:00:1X UTC audit-log fingerprint,
    • the old admin PAT (token_id 2058954005) as GITHUB_ADMIN_PAT → UA NEMAR-API, and stopped the moment the PAT was rotated,
    • S3/D1 bindings pointing at the dead personal account → their delete-cascade destroyed the shared GitHub repo (live PAT) while S3+D1 steps hit dead resources, which is exactly why prod D1 + S3 survived.

    Eliminated: crons removed, then all 4 nemar-* workers + both nemar D1s + both Vectorize indexes deleted from the personal account (details in #314). api.osc.earth/nemar/* now 404s.

    Also hardened during the incident: 53 repos restored, org set members_can_delete_repositories=false, default_repository_permission=read.

    Note: post-hoc, neither personal D1 still contains nm000192-346 and both compute stale-count 0, so the exact per-id selection query couldn't be reconstructed after teardown — immaterial now that the deployment is gone.

  6. neuromechanist commented on Jul 1, 2026

    @neuromechanist
    ContributorAuthor

    Resolved. Root cause = two leftover NEMAR Workers on the retired personal CF account (nemar-api/nemar-api-dev, cron 0 3 + old admin PAT), from the incomplete Phase 11 teardown (#332). Fully torn down (workers + D1 + Vectorize + secrets); 53 repos restored; org hardened (members_can_delete_repositories=false, default_repository_permission=read). Not a breach — self-inflicted decommission gap. Full write-up in-thread and on #314/#332.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions