Skip to content

Preserve HDF5 environment arguments across file lifecycles - #7309

Open
CoffeeDrivenCoder wants to merge 1 commit into
isaac-sim:developfrom
CoffeeDrivenCoder:fix/hdf5-env-args-lifecycle
Open

Preserve HDF5 environment arguments across file lifecycles#7309
CoffeeDrivenCoder wants to merge 1 commit into
isaac-sim:developfrom
CoffeeDrivenCoder:fix/hdf5-env-args-lifecycle

Conversation

@CoffeeDrivenCoder

Copy link
Copy Markdown

Description

HDF5DatasetFileHandler previously treated its instance-level _env_args cache as the source of truth. A fresh
handler opened in r+ mode therefore replaced the dataset's existing environment arguments when adding a field,
while a reused handler carried custom arguments from a closed dataset into a newly created one.

This change reads the env_args attribute from the active HDF5 data group before merging updates. Existing metadata
is preserved after reopening, and a new data group starts with an empty mapping regardless of handler history.

Fixes #7308

No new dependencies are required.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots

Not applicable; this change affects dataset metadata serialization.

Validation

  • Verified both regression tests fail on the unmodified implementation:
    2 failed, 3 deselected.
  • Ran the complete HDF5 dataset handler test file after the fix:
    5 passed (CPU and CUDA coverage included).
  • Ran Ruff lint on both changed Python files: passed.
  • Ran Ruff format check on both changed Python files: passed.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format (focused Ruff lint and format checks pass; the full repository hook suite is left to CI)
  • I have made corresponding changes to the documentation (not applicable; no public API or usage changed)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump extension.toml — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Read environment arguments from the active dataset before merging updates so reopened files retain their metadata and reused handlers do not leak state between files.

Fixes isaac-sim#7308

Signed-off-by: CoffeeDrivenCoder <wangke088@zju.edu.cn>
@CoffeeDrivenCoder
CoffeeDrivenCoder requested a review from a team August 23, 2026 03:59
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Aug 23, 2026

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

The change makes the active HDF5 data group's persisted env_args attribute the source of truth when merging updates, addressing both metadata loss after reopening and metadata leakage when reusing a handler.

  • Design and architecture: The revised ownership model is consistent with get_env_name(), which already reads persisted metadata directly. It removes reliance on handler-lifetime cache state without introducing new abstractions or dependencies.
  • API: Public signatures and the on-disk JSON representation remain unchanged. create(), set_env_name(), and get_env_name() retain their existing contracts, and the package includes an appropriately scoped changelog fragment.
  • Implementation: The create/reuse and close/reopen(r+)/update paths were traced. Reading the active group's attribute before each merge preserves existing values, while a newly created group starts from an empty mapping. The two focused regression tests cover both lifecycle failures. Re-parsing the small JSON attribute on each update is an intentional, non-blocking tradeoff for avoiding stale instance state.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes the active HDF5 data group the source of truth when environment arguments are updated, preserving metadata across reopen operations while preventing handler state from leaking into newly created datasets.

  • Reloads and deserializes persisted env_args before merging updates.
  • Adds regression coverage for reopening datasets and reusing handlers across files.
  • Adds the corresponding changelog fragment and contributor entry.

Confidence Score: 5/5

The PR appears safe to merge, with the changed metadata lifecycle behavior covered by focused regression tests and no actionable defects identified.

The handler now consistently merges against metadata stored in the active HDF5 group, preserving reopened-file arguments and preventing state from a previously closed file from contaminating a newly created dataset.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/utils/datasets/hdf5_dataset_file_handler.py Reloads environment arguments from the active HDF5 group before merging, correctly addressing both reopen preservation and cross-file handler reuse.
source/isaaclab/test/utils/test_hdf5_dataset_file_handler.py Adds focused regression tests for preserving metadata after reopening and resetting metadata when one handler creates multiple files.
source/isaaclab/changelog.d/coffeedrivencoder-preserve-hdf5-env-args.rst Accurately documents the two corrected metadata lifecycle failures.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[add_env_args called] --> B{Active data group has env_args?}
    B -- Yes --> C[Deserialize persisted mapping]
    B -- No --> D[Start with empty mapping]
    C --> E[Merge supplied arguments]
    D --> E
    E --> F[Serialize mapping to active data group]
Loading

Reviews (1): Last reviewed commit: "Preserve HDF5 environment arguments" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant