Skip to content

test: pin layout parity across native descriptors and Java for both store layouts - #103

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/layout-parity-p0
Nov 20, 2026
Merged

AdaWorldAPI merged 1 commit into
mainfrom
claude/layout-parity-p0

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

What

Tests and one documentation correction. No ABI change, no new symbol, no production behaviour change.

This is the first half of a layout-parity gate set by the consumer's owner: show that ndarray's strided primitives, the native lane descriptors and Java's Panama reads agree on layout for both store layouts, before a persistent writer is chosen. It extends the existing row-major and facet-major tests rather than replacing them.

Added

Rust

  • Every lane descriptor of the row-major and facet-major stores equals the documented geometry at n in {16, 257, 4096}: in rowstore.rs, and through the ABI (lgj_rowstore_open, lgj_rowstore_open_columnar, lgj_lane_describe). Until now only row-major descriptors were asserted.
  • Facet-major lanes tile the store: pairwise disjoint and ending exactly at 512n.
  • Every lane and every row is equal across the two layouts at n = 257 (the existing test sampled six rows).
  • The strided equality kernel gives the same mask words when the store's bytes sit at base offsets 1, 3 and 7.
  • offset_of! pins for every field of LgjLaneDesc, LgjResourceInfo and LgjOpDesc. Until now only sizes and alignments were asserted.

Java

  • DescriptorParityTest (in AllTests): the same geometry as Java reads it, the same struct offsets as Rust's literals, and all 257 × 32 reads equal across layouts and equal to an independent re-implementation of the generator, used only as a test oracle. No production visibility was widened.

Corrected

docs/abi.md §18 and the RowLayout::FacetMajor doc claimed every per-facet block offset is a multiple of 64 "for any n_rows". That was false: classid and hi32 blocks are all aligned only when n is a multiple of 16, lo64 blocks when n is a multiple of 8. At n = 257, block 1 starts at byte 1028. Answers were never affected (kernels and Java use unaligned reads). The text now says when alignment holds, and the test that supposedly pinned the old claim (it checked only n in {64, 128, 4096}) is replaced by one with a negative arm.

Valhalla lab: R11-observed.txt re-captured. Its prose (1.30–1.33 ns/row, ~9.2×) disagreed with its own table. The new text states the measured table and that the ratio varies by run and machine.

Evidence

  • cargo test: 213 passed in the library, other test binaries green. cargo fmt --check and cargo clippy --all-targets -- -D warnings clean.
  • AllTests: 678 checks (631 before, plus 47).
  • Disable run: a wrong lo64 offset in the Java test's expected geometry turns 6 checks red (the three facet-major sizes), row-major stays green; restored and green again.

Not covered here

  • Memory that comes from a Lance dataset. This crate has no path for externally owned memory, so that half of the gate is a separate probe outside this repository.
  • No production test ties a Valhalla value record to lane bytes.
  • OldAbiCompatTest is still not in AllTests.

Generated by Claude Code

Summary by CodeRabbit

  • Documentation
    • Clarified when facet blocks are aligned, noting that alignment varies with row count and storage is not padded.
    • Updated benchmark results and added context that measurements can vary by machine and run.
  • Tests
    • Expanded checks for row and facet layouts, descriptor geometry, and value parity.
    • Added coverage for strided comparisons with unaligned input.

…tore layouts

P0 gate, first half. No ABI change and no production behaviour change.

Rust: every lane descriptor of the row-major and facet-major stores equals the
documented geometry at n in {16, 257, 4096}, in the row store and through the
ABI; facet-major lanes tile the store exactly; every lane and every row is
equal across layouts at n = 257; the strided equality kernel gives the same
mask at base offsets 1, 3 and 7; field offsets of LgjLaneDesc, LgjResourceInfo
and LgjOpDesc are pinned to literals.

Java: DescriptorParityTest checks the same geometry as Java reads it, the same
struct offsets, and all 257 x 32 reads equal across layouts and equal to an
independent generator used as a test oracle. Disable run: a wrong lo64 offset
turns 6 checks red.

Docs: abi.md section 18 and rowstore.rs claimed every facet-major block offset
is a multiple of 64 for any n_rows. That was false (block 1 starts at byte
1028 at n = 257). The text and the test now state when it holds.

Valhalla lab: R11 re-captured; its prose disagreed with its own table.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VysoWJ6vsyg3wEGc5v7T5v
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T06:35:45.200157Z 3c23b9d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change clarifies conditional alignment for facet-major blocks, adds native and Java tests for ABI layouts and row-store parity, and updates R11 AoS/SoA benchmark measurements and their context.

Changes: Facet Layout Alignment and Parity

Layer / File(s) Summary
Alignment contract and row-store geometry
docs/abi.md, native/lgj-abi/src/rowstore.rs, native/lgj-abi/src/kernels.rs
Documentation distinguishes aligned region bases from conditionally aligned facet blocks. Row-store tests check alignment, lane geometry, coverage, and values across layouts. Kernel tests compare strided equality results with a scalar reference at varied base offsets.
Native ABI and descriptor checks
native/lgj-abi/src/abi.rs, native/lgj-abi/src/exports.rs, native/lgj-abi/src/exports/tests/layout_parity.rs
Native tests pin wire-struct field offsets and check lane descriptors, allocation coverage, and facet-lane spans against expected geometry.
Java descriptor and accessor checks
java/src/test/java/com/adaworldapi/lancegraph/AllTests.java, java/src/test/java/com/adaworldapi/lancegraph/DescriptorParityTest.java
The Java suite checks struct layouts, lane descriptors, and accessor values against independent expected results. The existing test runner registers the new test.

R11 Benchmark Measurements

Layer / File(s) Summary
Updated benchmark results
valhalla-lab/reproducers/R11-observed.txt, valhalla-lab/reproducers/README.md
The R11 results report updated AoS and SoA timings, median comparison, and machine- and run-dependent variation. The README also records the VM and JDK context.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: claude

Merge Risk: Minimal · up to 3c23b

This change adds layout-parity tests and corrects documentation and benchmark notes without altering production behavior. No actionable merge risk was identified.

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: pin layout parity across native descriptors and Java for both store layouts" matches the main change. The PR adds Rust and Java layout-parity tests for row-major and facet-major store…
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: pin layout parity across native descriptors and Java for both store layouts" matches the main change. The PR adds Rust and Java layout-parity tests for row-major and facet-major stores, pins field offsets for the ABI structs, and includes a documentation correction. The title names the primary change (layout-parity tests) and its scope. It does not mention the alignment documentation correction, which is a secondary part of the change.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each row and lane,
Then hops through offsets once again.
The facets line up where rules allow,
While tests compare each byte somehow.
New timings rustle through the night,
The burrow logs them neat and right.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: d17beaee-9361-40cf-a769-16fd8ff4f4f2
Commits

Reviewing files that changed from the base of the PR and between 4db4ce4 and 3c23b9d.

Files selected for processing: 10

  • docs/abi.md
  • java/src/test/java/com/adaworldapi/lancegraph/AllTests.java
  • java/src/test/java/com/adaworldapi/lancegraph/DescriptorParityTest.java
  • native/lgj-abi/src/abi.rs
  • native/lgj-abi/src/exports.rs
  • native/lgj-abi/src/exports/tests/layout_parity.rs
  • native/lgj-abi/src/kernels.rs
  • native/lgj-abi/src/rowstore.rs
  • valhalla-lab/reproducers/R11-observed.txt
  • valhalla-lab/reproducers/README.md

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 3 reviews per hour.

@AdaWorldAPI
AdaWorldAPI merged commit b9213dc into main Nov 20, 2026
8 of 9 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.

2 participants