Skip to content

refactor: centralize day budget computation and fix status idle trimming#7

Merged
Flyrell merged 1 commit intomainfrom
refactor/centralize-day-budget
Mar 14, 2026
Merged

refactor: centralize day budget computation and fix status idle trimming#7
Flyrell merged 1 commit intomainfrom
refactor/centralize-day-budget

Conversation

@Flyrell
Copy link
Owner

@Flyrell Flyrell commented Mar 14, 2026

Summary

  • Bug fix: status command computed today's logged time without passing activity entries to BuildReport, so idle gaps from precise mode were never trimmed — showing inflated numbers compared to report
  • Refactoring: Extracted ComputeDayBudget() and ComputeManualLogBudget() into internal/timetrack/budget.go to centralize all day-level time computation
  • Refactoring: Extracted LoadProjectEntries() into internal/cli/entries.go to load all 5 entry types in a single call, reducing boilerplate in status and report

New files

  • internal/timetrack/budget.go + budget_test.go
  • internal/cli/entries.go + entries_test.go

Modified files

  • internal/cli/status.go — uses LoadProjectEntries + ComputeDayBudget with activity entries
  • internal/cli/log.gocheckBudgetWarning uses ComputeManualLogBudget; getDayScheduleWindows returns []DaySchedule
  • internal/cli/report.goloadReportInputs uses LoadProjectEntries

Test plan

  • task test passes (all existing + new tests)
  • task lint passes
  • Verify hourgit status shows correct logged time with precise mode enabled (idle gaps trimmed)
  • Verify hourgit report numbers match hourgit status for the same day
  • Verify hourgit log budget warnings still fire correctly

🤖 Generated with Claude Code

The status command computed "today's logged time" via BuildReport without
passing activity entries, so idle gaps from precise mode were never
trimmed — causing inflated numbers compared to the report command.

Extract ComputeDayBudget() and ComputeManualLogBudget() into
internal/timetrack/budget.go, and LoadProjectEntries() into
internal/cli/entries.go. Rewire status, log, and report commands to use
these shared functions, ensuring consistent time attribution everywhere.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Flyrell Flyrell merged commit 85593b9 into main Mar 14, 2026
2 checks passed
@Flyrell Flyrell deleted the refactor/centralize-day-budget branch March 15, 2026 21:39
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