Repository navigation
Tell time in the status text by the minute the status is as of - #87
Merged
Merged
Conversation
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
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.
The status is as of a minute:
status::statusroundsnowdown to it, keeps it asStatus.at, and works out every moment and its horizon from it.status::textsays times fromstatus.at, butverdict,fit,line,limit_textandstalewere given the caller's unroundedcrate::now(), so one answer could count from two clocks. Late in a minute,check_limitssaid a limit reset "in 1h 59m" in its verdict and "in 2h" in the account's line under it, andstatuslinesaid "out in 59m" whilestatussaid "13:00 (in 1h)".short, behindstatusline, also worked out "soon" itself (at - now < 3 * HOUR), though eachMomentholds thehorizonthatMoment::ofworked out.Every caller of these functions now passes
status.atbutexplain_usage(below):check_limitsin src/mcp.rs, andstatus --hours,usage --limit,doctorandstatuslinein src/main.rs.check_limitsandstatuslineno longer keep anowof their own.shorttakes theMomentand counts down when its horizon isSoon, which, givenstatus.at, is the test it made before, now made in one place.doctor'sstaleshows nothing different, since it only takes the day from the time, but it's givenstatus.atlike the rest.The new test
an_answer_tells_time_by_the_minute_its_status_is_as_ofin tests/cli.rs runscheck_limitsandstatusline --account claude40 seconds into the minute. On origin/main the verdict and the line under it disagree:With only
check_limitsfixed, the status line fails on its own: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, andguard's message.explain_usagecounts its usage window (the limit's window, the last 7 days, or asincesuch as24h) and its first line, "since 10:00 (2h ago)", from that time. Givenstatus.atfor 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 tostatus.atwould 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 --lockedandRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --locked, all passing, on this branch and on it merged withcli-yours-any-agentandstatus-named-hidden-account. Didn't run the Swift tests, shellcheck, actionlint or cargo deny, since nothing they cover changed.