Append a file path to the touched_paths list (deduped, capped at 200). Stop is the consumer and clears under the same lock it reads with; UPS no longer wipes. The cap is a defensive bound for sessions where Stop never fires (disabled mid-session, abort) — git diff naturally filters
(session_id, file_path)
| 55 | |
| 56 | |
| 57 | def record_touched_path(session_id, file_path): |
| 58 | """Append a file path to the touched_paths list (deduped, capped at 200). |
| 59 | |
| 60 | Stop is the consumer and clears under the same lock it reads with; UPS |
| 61 | no longer wipes. The cap is a defensive bound for sessions where Stop |
| 62 | never fires (disabled mid-session, abort) — git diff naturally filters |
| 63 | stale paths so over-retention is harmless, just wasteful. |
| 64 | """ |
| 65 | def _record(state): |
| 66 | paths = state.setdefault("touched_paths", []) |
| 67 | if file_path not in paths: |
| 68 | paths.append(file_path) |
| 69 | if len(paths) > 200: |
| 70 | del paths[:len(paths) - 200] |
| 71 | with_locked_state(session_id, _record) |
| 72 | |
| 73 | |
| 74 | def consume_stop_state(session_id): |
no test coverage detected