{"record":{"id":"fd54bc5fa8fddb90","repo":"Hmbown/CodeWhale","slug":"automation-run-schema-v-is-newer-than-supported","errorCode":null,"errorMessage":"Automation run schema v{} is newer than supported v{}","messagePattern":"Automation run schema v(.+?) is newer than supported v(.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":1822,"sourceCode":"        return false;\n    };\n    if !rest.starts_with('-') || rest.len() < 2 {\n        return false;\n    }\n    stamp.char_indices().all(|(idx, ch)| match idx {\n        8 => ch == 'T',\n        18 => ch == 'Z',\n        _ => ch.is_ascii_digit(),\n    })\n}\n\nfn read_run_file(path: &Path) -> Result<AutomationRunRecord> {\n    let raw =\n        fs::read_to_string(path).with_context(|| format!(\"Failed to read {}\", path.display()))?;\n    let run: AutomationRunRecord = serde_json::from_str(&raw)\n        .with_context(|| format!(\"Failed to parse {}\", path.display()))?;\n    if run.schema_version > CURRENT_RUN_SCHEMA_VERSION {\n        bail!(\n            \"Automation run schema v{} is newer than supported v{}\",\n            run.schema_version,\n            CURRENT_RUN_SCHEMA_VERSION\n        );\n    }\n    Ok(run)\n}\n\nfn ensure_safe_storage_id(kind: &str, value: &str) -> Result<()> {\n    let mut components = Path::new(value).components();\n    let Some(component) = components.next() else {\n        bail!(\"{kind} must not be empty\");\n    };\n    if components.next().is_some() || !matches!(component, std::path::Component::Normal(_)) {\n        bail!(\"{kind} must be a single path component\");\n    }\n    Ok(())\n}","sourceCodeStart":1804,"sourceCodeEnd":1840,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/automation_manager.rs#L1804-L1840","documentation":"read_run_file parses an automation run history record and rejects any AutomationRunRecord whose schema_version exceeds CURRENT_RUN_SCHEMA_VERSION (v1 in this build). Run records persist under the automations storage tree carrying the version stamp of the binary that wrote them; the guard prevents an older codewhale from misinterpreting runs saved by a newer release. The message lists the file's version versus the supported one.","triggerScenarios":"Any flow that loads run history — listing runs, loading a run by id, resume or detail views backed by read_run_file — hitting a JSON file whose schema_version is greater than the compiled constant.","commonSituations":"Reading run history after downgrading codewhale; a synced or copied ~/.codewhale directory produced by a newer version; mixed-version installs (CI, teammate machines) sharing one state directory.","solutions":["Upgrade codewhale to a build whose run schema supports the version named in the message.","Otherwise archive or delete the newer-schema run JSON files under the automations runs storage to unblock history loading.","Isolate state directories per version so old binaries never open new records."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"fn record_schema_supported(path: &std::path::Path, supported: u64) -> bool {\n    std::fs::read(path)\n        .ok()\n        .and_then(|raw| serde_json::from_slice::<serde_json::Value>(&raw).ok())\n        .map(|v| v[\"schema_version\"].as_u64().unwrap_or(0) <= supported)\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"Catch the load error, branch on \"newer than supported\", and degrade gracefully — skip that run in history views while logging which file requires a newer binary; rethrow unrelated parse or IO errors.","preventionTips":["Pin one codewhale version across machines that share state.","Check schema_version before importing external run archives.","Clean state directories when switching between release channels."],"tags":["rust","schema-version","persistence","automation","backward-compatibility"],"backgroundTag":"schema-version-mismatch","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}