Enhance Mindnet settings and chain inspection features
- Added new settings for analysis policies path, chain inspector include candidates, and max template matches. - Updated MindnetSettingTab to allow user configuration of new settings with validation. - Enhanced chain inspection logic to respect includeCandidates option consistently across findings. - Improved template matching to apply slot type defaults for known templates, ensuring better handling of allowed node types. - Refactored tests to validate new functionality and ensure consistent behavior in edge case scenarios.
This commit is contained in:
1 parent
3bb59afdda
commit
86c88bc275
15 files changed
+1867
-66
No files matched your search
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Centralized severity policy for Chain Inspector findings.
|
||||
* Applies profile-aware severity rules.
|
||||
*/
|
||||
|
||||
export type Severity = "info" | "warn" | "error";
|
||||
export type ProfileName = "discovery" | "decisioning";
|
||||
|
||||
/**
|
||||
* Apply severity policy based on profile and finding code.
|
||||
*
|
||||
* Policy rules:
|
||||
* - missing_link_constraints:
|
||||
* - discovery => INFO
|
||||
* - decisioning => WARN
|
||||
* - missing_slot_*:
|
||||
* - discovery => INFO
|
||||
* - decisioning => WARN
|
||||
* - weak_chain_roles:
|
||||
* - discovery => INFO
|
||||
* - decisioning => INFO
|
||||
* - All other findings: keep base severity (no change)
|
||||
*/
|
||||
export function applySeverityPolicy(
|
||||
profileName: ProfileName | undefined,
|
||||
findingCode: string,
|
||||
baseSeverity: Severity
|
||||
): Severity {
|
||||
// If no profile specified, use base severity
|
||||
if (!profileName) {
|
||||
return baseSeverity;
|
||||
}
|
||||
|
||||
// missing_link_constraints
|
||||
if (findingCode === "missing_link_constraints") {
|
||||
return profileName === "decisioning" ? "warn" : "info";
|
||||
}
|
||||
|
||||
// missing_slot_*
|
||||
if (findingCode.startsWith("missing_slot_")) {
|
||||
return profileName === "decisioning" ? "warn" : "info";
|
||||
}
|
||||
|
||||
// weak_chain_roles
|
||||
if (findingCode === "weak_chain_roles") {
|
||||
return "info"; // Always INFO for both profiles
|
||||
}
|
||||
|
||||
// All other findings: keep base severity
|
||||
return baseSeverity;
|
||||
}
|
||||
Reference in new issue
Block a user