Skip to content

Fix S3 initremote false-fallback to enableremote (#396) - #397

Merged
neuromechanist merged 2 commits into
devfrom
feature/issue-396-s3-remote-fallback
Apr 30, 2026
Merged

neuromechanist merged 2 commits into
devfrom
feature/issue-396-s3-remote-fallback

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Closes #396.

  • Tighten the configureS3Remote fallback so it only fires on git-annex's actual duplicate-remote wording (There is already a special remote named "X"), not on any stderr substring "already exists". The old loose match could be triggered by S3 bucket-level errors (BucketAlreadyOwnedByYou, BucketAlreadyExists) and cascade into a doomed enableremote for a remote that was never registered, surfacing as git-annex: there is no available git remote named nemar-s3.
  • Replace the description-string scan in annexRemoteExists with a direct git annex info <name> --json probe.

Why this matters

This is what is breaking the OpenNeuro onboard workflow at nemarDatasets/.github/workflows/onboard-openneuro.yml. Most recent failure: https://github.com/nemarDatasets/.github/actions/runs/25174599561/job/73803153849

Test plan

  • bun test test/git-annex-remote.test.ts (7 new tests, all pass)
  • bun run typecheck
  • bun run lint (no new warnings)
  • Local repro: confirmed git annex info <name> --json returns success:true with a uuid only for registered special remotes
  • Confirmed the real git-annex duplicate message is There is already a special remote named "X". (Use enableremote to enable an existing special remote.) and that the new regex matches it
  • Manual: rerun nemar admin import-openneuro ds003825 --local after cleanup to confirm S3 setup succeeds (or surfaces the real S3 error)

Out of scope

The publish/request endpoint also blocks the OpenNeuro onboard workflow when BIDS CI has not finished or is failing (PR #274 gating). Tracking separately; this PR only fixes the S3 remote setup step.

Tighten the configureS3Remote fallback so it only fires on git-annex's
actual duplicate-remote wording ("There is already a special remote
named X"), not on any S3 stderr containing the substring "already
exists". Substring matching previously matched bucket-level errors
like BucketAlreadyOwnedByYou and triggered a doomed enableremote for
a remote that was never registered, masking the real S3 error as
"git-annex: there is no available git remote named nemar-s3".

Also rewrite annexRemoteExists to probe with `git annex info <name>
--json` directly instead of fuzzy-matching repository descriptions
in the full info dump.
@github-actions

github-actions Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR397

Version: 0.8.8-PR397.6a375b5
Commit: 6a375b5


🤖 Updated on each push.

- Tighten annexRemoteExists to require info.remote === name; rejects the
  'here' alias, bare UUIDs, and annexed-file path collisions that
  git annex info accepts as valid lookups.
- Extract initOrEnableSpecialRemote so the duplicate-detect-and-fallback
  flow is generic and end-to-end testable with type=directory remotes
  (no S3 credentials needed).
- Surface raw stderr or exit code when initremote fails and
  filterAnnexInfoMessages strips everything, so users no longer see a
  bare 'Failed to configure S3 remote' with no context.
- Add tests for the here/UUID/file-collision false positives, the new
  end-to-end fallback path, and a multi-line stderr regex fixture.
- Assert init exit codes inside newAnnexRepo so missing git-annex
  fails the suite cleanly instead of producing confusing assertions.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review fixes (commit 6a375b5)

Ran /review-pr with code-reviewer, pr-test-analyzer, silent-failure-hunter, and comment-analyzer agents in parallel. Code-reviewer approved with no required changes. The other three flagged real issues, all addressed in 6a375b5.

Critical

  • annexRemoteExists false-positive on here/UUID/file-collision (test-analyzer): git annex info <NAME> accepts files, keys, treeish, remote names, UUIDs, and the here alias. Old check (success && uuid only) returned true for here and bare UUIDs. Now also requires info.remote === name, which rejects all of those. New tests added at test/git-annex-remote.test.ts for the here alias, a bare UUID input, and an annexed-file path collision (nemar-s3 as filename).
  • Empty error message on filtered stderr (silent-failure-hunter): when initremote failed with stderr that was entirely matched by filterAnnexInfoMessages safe patterns, the user got a bare "Failed to configure S3 remote". Now mirrors the enableremote fallback chain: realStderr || stderr.trim() || initremote exited with code ${exitCode}``.

Important

  • No end-to-end test of the fallback path (test-analyzer): extracted the duplicate-detect + enableremote logic into initOrEnableSpecialRemote(path, name, params, env). Now covered by three new tests using type=directory remotes (no S3 needed): first-call init, second-call resume via fallback, and the unrelated-failure path with bad params.
  • Comment imprecision and transient framing (comment-analyzer): rewrote the JSDoc on annexRemoteExists to describe the info.remote === name invariant rather than overclaim what git annex info rejects; rewrote the ANNEX_REMOTE_EXISTS_RE JSDoc to point at the broader class of unrelated stderr instead of singling out BucketAlreadyOwnedByYou; dropped the "previously" framing inside configureS3Remote.

Nice-to-have

  • Added a multi-line stderr regex fixture covering progress chatter + a stray warning before the duplicate-remote message.
  • newAnnexRepo now asserts git init and git annex init exit codes so missing git-annex fails the suite cleanly.
  • beforeAll probes git annex version so the suite reports a clear setup error rather than cascading test failures if git-annex isn't installed.

Not addressed (deliberately)

  • Code-reviewer's "approve and merge" was the headline result; nothing additional from that pass.

Tests: 14/14 pass on the new file (bun test test/git-annex-remote.test.ts). Typecheck clean. Lint clean (only the pre-existing noNonNullAssertion at src/lib/git-annex.ts:120 remains, unrelated to this PR).

@neuromechanist
neuromechanist merged commit b6b652b into dev Apr 30, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-396-s3-remote-fallback branch April 30, 2026 17:07
neuromechanist added a commit that referenced this pull request Sep 21, 2026
A lot of its state moved on 2026-09-20 and 2026-09-21. #387 and #397
merged, #399 landed the Python 3.12 floor and the Pyodide-bounded
dependency floors, #402 corrected #399, and #403 is open to merge
develop into the epic branch.

Records the correction rather than quietly restating the conclusion:
only compiled floors are a ceiling in the browser, because the test is
whether the package publishes a pure-Python wheel and not whether
Pyodide bundles it. The earlier claim that threadpoolctl>=3.6.0 was a
live broken install was wrong.

Also records the integration bug #403 exposed, since it is the argument
for not letting the epic branch drift again: MemmapData.__array_function__
returned NotImplemented for everything except copyto and put, and
defining that method opts a type into numpy's dispatch protocol where
NotImplemented raises rather than falling back. Develop's #351 test
covers that path and the epic branch never had it.

Notes that the case for holding #386 is weaker now that the epic branch
is no longer behind, and carries #400 and #401 as open.

This branch was previously deployed

1 inactive deployment
npm — 6a375b54 Deployed Apr 30, 2026 by neuromechanist via publish #695
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