Skip to content

feat(time): list the hours to log as attention items - #157

Merged
Bakhomious merged 1 commit into
mainfrom
step/time-attention
Oct 29, 2026
Merged

Bakhomious merged 1 commit into
mainfrom
step/time-attention

Conversation

@Bakhomious

Copy link
Copy Markdown
Contributor

Brief

Goal. The Home's "Needs you today" tells me to log my hours. The time service answers the attention contract (decision 158) with an item for each weekday of the time report with nothing logged on Jira, today's included, so a missing day and today's hours show among the things that need me, and the Home marks a missing day late. Home already asks time for its items and the app already links them to the Time page, so neither changes.

Scope.

  • report: each day says, unseen in the JSON, whether it's a weekday with nothing logged, today included (Unlogged); a missing day is such a day before today, as before.
  • A new package, services/time/internal/attention, with the lister of the items, beside week.
  • main.go: time serves the attention contract on the same server as the time contract.
  • Unit tests, a test of the service's routes, and the tests' gRPC client shared by the week's and the items' tests.
  • Docs: plan §0, §4.5, §4.11, §8.2 and decision 188.

Out of scope.

  • Any change to home or the web: home asks every peer for its items (decision 167), its peers include time (codedogapp/homelab#42, process-compose.yaml), and the app links a time item to /time.
  • A partly logged day: it has no item, as it isn't missing (decision 181).
  • Holidays and days off, which show as missing until a setting lists them (§0's ideas).
  • Logging hours from the Home: worklog-add and fill-day bring the writing, on the Time page.

Acceptance criteria.

  1. With Jira set up, once a read of the worklogs has succeeded, ListItems lists an item for each weekday of the report with nothing logged, today's included, in the report's order, the earliest first:
    • ID: the day's date, such as 2026-10-29, which home makes time/2026-10-29;
    • title: "Log today's hours" for the report's last day, else "Log Monday's hours", with the day's weekday;
    • detail: "Nothing logged yet" for today, else "Nothing logged";
    • source: Jira;
    • due: 17:00 on that day in the service's zone, so today's item turns late at 17:00 and a missing day's is late.
  2. A day with any time logged, and Saturdays and Sundays, have no item.
  3. Without Jira, ListItems lists nothing.
  4. Until a read succeeds, ListItems fails with UNAVAILABLE, "no read of the worklogs on Jira has succeeded yet", as GetWeek does; after a read that fails, it lists the items of the latest read to succeed.
  5. A call waits for the first read, and returns its context's error if the context ends first.
  6. GET /time/report answers as before.
  7. Live: a home that names time as a peer lists time's items in "Needs you", with their due times, the missing days late.
  8. mise run check passes.

QA

  • Mutations: 46 of 48 caught. The two survivors are expected: the poller in UTC, in jira.go and in routes. The tests run in the process's zone, CI's is UTC, and the stand-in Jira logs away from midnight, so a report made in UTC matches one made in the local zone there. The worklogs package's own tests pin that the poller follows the zone it's given, and routes names the zone once. §0 has the idea that routes could take the zone.
  • QA added a test: TestTimeReadsTheWorklogsOnceForItsReportWeekAndItems, with countedJira. The report, the week and the items come from one poller, so one read of Jira serves all three. It catches a lister with a poller of its own, and a report with one.
  • Live (AC7): 49 of 49 checks pass. The home and time binaries run on loopback, with a stand-in Jira that holds worklogs on chosen days. ListItems is called with buf curl over gRPC on h2c and over the Connect protocol, and home's GET /home is read with time as its only peer.
    • Without Jira: no items, and time is ok.
    • Nothing logged: 5 items, from Friday 23 to Thursday 29 October, with no weekend among them. Each has the ID time/<date>, its title and detail, and Jira as its source. Each is due at 17:00 local, across the clock change on 25 October: 15:00Z on the Friday, 16:00Z after. At 18:33 every item is late, today's included.
    • Today and 3 days back logged: items for the other weekdays only.
    • Every day logged: no items.
    • Jira refusing from the start: unavailable, with the reason. Home marks time unavailable and logs list the items peer=time.
    • A slow first read: the call waits for it. With a 1 s deadline, the call ends deadline_exceeded.
    • TZ=America/Los_Angeles: Los Angeles's days, due at 17:00 there. At 10:33 there, today's item isn't late, and the missing days are.
    • A build that polls every 3 s: the items are kept through a failed read, then there's one item fewer, today's, once today is logged.
    • GET /time/report: unchanged, with date, loggedHours and missing, and no unlogged. Its missing days are the items before today.
    • Processes and logs: every process stops on SIGTERM with exit 0, and the logs stay empty while everything works.
    • Vacuity: two mutant builds of time fail the same script. With the items due at 16:00, 10 checks fail; with the attention handler left out, 18 fail.
  • Shots: the Home with time's items as home answers them. Time runs in the tests' zone (Tokyo) at the tests' time, Wednesday 09:41, with Thursday and Monday logged, beside a PR item. The rows' text, order and link are checked. The name and data are made up.
  • Gates: mise run check is green.
    • Go: lint 0 issues; vuln 0; tests pass; coverage 96.1% in total, 100% for attention.
    • Web: typecheck 0 errors and 0 warnings; unit 1108; E2E 339 passed and 7 skipped.
    • Also fmt, gen, actions, compose, audit, unused and build.

Review

No blocking findings. Non-blocking:

  1. The check that the items are unavailable until a read succeeds, six lines and a message, is in both week and attention. It's under dupl's 100 tokens. Sharing it would bring a connect error into worklogs, or need a package of its own.
  2. The root test's 17:00 check bites only outside UTC: on the Mac, not in CI. The two poller-zone mutants survive everywhere (§0 idea).
  3. item fails only on a report date that isn't a date, which report.New never makes. The error is handled, and a test covers it with a stand-in report.
  4. Size: about 100 hand-written lines of production code, and about 400 of tests.

Screenshots

The Home's "Needs you" with time's items. Home and the web are unchanged; these rows are new because time now lists them.

The Home on a desktop, light
The Home on a desktop, dark
The Home on a phone, light
The Home on a phone, dark

Merged under the user's standing OK (2026-10-26): merge once CI's check is green, and review everything at the end.

The time service now answers the attention contract, so the Home's
"Needs you" lists each weekday of the last 7 days with nothing logged
on Jira, today's included until anything is logged, due at 17:00 on
its day in the service's zone (decision 188).

The items come from the same poller as the time report and the week,
so the three agree, and one read of Jira serves them all.
@Bakhomious
Bakhomious merged commit 8da7ba5 into main Oct 29, 2026
2 checks passed
@Bakhomious
Bakhomious deleted the step/time-attention branch October 29, 2026 17:46
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