{"record":{"id":"cb8b9ba2836685aa","repo":"BigPizzaV3/CodexPlusPlus","slug":"theme-json-art","errorCode":null,"errorMessage":"theme.json.art 包含不支持的字段","messagePattern":"theme\\.json\\.art 包含不支持的字段","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":1286,"sourceCode":"        rest = &fraction[digits..];\n    }\n    if rest == \"Z\" {\n        return true;\n    }\n    if rest.len() != 6 || !matches!(rest.as_bytes()[0], b'+' | b'-') || rest.as_bytes()[3] != b':' {\n        return false;\n    }\n    rest[1..3].parse::<u32>().is_ok_and(|hour| hour <= 23)\n        && rest[4..6].parse::<u32>().is_ok_and(|minute| minute <= 59)\n}\n\nfn validate_theme_art(value: &Value) -> anyhow::Result<()> {\n    let object = value.as_object().context(\"theme.json.art 必须是对象\")?;\n    if object\n        .keys()\n        .any(|key| !matches!(key.as_str(), \"focusX\" | \"focusY\" | \"safeArea\" | \"taskMode\"))\n    {\n        bail!(\"theme.json.art 包含不支持的字段\");\n    }\n    for key in [\"focusX\", \"focusY\"] {\n        if object.get(key).is_some_and(|value| {\n            value\n                .as_f64()\n                .is_none_or(|number| !number.is_finite() || !(0.0..=1.0).contains(&number))\n        }) {\n            bail!(\"theme.json.art.{key} 无效\");\n        }\n    }\n    if object.get(\"safeArea\").is_some_and(|value| {\n        value\n            .as_str()\n            .is_none_or(|value| !matches!(value, \"left\" | \"right\" | \"none\"))\n    }) || object.get(\"taskMode\").is_some_and(|value| {\n        value\n            .as_str()\n            .is_none_or(|value| !matches!(value, \"ambient\" | \"full\" | \"off\"))","sourceCodeStart":1268,"sourceCodeEnd":1304,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L1268-L1304","documentation":"validate_theme_art whitelists the only fields permitted inside theme.json.art: focusX, focusY, safeArea, and taskMode. The library throws this error when the art object contains any other key. It exists to reject unknown/misspelled art properties early instead of silently ignoring them at render time.","triggerScenarios":"Calling validate_theme on a skin package whose theme.json has theme.json.art containing a key outside {focusX, focusY, safeArea, taskMode}, e.g. \"focus_x\", \"blur\", or \"zoom\".","commonSituations":"Typos in allowed keys (focusX written as focusx or focusX1); copying art fields from a newer/older skin spec that supports extra options; hand-authoring theme.json and guessing field names.","solutions":["Open theme.json and list the keys inside the art object.","Remove any key that is not exactly focusX, focusY, safeArea, or taskMode.","Fix misspellings of allowed keys (e.g. focusx -> focusX, key is case-sensitive).","Check the skin spec version; migrate any fields from a newer spec that this build does not support.","Re-run validate_theme / package validation to confirm."],"exampleFix":"// before\n{ \"art\": { \"focusX\": 0.5, \"focusx\": 0.5, \"blur\": 2 } }\n// after\n{ \"art\": { \"focusX\": 0.5, \"focusY\": 0.5 } }","handlingStrategy":"validation","validationCode":"const ALLOWED_ART_KEYS: &[&str] = &[\"focusX\", \"focusY\", \"safeArea\", \"taskMode\"];\nfn art_keys_valid(art: &serde_json::Map<String, Value>) -> bool {\n    art.keys().all(|k| ALLOWED_ART_KEYS.contains(&k.as_str()))\n}","typeGuard":"fn is_known_art_key(key: &str) -> bool {\n    matches!(key, \"focusX\" | \"focusY\" | \"safeArea\" | \"taskMode\")\n}","tryCatchPattern":"match validate_theme(value) {\n    Err(e) if e.to_string().contains(\"不支持的字段\") => eprintln!(\"theme.json.art has unknown keys: {e}\"),\n    other => other?,\n}","preventionTips":["Validate theme.json against the art schema at authoring time, not package time.","Use typed structs (serde) with deny_unknown_fields when generating theme.json.","Copy only documented art fields between packages; check spec version."],"tags":["skin-package","theme-json","schema-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}