From ffe363f06df4054e709d48405e8f11cb910736ad Mon Sep 17 00:00:00 2001 From: grobomo <105956248+grobomo@users.noreply.github.com> Date: Tue, 31 Mar 2026 17:17:19 -0500 Subject: [PATCH] T037: Update docs with logrotate module, test counts, and task status (#35) - CLAUDE.md: add logrotate.py, health.py, quotes.py to architecture - README.md: add logrotate to architecture, config table, test list - TODO.md: mark T033-T036 complete Co-authored-by: grobomo --- CLAUDE.md | 3 +++ README.md | 6 +++++- TODO.md | 35 ++++++++--------------------------- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index ba4611a..7cb96ac 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,6 +12,9 @@ core/ classifier.py Semantic message classifier (REPLY/RELAY/IGNORE) cache.py Rolling message cache with archiving ratelimit.py Per-adapter sliding window rate limiter + logrotate.py Size-based log rotation (stdlib only) + health.py Health file writer for liveness probes + quotes.py Quote chain resolution for threaded conversations adapters/ base.py Abstract adapter interface signal_adapter.py Signal via signal-cli REST API diff --git a/README.md b/README.md index 0e3867a..1febfae 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ core/ health.py Health writer, metrics, cost estimation quotes.py Teams quote chain resolution ratelimit.py Per-adapter sliding window rate limiter + logrotate.py Size-based log rotation (5MB default) adapters/ base.py Abstract adapter interface (poll/send) signal_adapter.py Signal via signal-cli REST API @@ -72,6 +73,8 @@ All settings via environment variables. See [`config/coconut.env.example`](confi | `COCONUT_WEBHOOK_SECRET` | (none) | HMAC-SHA256 shared secret | | `COCONUT_RATE_LIMIT_MAX` | 10 | Max replies per window per adapter | | `COCONUT_RATE_LIMIT_WINDOW` | 60 | Rate limit window in seconds | +| `COCONUT_LOG_MAX_BYTES` | 5242880 | Log rotation size threshold (5MB) | +| `COCONUT_LOG_BACKUPS` | 3 | Number of rotated log backups | ## Health Check @@ -95,8 +98,9 @@ python coconut.py --health bash scripts/test/test-coconut.sh # Core E2E (7 tests) bash scripts/test/test-multi-adapter.sh # Multi-adapter (6 tests) bash scripts/test/test-hardening.sh # Retry, metrics, health (8 tests) -bash scripts/test/test-webhook.sh # Webhook adapter (7 tests) +bash scripts/test/test-webhook.sh # Webhook adapter (8 tests) bash scripts/test/test-ratelimit.sh # Rate limiter (8 tests) +bash scripts/test/test-logrotate.sh # Log rotation (5 tests) bash scripts/test/test-docker.sh # Dockerfile validation ``` diff --git a/TODO.md b/TODO.md index 81cca1e..528420d 100644 --- a/TODO.md +++ b/TODO.md @@ -51,33 +51,14 @@ Extracted and modularized from: - [x] T031: GitHub Actions CI — test workflow + secret scan fix - [x] T032: Fix secret scan false positive in README -## Session Handoff (2026-03-31 21:30 UTC) +- [x] T033: Log rotation — size-based rotation for coconut.log (stdlib only) +- [x] T034: Conversation memory — already works via cache.json persistence (no code needed) +- [x] T035: CLI interactive mode — msvcrt.kbhit() on Windows, threaded pipe reader +- [x] T036: Fix multi-adapter test hang — CLI poll blocks on pipe stdin in test harness +- [ ] T037: Update docs — CLAUDE.md, README, TODO with new modules and test counts -### Done this session (30 of 32 tasks complete) -- T025-T029: Webhook adapter + per-adapter rate limiter (spec 007) - - Webhook: HTTP server, HMAC-SHA256 auth, callback URLs, health endpoint, 64KB body limit - - Rate limiter: sliding window per adapter, configurable window/max via env vars - - Integrated into main loop with rate limit stats in health.json -- T030: Hardened webhook (body size limit, graceful adapter shutdown on SIGTERM) -- T031-T032: GitHub Actions CI (test runner + secret scan), both green -- 10 PRs merged (#20-#29), all squash-merged to main -- 38 tests passing across 6 test suites, CI green on GitHub -- Cleaned up 20+ stale remote branches - -### CI Status -- `.github/workflows/test.yml` — runs all 6 test suites on push/PR to main (passing) -- `.github/workflows/secret-scan.yml` — scans for API keys, cloud creds, hardcoded IPs, PII (passing) - -### Blockers (unchanged) -- **T011**: Needs user Signal phone number + EP group ID to register -- **T012**: CCC fleet dispatcher hardcoded to altarr/boothapp — needs reconfiguration - -### Next priorities (by impact) -1. **T011 unblock**: Get a Signal phone number (Google Voice, Twilio, or spare SIM) to test real conversation flow end-to-end -2. **T012 unblock**: Modify CCC fleet dispatcher repo whitelist to include grobomo/coconut, then deploy -3. **Teams adapter live test**: Connect to hackathon chat and verify message flow -4. **Conversation memory**: Persistent context across restarts (beyond rolling cache) — would let coconut recall previous conversations -5. **Discord adapter**: Similar pattern to webhook, uses Discord bot API — expands platform reach -6. **Log rotation**: coconut.log grows unbounded — add size-based rotation +## Blocked (external deps) +- [ ] T011: Live Signal test — needs user phone number + EP group ID +- [ ] T012: CCC fleet deploy — needs dispatcher repo whitelist update ## Status: In Progress