fix: combined export_batch manifest lost all but the first model entry#88
Merged
Conversation
# Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug reported by a user: in multi-model combined exports (
export_batchwith a single output file), the manifest'smodelslist ended up with only one entry — each checkpoint write effectively rewrote it instead of accumulating.Root cause
CheckpointManager.combined_write_checkpointreturned the jsonable copy of the manifest thatwrite_arraysoperates on, not the original dict.run_pending_modelsrebinds its localmanifestto that returned copy after each per-model checkpoint, while the_write_ckptclosure inBatchExporter._run_combinedkeeps serializing the stale original — so every model entry after the first was appended to a throwaway copy and dropped from both the in-memory result and the on-disk manifest. As a side effect, combined-mode resume would needlessly re-run already-completed models.Fix
combined_write_checkpointnow merges the writer's path keys (manifest_path,npz_path,npz_keys,nc_path,nc_variables) back into the original manifest and returns that same object, preserving the in-place mutation contract. Per-item exports were never affected (each point's manifest is fully built before its single write).Tests
tests/test_checkpoint_manager.pywith two regression tests; the second faithfully mirrors the exporter's closure +run_pending_modelsloop structure. Verified both fail on the pre-fix code and pass with the fix.main).