Skip to content

Fix archive generation for SHA-addressed S3 storage - #165

Merged
neuromechanist merged 2 commits into
devfrom
164-fix-archive-generation-for-sha-addressed-s3-storage
Feb 20, 2026
Merged

neuromechanist merged 2 commits into
devfrom
164-fix-archive-generation-for-sha-addressed-s3-storage

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • Use git-annex SHA key for S3 URL construction instead of BIDS file path
  • Fix race condition in archiver entry/error event listener
  • Replace process.exit(1) with process.exitCode for proper output flushing
  • Track upload.done() promise separately for explicit S3 error handling

Details

The generate-archive.yml workflow was failing silently because:

  1. Wrong URL: It built S3 URLs from the file's BIDS path (sub-01/ses-1/emg/...) instead of the SHA-addressed key (SHA256E-s22085888--...bdf). With the SHA-addressed S3 rework, the original-path objects no longer exist.

  2. Race condition: archive.once("entry", resolve) was registered after archive.append(), but for small files the event could fire during append before the listener was set up. Fixed by combining entry/error listeners in a single promise.

  3. Silent crash: process.exit(1) kills the process before stdout/stderr flushes. Changed to process.exitCode = 1.

Test plan

  • Triggered archive generation on nm000108 v1.0.1
  • All 1674 annexed files fetched via SHA-addressed URLs
  • 4830 regular files read from checkout
  • 0 files skipped
  • 61.5 GB archive uploaded to s3://nemar/nm000108/archives/v1.0.1.zip
  • Run completed in ~58 minutes (vs previous 24-second silent failure)

Fixes #164

Use annex key (SHA hash) for S3 URL instead of BIDS file path.
Replace process.exit(1) with process.exitCode for proper output flushing.

Fixes #164
@neuromechanist
neuromechanist force-pushed the 164-fix-archive-generation-for-sha-addressed-s3-storage branch from 642a67d to 99b30a8 Compare February 20, 2026 06:12
@neuromechanist
neuromechanist merged commit 40f893a into dev Feb 20, 2026
@neuromechanist
neuromechanist deleted the 164-fix-archive-generation-for-sha-addressed-s3-storage branch February 20, 2026 06:13
neuromechanist added a commit that referenced this pull request Feb 20, 2026
* Fix archive generation for SHA-addressed S3 storage (#165)

* Fix archive generation for SHA-addressed S3 storage

Use annex key (SHA hash) for S3 URL instead of BIDS file path.
Replace process.exit(1) with process.exitCode for proper output flushing.

Fixes #164

* Fix upload error propagation and entry event race

* Point version DOI target to NEMAR page, not GitHub

Version DOIs were resolving to the GitHub release page. Both
concept and version DOIs should resolve to the NEMAR data
explorer with appropriate query params.

* Fix deletion cascade, test timeout, tag-triggered DOI CI, BIDS Name title, S3 cleanup (#170)

* Fix deletion cascade: clean up user_s3_permissions

Closes #149

* Fix flaky e2e-upload test timeout

Add 30s timeout to all CLI subprocess tests that spawn
bun processes for prerequisite checks.

Closes #155

* Add tag-triggered CI for version DOI

Extract DOI minting from pr-merge.yml into a standalone
version-doi.yml workflow triggered on v* tag pushes. All
paths (PR merge, admin push, manual tag) now converge
through the tag trigger. Also creates GitHub release if
missing and triggers archive generation.

Closes #160

* Use BIDS Name as authoritative dataset title

CLI upload now reads Name from dataset_description.json
instead of using directory basename. The LLM enrichment
webhook also syncs BIDS Name to D1 and GitHub repo
description when dataset_description.json changes.

Closes #168

* Fix S3 deletion to clean all objects under prefix

Scan entire {datasetId}/ prefix instead of only objects/,
version/, archives/ sub-prefixes. Older uploads stored
files directly under the dataset root which were missed.

Closes #169

* Address PR review findings

- Remove if: always() from trigger-archive job so it only
  runs when DOI publish succeeds
- Check setRepoDescription return value instead of relying
  on try/catch (function returns result, does not throw)
- Sanitize BIDS Name (strip newlines, trim to 200 chars)
- Track user_s3_permissions deletion count in DeletionSteps
- Distinguish ENOENT from parse errors in CLI BIDS Name read
- Fix JSDoc and comments per review feedback

* Fix biome formatting

* chore: bump version to 0.6.1
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