Enriches the PLAN_CANCELLED domain event emitted by PlanLifecycleService.cancel_plan()
with additional context fields to improve audit trail quality (SEC7 Audit Logging).
Progress context fields added to event details:
- cancelled_phase: the plan phase at the moment of cancellation (e.g. 'strategize')
- cancelled_processing_state: the processing state at cancellation (e.g. 'queued')
- last_completed_step: index of the last successfully completed step (-1 if none)
- subplan_count: number of spawned subplans at cancellation time
Resource cleanup context fields added to event details:
- sandbox_refs: list of active sandbox reference IDs requiring cleanup
- changeset_id: ID of any in-progress changeset that needs cleanup
- resources_pending_cleanup: count of sandbox refs pending cleanup
Existing fields (reason, project_names) are preserved for backward compatibility.
Progress context is captured before the plan state is mutated to CANCELLED so the
event accurately reflects the state at the moment of cancellation.
BDD tests added in features/plan_cancelled_enrichment.feature covering:
- All new progress context fields present in event details
- All new resource cleanup context fields present in event details
- Cancellation reason field (explicit and default empty string)
- Accurate field values (phase, step, sandbox refs count)
- Backward compatibility of existing fields
Closes#717