Skip to content

Fix ordering of compound fields with number-like names#1970

Merged
axelboc merged 1 commit into
mainfrom
compound-fields-array
Mar 11, 2026
Merged

Fix ordering of compound fields with number-like names#1970
axelboc merged 1 commit into
mainfrom
compound-fields-array

Conversation

@axelboc

@axelboc axelboc commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Fix #1765

The metadata of compound fields is now stored in a Map instead of a plain object in order to maintain proper ordering of fields with number-like names ("0", "1", etc.)

This also required changing the meta endpoint of h5grove to return compound fields metadata as an array instead of an object, just like HSDS and h5wasm.

⚠️ Breaking change: requires h5grove@4.0.0 (for now 4.0.0rc1)

Comment on lines +115 to +117
return compoundOrCplxType(
hsdsType.fields.map((v) => [v.name, convertHsdsType(v.type)]),
);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now calling compoundOrCplxType like in the other providers.

The subtle but negligible change from before is that if the r and i fields are present but not numeric, compoundOrCplxType doesn't throw an error — it just falls back to creating a compound type.

},
"members": {
"0": {
"members": [

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This shows the new array format returned by h5grove.

"class": "Boolean",
},
"1": {
"fields": Map {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This shows the new internal format for compound fields.

Comment on lines -1625 to -1631
"bigint": {
"class": 0,
"dtype": "<i8",
"order": 0,
"sign": 1,
"size": 8,
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Another fix here, but I think it was an issue with Vitest's snapshot serialization because the order was correct in the UI:

Image

@axelboc axelboc requested a review from loichuder March 4, 2026 10:53
@axelboc axelboc force-pushed the compound-fields-array branch from f51b999 to 34a7461 Compare March 10, 2026 08:27

@loichuder loichuder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the late review 😉

All good!

@axelboc axelboc closed this Mar 11, 2026
@axelboc axelboc force-pushed the compound-fields-array branch from 3ecfb81 to 6b883b2 Compare March 11, 2026 13:54
@axelboc axelboc reopened this Mar 11, 2026
@axelboc axelboc force-pushed the compound-fields-array branch from f3e83c5 to a690d89 Compare March 11, 2026 14:06
@axelboc axelboc merged commit 2b33ef2 into main Mar 11, 2026
13 checks passed
@axelboc axelboc deleted the compound-fields-array branch March 11, 2026 14:10
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.

[Compound] Colons with numeric labels in wrong order

2 participants