fix: address PR #24 review findings (#26, #27, #29, #30) #33

Manually merged
heiko merged 5 commits from fix/pr24-findings into master 2026-05-16 00:23:33 +02:00
Owner

Addresses the four open findings raised during review of PR #24.

Changes

  • #30 5abb5f3 — Gate IDLE per-UID logging behind --verbose. Without --verbose, the IDLE path now matches startup/initial: only matched messages are logged. doc/admin.md updated.
  • #27 9217811 — Restore matched= key on debug:scan log lines. The logArgs helper renamed the key to tagged=; the debug line now prepends matched= for backward compat while also emitting tagged=.
  • #26 2224dd4 — Replace brittle source-string regression tests with behavioral tests. The idle test runs a real runMailbox goroutine against imapmemserver, triggers an IDLE wakeup by appending a message, and asserts scan=idle in the log.
  • #29 1581aee — Type ProcessOptions.Source as ScanSource with ScanInitial/ScanStartup/ScanIdle constants. Wire values unchanged; callers get compile-time safety.

Test plan

  • go test ./... passes
  • go test -race ./... passes
  • Without --verbose: IDLE wakeup only logs matched messages
  • With --verbose: IDLE wakeup logs every processed UID with scan=idle
  • debug:scan log lines contain matched=<bool>
Addresses the four open findings raised during review of PR #24. ## Changes - **#30** `5abb5f3` — Gate IDLE per-UID logging behind `--verbose`. Without `--verbose`, the IDLE path now matches startup/initial: only matched messages are logged. `doc/admin.md` updated. - **#27** `9217811` — Restore `matched=` key on `debug:scan` log lines. The `logArgs` helper renamed the key to `tagged=`; the debug line now prepends `matched=` for backward compat while also emitting `tagged=`. - **#26** `2224dd4` — Replace brittle source-string regression tests with behavioral tests. The idle test runs a real `runMailbox` goroutine against `imapmemserver`, triggers an IDLE wakeup by appending a message, and asserts `scan=idle` in the log. - **#29** `1581aee` — Type `ProcessOptions.Source` as `ScanSource` with `ScanInitial`/`ScanStartup`/`ScanIdle` constants. Wire values unchanged; callers get compile-time safety. ## Test plan - [ ] `go test ./...` passes - [ ] `go test -race ./...` passes - [ ] Without `--verbose`: IDLE wakeup only logs matched messages - [ ] With `--verbose`: IDLE wakeup logs every processed UID with `scan=idle` - [ ] `debug:scan` log lines contain `matched=<bool>`
deb: use apt.schlittermann.de
Some checks failed
mod-nag (Push) / mod-nag (push) Failing after 6s
381930b51e
Without --verbose, the IDLE path now matches the startup/initial
convention: only matched messages are logged. With --verbose, every
processed UID is reported as before.

Also documents the scan=idle log volume behaviour in doc/admin.md.

ius:ai:claude-sonnet-4-6
ius:ai:claude-sonnet-4-6
Replace TestRegressionIdleWakeupReportsEveryProcessedUID and
TestRegressionInitialScanReportsInitialSource, which asserted on Go
source-text fragments, with runtime behavioral tests: the idle test
drives runMailbox against an imapmemserver and appends a message via a
second connection to trigger the IDLE wakeup branch, asserting scan=idle
appears in captured log output; the initial-scan test calls
scanner.ScanAll with Verbose:true against a fake client and asserts
scan=initial is emitted. Keep TestRegressionRunMailboxUsesMailboxScopedLogger
as-is.

ius:ai:claude-sonnet-4-6
refactor: type ProcessOptions.Source as ScanSource (closes #29)
Some checks failed
mod-nag (Push) / mod-nag (push) Failing after 6s
1581aeefda
Introduce ScanSource string type with constants ScanInitial, ScanStartup,
and ScanIdle, replacing the untyped string field in ProcessOptions. The
wire-format values ("initial", "startup", "idle") are unchanged; internal
helpers (logArgs, reportProcessed, reportIssue) and ActivityEvent.Source
remain string and convert at the boundary with string(opts.Source).
Update all call sites in main.go, scanner.go, and reporter_test.go.

ius:ai:claude-sonnet-4-6
simplify: clean up test helpers and ScanSource boundary
Some checks failed
mod-nag (Push) / mod-nag (push) Failing after 6s
f7aacf13d5
- Use safeBuffer (from heartbeat_test.go) instead of duplicate syncBuffer
- Replace t.Cleanup for runMailbox goroutine teardown instead of 3×cancel/drain
- Remove narration comments; keep only non-obvious WHY comments
- logArgs/reportProcessed/reportIssue now accept ScanSource directly,
  removing the src-local and inline string() conversions in ProcessUIDWithOptions

ius:ai:claude-sonnet-4-6
heiko force-pushed fix/pr24-findings from f7aacf13d5
Some checks failed
mod-nag (Push) / mod-nag (push) Failing after 6s
to a9a740e766
All checks were successful
mod-nag (Push) / mod-nag (push) Successful in 6s
2026-05-16 00:23:31 +02:00
Compare
heiko manually merged commit bf6d300f43 into master 2026-05-16 00:23:33 +02:00
heiko deleted branch fix/pr24-findings 2026-05-16 00:23:43 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
IUS/xr-invoiced!33
No description provided.