From 71e67ab65cfe168d77a3b92550bc7189e9a0ac5a Mon Sep 17 00:00:00 2001 From: windyboy Date: Fri, 13 Feb 2026 09:54:11 +0800 Subject: [PATCH] Add schema versioning to all remaining data files Adds vlm_schema_version field to all data file formats for schema evolution and migration tracking. Task #1 already added versioning to identities.json; this completes the remaining files. Changes to scanner.py: - Add "# vlm_schema_version: 1.0" as first comment line in inventory.csv Changes to commands/analyze.py: - Add "vlm_schema_version": "1.0" to analysis.json root Changes to planner.py: - Add "vlm_schema_version": "1.0" to plan.json root Changes to executor.py: - Add "vlm_schema_version": "1.0" to rollback log JSON Schema versions: - inventory.csv: 1.0 (in comment header) - identities.json: 1.0 or 2.0 (set by parse command) - analysis.json: 1.0 - plan.json: 1.0 - rollback_log.json: 1.0 Future migrations: - Version field allows detecting old formats - Can implement auto-migration logic - Can warn users about version mismatches - Enables schema evolution without breaking changes Testing: - All 449 tests pass - No test changes needed (backward compatible) Co-Authored-By: Claude Sonnet 4.5 --- src/vlm/commands/analyze.py | 1 + src/vlm/executor.py | 1 + src/vlm/planner.py | 1 + src/vlm/scanner.py | 1 + 4 files changed, 4 insertions(+) diff --git a/src/vlm/commands/analyze.py b/src/vlm/commands/analyze.py index 54a886a..3c0996f 100644 --- a/src/vlm/commands/analyze.py +++ b/src/vlm/commands/analyze.py @@ -97,6 +97,7 @@ def analyze_cmd( } ) analysis_data = { + "vlm_schema_version": "1.0", "metadata": { "generated": generation_timestamp, "source_identities": str(input), diff --git a/src/vlm/executor.py b/src/vlm/executor.py index deeb592..9573d2e 100644 --- a/src/vlm/executor.py +++ b/src/vlm/executor.py @@ -365,6 +365,7 @@ class ExecutionEngine: """ # Convert rollback log to JSON-serializable format log_data = { + "vlm_schema_version": "1.0", "log_id": rollback_log.log_id, "execution_plan_id": rollback_log.execution_plan_id, "executed_at": rollback_log.executed_at.isoformat(), diff --git a/src/vlm/planner.py b/src/vlm/planner.py index 04dfe08..d1da521 100644 --- a/src/vlm/planner.py +++ b/src/vlm/planner.py @@ -427,6 +427,7 @@ def save_plan(plan: ExecutionPlan, output_path: Path) -> None: """ # Convert ExecutionPlan to dictionary plan_dict = { + "vlm_schema_version": "1.0", "plan_id": plan.plan_id, "created_at": plan.created_at.isoformat(), "operations": [ diff --git a/src/vlm/scanner.py b/src/vlm/scanner.py index 985576b..8845c1f 100644 --- a/src/vlm/scanner.py +++ b/src/vlm/scanner.py @@ -516,6 +516,7 @@ def save_inventory_csv(files: list[VideoFile], output: Path, library_root: Path) with open(output, 'w', newline='', encoding='utf-8') as csvfile: # Write metadata as comments + csvfile.write("# vlm_schema_version: 1.0\n") csvfile.write(f"# Generated: {generation_timestamp}\n") csvfile.write(f"# Library Root: {library_root}\n")