Skip to content

feat: read rectangular con sections into column slabs - #134

Open
HaoZeke wants to merge 2 commits into
developfrom
land/fp-column-read-r4
Open

HaoZeke wants to merge 2 commits into
developfrom
land/fp-column-read-r4

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Reads rectangular con sections straight into column slabs, in two commits.

  • column_read.rs paints each section's columns into preallocated slabs, and Python gets the same reader.
  • tests/column_slab_match.rs checks the slabs against the row reader, and tests/column_slab_safety.rs covers short, ragged and malformed frames.
  • The second commit only adds SAFETY comments saying why the slab pointers are Send and Sync.
  • A new coverage record, clause_coverage-0.24.0-fpcr-r3.json, is the chain tip.

Note

Medium Risk
New parallel parsing and unsafe slab writes add complexity, but behavior is gated on rectangular trajectories and heavily tested against the existing frame reader.

Overview
Adds read_column_slabs (Python via readcon.read_column_slabs) and a new Rust column_read module that reads rectangular CON trajectories straight into caller-owned column buffers—positions plus optional velocities, forces, energies, charges, spins, magmoms, displacements, and spreads.

The reader does a layout pass (frame count, atom count, section shape, byte offsets), then fills slabs via a fast row-painting path when frames match stock metadata and shared identity, with serial, threaded, and repeated-frame optimizations; mismatches fall back to the existing frame parser. Slabs are only committed after a successful full read.

parse_scalar_section_row and settled are exposed as pub(crate) for this path. New Rust and Python tests assert column output matches read_con / full frame iteration. Paper tooling adds clause_coverage-0.24.0-fpcr-r3.json as the coverage ledger tip and updates chain tests accordingly.

Reviewed by Cursor Bugbot for commit 6f6a396. Bugbot is set up for automated code reviews on this repo. Configure here.

Read positions and the other rectangular sections into caller-owned
slabs. A short slab or a later-frame failure is refused before the
caller buffer changes. Storage dtypes and whitespace tails follow
the frame reader.
Workers share the pointers and each writes a disjoint frame range.
The slabs stay allocated until those workers join.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6f6a396. Configure here.

Comment thread src/column_read.rs
write_vec1(frame_index, n, dest, frame.spins.f64_slice(), |atom| {
frame.spins.get_f64(atom)
})?;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused slabs fail the slow fill

Medium Severity

push_frame writes every Some slab from the frame arrays and never consults sections. slabs_cover allows a correctly sized extra buffer for an absent section, and the fast painter leaves that buffer alone. On fallback, an empty source array is shorter than the slab, so write_values returns Err and a valid rectangular file fails to fill.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6f6a396. Configure here.

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