Repository navigation
Fix HDF5 reads of absolute field paths beneath an array of structures - #103
Open
olivhoenen wants to merge 1 commit into
Open
olivhoenen wants to merge 1 commit into
olivhoenen wants to merge 1 commit into
Conversation
`al_read_data` has always documented that a fieldpath may address a field from the dataobject root with a prepended `/`, but `HDF5Reader::read_ND_Data` honored only the relative half: it replaced `/` with `&` and then unconditionally prepended the current AOS context's tensorized path, so an already-rooted name was appended to the context it was meant to replace (`time_slice[]&constraints&j_phi[]&&time_slice&constraints&j_phi&…`). `H5Lexists` found nothing, the reader returned 0, and `al_plugin_read_data` filled the caller's buffer with EMPTY_* while reporting code 0 — stored data reported as absent, a silent wrong answer rather than an error. Decision: an absolute path resolves **by path segment** against the AOS chain the caller has open, cutting at the last matching AOS boundary. That answers the two coupled questions together — which dataset name to look up (the tensorized `[]` markers of the retained levels are kept) and which indices still apply (only the retained levels', so a child's cursor is never applied to an ancestor's shallower dataset, and the timed-AOS designation is dropped with it). Recorded in docs/adr/0002-absolute-field-path-resolution.md with the four rejected alternatives — chiefly plain de-slashing, which fixes only root fields, and keeping the child's whole cursor, which returns a wrong number instead of none. Segment-wise matching is the same rule ADR 0001 chose for `al_delete_data`, for the same reason: it tells a real descendant from a same-prefix stranger. The resolution lives in `HDF5Utils::resolveAbsoluteFieldPath`, which reports how many AOS levels the target still sits under; `read_ND_Data` truncates the current indices to it. No DD-version knowledge, no schema lookup, no ABI change. A target beyond an AOS the caller never opened has no cursor and no schema to infer one from, so it resolves without that `[]`, is not found, and travels the ordinary missing-data path — decided, and pinned by a test. Scope is HDF5 reads, as issue #65 establishes: the suite writes through relative spellings only, so it presumes nothing about writes, delete or arraystruct opening. Tests: Hdf5AbsoluteFieldPaths.* — both spellings of one address compared at nonzero indices on both levels of a nested AOS (time_slice → constraints/j_phi), for a scalar leaf, a CHAR array leaf, ancestor targets, root targets and the operation context itself; the plugin twin (al_plugin_read_data) asserted separately; cache/iteration stability, an absent-data control, and the unopened-AOS limit. Ten of the thirteen fail on the parent commit. Verified against the full suite, the Debug leg, ASan/UBSan (no new findings) and the Python suite. (cherry picked from commit 858a7a2)
This branch has not been deployed
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.
Part of the split of #85 (Tests and Benchmarks for regression) into smaller, single-purpose PRs that are easier to review.
Bug fix.
al_read_datalets a caller address a field from the IDS root with a leading/. On HDF5, such reads issued while an array-of-structures context was open reported existing data as absent: the dataset name lost its tensorized[]markers, and the child context's AOS indices were applied to an ancestor's dataset.HDF5Utils::resolveAbsoluteFieldPathcompares the path segment by segment with the open AOS chain, rebuilds the stored dataset name, and keeps only the AOS indices that still apply. The rationale is in ADRdocs/adr/0002-absolute-field-path-resolution.md. Includes the regression tests (test_hdf5_absolute_paths.cpp).Fork history: issue yohannmarguier#65, fork PR yohannmarguier#66.
Stack position: 9/9; depends on #101 (both touch
TRACEABILITY.mdandtests/contract/CMakeLists.txt).Authorship: these commits are @yohannmarguier's, cherry-picked unchanged from his fork with
git cherry-pick -x, so each one keeps its original author, date and message plus a(cherry picked from commit …)link back to the fork. Only conflicts with currentdevelopand with the new commit order were resolved.🤖 Generated with Claude Code