Add value-only matrix snapshot bridge#128
Merged
Merged
Conversation
There was a problem hiding this comment.
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
Snapshottype plussnapshot()/restore()onPineMatrix,PineGenericMatrix<T>, andPineGenericMatrix<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> | ||
|
|
This was referenced Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
SnapshotAPI toPineMatrix,PineGenericMatrix<T>, and the bool specialization.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
62af2350917d...,REGEN=0): 252/252 built and ran, 0 failures