Repository navigation
feat: extract minimal chekov-core state model - #33
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
From<Vec<u8>> for StateKey/StateValue currently performs an avoidable extra allocation+copy, which conflicts with the “cheaply shareable” intent and is straightforward to fix.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces a new dependency-free chekov-core crate that defines a minimal, domain-neutral state model (opaque byte keys/values, revisions, observations, mutations, and transition batches) intended for deterministic execution in the broader Chekov codebase.
Changes:
- Added
chekov-corewith core state types (StateKey,StateValue,Revision,StateCell,Mutation,TransitionBatch) and aStateViewtrait. - Added deterministic memory-backed tests covering create/update/delete, stale revisions, transition batching, and revision exhaustion.
- Registered the new crate in workspace lockfile.
File summaries
| File | Description |
|---|---|
| crates/chekov-core/src/lib.rs | Implements the minimal state model API plus memory-backed tests. |
| crates/chekov-core/Cargo.toml | Declares the new chekov-core crate metadata as workspace-managed. |
| Cargo.lock | Adds the new chekov-core package entry to the lockfile. |
Review details
Suppressed comments (1)
crates/chekov-core/src/lib.rs:108
From<Vec<u8>>currently callsStateValue::new(bytes), which copies viaAsRef<[u8]>. You can preserve the “cheaply shareable” goal by convertingVec<u8>directly intoArc<[u8]>to avoid an extra allocation+memcpy.
impl From<Vec<u8>> for StateValue {
fn from(bytes: Vec<u8>) -> Self {
Self::new(bytes)
}
}
- Files reviewed: 2/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Fixed in b4394d7. Both Vec conversions now construct Arc<[u8]> directly, avoiding the extra copy. Workspace tests, clippy, and formatting checks pass. |
Summary
chekov-corewith opaque byte keys and values, revisions, cells, views, mutations, observations, and transition batches.Verification
cargo test --workspacecargo clippy -p chekov-core --all-targets -- -D warningscargo fmt --all -- --check