Skip to content

Tell time in the status text by the minute the status is as of - #87

Merged
joeychilson merged 3 commits into
mainfrom
status-text-one-clock
Oct 19, 2026
Merged

joeychilson merged 3 commits into
mainfrom
status-text-one-clock

Conversation

@joeychilson

Copy link
Copy Markdown
Owner

The status is as of a minute: status::status rounds now down to it, keeps it as Status.at, and works out every moment and its horizon from it. status::text says times from status.at, but verdict, fit, line, limit_text and stale were given the caller's unrounded crate::now(), so one answer could count from two clocks. Late in a minute, check_limits said a limit reset "in 1h 59m" in its verdict and "in 2h" in the account's line under it, and statusline said "out in 59m" while status said "13:00 (in 1h)". short, behind statusline, also worked out "soon" itself (at - now < 3 * HOUR), though each Moment holds the horizon that Moment::of worked out.

Every caller of these functions now passes status.at but explain_usage (below): check_limits in src/mcp.rs, and status --hours, usage --limit, doctor and statusline in src/main.rs. check_limits and statusline no longer keep a now of their own. short takes the Moment and counts down when its horizon is Soon, which, given status.at, is the test it made before, now made in one place. doctor's stale shows nothing different, since it only takes the day from the time, but it's given status.at like the rest.

The new test an_answer_tells_time_by_the_minute_its_status_is_as_of in tests/cli.rs runs check_limits and statusline --account claude 40 seconds into the minute. On origin/main the verdict and the line under it disagree:

thread 'an_answer_tells_time_by_the_minute_its_status_is_as_of' (1349031) panicked at tests/cli.rs:461:5:
assertion `left == right` failed: Claude Max (me@example.com): about 40m of work left (20m–1h 10m) before 5 hours runs out; it resets 14:00 (in 1h 59m).

Claude Max (me@example.com) · via Claude Code · yours · in use
  5 hours: 25% left, resets 14:00 (in 2h). At this pace it runs out 13:00 (in 1h), as soon as 12:30. About 40m of work left (20m–1h 10m), at 40.9% an hour of work.
  Weekly: 56% left, resets Mon 00:00 (in 3d 12h). Lasts, with about 12% left at the reset (0–25%). About 19h of work left (8h 30m–47h), at 3% an hour of work.
  left: 1
 right: 2

With only check_limits fixed, the status line fails on its own:

thread 'an_answer_tells_time_by_the_minute_its_status_is_as_of' (1349799) panicked at tests/cli.rs:466:5:
assertion `left == right` failed
  left: "Claude Max · 5h 25%, out in 59m · weekly 56%"
 right: "Claude Max · 5h 25%, out in 1h · weekly 56%"

With the fix it passes. No snapshot changed: the tests' clock is on the minute.

Left as they were, each on one clock of its own, the unrounded time: explain_usage, and guard's message. explain_usage counts its usage window (the limit's window, the last 7 days, or a since such as 24h) and its first line, "since 10:00 (2h ago)", from that time. Given status.at for its limit line alone, as the first commit did, that one answer would count from two clocks, and a 5-hour window's "since 10:00 (2h 1m ago)" and "resets 15:00 (in 3h)" would add up to 5h 1m. Moving all of it to status.at would change the usage window and leave out responses from the current minute, so it isn't in this PR.

Ran cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings, cargo test --locked, TZ=America/Chicago cargo test --locked and RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --locked, all passing, on this branch and on it merged with cli-yours-any-agent and status-named-hidden-account. Didn't run the Swift tests, shellcheck, actionlint or cargo deny, since nothing they cover changed.

verdict, fit, line, limit_text and stale were given the caller's unrounded now while text used status.at, so one answer could count from two clocks. Every caller now passes status.at, and short uses each moment's stored horizon instead of working out soon itself.
Its first line counts its usage window from its unrounded now, so giving only its limit line status.at would make that one answer count from two clocks.
# Conflicts:
#	CHANGELOG.md
@joeychilson
joeychilson merged commit 352164e into main Oct 19, 2026
3 checks passed
@joeychilson
joeychilson deleted the status-text-one-clock branch October 19, 2026 22:11
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