Repository navigation
fix(phone): match the Mac's provider tab rule, formatter rounding and Kimi metadata - #81
Merged
Merged
Conversation
… Kimi metadata The upstream sync (#80) merged three Mac-side changes whose phone copies were left behind: - Provider tabs (upstream chattymin#377, chattymin#402): the Mac now keeps a provider's tab while it has usage this week or month, a live block, or any use within the 7-day quota window. The phone overlay still required usage today or a live block, so a provider used last Friday vanished from the phone on Monday while the Mac still showed it and its limits. The rule now lives once, in PhoneProviderSnapshot.hasDisplayableUsage(now:), and the payload carries lastUsage (optional; older Macs decode nil). - TokenFormatter (upstream chattymin#365, chattymin#418): the shared copy the iPhone and widget use now promotes units at rounding boundaries and picks precision from the rounded value ("1M" not "1000.0K", "$100" not "$100.0", "80%" not "80.0%"). - ProviderMetadata: add kimi_code so the phone's provider list knows the new Kimi Code provider before the first payload arrives. Defect log: phone copies of Mac rules drift on upstream sync; keep one rule in the shared package and grep the phone, widget and shared package for copies when syncing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NUKUCMdezMcZX7Sb2Bwu6x
6 of 10 tasks
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.
Summary
The upstream sync (#80) merged three Mac-side changes whose phone counterparts were left behind. This PR brings the shared package back in step with the Mac.
PhoneProviderSnapshot.hasDisplayableUsage(now:), and both overlay branches (recounted and Mac-kept providers) call it. The payload gains an optionallastUsagedate so the check still works after the Mac's week or month has rolled over; payloads from older Macs decode it as nil.TokenFormatterused by the iPhone app and widget now promotes units at rounding boundaries and picks precision from the rounded value:1Minstead of1000.0K,$100instead of$100.0,80%instead of80.0%.ProviderMetadata.allKnowngainskimi_code, so the phone's provider visibility list knows the provider before the first payload that carries it.Defect log entry added: phone copies of Mac rules drift silently on upstream sync. Keep one rule in the shared package, and grep the phone, widget and shared package for copies when syncing.
Type of change
Checklist
swift buildandswift testpass locallyValidation
PokeTokenBarShared:swift testpasses (65 tests). New tests:aRecountedProviderIdleTodayKeepsItsTabWhileThisMonthHasUsage,aRecountedProviderUsedInsideTheQuotaWindowSurvivesAMonthRollover(6 days back kept, 11 days back dropped),aMacOnlyProviderKeepsItsTabFromLastUsageAfterTheMacPeriodRolledOver,providerSnapshotWithoutLastUsageDecodes, and the Mac's formatter boundary cases. RevertinghasDisplayableUsageto the old rule makes the three retention tests fail.swift testruns 1698 tests with one failure,SessionKeySettingsRenderingTests.testSessionKeyEntryOpensInsideViewportAndPreservesDifficultyControls, which fails identically on untouchedmainon this machine. Three test classes were skipped locally because they reach the real Keychain and stall on a system prompt here (KeychainAutoPathTests,IncrementalStoreScanTests,testKeychainDisabledRecordsNoHistory); CI has no Keychain entries and runs them.🤖 Generated with Claude Code
https://claude.ai/code/session_01NUKUCMdezMcZX7Sb2Bwu6x