Skip to content

Lay out the IP Intelligence collection item as the C structure is - #199

Merged
jwrosewell merged 1 commit into
release/4.5.12from
fix/ipi-collection-item-layout
Oct 27, 2026
Merged

jwrosewell merged 1 commit into
release/4.5.12from
fix/ipi-collection-item-layout

Conversation

@jwrosewell

Copy link
Copy Markdown
Contributor

Closes #156.

Problem

ProfilePercentage in fiftyone-ip-intelligence-sys holds a CollectionItem ahead of raw_weighting, and CollectionItem was declared with no fields, where the C structure holds a data buffer, a handle and a collection pointer, 32 bytes on a 64 bit target. So a caller of fiftyoneDegreesResultsIpiGetValues read the weighting from the first bytes of the item's data pointer. #156 has the measurements and the lines involved. The engines read weightings through the weighted value collection and are not affected.

Change

CollectionItem now holds the data, handle and collection pointer the C structure holds, so the weighting fiftyoneDegreesResultsIpiGetValues returns reads correctly. A new test compares that weighting with the weighted value collection's for every property of the ASN data file.

How it was verified

Locally on Windows, on the five native fixes merged together (this change, #193 and the other three native pull requests, at d94fa6a), cargo fmt --all -- --check and cargo clippy -p fiftyone-native -p fiftyone-ip-intelligence-sys -p fiftyone-device-detection-sys -p fiftyone-common-sys --all-targets -- -D warnings pass, and cargo test -p fiftyone-native --no-fail-fast with the Lite Hash and ASN data files gives 58 passed, 0 failed and 0 ignored across 9 test binaries.

Behaviour that changes

The -sys crate's CollectionItem has the C structure's fields, so ProfilePercentage has the C size.

What remains

  • The Pull Request workflow, which builds and tests on every platform, is waiting for approval and has not run. The Nightly Pipeline dry run will build and test the whole release branch before it merges.

CollectionItem was declared with no fields, so ProfilePercentage, which
holds one ahead of its weighting, read raw_weighting from the first bytes
of the item's data pointer rather than 32 bytes in on a 64 bit target.
It now holds the data, handle and collection pointer the C structure
holds, so the weighting fiftyoneDegreesResultsIpiGetValues returns reads
correctly.

A test compares that weighting with the weighted value collection's for
every property.

Closes #156.
@jwrosewell jwrosewell self-assigned this Oct 27, 2026
@jwrosewell
jwrosewell merged commit 71afdd6 into release/4.5.12 Oct 27, 2026
14 checks passed
@jwrosewell
jwrosewell deleted the fix/ipi-collection-item-layout branch October 27, 2026 14:42
@jwrosewell jwrosewell mentioned this pull request Oct 27, 2026
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.

1 participant