feat: add vouch migrate for safe on-disk KB upgrades#108
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR introduces six new CLI commands and supporting infrastructure to enhance KB lifecycle management: ChangesKB Lifecycle, Transport, and Inspection
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant MigrationMod as migrations
participant Store as KBStore
User->>CLI: vouch migrate --check
CLI->>MigrationMod: detect_version, build_plan
MigrationMod->>Store: read config.yaml
MigrationMod->>MigrationMod: determine version 0→1
MigrationMod->>CLI: return MigrationPlan with steps needed
alt steps_needed and --check
CLI->>User: exit 1, print "needs migration"
else no steps needed
CLI->>User: exit 0, print "up to date"
end
sequenceDiagram
participant User
participant CLI
participant ProposalStore as proposals
participant Output
User->>CLI: vouch review --limit 5
CLI->>ProposalStore: list pending proposals
loop for each proposal
CLI->>Output: show preview + full YAML
User->>CLI: approve / reject / skip / quit
alt approve
CLI->>ProposalStore: set status=approved
else reject
CLI->>ProposalStore: set status=rejected, decision_reason
else skip
CLI->>Output: skip to next proposal
else quit
CLI->>Output: stop, remaining stay pending
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for putting this together — the framework itself is genuinely clean. But I think we should hold off, because right now it's a migration engine with nothing to migrate. The only step is The bigger thing: adding Really nice work regardless — I just think it's a bit early and I will keep this open. 🙏 |
d320db5 to
5022e5e
Compare
5022e5e to
f3ec53f
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
f3ec53f to
c90312c
Compare
|
LGTM! |


What changed
Adds
vouch migrateand a small on-disk migration framework: version detection inconfig.yaml,--check/--dry-run/ apply flows, a legacy0 → 1step, audit logging on successful apply, and index rebuild after migration. Rebased onto latesttestso the change is a single commit on currenttest(no duplicate batch-approve / expire / template work).Why
As
.vouch/evolves pre-1.0, users need a supported way to upgrade existing KBs without hand-editing files or losing audit history. This lays the groundwork for future format changes (roadmap:vouch migratebefore 1.0). The only step today is0 → 1(unversioned / legacy KBs → stamped format version 1); a real1 → 2migration can land in a follow-up when there is an actual breaking layout change.Closes #107
What might break
Additive for users who do nothing: existing version-1 KBs are unchanged.
If someone runs
vouch migrateon a legacy/unversioned KB, it may:config.yamlversion: 1.gitignorewithproposed/,state.db,state.db-*state.dbkb.migrateaudit eventNo durable artifact schema changes, no file moves, and no
kb.*method behavior changes.VEP
Touches on-disk layout compatibility (
KB_FORMAT_VERSION, migration story). Likely needs maintainer sign-off or a VEP before merge; happy to pair with the first real1 → 2format change if preferred.Tests
make checkpasses locally (lint + mypy + pytest)tests/test_migrations.py)CHANGELOG.mdupdated under## [Unreleased]Note for reviewers
Rebased onto
testafter overlapping PRs landed. This PR is intentionally scoped to the migrate framework +0 → 1stamping; feedback welcome on keeping it open until a concrete1 → 2migration exists.