{"record":{"id":"7ea50362e90b25ea","repo":"Hmbown/CodeWhale","slug":"configstore-path-is-validated-before-construction","errorCode":null,"errorMessage":"ConfigStore path is validated before construction","messagePattern":"ConfigStore path is validated before construction","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/lib.rs","lineNumber":5223,"sourceCode":"    pub fn reload(&mut self) -> Result<()> {\n        *self = Self::load(Some(self.path.clone()))?;\n        Ok(())\n    }\n\n    #[must_use]\n    pub fn path(&self) -> &Path {\n        &self.path\n    }\n\n    #[must_use]\n    pub fn permissions(&self) -> &PermissionsToml {\n        &self.permissions\n    }\n\n    #[must_use]\n    pub fn permissions_path(&self) -> PathBuf {\n        checked_permissions_path_for_config_path(&self.path)\n            .expect(\"ConfigStore path is validated before construction\")\n    }\n\n    #[must_use]\n    pub fn exec_policy_engine(&self) -> ExecPolicyEngine {\n        if self.permissions.is_empty() {\n            ExecPolicyEngine::new(Vec::new(), Vec::new())\n        } else {\n            ExecPolicyEngine::with_rulesets(vec![self.permissions.ruleset()])\n        }\n    }\n\n    /// Atomically append ask-only permission rules to the sibling\n    /// `permissions.toml` file.\n    ///\n    /// Existing comments and formatting are preserved. Exact duplicate rules\n    /// are ignored, and the in-memory permissions snapshot is refreshed after\n    /// a successful write.\n    pub fn append_ask_rules(&mut self, rules: &[ToolAskRule]) -> Result<usize> {","sourceCodeStart":5205,"sourceCodeEnd":5241,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/config/src/lib.rs#L5205-L5241","documentation":"permissions_path() derives the permissions file location from the store's config path and unwraps with this expect because ConfigStore construction already validated that path. The panic fires only if a ConfigStore was built through a path that bypassed validation — an internal-contract violation.","triggerScenarios":"Thrown at crates/config/src/lib.rs:5223 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure all ConfigStore instances are created via the validated load() constructor","Fix any code that mutates the config path after construction"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}