feat(vcs): KG versioning + merge — ADR-042/043, khive-vcs + khive-merge crates, frontend design (#1, #2)#82
Merged
Conversation
…rge algorithm ADR-042 specifies the khive-vcs crate: SHA-256 content-addressed snapshots, pointer-style branch model, dirty-flag tracking, FTS5-sync/vector-async checkout, HTTP remote push/pull protocol, and the delta storage migration path. ADR-043 specifies the khive-merge crate: three-way merge with LCA ancestry walk, entity and edge categorization, field-level property merge, structured MergeConflict enum (NameConflict, KindConflict, PropertyMismatch, ModifyDelete, DanglingEdge), and MergeStrategy shortcuts (Ours/Theirs/Auto). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… ADR-043) khive-vcs: SHA-256 content-addressed snapshot hashing (canonical JSON), KgSnapshot and KgBranch types, commit/branch/checkout/log operations, MergeEngine trait with NoOpMergeEngine stub, SQL migrations for kg_snapshots/kg_branches/kg_vcs_state. khive-merge: ThreeWayMergeEngine implementing MergeEngine, LCA ancestry walk (O(D) HashSet algorithm), entity categorization (12 change categories) with field-level property/name/kind/tag merge, edge categorization with dangling-edge validation, Ours/Theirs last-write-wins strategy shortcuts. 40 tests pass. cargo check clean on both crates. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Specifies four UI surfaces for the Next.js 15 + React 19 scaffold (PR #25): Branch DAG view (React Flow), diff viewer (side-by-side entity/edge changes), merge conflict resolution UI (structured conflict cards with resolution actions), and snapshot timeline (virtualized list). Includes TypeScript type mirroring of Rust VCS types, VcsContext state architecture, accessibility requirements, and open questions for v0.2. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…t, NaN reject F1: Make SnapshotId inner field private to enforce invariant. F2: sort_properties_value now recurses into nested objects and arrays. F3: NaN/Inf edge weights panic instead of silently mapping to 0. F8: cargo fmt applied. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Full KG versioning system: ADR design + Rust implementation + frontend design.
Addresses #1 (KG merge) and #2 (KG versioning).
Phase 1 — ADR Design
ADR-042 (KG Versioning Implementation): SHA-256 canonical hashing, split storage tables (
kg_snapshots/kg_snapshot_archives),khive-vcscrate boundary, remote push/pull protocol (fast-forward-only push),format = 'full'/'delta'for future delta migration, FTS5-sync + vector-async checkout.ADR-043 (KG Merge Algorithm): LCA algorithm (O(D) HashSet walk), diff-to-merge rules for all 12 entity-change + 12 edge-change categories, field-level property merge (per-key analysis, name/kind always conflict, description ours-wins, tags union),
MergeConflictenum with 6 variants, last-write-wins strategies.Phase 2 — Rust Implementation (2 new crates, 40 tests)
crates/khive-vcs/(8 modules):types.rs—SnapshotId,KgSnapshot,KgBranch,RemoteConfig,VcsStatehash.rs— deterministic canonical JSON + SHA-256 snapshot hashingsnapshot.rs—commit(),load_archive(),load_vcs_state()branch.rs— create/list/get/checkoutlog.rs— history traversal,ancestor_ids()merge_engine.rs—MergeEnginetrait +NoOpMergeEnginemigrations.rs— DDL for VCS tableserror.rs— 13 error variantscrates/khive-merge/(6 modules):diff_local.rs— entity/edge diffinglca.rs— lowest common ancestor via HashSet ancestry walkentity.rs— 12-category entity merge + field-level property mergeedge.rs— edge merge + dangling edge validationstrategy.rs— ours/theirs/last-write-winsmerge.rs—three_way_merge()orchestratorPhase 3 — Frontend Design
docs/design/kg-versioning-frontend.md: 4 screens (Branch DAG via React Flow + ELK, diff viewer, merge conflict resolution UI, snapshot timeline), TypeScript type mirrors,VcsContextstate architecture, accessibility requirements.Test plan
cargo clippy— cleancargo fmt --check— cleanCloses #1, closes #2
Generated with Claude Code