Skip to content

fix(admin): only exclude past-dated deactivations - #3507

Merged
steebchen merged 3 commits into
mainfrom
bissau
Aug 9, 2026
Merged

steebchen merged 3 commits into
mainfrom
bissau

Conversation

@steebchen

@steebchen steebchen commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Problem

Routing Analytics marked every mapping carrying a deactivatedAt as deactivated and unroutable — including dates far in the future. gpt-5.6-sol's Azure mapping deactivates on 2028-01-11, yet the page showed it as deactivated, dropped it from the score table (Score: —) and excluded it from the "Routable mappings" count, while it was demonstrably serving ~7% of that model's traffic.

Routing itself has always compared against the date (now > deactivatedAt in resolve-model-info.ts, chat.ts, models.ts, realtime/catalog.ts, …), so a scheduled deactivation never affected election or filtering. The analytics page was the only place treating a bare deactivatedAt as "deactivated", so what it reported disagreed with what the router actually did.

Change

  • apps/api/src/routes/admin-routing-analytics.ts — a deactivation is only an exclusion reason once the date has passed. Scheduled mappings are routable again, get scored, and appear in the score-composition table.
  • ee/admin — a scheduled deactivation is surfaced next to the stability badge as deactivates <date>, but only when it falls within the next 30 days. Anything further out reads as an ordinary stable mapping, because it is one.
  • packages/shared — isMappingDeactivated moved out of the React components barrel into @llmgateway/shared/deactivation (a backend can't import the components entry), joined by isDeactivationScheduledSoon + DEACTIVATION_NOTICE_DAYS. The old export path still works via a re-export, so no consumer changed.

No OpenAPI change — the response shape is untouched.

Screenshots

Before — Azure flagged deactivated with no score, despite a 2028 date:

Before, light

Before, dark

After — Azure is stable, scored (-0.852) and sorted into place:

After, light

After, dark

Imminent deactivation — kimi-k2.6, whose together-ai mapping retires on Aug 19, keeps its stability badge and score and gains an amber notice:

Scheduled deactivation notice, light

Scheduled deactivation notice, dark

Verification

  • New endpoint spec asserts a future-dated mapping is routable with no deactivated reason, and a past-dated one is still excluded — it fails on main.
  • packages/shared suite (223 tests) covers the new notice-window helper.
  • pnpm format + full pnpm build clean; screenshots taken against a locally seeded stack.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Routing analytics now correctly distinguishes active deactivations from future scheduled deactivations.
    • Provider mappings remain routable until their scheduled deactivation date.
    • Added a scheduled deactivation badge to routing analytics, including the upcoming date and an explanatory tooltip.
  • Bug Fixes

    • Past deactivations are now excluded from routing and score calculations with a clear deactivation reason.
    • Future deactivation dates no longer incorrectly mark mappings as unavailable.

Routing analytics flagged any mapping with a deactivatedAt as deactivated
and unroutable, even when the date is more than a year out. Routing itself
compares against the date, so those mappings still elect and serve traffic
- the page dropped them from the score table while they were receiving
requests.

A deactivation is now only an exclusion once the date has passed, and a
scheduled one is surfaced as a "deactivates <date>" badge alongside the
stability badge only when it falls within the next 30 days.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 9, 2026 14:35
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@steebchen, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ff8eb19d-17f3-46b6-b917-c7a51952664c

📥 Commits

Reviewing files that changed from the base of the PR and between 5d65360 and 0e14fce.

📒 Files selected for processing (4)
  • apps/api/src/routes/admin-routing-analytics.spec.ts
  • apps/api/src/routes/admin-routing-analytics.ts
  • ee/admin/src/app/routing-analytics/client.tsx
  • packages/shared/package.json

Walkthrough

The change centralizes mapping deactivation checks, updates routing analytics to distinguish past and future dates, and displays imminent scheduled deactivations in the dashboard.

Changes

Deactivation status handling

Layer / File(s) Summary
Shared deactivation utilities
packages/shared/src/deactivation.ts, packages/shared/src/deactivation.spec.ts, packages/shared/package.json, packages/shared/src/components/index.tsx, packages/shared/src/components/models-directory/all-models.tsx
Adds helpers for active and scheduled deactivation dates, tests date boundaries, and exposes the helpers through the shared package.
Routing analytics deactivation checks
apps/api/src/routes/admin-routing-analytics.ts, apps/api/src/routes/admin-routing-analytics.spec.ts
Uses effective deactivation dates for routability and exclusion reasons. Tests past and future deactivation behavior.
Dashboard scheduled status display
ee/admin/src/app/routing-analytics/client.tsx
Formats scheduled deactivation dates and displays imminent dates with warning styling and tooltip text.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: smakosh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: only deactivations whose dates have passed are excluded.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bissau

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/api/src/routes/admin-routing-analytics.spec.ts`:
- Around line 43-76: Replace the catalogue-scanning findModelWithDeactivation
fixture with a controlled provider mapping and mocked clock that
deterministically represent effective past and scheduled future deactivation
cases. Update the affected tests to use these controlled fixtures for both
scenarios, avoiding dependence on models’ real deactivatedAt dates during module
initialization.

In `@ee/admin/src/app/routing-analytics/client.tsx`:
- Around line 202-210: Update formatDeactivationDate to pass timeZone: "UTC" in
the Intl date formatting options, preserving the existing en-US, short month,
and numeric day settings so ISO timestamps display their catalogue date
consistently.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9f0388ce-7119-48af-b13a-3fe3fc10df56

📥 Commits

Reviewing files that changed from the base of the PR and between 0c0f77f and 5d65360.

📒 Files selected for processing (10)
  • apps/api/src/routes/admin-routing-analytics.spec.ts
  • apps/api/src/routes/admin-routing-analytics.ts
  • ee/admin/src/app/routing-analytics/client.tsx
  • packages/shared/package.json
  • packages/shared/src/components/index.tsx
  • packages/shared/src/components/models-directory/all-models.tsx
  • packages/shared/src/components/models-directory/deactivation.spec.ts
  • packages/shared/src/components/models-directory/deactivation.ts
  • packages/shared/src/deactivation.spec.ts
  • packages/shared/src/deactivation.ts
💤 Files with no reviewable changes (2)
  • packages/shared/src/components/models-directory/deactivation.ts
  • packages/shared/src/components/models-directory/deactivation.spec.ts

Comment thread apps/api/src/routes/admin-routing-analytics.spec.ts Outdated
Comment thread ee/admin/src/app/routing-analytics/client.tsx
The fixture scanned the catalogue for a future-dated mapping and threw at
module load if none existed, so the whole spec file would start failing once
scheduled dates passed - unrelated to the route being correct. Assert the
past/future rule over whichever dated mappings the catalogue carries instead.

Also format the scheduled-deactivation badge in UTC: catalogue dates are
UTC-midnight calendar dates, so viewers west of UTC saw the previous day.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@steebchen
steebchen enabled auto-merge August 9, 2026 16:13
auto-merge was automatically disabled August 9, 2026 17:40

Merge commits are not allowed on this repository

@steebchen
steebchen merged commit a3d083b into main Aug 9, 2026
27 checks passed
@steebchen
steebchen deleted the bissau branch August 9, 2026 17:50
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.

2 participants