Skip to content

test(semantic-types): stabilize Arrow fixture identities across Python versions - #676

Merged
eywalker merged 2 commits into
mainfrom
eywalker/fix-narrow-float-test-py311
Nov 30, 2026
Merged

eywalker merged 2 commits into
mainfrom
eywalker/fix-narrow-float-test-py311

Conversation

@eywalker

@eywalker eywalker commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Cause

This is case (b), a test-fixture issue. Python 3.11 preserves the module passed in make_dataclass(namespace=...). Python 3.12 and 3.13 overwrite it with the caller's module when the module argument is omitted. Orcapod correctly includes the module-qualified name of an exact dataclass in its Arrow extension identity.

Tracing the writer's serialized Arrow extension metadata before the IPC round trip showed these differing identity.name inputs:

Class Python 3.11 Python 3.12 and 3.13
Entries itl1591_arrow_compatibility.Entries tests.test_semantic_types.test_narrow_float_arrow_compatibility.Entries
Outer itl1591_arrow_compatibility.Outer tests.test_semantic_types.test_narrow_float_arrow_compatibility.Outer
Nested Inner itl1591_arrow_compatibility.Inner tests.test_semantic_types.test_narrow_float_arrow_compatibility.Inner

The recorded field tokens were identical, including dict[str, int], dict[numpy.float32, int], and set[numpy.float32]. For the synchronous Arrow replacement-class case, the pipeline hash started with f8ea489b on 3.11 and 023b1ebb on 3.12 and 3.13. The same identity difference affected the source content hash and row data hash. Rows, data, and tag hashes matched.

Fix

Assign the module name embedded in the existing snapshot after creating each synthetic dataclass. This restores the three affected fixtures' pipeline, content, and data hashes on Python 3.11. The existing snapshot and golden hashes are preserved.

Verification

  • Compatibility file on Python 3.11, 3.12, and 3.13
  • Hashing suite and golden tests on Python 3.11 and 3.13
  • Ruff check, Ruff format check, basedpyright, and changelog fragment validation

Summary by CodeRabbit

  • Tests
    • Improved consistency in Arrow source compatibility checks across supported Python versions, reducing differences caused by test setup.
  • Documentation
    • Updated the changelog to reflect the compatibility checks.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a8c808e and 9fa8931.

Files selected for processing: 2

  • changelog.d/ITL-1591.md
  • tests/test_semantic_types/test_narrow_float_arrow_compatibility.py

Limit details: You’ve used the included review currently available. Your 100 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Recent review details

Context from checks skipped due to timeout: 1

  • GitHub Check: CodeRabbit
Additional context used

Code guidelines: 1

CLAUDE.md — auto-discovered
Path-based instructions: 1

Source excerpt: The file holds only the text that would have gone under the release heading in `CHANGELOG.md`: the same category headings `CHANGELOG.md` uses (`### Breaking changes and migration`, `### Added`, `### Changed`, `### Fixed`, `#...

CodeRabbit inference engine (CLAUDE.md)

Files:

  • changelog.d/ITL-1591.md
Learnings: 1

Common learnings

Learnt from: CR
Repo: metamorphic-labs/orcapod-python

Timestamp: 2026-11-30T01:19:31.298Z
Learning: Source excerpt:
# Claude Code instructions for orcapod-python

## Changelog

A pull request never edits `CHANGELOG.md` (developer, November 11, 2026; ITL-961). It adds
exactly one file, `changelog.d/<ISSUE-ID>.md` (e.g. `changelog.d/ITL-955.md`; a PR that
resolves several issues uses its primary issue's id).
Walkthrough

The Arrow compatibility tests now create selected synthetic dataclasses with an explicit test-module identity. The changelog records that the tests use consistent synthetic class identities across supported Python versions.

Changes: Arrow compatibility test identities

Layer / File(s) Summary
Assign stable identities to synthetic dataclasses
tests/test_semantic_types/test_narrow_float_arrow_compatibility.py, changelog.d/ITL-1591.md
A helper sets each dataclass’s __module__ to the test module. The newer-class and missing-class cases use the helper. The changelog notes the identity consistency across supported Python versions.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Possibly related PRs

Merge Risk: Minimal · up to 9fa89

This change only stabilizes test fixture identities across Python versions and adds a changelog note. It does not change product behavior, and no merge-blocking risk was identified.

Security architecture risk: Minimal · up to 9fa89

The change gives test fixtures consistent class names across Python versions without changing how production code handles Arrow input.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "test(semantic-types): stabilize Arrow fixture identities across Python versions" matches the changeset. The PR gives each synthetic dataclass in the Arrow narrow-float compatibility test an…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "test(semantic-types): stabilize Arrow fixture identities across Python versions" matches the changeset. The PR gives each synthetic dataclass in the Arrow narrow-float compatibility test an explicit module identity through a new _snapshot_dataclass helper. This removes the Python 3.11 versus 3.12/3.13 difference in __module__ for make_dataclass classes. The title is short, specific, and names the main change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

@eywalker
eywalker merged commit 90815da into main Nov 30, 2026
12 checks passed
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