Repository navigation
fix(usage): keep Block Usage's at-limit state on the stack's usage-percent subclass - #145
Closed
eric-engberg wants to merge 2 commits into
Closed
eric-engberg wants to merge 2 commits into
eric-engberg wants to merge 2 commits into
Conversation
…Timer At the 5-hour limit, the block's percent says nothing new: it's 100% until the reset, and the countdown is what matters. Block Usage gets an "at-limit" hide state, the mirror of Block Reset Timer's "under-limit": with both on, the reset countdown takes the percent's place once the block is used up. Both states read one shared check, isAtSessionLimit, which reads the percent the way Block Reset Timer's under-limit state does: the usage API's raw percent when prefetch accepted one, so 99.7% shown as "100%" isn't the limit yet and a lagging payload doesn't decide, and otherwise the payload's own percent, never an API percent prefetch rejected as stale. The two widgets therefore always swap in the same render, never both or neither. The prefetch asks the usage API for the block's percent for either state, through the same cache, so a line with both makes one request.
Fork-only, for `next`: on the stack, #11 makes Block Usage a UsagePercentWidget('session') subclass, while #89 adds its at-limit hide state to the widget class main has. Block Usage here stays the subclass and adds the state and its render check, reading isAtSessionLimit from the render context as #89 does. Whichever of #89 and #11 goes upstream second carries this shape on its branch.
|
Owner
Author
|
Folded into #11: with #89 upstream as sirmalloc#747 and main merged up the stack, #11 carries this branch's shape of Block Usage's at-limit state on the shared UsagePercentWidget subclass. |
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.



Builds on #40 (the stack top,
feat/model-family-colors) and merges #89 (feat/block-usage-hide-at-limit). Fork-only: it makes the two work together innext, like #52 does for #14 and #49.What
Block Usage keeps the
UsagePercentWidget('session')subclass shape #11 gives it on the stack, and gains #89'sat-limithide state and render check.Why
#89 adds the state to the Block Usage class
mainhas, which implementsWidgetdirectly. On the stack, #11 replaced that class with a subclass ofUsagePercentWidget, so merging the two conflicts across the whole file.nextused to resolve it in its own merge of #89, but git now leaves the file's type imports outside the conflict, wherenext's recorded resolution can't keep them, and the import-order lint fails. Resolving it on a branch keepsnext's rebuild automatic.How
SessionUsage.ts: the subclass addsSESSION_AT_LIMIT_HIDEABLE_STATEtogetHideableStates()and hides inrender()whenisAtSessionLimit(context)says the block is at 100%, as feat(usage): Block Usage can hide at 100%, swapping with Block Reset Timer #89 does.next-branches.txtlists this branch in place of feat(usage): Block Usage can hide at 100%, swapping with Block Reset Timer #89, since it contains feat(usage): Block Usage can hide at 100%, swapping with Block Reset Timer #89.Nothing visible changes beyond #89 itself, so no demo.
Testing
bun test: 3688 pass, 0 fail.bun run lint: clean.