Repository navigation
feat(home): show the week from the time service - #155
Merged
Merged
Conversation
Home asks the time service for this week's hours over the time contract, at the same time as the peers' items and with the same 1.5 s, and answers them as the Home's week beside a new weekState, so the app can tell a failing time service from one without a week (decision 186). Hours that JSON can't encode count as a failure, so they can't cut the Home's answer short.
Bakhomious
added a commit
that referenced
this pull request
Oct 29, 2026
Since #155, home's answer says how asking the time service for the week went. When home couldn't get the week, the Home left "This week" out, as if Jira weren't set up. It now keeps the section's head and link, and the week card says "Hours unavailable" in the hours' type, muted, without the label and the bar (decision 187).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief
Goal. The Home's "This week" shows the real week. Home asks the time service for it over the time contract (
bakhyard.time.v1, #154) and answers it, with how asking went, so that the app can tell a time service that's down from one that isn't there (decision 186).Scope.
week: anAskerthat asks the peer namedtimein home'sBAKHYARD_PEERSforTimeService/GetWeek, over gRPC on h2c, with 1.5 s to answer, as each peer has for its items. It returns the week, or none when time has none, and how asking went:ok, orunavailablewhen the call fails. A failure is loggedget the weekwithpeer=time, unless the request has ended. Without atimepeer, it asks nothing.screen: aWeektype, and the Home'sweekandweekState.api:Registertakes the two asks asapi.Peers, and makes both at once.main.gowires it, with a test against a stand-in time.BAKHYARD_PEERSnames time.home-time-weeksplits in two, sotime-trackinghas fourteen steps.Out of scope.
week-unavailable. The app is unchanged: it showsweekwhen the answer has one, as it did with the demo week, and ignoresweekState.time-attention).Acceptance criteria.
timepeer that answers a week,GET /homeanswers"week":{"loggedHours":…,"targetHours":…}and"weekState":"ok".timepeer that answers no week, as without Jira, there's noweek, and"weekState":"ok".timepeer that fails, such as withUNAVAILABLEbefore its first read of the worklogs, or is down, or doesn't answer within 1.5 s, or answers hours that aren't finite, which JSON can't encode: noweek,"weekState":"unavailable", andget the weeklogged withpeer=time, unless the client has gone.timepeer, the answer has neitherweeknorweekState, and nothing is asked."loggedHours":0, a week rather than none.mise run checkpasses.QA
mutate.py, withgo test -race ./services/home/...):week.go: no timeout, a longer or a shorter one; no client check; a state without time; no log, a log after the client has gone, the call's context checked, another message, no peer in the log;okon a failure;unavailablewithout a week; theHasWeekcheck removed or inverted; either hours dropped, swapped or read twice, a target of 40; the finite check removed, joined with&&, on one value only, NaN taken as finite, one infinity only;ok, or no log, on hours that aren't finite; the first peer asked; no peer check; another peer name; Connect's protocol; HTTP/1.1;api.go: the week asked before the items, the wait before them, no wait, the week or the state left out, the request's context dropped;screen: anullweek, an emptyweekState, another member name;main.go: not wired; wired without the peers.live.py, 44 checks, all passed, run again after the review's fix): home and time built from the branch, on the loopback, with a stand-in Jira.unavailableat once, logged withpeer=timeand the refused connection.ok, no week.ok, the same week as time'sGET /time/report.{"loggedHours":0,"targetHours":40}.unavailable, logged with time's reason, "no read of the worklogs on Jira has succeeded yet".unavailableand logsdeadline_exceeded, and the items aren't held up; once the read is in,okwith the week.go build -overlay) logscanceledthere, so the check isn't vacuous.pullsinstead): neither member, nothing logged.process-compose.yaml: home's peers name time at time's address, andGET /api/homethrough the gateway answers"weekState":"ok"and no week, since Jira is off in the dev settings. A copy of the compose file without time in home's peers is caught.shots.spec.ts, 8 checks, all passed): the demo Home with"weekState":"ok"shows its week; an unavailable week leaves "This week" out, with no console problem; a week with nothing logged shows "0h / 40h".Review
One blocking finding, fixed:
{"name":"Alex", and the whole Home failed to load, where §4.11 says a failing peer never blanks the screen. Time never sends them, since it sums durations, but the contract allows any double. Home now counts such hours as a failure:unavailable, logged asget the weekwithhours that aren't finite: NaN of 40. Three test rows and ten mutants cover it; §4.11 and decision 186 say so.Non-blocking:
feedandweek, four lines, underdupl's threshold.listinghelper becamenothing, sinceunparamflagged a parameter that every caller left empty.time-attention.main.go's wiring, which the gate leaves out;main_test.gocovers the routes end to end against a stand-in time.Shots
The demo Home, with the week from the answer: "31h 30m / 40h".
Gates
mise run checkpassed locally after the fix:gen:check; govulncheck (none);-race, Go coverage 96.0% total (services/home/internal/week100%);tsc, knip,pnpm audit;SonarQube Cloud runs on demand (decision 132).
Merged under the user's standing OK (2026-10-26): merge once CI's
checkis green, and review everything at the end.