summaryrefslogtreecommitdiff
path: root/plugins/security-guidance/tests/test_stop_diff_memory.py
AgeCommit message (Collapse)Author
2026-10-19security-guidance: keep added lines past the cut, hold the diff timeoutMohamed Hegazy
A reviewable file past the per-file cap now keeps as much again of its added lines, so a rewritten large file still shows what is new, and its diff ends with a line saying it was cut. The read runs on a thread so the 30 s limit holds while a process git started keeps the pipe open; a read that breaks is an error instead of a short diff. SG_MAX_FILE_DIFF_BYTES of zero or less means the default. The parser and the reader share one test for which files are reviewed.
2026-10-19security-guidance: read the Stop review's git diff without holding it wholeMohamed Hegazy
The Stop review captured the whole diff of the turn before its per-file caps applied, so a turn that wrote large text files cost the hook several times their size in memory. The output is now read as it arrives: files the review drops keep only their header line, and one file's diff is cut at 4 MiB (SG_MAX_FILE_DIFF_BYTES). The git command is unchanged. Adds count-only metrics, nonzero only: diff_mb, diff_cut_files, diff_timeout.