Skip to content

Preserve HERD tables in archives outside the current directory - #1613

Open
dhairyajangir wants to merge 3 commits into
hdmf-dev:devfrom
dhairyajangir:fix/herd-zip-roundtrip
Open

dhairyajangir wants to merge 3 commits into
hdmf-dev:devfrom
dhairyajangir:fix/herd-zip-roundtrip

Conversation

@dhairyajangir

@dhairyajangir dhairyajangir commented Nov 10, 2026 •

Copy link
Copy Markdown

Motivation

When HERD.to_zip() writes outside the working directory, it can include the output directory in each archive member. HERD.from_zip() then fails to locate those tables. The old writer can also replace and remove a neighboring TSV with a table name.

Stage the TSVs privately and write canonical names at the archive root. Read members directly from the ZIP. Prefer canonical root names, accept a unique directory-prefixed member from older archives, and reject ambiguous members.

Fixes #1611.

How to test the behavior?

python -m pytest -q tests/unit/common/test_resources.py -k 'zip_in_directory or zip_operations_preserve or legacy_member_paths or ambiguous_legacy or duplicate_root'

The five regression cases fail on unchanged dev and pass with the patch. The full unit suite passed 1,896 tests, with 124 skips and one expected failure. A real archive produced by the old writer round-tripped with the same six TSV payloads and member order. Ruff passed.

A wheel built from the final published commit passed 616 tests with six skips on HDMF-Zarr fda82e5 using Python 3.14. PyNWB ef74c166 passed its unit and integration runner (python test.py -p -i -q), with 772 cases and 13 skips. The nested archive also round-tripped through PyNWB's HERD class on that development revision and on PyNWB 4.2.0, preserving the six archive members and an existing neighboring TSV.

On current dev cf6f249, I resolved the changelog conflict and kept the HERD code and tests unchanged. The updated tree passed 1,896 HDMF unit tests. A wheel from this head passed the PyNWB HERD archive round-trip, seven PyNWB resource tests and 33 focused HDMF-Zarr tests.

Codex assisted with the investigation, patch, and tests.

Checklist

  • Updated CHANGELOG.md
  • Described the problem and solution
  • Reviewed the contribution guide
  • Linked the issue for closure

@dhairyajangir

Copy link
Copy Markdown
Author

Could a maintainer authorize the workflows for a2bcf5cb and review the HERD ZIP fix for #1611? Seven workflows, including Run tests, PyNWB and HDMF-Zarr, still report action_required. The current-dev synchronization preserved the HERD code and tests; 1,896 HDMF unit tests and focused downstream wheel checks passed locally, with the exact scope in the description. Hosted test results remain pending.

AI assisted with the validation review and this update.

@oruebel

oruebel commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Could a maintainer authorize the workflows for a2bcf5cb

Workflows are running

@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.17%. Comparing base (cf6f249) to head (a2bcf5c).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1613   +/-   ##
=======================================
  Coverage   93.17%   93.17%           
=======================================
  Files          41       41           
  Lines       10304    10306    +2     
  Branches     2132     2133    +1     
=======================================
+ Hits         9601     9603    +2     
  Misses        423      423           
  Partials      280      280           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

HERD.to_zip stores tables under their full paths, so HERD.from_zip cannot read the zip

2 participants