-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or requestfeature:phase2-governancePhase 2 Governance featuresPhase 2 Governance featuresphase:P2.1Core GovernanceCore Governance
Description
Task: Implement mode-based action execution
Phase: 2.1 - Core Governance
Estimated: 1 day
File: cch_cli/src/hooks/actions.rs
Depends on: P2.1-T03
Description
Update action execution to respect rule mode (enforce/warn/audit).
Acceptance Criteria
- Update
execute_actionto check rule mode -
Enforce: Current behavior (block/inject/run) -
Warn: Never block, inject warning message instead -
Audit: Skip action, log only - Create warning context injection for warn mode
- Add integration tests for each mode
Mode Behavior Matrix
| Mode | Blocks? | Injects? | Logs? |
|---|---|---|---|
| enforce | Yes | Yes | Yes |
| warn | No | Warning only | Yes |
| audit | No | No | Yes |
Code Reference
fn execute_action(rule: &Rule, action: &Action, event: &Event) -> ActionResult {
let mode = rule.mode.unwrap_or_default();
match mode {
PolicyMode::Enforce => execute_action_impl(action, event),
PolicyMode::Warn => {
if action.is_block() {
ActionResult::Warning(format!("Rule '{}' would block: {}", rule.name, action.reason()))
} else {
execute_action_impl(action, event)
}
}
PolicyMode::Audit => ActionResult::Audited,
}
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeature:phase2-governancePhase 2 Governance featuresPhase 2 Governance featuresphase:P2.1Core GovernanceCore Governance