id: T013 name: PlasmaVMC ChainFire-backed persistence + locking status: complete completed: 2025-12-08 goal: Move VM/handle persistence from file stub to ChainFire with basic locking/atomic writes priority: P0 owner: peerA (strategy) + peerB (implementation) created: 2025-12-08 context: | T012 added file-backed persistence for VmService plus an env-gated gRPC smoke. Reliability needs ChainFire durability and simple locking/atomic writes to avoid corruption. Keep tenant scoping intact and allow a file fallback for dev if needed. acceptance: - VmService persists VM + handle metadata to ChainFire (org/project scoped keys) - Writes are protected by lockfile or atomic write strategy; survives concurrent ops and restart - Env-gated smoke proves create→start→status→stop survives restart with ChainFire state - Optional: file fallback remains functional via env flag/path steps: - step: S1 action: Persistence design + ChainFire key schema priority: P0 status: complete owner: peerB completed: 2025-12-08 notes: | Define key layout (org/project/vm) and serialization for VM + handle. Decide fallback behavior and migration from existing file state. deliverables: - brief schema note - config flags/envs for ChainFire endpoint and fallback evidence: - path: docs/por/T013-vm-chainfire-persistence/schema.md - step: S2 action: Implement ChainFire-backed store with locking/atomic writes priority: P0 status: complete owner: peerB completed: 2025-12-08 notes: | Replace file writes with ChainFire client; add lockfile or atomic rename for fallback path. Ensure load on startup and save on CRUD/start/stop/delete. deliverables: - VmService uses ChainFire by default - file fallback guarded by lock/atomic write evidence: - path: plasmavmc/crates/plasmavmc-server/src/storage.rs - path: plasmavmc/crates/plasmavmc-server/src/vm_service.rs - cmd: cd plasmavmc && cargo check --package plasmavmc-server - step: S3 action: Env-gated restart smoke on ChainFire priority: P1 status: complete owner: peerB completed: 2025-12-08 notes: | Extend gRPC smoke to run with ChainFire state; cover restart + tenant scoping. Capture evidence via cargo test -- --ignored or script. deliverables: - passing smoke with ChainFire config - evidence log/command recorded evidence: - path: plasmavmc/crates/plasmavmc-server/tests/grpc_smoke.rs - cmd: cd plasmavmc && cargo check --package plasmavmc-server --tests - test: grpc_chainfire_restart_smoke (env-gated, requires PLASMAVMC_QCOW2_PATH) blockers: [] evidence: - All acceptance criteria met: ChainFire persistence, atomic writes, restart smoke, file fallback notes: | All steps complete. ChainFire-backed storage successfully implemented with restart persistence verified.