Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Validation on the CI-pinned toolchain (Rust 1.98.0,
The three clippy errors mentioned in the PR body are in files this PR doesn't touch. They only appear on the machine's older default toolchain (1.96.1); |
Summary
Brings the native Neuralwatt provider (
rust/src/providers/neuralwatt/) in line with the behavior upstream keeps after moving Neuralwatt to the bundledneuralwatt.jsplugin in v0.64.1:Retry-After(non-negative number, capped at 10 s) or 1 s. There is no second retry; the final failure readsNeuralwatt API error: HTTP <status>(previouslyHTTP 503 Service Unavailable). 401/403 stayAuthRequiredand are never retried, TLS handshake failures are never retried, and cancelling the fetch (refresh timeout) drops the retry sleep with the future.SubscriptionMetadata.renews_atis set fromsubscription.current_period_endunlesssubscription.auto_renew == false.balanceis missing, or when none ofcredits_remaining_usd >= 0,credits_used_usd >= 0,total_credits_usd > 0is usable. Present-but-invalid timestamps and wrong-typed fields (includingusage.*.requests/tokensnon-integers) are parse failures, as in upstream's schema checks.accounting_method(energybecomesEnergy) whenever there is no plan, including whensubscriptionisnull(previously it only applied inside a non-null subscription and was not capitalized). Plan and key-allowance labels use the same upstreamtitlecasing.NEURALWATT_API_URLmust be HTTPS or a bare host (promoted to HTTPS), otherwise the fetch fails withNeuralwatt endpoint override NEURALWATT_API_URL must use HTTPS or a bare host.A configured?queryis kept after/v1/quota. Validation reuses the sharedproviders::validated_https_url.current_period_startis absent (upstream setsresetsAtfrom the end alone); the window length is still only set when both ends are present.Retry logic is provider-local (no shared retry layer). The retry delay is an argument of the private
fetch_quota, so tests run without waiting.Upstream reference
18ee35247).Sources/CodexBarCore/Resources/Plugins/neuralwatt.js,Sources/CodexBarCore/ProviderHTTPClient.swift(ProviderHTTPRetryPolicy.transientIdempotent),Sources/CodexBarCore/Providers/NeuralWatt/NeuralWattSettingsReader.swift(validateEndpointOverrides),NeuralWattProviderDescriptor.swift,TestsPlugin/NeuralWattPluginTests.swift(fixtures and malformed-body list),docs/neuralwatt.md.Ported / Deferred
Ported: everything listed in Summary.
Not ported (no Windows counterpart or already matching): the plugin-engine migration itself (Swift/QuickJS), the
costshape (upstream reports the balance asused/limit: 0; Windows keepsCostSnapshot::with_balancewith used/limit), and percent-decoding of the base path before the/v1check. Connection-closed detection uses the hyper messageconnection closed before message completedbecausehyperis not a direct dependency. No deferrals of wire shapes.Validation
Run in this worktree with a process-local
CARGO_TARGET_DIRoutside every worktree (equivalent toscripts/worktree-env.ps1; the script cannot run under this agent's worktree guard because it calls git):cargo fmt --all: clean.cargo test -p codexbar neuralwatt: 18 passed, 0 failed (upstream quota fixtures 0-9, malformed bodies,auto_renewtrue/false/absent, endpoint override, retry exactly 2 requests for 503 and 429-then-200, no retry for 400/401/403/404, timeout and lost-connection retry on a raw-socket stub, TLS handshake not retried, retry sleep dropped when the fetch future is cancelled).cargo clippy -p codexbar --all-targets -- -D warnings: no findings inneuralwatt. It reports 3 pre-existing errors in files this PR does not touch (alibabatokenplan/cli.rs:163,kiro/usage_limits.rs:315,openai/subscription.rs:206; new lints in the installed rustc 1.96). They are also present on the base branch.cargo test -p codexbar(no shared code touched), Tauri crate tests (not touched).Affected areas
UI proof
Not applicable. No UI surface changed; the renewal date renders through the existing subscription-metadata path.