Skip to content

Watering can grace period (#7) - #17

Merged
rwrife merged 1 commit into
mainfrom
issue-7-watering-can-grace
Jul 6, 2026
Merged

rwrife merged 1 commit into
mainfrom
issue-7-watering-can-grace

Conversation

@rwrife

@rwrife rwrife commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Closes #7

Adds commit-sprout water — a deliberate escape hatch that buys the plant a grace day for a weekend / PTO — without letting it fake a streak.

Acceptance criteria

  • commit-sprout water records a grace day in state (persisted as auditable watered_dates in state.json)
  • Grace days are limited/rate-limited: one per calendar day (idempotent), capped at 2 in effect at once, and pruned by any fresh commit so they can't be banked across commits into a permanent green streak
  • Status output shows remaining grace and the projected next-wilt date
  • Watering is reflected in the health calc only — it shifts the thirsty/wilting thresholds, and never touches the growth stage or the streak number

What changed

  • internal/plant: State gains GraceDays; healthFor rewinds the effective dry spell by (clamped) grace; grace is surfaced on PlantState and clamped to [0, MaxGraceDays=2]. Stage/streak are untouched.
  • internal/store: persists watered_dates (sorted, de-duped, bounded); EffectiveGrace scopes grace to the current gap (waterings must post-date the last commit and not be in the future); Water enforces per-day idempotency + the cap; FromPlant prunes waterings on/before a fresh commit.
  • cmd/water.go: new subcommand with clear applied / already-watered / at-cap messaging; honors --no-save.
  • cmd/status.go: adds grace: and wilts: lines, grace-aware.
  • README: documents the watering can and the new status lines.

Example

$ commit-sprout status        # 2 days idle
health:  thirsty — 2 days until it wilts
wilts:   2026-07-07
$ commit-sprout water
💧 Watered. The plant can coast one more day.
$ commit-sprout status
grace:   1 day (watered)
health:  healthy — commit today to stay ahead of thirst
wilts:   2026-07-08

Tests

New unit coverage for threshold shifting, clamping, streak-independence, per-day idempotency, cap-refusal, commit-prune, normalize (sort/dedupe/drop-garbage), and save/load round-trip. gofmt/go vet/go build/go test ./... all clean. Also verified end-to-end against a throwaway repo.

- New `commit-sprout water` subcommand records a grace day for a deliberate
  gap (weekend / PTO), buying one extra idle day before thirsty/wilting.
- Grace is anti-gaming by design: one per calendar day (idempotent), capped
  at 2 in effect at once, pruned by any fresh commit, and it only shifts the
  health thresholds -- never the growth stage or streak count.
- plant.Compute now folds an effective grace count into healthFor and surfaces
  it on PlantState; store persists auditable `watered_dates` (sorted, deduped,
  bounded) and scopes grace to the current dry spell via EffectiveGrace/Water.
- status shows remaining grace and the projected wilt date.
- README documents the watering can; unit tests cover thresholds, clamping,
  streak-independence, idempotency, cap-refusal, commit-prune, and persistence.
@rwrife rwrife mentioned this pull request Jul 5, 2026
4 tasks
@rwrife
rwrife merged commit 0e47375 into main Jul 6, 2026
1 check passed
@rwrife
rwrife deleted the issue-7-watering-can-grace branch July 6, 2026 09:02
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.

[feature] Watering can grace period

1 participant