diff options
| author | Claude <noreply@anthropic.com> | 2026-10-15 22:30:36 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-10-15 22:30:36 +0000 |
| commit | ba27dfbea7ee01b2cbaf4fbfd6ed23c074b3ca88 (patch) | |
| tree | f4dc2ef8188ed691fdc968d299be198548403642 /plugins/security-guidance/hooks/diffstate.py | |
| parent | 7b5d1742310abe7d90f10aa574adfa0613226ec6 (diff) | |
| parent | 7b2259ba542c313099b1f00be8b670f7aa0c63bb (diff) | |
Merge remote-tracking branch 'origin/main' into mhegazy/sg-no-credentials-notice
# Conflicts:
# plugins/security-guidance/hooks/security_reminder_hook.py
Diffstat (limited to 'plugins/security-guidance/hooks/diffstate.py')
| -rw-r--r-- | plugins/security-guidance/hooks/diffstate.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/security-guidance/hooks/diffstate.py b/plugins/security-guidance/hooks/diffstate.py index 74870c15..7725cdd9 100644 --- a/plugins/security-guidance/hooks/diffstate.py +++ b/plugins/security-guidance/hooks/diffstate.py @@ -104,17 +104,22 @@ def consume_stop_state(session_id, clear=True): "fire_count_expired": expired and state.get("stop_hook_fire_count", 0) > 0, "previous_findings": [] if findings_expired else list(state.get("previous_findings", [])), "reviewed_diff_hash": state.get("reviewed_diff_hash"), + # State lost or overwritten since the last Stop (session_state). + "state_resets": state.get("state_resets", 0), + "state_overwrites": state.get("state_overwrites", 0), } if clear: state["touched_paths"] = [] state.pop("reviewed_diff_hash", None) + state.pop("state_resets", None) + state.pop("state_overwrites", None) return snap return with_locked_state(session_id, _snap) or { "touched_paths": [], "baseline_sha": None, "head_at_capture": None, "untracked_at_baseline": {}, "fire_count": 0, "fire_count_expired": False, "previous_findings": [], - "reviewed_diff_hash": None, + "reviewed_diff_hash": None, "state_resets": 0, "state_overwrites": 0, } @@ -199,7 +204,8 @@ def capture_git_baseline(cwd): NOTE: `git stash create` does NOT capture untracked files. UPS pairs this SHA with a `_list_untracked()` snapshot stored as `untracked_at_baseline`, and `compute_v2_review_set` subtracts that set so pre-existing untracked - files are not reviewed as Claude-authored. + files are not reviewed as Claude-authored. UPS takes no snapshot while the + Stop review, its only reader, is switched off. """ # stdout is a SHA so text=True is safe on stdout, but a non-ASCII # filename in `git stash create`'s STDERR warning (e.g. a worktree |
