{"record":{"id":"63a1563cdca0fe84","repo":"pbakaus/impeccable","slug":"config-cspchecked-if-present-must-be-a-boolean","errorCode":null,"errorMessage":"config.cspChecked, if present, must be a boolean","messagePattern":"config\\.cspChecked, if present, must be a boolean","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"plugin/skills/impeccable/scripts/live-inject.mjs","lineNumber":472,"sourceCode":"  if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {\n    throw new Error('config.files must contain only non-empty strings');\n  }\n  if (cfg.exclude !== undefined) {\n    if (!Array.isArray(cfg.exclude)) {\n      throw new Error('config.exclude, if present, must be a string array');\n    }\n    if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {\n      throw new Error('config.exclude must contain only non-empty strings');\n    }\n  }\n  if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {\n    throw new Error('config.insertBefore or config.insertAfter (string) required');\n  }\n  if (cfg.commentSyntax !== 'html' && cfg.commentSyntax !== 'jsx') {\n    throw new Error(\"config.commentSyntax must be 'html' or 'jsx'\");\n  }\n  if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {\n    throw new Error(\"config.cspChecked, if present, must be a boolean\");\n  }\n}\n\n// ---------------------------------------------------------------------------\n// Auto-execute\n// ---------------------------------------------------------------------------\n\nconst _running = process.argv[1];\nif (_running?.endsWith('live-inject.mjs') || _running?.endsWith('live-inject.mjs/')) {\n  enterLiveRoot();\n  injectCli();\n}\n\n// Re-exported so long-standing importers (live.mjs, the adapter modules, the\n// test suites) keep their entry points while the implementations live in\n// live/frameworks/.\nexport {\n  buildLiveScriptSrc,","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/plugin/skills/impeccable/scripts/live-inject.mjs#L454-L490","documentation":"Eighth validateConfig() check: cfg.cspChecked is optional (undefined is fine), but if present it must be a boolean. cspChecked records whether the Content-Security-Policy meta was already reconciled by patchCspMeta()/revertCspMeta(); a non-boolean would mislead the journal reconciliation logic that reads it.","triggerScenarios":"\"cspChecked\": \"true\" (string), 1, \"yes\", null. The field is correctly omitted by setup unless CSP work has run, so a non-boolean value typically comes from hand-editing.","commonSituations":"User added the field manually with a stringy boolean; a config-merge tool coerced true to 'true'; YAML-to-JSON conversion mangled the type.","solutions":["Remove the cspChecked key if you don't need to assert CSP state — the injector manages it internally.","Set it to a real JSON boolean (true/false, unquoted).","Validate with `node live-inject.mjs --check`.","Regenerate the config to let the injector own this field."],"exampleFix":"// before\n{ \"cspChecked\": \"true\", ... }\n\n// after\n{ \"cspChecked\": true, ... }\n// or simply omit the key\n{ \"files\": [...], ... }","handlingStrategy":"validation","validationCode":"function isValidCspChecked(cfg) {\n  return cfg?.cspChecked === undefined || typeof cfg.cspChecked === 'boolean';\n}\nif (!isValidCspChecked(cfg)) {\n  cfg.cspChecked = cfg.cspChecked === 'true' || cfg.cspChecked === true;\n}","typeGuard":"/** True when cspChecked is absent or a real boolean. */\nfunction isOptionalBoolean(value) {\n  return value === undefined || typeof value === 'boolean';\n}","tryCatchPattern":"try {\n  validateConfig(cfg);\n} catch (err) {\n  if (/cspChecked/.test(err.message)) {\n    cfg.cspChecked = undefined; // let the injector own it\n    validateConfig(cfg);\n  }\n  throw err;\n}","preventionTips":["Omit cspChecked unless you have a specific reason — the injector manages CSP state internally.","If you set it, use an unquoted JSON boolean (true/false), never a string.","Watch for YAML->JSON converters that coerce booleans to strings."],"tags":["live-inject","config","validation","json","csp"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}