Repository navigation
fix(quota): let the phone's cap rule decide, not a copy of it - #307
Conversation
CodeCaps PR #298 carried two of the four Kody findings raised on that branch, and the other two were left open on main. Both are in the phone's Antigravity pool, which is the surface the owner reported as broken. The phone's Antigravity pool let the wire's exhausted word override a healthy weekly reading, so the phone called a live pool exhausted while the Mac kept it live. And the phone published a weekly row with no percentage when the provider reported the allowance as gone without a figure, so the shared rule had nothing to bind and the cap line never appeared. The Mac avoided the second one only because its own pool grouper forces a zero. Both now ask the shared rule. Two helpers in QuotaCapRule answer the two questions the phone and the Mac were each answering for themselves: whether an allowance is spent when the provider's word and its reading disagree, and what reading a row publishes when the provider reports a spent allowance without a figure. The Mac's Antigravity pool grouper calls them too, so the decision has one home. Every place that decides "is this spent" now reads the same rule, so the two surfaces cannot drift apart again. Fixes CC-186
This comment has been minimized.
This comment has been minimized.
|
Task description is insufficient for business logic validation. 🤔 Insufficient Task ContextI found a task linked to this PR, but it only contains minimal information (title only, no description or acceptance criteria). To perform a meaningful business rules validation, I need more details. 🔍 What I need to validate:
💡 How to improve the task context:
|
Answers the seven open threads on CC-186, where the phone moved to the shared rule and the widget, the pool decision and the published reading had each kept a copy of the question beside it. QuotaCapRule.isExhausted now decides that a reading exists with the shared `bounded` reader rather than a nil check. A NaN or infinite value passed the nil check, was then judged as headroom, and silently dropped the provider's exhausted word, which was the only evidence there was. QuotaCapRule.publishedReading bounds the reading it publishes, so the phone's raw wire value and the Mac's already-clamped value come out the same number instead of the phone rendering "150%" for a window the cap rule judged at 100. The phone's pool decision ORs its per-window decisions instead of weighing the provider's word against `controllingPct`, which is a reading belonging to a different window than the one with no reading at all: a weekly the provider reports as gone, beside a healthy five-hour reading, no longer reports the plan live. The weekly row also counts the exhausted word of the window it is built from, so a spent weekly publishes zero even when the pool's weekly selector picked a different window. The widget asks the shared rule in all four places it decided for itself (per-window, weekly, the five-hour row and the pool), and publishes the same bounded readings, so app and widget stop disagreeing about one payload (Sentry 18329264). Both `weeklySpentThreshold` copies are deleted. The weekly decision now lives in the shared rule, so neither constant had a production reader; they survived only as dead code held up by tests that could not see the live copy of the same question in the widget.
|
@kody start-review |
Resolved ios/CodeCapsCompanion/App/Models/CompanionQuotaModel.swift by keeping both sides: #307's shared QuotaCapRule.isAtCap decides the cap instead of the local (x ?? 100) <= 0 copy, while this branch keeps the suffix-free subtitle. sourceSuffix could not be restored because this branch removed its definition along with the multi-source chip.
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Fixes CC-186
Summary
Centralizes quota exhaustion and cap-publication decisions in
QuotaCapRule, then uses the shared rules in the iOS companion app and Antigravity pool grouping. For finite readings, the remaining percentage now takes precedence over the provider’s potentially staleisExhaustedflag. When no reading is available, the provider’s exhaustion state remains the fallback.Functional changes
"7-day window"resolve consistently with"7-day".Outstanding review items
weeklySpentThresholddeclaration remains present and is retained by a source-text test.Summary
QuotaCapRuleand removed duplicate weekly-cap thresholds from the phone and Mac code.0%when an exhausted weekly window has no numeric reading.0%fallbacks for exhausted windows without figures.100%.Test Coverage
Automated Review Findings
ios/CodeCapsCompanion/App/Models/CompanionQuotaModel.swift:1859: Plan-level exhaustion now counts sub-model, scoped, and video windows that are excluded by the cap rule.ios/CodeCapsCompanion/Widgets/WidgetPresentation.swift:776: The widget publishes0%for a spent five-hour window with no numeric figure, while the phone publishes no reading.