Skip to content

Commit 0183a25

Browse files
committed
test(catalog): name the suffix test for what it now accepts, and pin the -1024 cost
The review is right that `isDatedVariantId matches only <alias>-YYYYMMDD` stopped being true once MMDD was accepted. Renamed, and the MMDD case it now covers is asserted in it rather than only elsewhere. Also pins the cost the review asked for: a four-digit suffix that is a valid month and day is read as one, so `model-1024` folds into `model`. Suffixes that cannot be a date -- 2048, 4096, 8192, 0000 -- stay separate, which is what keeps most version and size suffixes safe.
1 parent aef4bec commit 0183a25

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

tests/codex-catalog.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3683,14 +3683,31 @@ describe("Codex catalog routed normalization", () => {
36833683
expect(droppedConfiguredIds).toEqual([]);
36843684
expect(models.map(m => m.id)).toContain("deepseek-v4-pro-0813");
36853685
});
3686-
test("isDatedVariantId matches only <alias>-YYYYMMDD", () => {
3686+
test("isDatedVariantId matches <alias>-YYYYMMDD and <alias>-MMDD, nothing else", () => {
36873687
expect(isDatedVariantId("claude-haiku-4-5-20251001", "claude-haiku-4-5")).toBe(true);
3688+
expect(isDatedVariantId("deepseek-v4-pro-0813", "deepseek-v4-pro")).toBe(true);
36883689
expect(isDatedVariantId("claude-haiku-4-5-2025", "claude-haiku-4-5")).toBe(false);
36893690
expect(isDatedVariantId("claude-haiku-4-5-latest", "claude-haiku-4-5")).toBe(false);
36903691
expect(isDatedVariantId("claude-haiku-4-5", "claude-haiku-4-5")).toBe(false);
36913692
expect(isDatedVariantId("claude-haiku-4-5-20251001", "claude-haiku-4")).toBe(false);
36923693
});
36933694

3695+
// A four-digit suffix that IS a valid month and day is read as one, even when the
3696+
// author meant something else. `-1024` is October 24th, so `model-1024` folds into
3697+
// `model` and the two are treated as the same model. Pinned as a known cost of
3698+
// accepting MMDD at all: nothing in an id says which reading was intended, and the
3699+
// alternative -- rejecting MMDD -- is the bug this fold exists to fix (#3024).
3700+
test("a four-digit suffix that reads as a date is folded, context size or not", () => {
3701+
expect(isDatedVariantId("model-1024", "model")).toBe(true);
3702+
expect(isDatedVariantId("model-0128", "model")).toBe(true);
3703+
// Values that cannot be a date stay separate models, which is what keeps most
3704+
// version and size suffixes safe.
3705+
expect(isDatedVariantId("model-2048", "model")).toBe(false);
3706+
expect(isDatedVariantId("model-4096", "model")).toBe(false);
3707+
expect(isDatedVariantId("model-8192", "model")).toBe(false);
3708+
expect(isDatedVariantId("model-0000", "model")).toBe(false);
3709+
});
3710+
36943711
test("disabled providers are excluded from routed model gathering", async () => {
36953712
const models = await gatherRoutedModels({
36963713
port: 10100,

0 commit comments

Comments
 (0)