Repository navigation
refactor(lens)!: rename internal engine code and API - #44034
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@veria-ai |
|
bugbot run |
|
|
@veria-ai |
|
bugbot run |
|
@greptileai @veria-ai |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 17a97f8. Configure here.
…ase URL (#44073) The Lens rename check added in #44034 refuses prisma db push when it cannot reach the database. This test pointed DATABASE_URL at a dead port to keep the real CI database out of the run, so it now trips that check before the push timeout it exists to cover. Unsetting DATABASE_URL skips every database probe and keeps the test focused on the timeout hint.
TLDR
Problem this solves:
How it solves it:
Intentional product change: Lens APIs move from
/engineto/lens; list responses uselenses, and worker claims uselens_id. Existing API clients and workers must upgrade with the proxyUser Flow
Before: Lens API clients use the old product name
/ui/lens/and connect a worker/engineto manage investigationsAfter: Lens uses its own name throughout setup and execution
/ui/lens/and connect the matching worker/lensto manage investigationsValidation
Full local
make checkpasses after the review fixes. All 16 Postgres migration/repository checks pass, covering all three db-push entrypoints, each legacy table, fresh setup, restart, and replay of the migration. The combined migration and extras suite passes 90 tests, and all 10 component-allowlist tests pass. The two added search-path cases fail on the previous SQL and pass with the fix, retaining saved run associations through migration replay. A clean environment installing only the extras package receives its database driver automatically and passes both fresh-schema and legacy-schema safety checks.uv lock --checkpasses. Earlier validation passed all 100 existing Lens unit tests and 26 dashboard tests. All four HTTP billing/privacy cases also pass, including disconnect cancellation. Existing test assertions were preserved while updating names; one new regression verifies saved findings, history, worker credentials, and billing assignments survive the actual migrationThe published worker image is pinned by digest in setup and Compose, and was pulled successfully. The standalone Docker image passes non-root/read-only imports and temporary-storage recovery. A real Docker investigation completed against local request logs, screening one selected request and returning a finding. This is a naming/transport check, not a claim of large-scale analysis quality
Screenshots / Proof of Fix
Use a disposable PostgreSQL schema with the legacy Lens tables and a saved run. Put another empty schema first in
search_path, then execute the rename SQL and querySELECT id, lens_id FROM "LiteLLM_LensRun"Before (ed19330)
ERROR: column lens_id does not existAfter (17a97f8)
('saved-run', 'saved-lens')The proxy's earlier real-inference validation returned HTTP 200 through
/lens/worker/{lens_id}/{job_id}/model, with matching Lens and virtual-key spend, and rejected blocked, exhausted, model-restricted, and deleted keys. A published worker completed a one-request investigation. Those inference checks predate this commit; the latest checks exercise migration and dependency fixes against real PostgreSQLCaveats
Severe
/engineclients cannot use renamed APIsLow
The docs guide was updated in merged BerriAI/litellm-docs#1971. The db-push upgrade instructions are in
deploy/lens/README.mdNote
High Risk
Breaking API and database rename requires coordinated proxy, worker, and client upgrades; incorrect migration order or mixed versions can block startups or strand scans, though db-push guards and in-place SQL mitigate data loss.
Overview
Breaking rename: Lens moves off the internal “engine” name end-to-end—HTTP surface
/engine→/lens, list payloads uselenses, worker claims uselens_id, and the Python package islitellm/proxy/lens(worker modulelens.worker). Proxy routing, backend allowlists, OpenAPI snapshot, and dashboard (lensData,LensView, etc.) follow the same paths and field names.Data and deploy: Prisma/Postgres objects become
LiteLLM_Lens,LiteLLM_LensRun(engine_id→lens_id), andLiteLLM_LensWorker, with migration20261001100000_rename_lensrenaming legacy tables in place.prisma db pushnow callsraise_if_lens_rename_pending()(proxy + extras) so existingLiteLLM_Engine*data is not dropped;litellm-proxy-extrasadds psycopg for that check. Lens worker Docker/Compose images and CI path filters point at the new package; upgrade notes are indeploy/lens/README.md.Tests and integration suites are retargeted to
/lensand the new table names, with added coverage for migration replay and db-push refusal on legacy schemas.Reviewed by Cursor Bugbot for commit 17a97f8. Bugbot is set up for automated code reviews on this repo. Configure here.