Skip to content

Exclude metadata files from git-annex largefiles - #281

Merged
neuromechanist merged 2 commits into
devfrom
fix/largefiles-exclude-metadata
Mar 11, 2026
Merged

neuromechanist merged 2 commits into
devfrom
fix/largefiles-exclude-metadata

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • Update git-annex largefiles pattern to explicitly exclude metadata files (.tsv, .json, .md, .txt, .yml, .yaml, README*, LICENSE*, CHANGES*, .bidsignore, .gitignore) from annexing regardless of size
  • Previously the largerthan=100kb rule could annex large TSV files, causing BIDS validation failures (e.g., nm000112 events.tsv stored as annex pointers)
  • *.tsv.gz is NOT excluded since it's compressed data that should be annexed
  • Updated pattern in src/lib/git-annex.ts, scripts/nemar-restore-dataset.sh, CLAUDE.md, and restoration guide

Context

  • nm000110 v1.0.1: fixed participants.tsv age cap (BIDS privacy requirement)
  • nm000112 v1.0.1: un-annexed 4 events.tsv files that were stored as annex pointers
  • This PR prevents the nm000112 class of issues from recurring

Test plan

  • Verified pattern with git annex matchexpression against: .tsv (excluded), .edf (annexed), .tsv.gz (annexed), .json (excluded), README.md (excluded)
  • Build passes

TSV, JSON, MD, txt, yml, and common BIDS root files (README,
LICENSE, CHANGES, .bidsignore) are now explicitly excluded from
annexing regardless of size. Previously, the largerthan=100kb
rule could annex large TSV files, causing BIDS validation
failures (nm000112 events.tsv stored as annex pointers).

Tested with git annex matchexpression against all relevant
file types.
@github-actions

github-actions Bot commented Mar 11, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR281

Version: 0.7.17-PR281.3358f56
Commit: 3358f56


🤖 Updated on each push.

- Fix: add missing extensions in restore script (fif, vhdr, eeg, cnt, fdt)
- Refactor pattern into arrays for readability in git-annex.ts
- Update stale patterns in .context/validated_workflows.md
- Add cross-reference comment to restore script
@neuromechanist

Copy link
Copy Markdown
Contributor Author

PR Review Findings

Ran code-reviewer, comment-analyzer, and code-simplifier agents in parallel.

Critical (1)

  • Inconsistent include-list in nemar-restore-dataset.sh: Shell script was missing 5 EEG/MEG extensions (*.fif, *.vhdr, *.eeg, *.cnt, *.fdt) present in the TS source and docs. The largerthan=100kb fallback would catch most of these, but the explicit matching was inconsistent.

Important (2)

  • Stale patterns in .context/validated_workflows.md: 3 occurrences of old pattern without metadata exclusions. This file is referenced in CLAUDE.md as source of truth for proven workflows.

    • Fixed in 3358f56 - updated all 3 occurrences, added cross-references to canonical source in src/lib/git-annex.ts
  • Pattern readability: 300+ char string on single line is hard to read and diff.

    • Fixed in 3358f56 - refactored into DATA_EXTENSIONS and METADATA_EXCLUSIONS arrays that build the pattern string

Suggestions (3)

  • Clarify tsv.gz comment: Explain why exclude=*.tsv doesn't match *.tsv.gz (glob is exact, not substring).

  • Update restoration guide "What happens" section (~line 244) to list all 8 extensions.

    • Skipped: low priority, the pattern itself is correct in that section
  • Add CLAUDE.md key insight about why metadata must stay in git.

    • Skipped: the inline comment in the code block already explains this, adding another bullet is redundant

Strengths noted by reviewers

  • Comment in git-annex.ts is well-structured: explains intent, reason, and non-obvious edge case
  • Restoration guide "Critical Step" explanation correctly reframed from cosmetic ("README would be a pointer") to functional ("TSV/JSON break BIDS validation")
  • PR tested with git annex matchexpression against all relevant file types

@neuromechanist
neuromechanist merged commit 10f88bd into dev Mar 11, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the fix/largefiles-exclude-metadata branch March 11, 2026 08:43
This was referenced Mar 14, 2026

This branch was previously deployed

1 inactive deployment
npm — 3358f568 Deployed Mar 11, 2026 by neuromechanist via publish #483
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