Skip to content

feat: extract minimal chekov-core state model - #33

Merged
Freyskeyd merged 2 commits into
mainfrom
freyskeyd/che-3-extract-minimal-chekov-core-state-model
Sep 8, 2026
Merged

Freyskeyd merged 2 commits into
mainfrom
freyskeyd/che-3-extract-minimal-chekov-core-state-model

Conversation

@Freyskeyd

Copy link
Copy Markdown
Owner

Summary

  • Add dependency-free chekov-core with opaque byte keys and values, revisions, cells, views, mutations, observations, and transition batches.
  • Add deterministic memory-backed tests for creation, update, deletion, stale observations, transition construction, and revision exhaustion.
  • Refs CHE-3.

Verification

  • cargo test --workspace
  • cargo clippy -p chekov-core --all-targets -- -D warnings
  • cargo fmt --all -- --check

@linear-code

linear-code Bot commented Sep 8, 2026

Copy link
Copy Markdown

CHE-3

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.

🟡 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-core with core state types (StateKey, StateValue, Revision, StateCell, Mutation, TransitionBatch) and a StateView trait.
  • 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 calls StateValue::new(bytes), which copies via AsRef<[u8]>. You can preserve the “cheaply shareable” goal by converting Vec<u8> directly into Arc<[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.

Comment thread crates/chekov-core/src/lib.rs
@Freyskeyd

Copy link
Copy Markdown
Owner Author

Fixed in b4394d7. Both Vec conversions now construct Arc<[u8]> directly, avoiding the extra copy. Workspace tests, clippy, and formatting checks pass.

@Freyskeyd
Freyskeyd merged commit b0e24b7 into main Sep 8, 2026
16 checks passed
@Freyskeyd
Freyskeyd deleted the freyskeyd/che-3-extract-minimal-chekov-core-state-model branch September 8, 2026 11:07
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