Repository navigation
Show a daily target for monthly allowances #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0549b2b
7f0c0f0
fe3984e
2d13a4c
98971be
ff11653
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -627,7 +627,7 @@ fn fill_window_pace( | |
| now: chrono::DateTime<chrono::Utc>, | ||
| work_days: Option<u8>, | ||
| ) { | ||
| if w.pace.is_some() || w.is_informational { | ||
| if (w.pace.is_some() && w.daily_target.is_some()) || w.is_informational { | ||
| return; | ||
| } | ||
| let Some(resets_at) = w | ||
|
|
@@ -637,12 +637,19 @@ fn fill_window_pace( | |
| else { | ||
| return; | ||
| }; | ||
| let window = codexbar::core::RateWindow::with_details( | ||
| let mut window = codexbar::core::RateWindow::with_details( | ||
| w.used_percent, | ||
| w.window_minutes, | ||
| Some(resets_at.with_timezone(&chrono::Utc)), | ||
| w.reset_description.clone(), | ||
| ); | ||
| window.reset_regenerates = w.reset_regenerates; | ||
| if w.daily_target.is_none() { | ||
| w.daily_target = crate::commands::pace::daily_target(id, &window, now); | ||
| } | ||
|
Comment on lines
637
to
+649
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis
Gate seed enrichment on
Add the authority gate before enriching the seed windows. Suggested fix
🤖 Prompt for AI Agents
|
||
| if w.pace.is_some() { | ||
| return; | ||
| } | ||
| w.pace = match id { | ||
| Some(id) => crate::commands::pace::WindowPaceSnapshot::for_lane( | ||
| id, | ||
|
|
@@ -979,6 +986,25 @@ mod tests { | |
| assert!(snapshot.extra_rate_windows[0].window.pace.is_none()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn seed_daily_target_skips_regenerating_windows() { | ||
| use chrono::TimeZone; | ||
| let now = chrono::Utc.with_ymd_and_hms(2026, 2, 15, 0, 0, 0).unwrap(); | ||
| let seed = |regenerates: bool| { | ||
| let json = format!( | ||
| r#"{{"providerId":"copilot","displayName":"Copilot", | ||
| "primary":{{"usedPercent":60.0,"resetsAt":"2026-03-01T00:00:00Z", | ||
| "resetRegenerates":{regenerates}}}}}"# | ||
| ); | ||
| let mut snapshot: ProviderUsageSnapshot = serde_json::from_str(&json).unwrap(); | ||
| normalize_seed_snapshot(&mut snapshot); | ||
| fill_seed_pace(&mut snapshot, now, None); | ||
| snapshot.primary.daily_target | ||
| }; | ||
| assert!(seed(false).is_some()); | ||
| assert_eq!(seed(true), None); | ||
| } | ||
|
|
||
| #[test] | ||
| fn seed_pace_keeps_explicit_pace() { | ||
| let json = r#"{"providerId":"codex","displayName":"Codex", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.