Skip to content

fix(compare): calibration compares raw Arrow values, never Python objects (ITL-1347) - #518

Merged
eywalker merged 1 commit into
eywalker/job-speedfrom
eywalker/itl-1347-compare-raw-values
Nov 23, 2026
Merged

eywalker merged 1 commit into
eywalker/job-speedfrom
eywalker/itl-1347-compare-raw-values

Conversation

@eywalker

@eywalker eywalker commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Part of ITL-1347.

Codex review of PR #510 (minor, reproduced): docs/dev/scripts/itl_1347/compare.py's calibration labelled a time64[ns] column changing from [1, 9] to [2, 9] in place as row-order variation, because both arrays became the same microsecond Python time. The multiset of a column's values is now built from each raw value written in the Arrow IPC format (after _bits, which keeps float bits; the element copied with take so no offset enters the bytes; a null one fixed key): two values are equal exactly when their Arrow values are. Never a Python object.

Tests (tests/test_dev_scripts/test_itl_1347_compare.py): a value changed in place is a change, not a reorder, and the same raw values reordered are a reorder, each for time64[ns], timestamp[ns] (with and without a zone), duration[ns], decimal256(76, 40), -0.0 against 0.0, a NaN payload, and a 5,000-character string (whose text form Arrow shortens). The reviewer's time64[ns] case fails against the old Python-object comparison.

Could a gate tonight have been affected? No. The direction of the old error could only keep a column out of the volatile list (compared exactly), never hide a drift; and re-running the calibration of both gates with this fix gives the volatile lists the gates used, and no reorder-only column:

Gate Fixture Volatile columns (by count of tables) Reorder-only Gate's volatile.json equals the fixed calibration
main 8ee6c6d vs job-speed+516 5045660 tutorial __data_id 2, __pod_ts 2, __record_id 2, _source_mean_rate_hz 2, _source_rate_hz 5 none yes
spikes __data_id 2, __pod_ts 2, __record_id 2, _source_bin 5, _source_n_bins 3, _source_n_spikes 4, executed_at 1, pipeline_run_id 1 none yes
main 83c5476 vs job-speed 087ff54 tutorial same as above none yes
spikes same as above none yes

Every volatile column is a run-made identifier (__data_id, __pod_ts, __record_id, executed_at, pipeline_run_id) or a function output's source-info token (which embeds a run's data id); no data column.

Checks: the test file 22 passed; basedpyright on the changed files exit 0; ruff clean. Tooling and tests only: no library code changes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved comparison accuracy for values such as high-precision timestamps, large decimals, negative zero, distinct NaN values, and long strings.
    • Comparisons now distinguish changes to values from changes in row order, helping produce more reliable results.

…ects (ITL-1347)

Codex on PR #510: a time64[ns] column changing from [1, 9] to [2, 9] in place
was labelled row-order variation, because both became the same microsecond
Python time. The multiset of a column's values is now taken from each raw
value written in the Arrow IPC format (after _bits; a null one fixed key):
equal exactly when the values are. Tests: a value changed in place is a
change (time64/timestamp/duration ns, decimal256, -0.0, a NaN payload, a
long string) and the same raw values reordered are a reorder, for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The calibration comparison now uses isolated Arrow IPC serialization to count values instead of Python repr strings. Tests cover in-place value changes and row reorderings across several data types.

Changes: Calibration value comparison

Layer / File(s) Summary
Arrow serialization and calibration tests
docs/dev/scripts/itl_1347/compare.py, tests/test_dev_scripts/test_itl_1347_compare.py
_as_multiset now counts serialized Arrow value keys, with a fixed key for nulls. Tests check whether changes and reorderings across temporal, decimal, floating-point, and string values are classified as volatile or as row-order variation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 40a4e

This changes how the internal calibration script decides whether column values are equal, so it distinguishes in-place changes from row reordering for types such as time64[ns], decimal256, signed zero and NaN payloads. The parameterized tests cover both cases. The impact is limited to developer tooling, and no concrete merge-blocking risk remains.

Security architecture risk: Minimal · up to 40a4e

The fix makes calibration distinguish Arrow values that Python conversion could collapse. It can change which columns calibration reports as volatile, but it does not change how the comparison consumes that list or introduce a new access path.

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 names the main change: calibration in the ITL-1347 compare script now compares raw Arrow values instead of Python objects. The raw summary and objectives confirm that _as_multiset and _value…
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 names the main change: calibration in the ITL-1347 compare script now compares raw Arrow values instead of Python objects. The raw summary and objectives confirm that _as_multiset and _value_key now serialize Arrow values, and that tests cover the time64[ns] case that motivated the fix. The title is specific and matches the changeset.

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
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 087ff54 and 40a4ea7.

Files selected for processing: 2

  • docs/dev/scripts/itl_1347/compare.py
  • tests/test_dev_scripts/test_itl_1347_compare.py

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your 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: 6

  • GitHub Check: Tests (3.13)
  • GitHub Check: CodeRabbit
  • GitHub Check: PostgreSQL tests (3.11)
  • GitHub Check: PostgreSQL tests (3.13)
  • GitHub Check: Ruff and basedpyright
  • GitHub Check: PostgreSQL tests (3.12)
Additional context used

Code guidelines: 1

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

Source excerpt: Documents written during development are kept in the repository, under `docs/dev/` (developer, November 16, 2026; ITL-1169): Never put them in the published documentation (`docs/` outside `docs/dev/`) or at the top level of...

CodeRabbit inference engine (CLAUDE.md)

Files:

  • docs/dev/scripts/itl_1347/compare.py
  • tests/test_dev_scripts/test_itl_1347_compare.py
Additional comments: 1

docs/dev/scripts/itl_1347/compare.py: 1

222-223: Data Integrity & Integration

The review concern does not hold for the inputs this script receives. Orcapod rejects dictionary-encoded columns at source and stream construction (schema_utils.py:798-815, stream_builder.py:462-467, arrow_table_stream.py:90-94), and the Delta writer stores decoded values. The reviewed dumps therefore do not carry the dictionary encoding that the example needs. The remaining gap is that dump.py's table-building path was not read. That gap does not change the result, because the repository's input contract already excludes the case.

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eywalker
eywalker merged commit f7a65d5 into eywalker/job-speed Nov 23, 2026
16 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