Skip to content

fix: three publication regressions (#429) - #430

Merged
neuromechanist merged 3 commits into
devfrom
429-fix-three-publication-regressions-archiver-export-idempotent-doi-badge-commit-openneuro-skip-ci
May 11, 2026
Merged

neuromechanist merged 3 commits into
devfrom
429-fix-three-publication-regressions-archiver-export-idempotent-doi-badge-commit-openneuro-skip-ci

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • Pin archiver@^7.0.1 in the Generate Archive workflow template (v8 is ESM-only, regressed require("archiver")).
  • Skip the no-op "Add DOI badge" commit on update_readme resumes when the badge is already in place.
  • Restore skipCiCheck=true in the OpenNeuro import approve retry loop; flipped to false in Fix BIDS CI failures from annex pointers and branch naming #271 but the push/approve race always loses in practice.

Closes #429.

Test plan

  • bun tsc --noEmit in repo root and backend/ — clean
  • Focused bun test test/publish-workflow.test.ts test/ezid.test.ts test/admin-restructure.test.ts — 51/51 pass
  • Full bun test — 985 pass, 4 pre-existing fails unrelated to this PR (datalad-commands clone tests + upload-progress JSON parse warnings, none touch the changed code paths)
  • Backend deploy: npx cfman wrangler --account sccn deploy -c backend/wrangler-sccn.toml after current in-flight approvals finish (see Fix three publication regressions: archiver export, idempotent DOI badge commit, OpenNeuro skip-ci #429 deploy notes)
  • After deploy, run nemar admin ci add <id> to refresh existing dataset workflows so the archiver pin propagates (one-shot follow-up; new approvals already publish to repos with the unpinned line)

Discovered via

Triaging bruaristimunha's 20 stuck publication requests (May 2026). Companion issues #427 (duplicates) and #428 (stale block_reason).

1. backend/src/services/github.ts: pin archiver to ^7.0.1 in the
   Generate Archive workflow template. archiver 8.x is ESM-only and
   require("archiver") no longer returns the factory function, causing
   "archiver is not a function" on every newly published dataset.

2. backend/src/routes/admin.ts: skip the createOrUpdateFile call in
   update_readme when the DOI badge is already present and the README
   does not need renaming. Previously the orchestrator shipped an
   empty "Add DOI badge: ..." commit on every --resume, which retriggered
   BIDS Validation each time.

3. src/lib/import-openneuro.ts: restore skipCiCheck=true (4th arg of
   approvePublication) in the import retry loop. PR #271 had flipped it
   to false on the assumption that the BIDS check could complete in time,
   but in practice the push + approve race always loses and imports
   wind up in 'bids_validation_pending'. OpenNeuro datasets are
   validated upstream and the CI runs separately after push regardless.
@github-actions

github-actions Bot commented May 11, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR430

Version: 0.8.10-PR430.133a53e
Commit: 133a53e


🤖 Updated on each push.

- backend/src/services/doi.ts: extract planReadmeBadgeCommit() pure helper.
  Tightens the skip path to require that the existing badge encode the
  *current* concept DOI; without that check a stale badge (from re-registered
  or provider-migrated DOIs) would be silently kept. Detects mismatch and
  emits a "Replace stale DOI badge" commit. URL-encoded DOI form is
  recognized as a match (matches the actual badge URL encoding).
- backend/src/routes/admin.ts: use planReadmeBadgeCommit() in update_readme.
- test/readme-badge-plan.test.ts: unit tests covering skip, stale-badge
  rewrite, no-README, rename-needed, and encoded-DOI cases (6 cases).
- test/workflow-yaml.test.ts: assert generate-archive.yml pins
  archiver@^7 to catch a future unpinned regression.
- Trim verbose comments in github.ts and import-openneuro.ts per review.

Follow-up #431 tracks the design improvement of replacing
skipCiCheck=true with a bounded poll on workflow_runs.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review findings addressed (commit 37e3428)

Source Finding Action
code-reviewer none —
comment-analyzer 3 verbose comments Trimmed in github.ts, import-openneuro.ts, admin.ts (now one-liners; PR-flip narrative moved to commit/PR body where it belongs)
silent-failure-hunter stale-badge silently kept by skip path Fixed: extracted planReadmeBadgeCommit() in backend/src/services/doi.ts that requires the existing badge to encode the current concept DOI. Mismatch → emits "Replace stale DOI badge" commit instead of skipping. URL-encoded DOI form also recognized.
silent-failure-hunter skipCiCheck=true is a trust assumption Deferred to #431: replacing the unconditional skip with a bounded poll on workflow_runs is a design improvement, not a regression fix. #430 lands the user-documented baseline (by hand I always skip ci check) so this can ship now.
pr-test-analyzer archiver pin needs regression test Added in test/workflow-yaml.test.ts: asserts archiver@^7 in the install line and rejects the bare unpinned form.
pr-test-analyzer README-skip needs coverage Added in test/readme-badge-plan.test.ts: 6 unit tests covering skip-when-current, stale-badge rewrite, no-README, rename-needed, URL-encoded DOI match, and unrelated-shape-with-wrong-DOI.
pr-test-analyzer OpenNeuro skip-ci flip needs a guard Captured in #431 alongside the design improvement; not adding a local HTTP capture test in #430 — that's heavier infrastructure than the one-line revert it would guard.

All 102 tests across the touched test files pass. tsc --noEmit clean.

#430 CI api-test failure root cause: validateGitHubUsername() ran
before the dup check, so a signup attempt with an already-registered
github_username that happens not to resolve on GitHub (renamed/deleted
account, or test seed with a fake username) returned 400 instead of 409.

Now we direct-check the raw input first (case-insensitive). The GitHub
API call is retained for canonical-login dedup but only re-checks when
GitHub normalized the case (the original motivation in #176 for doing
validation first). Saves one REST call on the common already-registered
case and unblocks api-test.

Test "signup with existing github_username returns 409" in
test/api.test.ts:124 is the assertion.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Red CI on `api-test` — root cause and fix (commit 133a53e)

The failing assertion in `test/api.test.ts:136` ("signup with existing github_username returns 409") was an independent pre-existing bug in the signup flow, exposed by the test seed using `test-user-gh` (a fake GitHub username).

Original order in `backend/src/routes/auth.ts`:

  1. username dup → 409
  2. email dup → 409
  3. `validateGitHubUsername()` (real GitHub API call) → 400 if not found
  4. github_username dup with canonical login → 409

So step 3 returned 400 for the fake seed username before step 4 could fire the expected 409.

Fix: direct dup check on the raw input before the GitHub API call (case-insensitive). Saves one REST call on the common already-registered case and works regardless of whether the registered username still resolves on GitHub (covers renamed/deleted accounts too). The original motivation in #176 (canonical-login dedup) is preserved by re-checking with the canonical form after validation, but only when GitHub normalized the case.

Note on the chicken-and-egg

`api-test` runs against the deployed dev backend (`nemar-api-dev.sccn-org.workers.dev`). It will keep failing on this PR's CI until the fix is deployed to dev — i.e., until this PR merges to dev and `deploy-backend.yml` ships. Per project convention this is acceptable: the api-test exposes a real bug in deployed dev that this PR fixes.

Companion to

@neuromechanist
neuromechanist merged commit 232845b into dev May 11, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the 429-fix-three-publication-regressions-archiver-export-idempotent-doi-badge-commit-openneuro-skip-ci branch May 11, 2026 14:44

This branch was previously deployed

1 inactive deployment
npm — 133a53e9 Deployed May 11, 2026 by neuromechanist via publish #752
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