Repository navigation
fix(web): price dialog no longer flags a model before a price is entered - #25755
juliusmarminge wants to merge 4 commits into
Conversation
… is entered These tests reproduce #19688: the Custom model prices dialog shows "Input is required on <env>." and marks the Model ID invalid as soon as a new row has a model ID, before any price is entered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new row in Custom model prices showed "Input is required" and a red Model ID as soon as it had a model ID. Hide the missing/invalid price error on new rows until a price or mapping is entered; Save stays disabled because the errors map is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped validation UX fix: empty new price rows no longer show premature errors, while Save remains disabled until valid pricing or mapping is entered. A focused browser regression test covers the changed behavior, with no change to persisted pricing or calculation logic. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Defer missing-price errors apps/web/src/components/usage/UsagePriceOverrides.tsx, apps/web/src/components/usage/UsagePriceOverrides.browser.test.tsx |
New model drafts retain their validation errors, but the dialog hides them until a price or mapping is entered. Browser tests check that prefilled and partially typed model rows are not marked invalid, and that saving remains disabled when required prices are missing. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related issues
- Issue 19688 — The changes address the missing-input validation shown while mapping an unpriced model. They do not add automatic Z.AI pricing.
Suggested reviewers: maria-rcks, macroscopeapp
Merge Risk: 
Minimal · up to 604db
-
The dialog can avoid showing a premature price error while still preventing an incomplete row from being saved. No merge-blocking issue is established.
Pre-merge checks: 
3 · 
1
-
Failed checks: 1 warning Passed checks: 3 passed-
Full details: Description check
-
Explanation
The description covers the required Problem, Change, Scope and approval, and Verification sections. It provides reproduction details, implementation scope, focused test results, UI evidence, and known limitations.
Full details: Out of Scope Changes check
-
Explanation
All changes relate to the linked issue's validation requirement. The component change adds an awaitingPrice set. For a new row with a model ID and no alias and no entered price, the price error is not shown. The row still counts as errored, so Save stays disabled. Errors for a missing model ID, a duplicate row, and invalid or missing prices after input remain unchanged, per the diff hunks. The new browser test file covers the same behavior. No unrelated files or refactors appear in the reviewed diff.
-
Full details: Linked Issues check
-
Explanation
Directly linked issue
#19688has two requirements. (1) Expected: show an estimated API-equivalent cost for OpenCode GLM 5.3 (provider zai-coding-plan) from Z.AI published token rates, and distinguish that estimate from subscription billing. (2) Actual: the 'Input is required on WSL (Ubuntu)' error appears when mapping the model. The diff changes only apps/web/src/components/usage/UsagePriceOverrides.tsx and its browser test. It hides the premature 'Input is required' error on a new row that has a model ID but no price or mapping (awaitingPrice set). This addresses requirement (2). It does not add any pricing lookup, provider-ID handling, or Z.AI rate fallback, so requirement (1) is not implemented at this head. The PR description states that automatic Z.AI pricing is handled by#21646. A reference to another PR is not evidence that its code is present here. The PR also says 'Fixes #19688', which would close the issue while requirement (1) is unmet.Resolution
Implement the zai-coding-plan pricing requirement of
#19688in this PR. Alternatively, change the PR scope so it does not claim to fix#19688, for example by linking the issue as partial. If#21646provides the pricing code, its merged code must be present at the reviewed head before this requirement can be assessed as met.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Problem
On the Usage page, clicking an unpriced model and then Set price opens "Custom model prices" with the model ID filled in and every price blank. Before anything is typed, the row shows "Input is required on ." under the Model ID and outlines the Model ID in red. Typing a model ID into a fresh + row does the same after the first keystroke. Reproduced on main becf853def in the web dev server with a synthetic OpenCode
glm-5.3usage record.Change
UsagePriceOverrideskeeps the full validation error map, so Save stays disabled for an incomplete row. A new row with a model ID but no price and no mapping only hides its price error until the user types a price or mapping. Errors for a missing model ID, a duplicate row, a self-mapping and an invalid or missing price after a price is typed show as before. Existing rows are unchanged.Scope and approval
Fixes #19688
Triaged via the automated issue flow. This covers the issue's premature "Input is required on …" validation; the automatic Z.AI pricing for
zai-coding-planis handled separately by #21646.Verification
apps/web/src/components/usage/UsagePriceOverrides.browser.test.tsx(new): "waits for a price before flagging an unpriced model's new row" and "does not flag a new row while only its model ID is typed". Both fail on main with the "Input is required on …" alert (expected [ <p role="alert"> ] to deeply equal []) and pass with the fix. The first also asserts Save stays disabled and that "Output is required on …" appears once Input is typed.usagePriceTable.test.tsandusagePriceForm.test.tspass;vp run check:changedpasses (format, lint, knip, typecheck, tests).Evidence
Real web app from separate checkouts, fresh synthetic-only T3 homes. Before becf853def, after a2af027edb (this branch's head before merging main; the merge brings no changes to these files). Chromium 156, no device emulation, DPR 2, 100% font scaling; CSS viewports 1280×900, 1440×900 and 390×844, light and dark; browser clock frozen. Each sheet's columns are Before | After | Diff0 (any change) | Diff8 (>8/255), with the SHA under each column. Rows per sheet: cleared, Input-only, untouched.
C1 — Set price on an unpriced model (prefilled row)
C2 — Model prices → + → type a model ID only
Recordings of the scripted interactions (open, focus/blur, type Input, clear, invalid number, mapping, self-mapping, clear mapping), with step timestamps in the full evidence: C1 1280 dark before · after; C2 1280 dark before · after. All 12 recording pairs, 56 still pairs and 112 diffs, row by row: evidence.md · index.
What else changed: in the model-only and back-to-blank states, the error line and red outline are gone, so the row is shorter and the dialog re-centres (its shadow moves), which lights the whole dialog in the diffs. 27 of 56 still pairs are identical at zero threshold. Eight unchanged control pairs differ by 1–8 isolated border pixels at 1–2/255, visible only in Diff0. Input-only, zero, invalid, missing-ID, duplicate, mapping and saved-row states are unchanged.
Seed and drivers (synthetic OpenCode store only): rebuild.md · seed.py · start-server.py · capture-driver.js · replay-driver.mjs · make-diffs.py. An independent rebuild of C1 at the head matched the delivered captures with zero changed pixels (comparison).
Not checked: the Electron desktop app (it renders this same web component; not launched); multiple environments with mixed prices, offline or permission-denied environments, partial save failure, and long names or many rows (same code path, not captured). Mobile has no price editor.
Model and harness: Claude Opus 5.5 (lead, tests, fix, review B) and GPT-6.1 Sol (review A, proof audit, captures) in T3 Code via Claude Code and Codex.
🤖 Generated with Claude Code