Skip to content

fix: post-release review polish - #11

Merged
Swingcloud merged 1 commit into
mainfrom
fix/review-polish
Apr 16, 2026
Merged

fix: post-release review polish#11
Swingcloud merged 1 commit into
mainfrom
fix/review-polish

Conversation

@Swingcloud

Copy link
Copy Markdown
Owner

Summary

Five issues caught in a fresh full-codebase review after v0.1.0 shipped. No behavior changes for the normal path; all fixes target edge cases and UX.

Fixes

  • Test flake around midnight (tests/test_cli.py): test_stats_with_data and test_stats_reads_timestamp_key wrote event timestamps up to 50 min in the past. When the test ran near local midnight, the earliest events landed on "yesterday" and got filtered out of the "today" stats bucket. Tightened windows to a few seconds.
  • Clock-skew bypass in grace period (skills/tomato/bin/tomato-hook.sh): the grace arithmetic assumed NOW >= GRACE_*_AT. A backward clock jump made NOW - GRACE_LAST_CALL_AT negative, which evaluated as "within grace window" and bypassed rest indefinitely. Added [ NOW -ge X ] guards so skew falls through to block.
  • uninstall.sh preserves history by default (uninstall.sh): previously rm -rf ~/.tomato/ silently deleted focus history, checkpoints, and config on every run. Now preserved; pass --purge to delete.
  • Config validation (skills/tomato/bin/tomato-cli.py): load_config() silently accepted invalid values (negative ints, wrong types, bools). Now warns and falls back to the default per-key.
  • Soften README perf claim (README.md): dropped the specific ~8ms / ~35ms numbers; we don't have a benchmark in CI to back them up yet.

Tests

  • New: TestConfigValidation::test_invalid_config_falls_back_to_defaults
  • Updated: two stats tests that straddled midnight
  • Full: 22 pytest + 30 bats all green locally

Test plan

  • CI passes on Ubuntu + macOS
  • ./uninstall.sh (without --purge) keeps ~/.tomato/ intact
  • ./uninstall.sh --purge deletes ~/.tomato/
  • Bad ~/.tomato/config.json emits a warning and uses defaults

🤖 Generated with Claude Code

Five issues caught in a fresh codebase review:

- test_stats_with_data and test_stats_reads_timestamp_key were writing
  event timestamps up to 50 minutes in the past, which could straddle
  local midnight and drop events from the "today" bucket. Tightened the
  windows to a few seconds.
- Hook grace-period arithmetic assumed NOW >= stored timestamps. A
  backward clock jump made (NOW - GRACE_LAST_CALL_AT) negative, which
  bypassed rest indefinitely. Added [ NOW -ge X ] guards so skew falls
  through to block instead.
- uninstall.sh was silently rm -rf'ing ~/.tomato (focus history and
  checkpoints) on every run. Now preserved by default; --purge deletes.
- load_config() silently accepted invalid user values (negative ints,
  wrong types, bools). Now warns and falls back to the default.
- README no longer claims specific millisecond numbers for the hook
  fast path without a benchmark to back them up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Swingcloud
Swingcloud merged commit ee6c20a into main Apr 16, 2026
5 checks passed
@Swingcloud
Swingcloud deleted the fix/review-polish branch April 16, 2026 16:43
@Swingcloud Swingcloud mentioned this pull request Apr 16, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant