Skip to content

Port upstream 0.63.0: StepFun credit plans (Credit label, no invented reset) - #710

Draft
Finesssee wants to merge 1 commit into
port/upstream-0.63.0from
port/micro-0.63.0-stepfun-credit-plan
Draft

Finesssee wants to merge 1 commit into
port/upstream-0.63.0from
port/micro-0.63.0-stepfun-credit-plan

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

StepFun Token Plan (credit) payloads now produce a usable snapshot instead of failing with "Missing StepFun five-hour usage". Credit plans show a single primary lane labelled Credit, never get an invented reset date, and Coding Plan snapshots keep their 5-hour / Weekly labels and lanes.

Found by the 0.60.4-0.69.0 port gap audit (0.63.0 item #13).

Upstream reference

Ported / Deferred

Ported (rust/src/providers/stepfun/mod.rs only):

  • New fields plan_family, plan_credit_rate_limit (subscription_credit_left_rate, subscription_credit_reset_time, topup_credit_left_rate, credit_buckets[].credit_total/credit_residual), all names taken from the upstream decoder.
  • Credit-plan classification: no live rolling window (both reset times 0/absent) and a credit pool exists; plan_family == 2 only as tie-breaker.
  • Primary-only window: used = clamp((1 - left) * 100), left rate weighted from sound buckets (residual/total), else subscription rate, else top-up rate (never summed).
  • Zero/missing subscription_credit_reset_time stays unknown: no resets_at, no reset description, no window minutes. A real reset sets monthly window minutes via the existing RateWindow::monthly_window_minutes.
  • primary_label = "Credit" via the existing UsageSnapshot::primary_label; the Tauri bridge, tray and CLI already consume it. Coding Plan still requires the five-hour and weekly fields.

Left out:

  • Upstream returns a nil primary for a credit plan with no balance yet. Win's UsageSnapshot.primary is non-optional, so this shows an informational "No credit balance reported" primary (the same pattern used by Amp/Antigravity), not an error and not a quota percentage.
  • Upstream ProviderPaceCapability.monthlyWindowSentinelMinutes is replaced by the local calendar-month helper, matching how other monthly providers (Abacus) are handled.
  • Upstream expire_at / next_reset_at bucket fields are unused by upstream's snapshot and are not modelled.
  • Upstream login flow / descriptor label renames (5h Window): unrelated to this item.
  • No local StepFun doc exists, so no docs change.

Validation

  • cargo +1.98.0 fmt --all: clean
  • cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: pass (both manifests)
  • cargo +1.98.0 test -p codexbar stepfun: 11 passed, 0 failed (8 new: coding-plan regression and missing-field error, credit with reset, no/zero reset, bucket weighting, unsound-bucket fallback, no-balance credit family, live window beats credit family)
  • Shared code untouched, so the full cargo test -p codexbar and frontend tests were not run.

Affected areas

Provider: StepFun. Tray/dashboard/CLI primary-lane label (Credit) and reset line.

UI proof

Pending: coordinator will capture CUA proof on a fresh build.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant