Repository navigation
Availability report: never create main on a repository nothing was pushed to - #1655
Conversation
The availability-report sweep commits .nemar/availability-report.json to main through the Contents API. On a dataset that was created but whose upload had not pushed yet, that PUT created main as an unrelated ROOT commit. nm000358 (created 2026-10-06 14:55Z, report commit 4ba0a7b at 03:00Z): every later 'nemar dataset upload' attempt failed at 'Pushing metadata to GitHub' with '[rejected] adjusted/main(unlocked) -> main (fetch first)', and the adjusted branch cannot be auto-rebased, so the upload Job failed after 12 attempts and needed a manual merge. - writeAvailabilityReport checks that main exists (new branchExists: 404 or GitHub's 409 'Git Repository is empty' mean no) and refuses with 409 instead of creating it. - The sweep's candidates now require a version (a version DOI or a dataset_versions row), like ARCHIVE_RETRY_SWEEP_QUERY: a never-versioned dataset has nothing to report, and a row the pass cannot complete must not hold one of its LIMIT slots forever. - Test seeds that model reportable datasets now carry a version.
|
Thank you for this fix and for the careful write-up. It is merged into the integration branch for epic #1671 as PR #1672, with your commit kept (103f298 on that branch, authored by you). The review added commits on top, so this PR is closed in favor of that one. What the review added: the branch check now runs before any S3 work and cannot sleep inside the sweep; a 404 on the ref is followed by a repository probe so an invisible repository is reported as such rather than as a missing The epic merges into |
Problem
#1643: the availability-report sweep commits
.nemar/availability-report.jsontomainthrough the Contents API. On nm000358, created but not yet pushed, that PUT createdmainas an unrelated root commit at 03:00 UTC. Every laternemar dataset uploadfailed at "Pushing metadata to GitHub" with[rejected] adjusted/main(unlocked) -> main (fetch first)(12 attempts), and the adjusted branch cannot be rebased onto it, so it needed a manual merge.Change
branchExists()inbackend/src/services/github/contents.ts(a 404, or GitHub's 409 "Git Repository is empty", means no).writeAvailabilityReportrefuses with 409 whenmaindoes not exist instead of creating it.dataset_versionsrow), the same rule asARCHIVE_RETRY_SWEEP_QUERY: a never-versioned dataset has nothing to report, and a row the pass cannot complete must not hold one of itsLIMITslots.Closes #1643
Testing
backend/test/github-branch-exists.test.ts(new, 4 tests): existing branch; 404 without retry; 409 "Git Repository is empty"; any other failure throws.Candidacy SQL tests in
availability-report-sweep-route.test.ts, and the updatedarchive-completeness/availability-report-at-migrationseeds. 6 backend files that import the changed modules: 71 pass, 0 fail (on currentdev).bun run typecheck,biome checkon the changed files.The write path itself is not covered end to end, because it needs S3 for
verifyDatasetVersionS3;branchExistsand the candidacy are.CI
api-testandintegration-devfail on this PR because it comes from a fork: both call the dev API with theTEST_*_API_KEYsecrets, which GitHub does not pass to fork pull requests, so the authenticated cases fail and the unauthenticated ones pass.lint,unit-pureande2e-sandboxrun normally.