Skip to content

feat: show DeepSeek peak and off-peak pricing - #280

Merged
Finesssee merged 1 commit into
nesszer:mainfrom
juanmackie:feat/deepseek-peak-off-peak
Aug 16, 2026
Merged

Finesssee merged 1 commit into
nesszer:mainfrom
juanmackie:feat/deepseek-peak-off-peak

Conversation

@juanmackie

@juanmackie juanmackie commented Aug 14, 2026 •

Copy link
Copy Markdown

Summary

  • add the official DeepSeek peak/off-peak UTC schedule with the 2026-08-16 effective time
  • show current period, local transition times, and effective time in DeepSeek cards
  • poll status every minute and notify once when the observed pricing period changes
  • add locale keys and deterministic schedule/UI tests

Verification

  • cargo fmt --all -- --check
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
  • cargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings
  • cargo test --manifest-path rust/Cargo.toml (1209 passed)
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml (341 passed)
  • pnpm --dir apps/desktop-tauri exec vitest run (257 passed)
  • pnpm --dir apps/desktop-tauri run build
  • pnpm --dir apps/desktop-tauri run check-locale

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@Finesssee Finesssee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for one confirmed schedule bug and a broader structural regression. The midnight transition must be corrected, and the pricing observer should be consolidated instead of coupling per-webview polling, browser events, duplicate reads, and notification side effects. Please also preserve the typed pricing-period model across the Rust/bridge boundary. The hosted check passes, but this UI-affecting change still needs fresh Windows/CUA proof per the repository process.

// 00:00-01:00 and 10:00-24:00 are off-peak. Use the next day's 01:00
// as the transition so the reported instant always changes the period.
let next = DateTime::<Utc>::from_naive_utc_and_offset(
(now.date_naive() + chrono::Days::new(1))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fallback also handles 00:00-01:00, but it unconditionally adds one day. At 00:30 UTC the function therefore reports tomorrow at 01:00 (24.5 hours away) instead of today at 01:00 (30 minutes away). Please choose today's 01:00 before that boundary and tomorrow's 01:00 after 10:00, and add a deterministic status_at(at(0, 30)) test.

const [themePreference, setThemePreference] = useState<ThemePreference>("dark");

useTheme(themePreference);
useDeepSeekPricingStatus();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mounts the polling hook in every AppInner, so main, settings, float-bar, and detached webviews can each own a minute timer. The hook then forwards data through a window-local CustomEvent, while each DeepSeek MenuCard invokes the same command again; that "get" command also mutates notification state and can show a toast. This works, but it makes one concern a duplicated cross-layer pipeline. Please use one Rust-owned observer (sleeping until the exact next transition), keep status retrieval pure, update notifications once, and emit a typed Tauri event for UI subscribers. That removes the per-webview intervals, custom browser event, duplicate reads, and repeated settings loads.

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DeepSeekPricingStatus {
pub period: &'static str,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PricingPeriod is already a typed domain enum, but this boundary flattens it to a string; NotificationManager then stores another String, TypeScript redeclares the union, and the UI/notification matches use silent fallback branches. Please make the enum serializable with the bridge casing and pass it directly to notification logic. Keeping this exhaustive removes duplicated representations and prevents a future period from silently acquiring "standard" behavior.

@Finesssee
Finesssee merged commit 526ad1b into nesszer:main Aug 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants