Skip to content

Add defensive check for main branch naming - #195

Merged
neuromechanist merged 3 commits into
devfrom
194-add-defensive-check-ensure-dataset-repos-use-main-branch
Feb 25, 2026
Merged

neuromechanist merged 3 commits into
devfrom
194-add-defensive-check-ensure-dataset-repos-use-main-branch

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • Add ensureLocalMainBranch() to CLI upload flow: checks local branch name before push, prompts user to rename if not main
  • Add ensureMainBranch() to backend: checks remote default branch via GitHub API, auto-renames in finalize and llm-enrich webhook
  • Fix pre-existing manifest test failure caused by bun test module cache sharing
  • Add DataLad branch naming warning to upload docs
  • Already renamed 8 affected repos (nm000109-nm000114, xx000001-xx000002) to main

Context

Dataset repos created with DataLad use adjusted/master(unlocked) as default branch. The backend hardcodes main everywhere (branch protection, CI workflows, file reads, webhooks), so these repos silently fail on CI, protection, and metadata operations.

Test plan

  • All 531 tests pass, 0 failures
  • Backend type-check passes
  • CLI builds successfully
  • Verified all 17 nemarDatasets repos now use main as default branch
  • Fixed manifest test that was failing due to bun test module cache isolation issue

Closes #194

Dataset repos created with DataLad use adjusted/master(unlocked)
as default branch, breaking CI, branch protection, and metadata
pipelines that hardcode "main". Add ensureLocalMainBranch() for
CLI upload flow (prompts user to rename) and ensureMainBranch()
for backend finalize/webhook routes (auto-renames via API).

Closes #194
bun test shares module cache with spawned subprocesses, making
NEMAR_CONFIG_DIR unreliable for isolating the Conf instance.
Use TEST_API_URL env var which is checked at call time instead.
- Refactor ensureLocalMainBranch: extract promptForRename
  helper, handle null branch with warning, capture git
  stderr, log errors with manual rename hint
- Add response body to github.ts repo-fetch error message
- Add datasetId to finalize branch-check log message
- Update docs to mention CLI auto-detection of branch name
@neuromechanist
neuromechanist merged commit 5f5cec8 into dev Feb 25, 2026
7 checks passed
@neuromechanist
neuromechanist deleted the 194-add-defensive-check-ensure-dataset-repos-use-main-branch branch February 25, 2026 13:26
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.

1 participant