fix(dsh): reconcile orphan schedules and preserve audit evidence

This commit is contained in:
阿白叔 committed 2026-10-31 20:24:04 +08:00
1 parent 4aaebcb65a
commit 282252a5fb
16 files changed
+578 -27

No files matched your search

@@ -28,6 +28,7 @@ export function compactResult(value){
if(result.tasks)result.tasks=result.tasks.map(t=>({...t,...t.note?{note:short(t.note,300)}:{}}));
if(result.runs)result.runs=result.runs.slice(0,5).map(run);
if(result.schedules)result.schedules=result.schedules.slice(0,10).map(schedule);
if(result.schedule_audit)result.schedule_audit=fields(result.schedule_audit,['status','live_events','archived_events','retained_limit']);
if(result.schedule_events)result.schedule_events=result.schedule_events.slice(0,10).map(row=>({
...fields(row,['sequence','schedule_id','at_utc','event','run_id']),
payload:{...fields(row.payload,['automatic','authority','status']),
@@ -47,7 +48,7 @@ export function modelSnapshot(value){
result.operations=compactResult({busy:ops.busy===true,live_run:ops.live_run,last_execution:ops.last_execution,
runs:ops.runs||[],schedules:ops.schedules||[],experiences:ops.experiences||[],tickets:ops.tickets||[],health:ops.health,
decision_audit:ops.decision_audit,decisions:ops.decisions||[],
section_errors:ops.section_errors||[],schedule_events:ops.schedule_events||[]});
section_errors:ops.section_errors||[],schedule_events:ops.schedule_events||[],schedule_audit:ops.schedule_audit});
if(value.automation?.incident_id)result.automation=fields(value.automation,['incident_id','task_id','issue_code','status','attempts','verification']);
if(value.lifecycle?.status)result.lifecycle=fields(value.lifecycle,['request_id','status','task_ids','run_id']);
return result;