Skip to content

fix(web): price dialog no longer flags a model before a price is entered - #25755

Open
juliusmarminge wants to merge 4 commits into
mainfrom
fix/issue-19688
Open

juliusmarminge wants to merge 4 commits into
mainfrom
fix/issue-19688

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

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.3 usage record.

Change

UsagePriceOverrides keeps 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-plan is 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.ts and usagePriceForm.test.ts pass; vp run check:changed passes (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)

Viewport · theme Sheet
1280 · light C1 1280 light: before shows Input-required error on untouched and cleared rows, after shows none; Input-only identical
1280 · dark C1 1280 dark
1440 · light C1 1440 light
1440 · dark C1 1440 dark
390 · light C1 390 light
390 · dark C1 390 dark

C2 — Model prices → + → type a model ID only

Viewport · theme Sheet
1280 · light C2 1280 light
1280 · dark C2 1280 dark
1440 · light C2 1440 light
1440 · dark C2 1440 dark
390 · light C2 390 light
390 · dark C2 390 dark

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

juliusmarminge and others added 4 commits October 27, 2026 01:55
… 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>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 27, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 604dbee

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.

@juliusmarminge juliusmarminge added the bugfix Fix PR opened by an issue lead; enters the PR loop label Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 3425671 and 604dbee.

Files selected for processing: 2
  • apps/web/src/components/usage/UsagePriceOverrides.browser.test.tsx
  • apps/web/src/components/usage/UsagePriceOverrides.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Walkthrough

The usage price override dialog now defers missing-price validation display for new model rows until a price or mapping is entered. Browser tests cover the displayed errors and invalid state.

Changes: Usage price validation

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: Low

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: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Linked Issues check Warning Directly linked issue #19688 has 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 … Implement the zai-coding-plan pricing requirement of #19688 in this PR. Alternatively, change the PR scope so it does not claim to fix #19688, for example by linking the issue as partial. If #21646 provides the pricing code, its merged code…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary fix: preventing premature validation in the web price dialog.
Description check Passed 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…
Out of Scope Changes check Passed 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…
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 #19688 has 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 #19688 in this PR. Alternatively, change the PR scope so it does not claim to fix #19688, for example by linking the issue as partial. If #21646 provides 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.

@juliusmarminge juliusmarminge added the pr:gate-failed A land gate failed label Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop pr:gate-failed A land gate failed size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenCode GLM 5.3 (via GLM coding plan) usage shows “unpriced” despite available Z.AI rates

1 participant