Skip to content

feat: add snapshot in py server#24

Open
kerthcet wants to merge 4 commits into
InftyAI:mainfrom
kerthcet:feat/support-snapshot-in-server
Open

feat: add snapshot in py server#24
kerthcet wants to merge 4 commits into
InftyAI:mainfrom
kerthcet:feat/support-snapshot-in-server

Conversation

@kerthcet

Copy link
Copy Markdown
Member

What this PR does / why we need it

Which issue(s) this PR fixes

Fixes #

Special notes for your reviewer

Does this PR introduce a user-facing change?


kerthcet added 2 commits June 30, 2026 00:20
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings June 29, 2026 23:31
@InftyAI-Agent InftyAI-Agent added needs-triage Indicates an issue or PR lacks a label and requires one. needs-priority Indicates a PR lacks a label and requires one. do-not-merge/needs-kind Indicates a PR lacks a label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces snapshot operations (create/restore/list/find/get/delete) to the SandD daemon and exposes them through the Python server API, backed by new protocol message variants and expanded end-to-end tests.

Changes:

  • Added snapshot message types to the WebSocket protocol and implemented snapshot request handling in the daemon.
  • Added Python-facing snapshot APIs and a SnapshotInfo model to represent snapshot metadata.
  • Updated snapshot manager/types naming and expanded E2E coverage for snapshot workflows.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
server/src/lib.rs Adds PyO3-exposed snapshot methods that send snapshot protocol messages and await responses.
sandd/src/snapshot/types.rs Renames snapshot field to workspace (from workspace_path).
sandd/src/snapshot/manager.rs Renames find_by_tag to find_snapshot_by_tag and changes get_snapshot to return SnapshotInfo.
sandd/src/protocol.rs Adds snapshot-related protocol message variants.
sandd/src/main.rs Wires SnapshotManager into the daemon message handler and implements snapshot operations.
python/sandd/server.py Adds Python API methods for snapshot operations and maps raw results into SnapshotInfo.
python/sandd/models.py Introduces SnapshotInfo Python model (including timestamp handling).
python/tests/test_e2e.py Adds extensive E2E tests for snapshot create/list/find/get/restore/delete behaviors.
examples/snapshot_simple.rs Updates example code to the renamed find_snapshot_by_tag API.
docs/proposals/SNAPSHOTS.md Updates the proposal doc with snapshot protocol integration details and renamed APIs.
Comments suppressed due to low confidence (1)

docs/proposals/SNAPSHOTS.md:199

  • The proposal still documents get_snapshot returning a full Snapshot, but the implementation now returns SnapshotInfo (see sandd/src/snapshot/manager.rs). The doc should match the implemented API.
    /// Get snapshot by ID
    pub async fn get_snapshot(&self, id: &str) -> Result<Snapshot>;


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

Comment thread server/src/lib.rs
Comment on lines +373 to +377
let msg = Message::CreateSnapshot {
request_id: request_id.clone(),
workspace,
message,
tags,
Comment thread server/src/lib.rs Outdated
Comment on lines +474 to +475
let snapshots: Vec<serde_json::Value> = serde_json::from_str(&result.stdout)
.map_err(|e| PyRuntimeError::new_err(format!("Invalid snapshot list: {}", e)))?;
pub message: String,
pub tags: Vec<String>,
pub workspace_path: PathBuf,
pub workspace: PathBuf,
Comment thread python/sandd/models.py
Comment on lines +146 to +148
self.id = id
self.created_at = datetime.fromtimestamp(created_at)
self.message = message
Comment on lines +231 to +234
request_id: String,
snapshot_id: String, // Snapshot ID or tag name
destination: String, // Path to restore to
},
Comment on lines +265 to 268
SnapshotDetails {
request_id: String,
snapshot: Snapshot, // Full snapshot metadata
},
Comment thread server/src/lib.rs Outdated
Comment on lines +388 to +392
if let Some(snapshot_id) = result.stdout.split_whitespace().next() {
Ok(snapshot_id.to_string())
} else {
Err(PyRuntimeError::new_err("Invalid snapshot response"))
}
kerthcet added 2 commits June 30, 2026 09:05
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/needs-kind Indicates a PR lacks a label and requires one. needs-priority Indicates a PR lacks a label and requires one. needs-triage Indicates an issue or PR lacks a label and requires one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants