Skip to content

Memberships refuse an object whose events are in another order or another partition - #59

Open
david-priest wants to merge 1 commit into
mainfrom
fix/memberships-fingerprint
Open

david-priest wants to merge 1 commit into
mainfrom
fix/memberships-fingerprint

Conversation

@david-priest

Copy link
Copy Markdown
Owner

The stored population memberships are one packed bitset per population, positional over the SCE's columns, and the only guard on reading them back was the column count. An SCE with the same number of events in a different order, or partitioned into different samples, read the wrong events as members — while gatelabPopulations()'s documentation said reordering was refused.

An explicit "Save to SCE" now stores a fingerprint beside the record: an xxhash64 digest of colnames(sce) and one of the sample partition it packed against (with the column the partition used, so the read recomputes the same one). gatelabPopulations(), gatelabLeafPopulation() and the hierarchy readers compare both and refuse a mismatch with a message that says what differed and to press Save to SCE on this object. A record written before the fingerprint existed keeps the column-count check alone, so nothing already saved stops reading.

Tests: a reordered SCE and a re-partitioned one are refused; the object the memberships were saved on still reads; a record without a fingerprint still reads.

Finding 13 of the 2026-09-11 review of the wsp-testing PRs.

🤖 Generated with Claude Code

…ther partition

The stored bitsets are positional, and the only guard was the column count, so
an SCE with the same number of events in a different order, or partitioned into
different samples, read the wrong events as members while the documentation
said reordering was refused. An explicit save now stores a fingerprint of the
column names and of the sample partition it packed against, and the read
compares both; a record written before the fingerprint existed keeps the
column-count check alone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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