Revert 3 commits pushed directly to main#5885
Conversation
Greptile SummaryThis PR reverts three commits ( Key points:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Pull-to-Refresh triggered] --> B["Future.wait(\n fetchUsageStats,\n fetchSubscription\n)"]
B --> C[Stats & Subscription updated]
C --> D{Fair use status\nstale?}
D -->|Yes - not refreshed| E[Banner shows old stage]
D -->|No| F[Banner up to date]
subgraph "After revert (this PR)"
B
end
subgraph "Reverted commit a68365d7a"
B2["Future.wait(\n fetchUsageStats,\n fetchSubscription,\n _loadFairUseStatus\n)"] --> C2[All three updated]
end
G[_buildFairUseBanner called] --> H["_fairUseStatus!\['stage'\]\nas String? ?? 'none'"]
H -->|null| I[stage = 'none' → hidden]
H -->|non-null String| J[stage = value → shown]
H -->|non-null non-String| K["⚠️ TypeError thrown"]
Last reviewed commit: "Revert "Bump app ver..." |
| // Using Future.wait to run both fetches concurrently | ||
| await Future.wait([provider.fetchUsageStats(period: period), provider.fetchSubscription()]); |
There was a problem hiding this comment.
Extra comment not present in original code
The comment // Using Future.wait to run both fetches concurrently was not in the codebase before the three commits being reverted. This means the revert is not a clean reversal — it introduces a net-new change. A pure revert should restore the exact prior state. Consider removing this comment to keep the diff minimal and the revert verifiably clean.
| // Using Future.wait to run both fetches concurrently | |
| await Future.wait([provider.fetchUsageStats(period: period), provider.fetchSubscription()]); | |
| await Future.wait([provider.fetchUsageStats(period: period), provider.fetchSubscription()]); |
| if (_fairUseStatus == null) return const SizedBox.shrink(); | ||
| final rawStage = _fairUseStatus!['stage']; | ||
| final stage = rawStage is String ? rawStage : 'none'; | ||
| final stage = _fairUseStatus!['stage'] as String? ?? 'none'; |
There was a problem hiding this comment.
Unsafe cast reintroduced by this revert
_fairUseStatus!['stage'] as String? ?? 'none' will only safely handle a null value — the ?? 'none' fallback is never reached for non-null, non-String values (e.g., an int or bool). Dart's as operator throws a TypeError at runtime when the actual type doesn't match. The reverted commit a68365d7a replaced this with the defensive rawStage is String ? rawStage : 'none' pattern specifically to guard against this.
This is noted in the PR description as a known regression that will be addressed in a follow-up PR, but it's worth flagging so reviewers are aware this is an active risk until that follow-up lands.
Summary
af8606f67— Update test harness to match safe cast fixa68365d7a— Fix safe cast for fair use stage and add refresh supportdd690961b— Bump app version to 784Why
These changes should have gone through a PR. The fixes (safe cast, refresh support, evidence cleanup, version bump) will be re-submitted as a proper PR after this revert lands.
🤖 Generated with Claude Code
by AI for @beastoin