The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 10:45 UTC
fix(usage): explain price edits blocked by model mappings (#23768)
Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Victor Vogel committed
Oct 30, 2026 at 16:00 UTC
90235549bf046154e16aa7d1e84d63377dd52f2b
2 files changed
+27
apps/web/src/components/usage/usagePriceTable.test.ts
+20
@@ -120,6 +120,26 @@ describe("price table edits", () => {
120
),
121
).toBe("Map to a different model.");
122
});
123
+
124
+ it("requires clearing a mapping before a price edit can apply to every environment", () => {
125
+ const mapped = target("mapped", {}, { example: "example-model" });
126
+ const priced = target("priced", { example: price });
127
+ const edit = draft({ inputCostPerMillionTokens: "3", outputCostPerMillionTokens: "8" });
128
+ expect(usagePriceTableErrors([mapped, priced], [edit]).get(edit.id)).toBe(
129
+ 'mapped maps this model. Remove it from "Apply to" or clear its mapping first.',
130
+ );
131
+ expect(usagePriceTableChanges(mapped, [edit]).changes).toEqual([]);
132
+
133
+ const cleared = { ...edit, alias: "" };
134
+ expect(usagePriceTableErrors([mapped, priced], [cleared]).size).toBe(0);
135
+ expect(usagePriceTableChanges(mapped, [cleared]).changes).toEqual([
136
+ { model: "example", alias: null },
137
+ { model: "example", price: { inputCostPerMillionTokens: 3, outputCostPerMillionTokens: 8 } },
138
+ ]);
139
+ expect(usagePriceTableChanges(priced, [cleared]).changes).toEqual([
140
+ { model: "example", price: { inputCostPerMillionTokens: 3, outputCostPerMillionTokens: 8 } },
141
+ ]);
142
+ });
143
});
144
145
describe("model mapping validation", () => {
apps/web/src/components/usage/usagePriceTable.ts
+7
@@ -78,6 +78,13 @@ export function usagePriceTableChanges(
78
}
79
const alias = (draft.alias ?? currentAlias ?? "").trim();
80
if (alias !== "") {
81
+ if (draft.alias === undefined && Object.keys(draft.values).length > 0) {
82
+ errors.set(
83
+ draft.id,
84
+ `${target.label} maps this model. Remove it from "Apply to" or clear its mapping first.`,
85
+ );
86
+ continue;
87
+ }
88
if (model === "") errors.set(draft.id, "Enter a model ID.");
89
else if (alias === model) errors.set(draft.id, "Map to a different model.");
90
else {