(state)
| 87 | now = _time.time() |
| 88 | |
| 89 | def _snap(state): |
| 90 | fire_ts = state.get("stop_hook_fire_count_ts", 0) |
| 91 | expired = (now - fire_ts) > STOP_LOOP_STATE_TTL_SEC |
| 92 | findings_ts = state.get("previous_findings_ts", fire_ts) |
| 93 | findings_expired = (now - findings_ts) > PREVIOUS_FINDINGS_TTL_SEC |
| 94 | snap = { |
| 95 | "touched_paths": list(state.get("touched_paths", [])), |
| 96 | "baseline_sha": state.get("baseline_sha"), |
| 97 | "head_at_capture": state.get("head_at_capture"), |
| 98 | "untracked_at_baseline": ( |
| 99 | dict(state["untracked_at_baseline"]) |
| 100 | if isinstance(state.get("untracked_at_baseline"), dict) else {} |
| 101 | ), |
| 102 | "fire_count": 0 if expired else state.get("stop_hook_fire_count", 0), |
| 103 | "fire_count_expired": expired and state.get("stop_hook_fire_count", 0) > 0, |
| 104 | "previous_findings": [] if findings_expired else list(state.get("previous_findings", [])), |
| 105 | } |
| 106 | state["touched_paths"] = [] |
| 107 | return snap |
| 108 | |
| 109 | return with_locked_state(session_id, _snap) or { |
| 110 | "touched_paths": [], "baseline_sha": None, "head_at_capture": None, |
nothing calls this directly
no outgoing calls
no test coverage detected