Skip to content

fix(api): migrate legacy model types during upgrade - #41326

Merged
laipz8200 merged 1 commit into
mainfrom
laipz8200/fix-legacy-model-type-migration
Aug 27, 2026
Merged

laipz8200 merged 1 commit into
mainfrom
laipz8200/fix-legacy-model-type-migration

Conversation

@laipz8200

Copy link
Copy Markdown
Member

Summary

Fixes #41294

Automatically migrate pre-1.15 model type values during the normal flask db upgrade path instead of requiring a separate manual data-migration command.

  • Canonicalize text-generation, embeddings, and reranking across the five affected provider tables
  • Resolve legacy/canonical collisions deterministically while preserving credential references
  • Keep PostgreSQL and MySQL upgrade behavior equivalent
  • Rotate provider cache namespaces so stale credential data cannot shadow migrated rows

This complements #41303 by repairing the stored data during deployment rather than only accepting legacy values at read time.

Screenshots

Not applicable (backend data migration).

Add a PostgreSQL and MySQL Alembic migration that canonicalizes legacy model types, resolves data collisions, and preserves credential references. Rotate provider cache namespaces so migrated records cannot be shadowed by stale Redis values.
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 61.32% 61.32% +0.00%
Strict coverage 60.91% 60.92% +0.00%
Typed symbols 42,275 42,281 +6
Untyped symbols 26,847 26,848 +1
Modules 3268 3269 +1

@laipz8200
laipz8200 marked this pull request as ready for review August 26, 2026 21:25
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.74%. Comparing base (0d05eae) to head (cb33644).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #41326      +/-   ##
==========================================
- Coverage   86.74%   86.74%   -0.01%     
==========================================
  Files        5288     5288              
  Lines      304493   304493              
  Branches    60853    60853              
==========================================
- Hits       264132   264129       -3     
- Misses      35081    35084       +3     
  Partials     5280     5280              
Flag Coverage Δ
api 86.68% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@laipz8200
laipz8200 requested a review from a team August 26, 2026 21:25
@laipz8200
laipz8200 enabled auto-merge August 26, 2026 21:32
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 27, 2026
@laipz8200
laipz8200 added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit 82520c1 Aug 27, 2026
41 checks passed
@laipz8200
laipz8200 deleted the laipz8200/fix-legacy-model-type-migration branch August 27, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update 1.17.0 model is not usable

3 participants