Skip to content

Add value-only matrix snapshot bridge#128

Merged
luisleo526 merged 1 commit into
mainfrom
codex/matrix-snapshot-compat-20260722
Jul 22, 2026
Merged

Add value-only matrix snapshot bridge#128
luisleo526 merged 1 commit into
mainfrom
codex/matrix-snapshot-compat-20260722

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

What changed

  • Add an opaque, reusable Snapshot API to PineMatrix, PineGenericMatrix<T>, and the bool specialization.
  • Restore snapshots through copy-then-swap so a failed snapshot copy leaves the live matrix untouched.
  • Cover valid, reassigned, na, and valid 0x0 receivers plus snapshot copy/move/reuse.

Why

The upcoming recursive calc-on-order-fills checkpoint work needs a stable matrix snapshot interface before matrix object-ID semantics are introduced. Landing this bridge separately keeps that later factorial factor narrow and independently testable.

This change is deliberately semantics-neutral: ordinary assignment and explicit .copy() retain their existing detached value behavior.

Validation

  • Full engine build and CTest: 116/116 passed
  • Full pinned corpus (62af2350917d..., REGEN=0): 252/252 built and ran, 0 failures
  • Corpus grading: 247 Excellent / 4 Strong / 1 documented anomaly, zero tier drift versus the pinned authoritative report
  • Cross-repo native compile using the candidate codegen matrix checkpoint traits: PASS
  • Fresh read-only Grok review: no actionable findings

Copilot AI review requested due to automatic review settings July 22, 2026 08:08

Copilot AI 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.

Pull request overview

Adds a value-only “Snapshot” checkpoint/restore bridge for matrix types to support upcoming rollback/checkpoint work, while keeping existing matrix assignment and .copy() semantics unchanged.

Changes:

  • Introduced an opaque Snapshot type plus snapshot() / restore() on PineMatrix, PineGenericMatrix<T>, and PineGenericMatrix<bool>.
  • Implemented restore via copy-then-swap to keep the live matrix unchanged if snapshot copying throws.
  • Added a new compatibility test covering snapshot copy/move/reuse, NA behavior, reassignment, and 0x0 matrices.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_matrix_snapshot_compat.cpp New test exercising snapshot/restore semantics across matrix types.
tests/CMakeLists.txt Registers the new snapshot compatibility test in the test suite.
src/matrix.cpp Implements PineMatrix::snapshot() and PineMatrix::restore().
include/pineforge/matrix.hpp Adds the public, opaque PineMatrix::Snapshot API and declarations.
include/pineforge/generic_matrix.hpp Adds Snapshot + snapshot/restore for generic matrix templates and bool specialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4 to +9
#include <cassert>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>

@luisleo526
luisleo526 merged commit 2672cf9 into main Jul 22, 2026
8 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