Skip to content

fix(schema): accept override_dates on off_peak_pricing windows - #42893

Closed
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
litellm_off_peak_override_dates_schema
Closed

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
litellm_off_peak_override_dates_schema

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

what to review

Cost map rows cannot carry holiday dates yet because the schema rejects the key. This teaches the schema, the types and the Rust catalog about override_dates so #42880 can ship the DeepSeek dates

summary

decisions

TLDR

Problem this solves:

  • window rules cannot express holiday or make-up workday dates
  • the guard validates PRs with main's generator, so schema and rows cannot land together

How it solves it:

  • override_dates added to the schema generator and regenerated schema.json
  • OffPeakWindow TypedDict and Rust struct gain the optional field
  • the hand-written schema in test_utils.py accepts the key

User Flow

Before: a proxy admin who adds override_dates to a window rule in model_info gets it, but the shipped cost map cannot carry it

  1. They add {"hours_utc": "00:00-00:00", "override_dates": ["2026-10-01"]} to a window rule in the cost map
  2. python ci_cd/generate_model_prices_schema.py --check fails with Additional properties are not allowed ('override_dates' was unexpected)

After: the same row validates and a typo in the date fails the check

  1. They add the same rule to the cost map
  2. python ci_cd/generate_model_prices_schema.py --check passes
  3. A date like 2026-10-1 or an empty list fails the check with the pattern or minItems error

Relevant issues

Prerequisite for #42880

Linear ticket

Part of LIT-8177

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Schema only, so the proof is the generated schema accepting and rejecting a probe row with jsonschema.validate against model_prices_and_context_window.schema.json

Before (main)

  1. override_dates: ["2026-10-01"] on a window rule: Additional properties are not allowed ('override_dates' was unexpected)

After (ecfcf0b)

  1. uv run --no-sync python ci_cd/generate_model_prices_schema.py --check: model_prices_and_context_window.schema.json is in sync and model_prices_and_context_window.json validates against it
  2. override_dates: ["2026-10-01"]: valid
  3. override_dates: ["2026-10-1"]: '2026-10-1' does not match '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$'
  4. override_dates: "2026-10-01": '2026-10-01' is not of type 'array'
  5. override_dates: []: [] should be non-empty
  6. uv run --no-sync python ci_cd/cost_map_guard.py --base origin/main --head HEAD --head-ref litellm_off_peak_override_dates_schema: passed, cost map untouched

Type

🧹 Refactoring

Caveats (if any)

Low

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/3e4563b49e964e089f8abcee782456ec
Open in Devin Desktop: https://app.devin.ai/desktop/session/3e4563b49e964e089f8abcee782456ec?variant=devin
Requested by: @shreshth-berri

A window rule may carry override_dates, YYYY-MM-DD dates on which it alone decides, so the generated schema, the OffPeakWindow TypedDict, and the Rust model catalog now model it.
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_off_peak_override_dates_schema (ecfcf0b) with main (6dbd65b)

Open in CodSpeed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant