Skip to content

fix(io): arrow.load validates wire-contract row order before reshaping (#199 item 1) → v1.10.1 - #206

Merged
Polichinel merged 1 commit into
developmentfrom
fix/issue-199-arrow-load-ordering
Jul 28, 2026
Merged

fix(io): arrow.load validates wire-contract row order before reshaping (#199 item 1) → v1.10.1#206
Polichinel merged 1 commit into
developmentfrom
fix/issue-199-arrow-load-ordering

Conversation

@Polichinel

Copy link
Copy Markdown
Contributor

Addresses #199 item 1 (ordering validation on load). Item 2 (mmap/partitioned reading) deliberately stays open in the issue.

What

arrow.load reconstructs frames positionally (reshape(n, s)) but never read back the sample column that save writes as the order contract — so a reordered, truncated, or foreign-rewritten parquet loaded successfully with draws in the wrong sample slots, silently. This is the check views-postprocessing ADR-013 §4.5(b) previously required every consumer to run themselves on a separate raw-table read.

load now validates the layout first and raises ValueError on:

  1. Truncated/filtered table — row count not a positive multiple of the header's n_samples.
  2. Row-level reordersample column deviates from the written tile(arange(S), N).
  3. Cross-cell row swapstime/unit not constant within a sample block (invisible to the tile check alone).

A whole-cell block reorder still loads — identifiers travel with their draws, so it is a consistent table (pinned by a green boundary test).

Governance

Register C-72 (born-resolved, Tier 2 — silent corruption, but only reachable via an out-of-contract intermediary mutating the file; the supported save→load path was always correct); CHANGELOG [1.10.1]; version → 1.10.1 (fail-loud fix, no API change; banner guard is patch-tolerant). No ADR needed — implements an existing cross-repo contract requirement.

Verification

ruff + format clean · mypy strict green (3.10 + 3.11) · pytest 100% line+branch (5 new tests: 3 red raises + truncation + the consistent-reorder green boundary) · validate_docs PASSED (v1.10 ~ 1.10.1 OK).

🤖 Generated with Claude Code

…aping (#199 item 1, C-72) → v1.10.1

load reconstructed frames positionally but never checked the 'sample'
column save wrote as the order contract — a reordered, truncated, or
foreign-rewritten parquet reshaped plausible floats into the wrong
sample slots silently. Now fails loud (ValueError) on: row count not a
positive multiple of n_samples; sample column deviating from
tile(arange(S), N); time/unit not constant within a sample block
(cross-cell swaps the tile check alone cannot see). Whole-cell block
reorders remain loadable (consistent tables). Implements the check
views-postprocessing ADR-013 §4.5(b) made every consumer run
themselves. Register C-72; #199 item 2 (mmap/partitioned) stays open.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Polichinel
Polichinel merged commit bd39ad1 into development Jul 28, 2026
7 checks passed
@Polichinel
Polichinel deleted the fix/issue-199-arrow-load-ordering branch July 28, 2026 00:32
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