Commit graph

12 commits

Author SHA1 Message Date
Yujong Lee
6d800a887b build(redis-resolve): add the script that regenerates redis-py-kwargs.json
redis_py_kwargs.py reads each redis-py version's signatures in a throwaway uv
environment and the REDIS_* names from litellm._redis under the locked
version, then writes the catalog. Run on this branch it reproduces every arg row
of the hand-made file, so only the meta text changes.

test_redis.py now loads the script's arg_signatures instead of keeping its own
copy of the introspection, so the code that writes the file is the code that
checks it in every redis-compat CI job
2026-11-05 12:51:30 +09:00
Yujong Lee
d664e21c57 fix(redis-resolve): refuse ssl_include_verify_flags and ssl_exclude_verify_flags
Both ask for X.509 checks such as CRL revocation that rustls cannot perform,
and redis-py 5.3.1's async client already refuses them with a TypeError, so a
set value now fails with Error::Unenforceable like the OCSP settings instead of
connecting without the check. An empty list asks for nothing.

A Reject row now says which values ask for its check: true for the OCSP flags,
any present value for the verify flag lists. tests/catalog.rs fails if the
locked redis-py's async, cluster or connection signature accepts a Reject row,
so a redis-py bump forces the decision again
2026-11-05 12:47:57 +09:00
Yujong Lee
185c026603 refactor(redis-resolve): make SETTINGS the one table of how Rust handles each redis-py kwarg
Each row now carries its handling with the warning's consequence, whether the
value is plain data or a Python object, whether a url query carries it, its
REDIS_* name and its get_secret fallbacks. HOST_OBJECTS, consequence(),
is_met_by_rustls and the url setting lists in tls.rs fold into those columns.

The 29 kwargs that had no row get one, so setting them now warns instead of
passing through silently. redis-py-kwargs.json keeps only the Python facts:
which redis-py versions name each kwarg and whether Python reads its REDIS_*
name. tests/catalog.rs fails until SETTINGS has exactly one row per kwarg in
it with the same REDIS_* flag, and test_redis.py checks the file against the
redis-py each redis-compat CI job installs
2026-11-05 12:39:36 +09:00
Yujong Lee
b7e07948c8 refactor(redis): interpret merged kwargs in redis-resolve and merge in gateway
config now only deserializes the Redis YAML. The new litellm-redis-resolve crate
turns an already merged redis-py kwargs dict into a Resolution without reading the
environment or secrets, so both hosts can share it. The REDIS_* layering, the
get_secret fallbacks and the Azure REDIS_USERNAME read move to gateway, the only
host that needs a Rust copy of the merge.

litellm/_redis.py gets _merge_redis_kwargs, the merge stage of
_get_redis_client_logic, and the contract cases gain a merged column that pins
the Python merge, the Rust merge and the Rust interpret step to the same dict.
2026-11-05 08:35:23 +09:00
Yujong Lee
3de1f0caec fix(config): refuse OCSP validation instead of connecting without it
ssl_validate_ocsp and ssl_validate_ocsp_stapled were dropped with a warning, so
a config that asked for revocation checks connected without them. rustls has no
client-side OCSP, so a true value from the kwargs, REDIS_* or a url query now
fails resolution with RedisError::Unenforceable. redis-py 5.3.1's async client
refuses both with a TypeError, so this matches the proxy's path. A false value
asks for nothing and is dropped silently

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 07:18:25 +09:00
Yujong Lee
bd4a12649c feat(redis-client): decrypt an encrypted client key with ssl_password
rustls only reads unencrypted keys, so ssl_password was dropped with a warning
and the TLS handshake failed. The resolver now reads it into TlsOptions and
redis-client decrypts a PKCS#8 ENCRYPTED PRIVATE KEY before handing it to
redis-rs, like the sync redis-py client's load_cert_chain(password=...). A
missing or wrong password, or a legacy Proc-Type encrypted PEM key, fails at
client build with a TlsKey error naming the file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 07:18:25 +09:00
Yujong Lee
5b75f64f71 feat(redis-client): stop rejecting redis-py settings and support health checks, Unix sockets and CA bundles
A Redis setting the Rust client cannot honor is now warned and dropped with
what that means, so a config that works on Python never fails to build on
Rust. health_check_interval, unix_socket_path, ssl_ca_data and ssl_ca_path
are read and applied like redis-py.

health_check_interval resolves to a three-state HealthCheck, so 0 stays off
on a cluster instead of turning on Python's 25 second cluster default, which
only an unset interval takes. unix_socket_path resolves to Target::Unix. A
url's ?db=, ?username= and ?password= are read like parse_url reads them
instead of being dropped, and ssl_min_version no longer warns at TLS 1.2 or
lower, which rustls already meets.
2026-11-05 07:18:25 +09:00
Yujong Lee
a41ba72c89 refactor(config): resolve Redis through surface adapters and typed options
Each config surface now turns its Redis section into a ConfiguredRedis
(coordination, cache_params, or a RedisCache.redis_kwargs dict), and one
resolve returns the ResolvedRedis plus the ignored settings by source, so
hosts log gaps instead of the resolver. The resolve/resolve_cache flag and
the coordination ssl normalization are gone

Resolution reads the layered kwargs into a typed Options struct once, and
endpoint and auth selection work from that struct alone. An empty value is
unset everywhere, and a flag Python surfaces read differently is an error

ResolvedRedis and RedisAuth move to redis-types, so redis-connect no longer
depends on litellm-config

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 07:18:24 +09:00
Devin AI
f2af84d72b feat(config): resolve Redis settings the way litellm/_redis.py does 2026-11-05 07:18:24 +09:00
devin-ai-integration[bot]
8a103e26ab
test: move routing, caching and callback tests out of local_testing (#45761)
* test: move routing, caching and callback tests out of local_testing

Moves the 37 routing, caching and callback files in tests/local_testing into mirrored tests/unit paths and tests/integration sdk and security groups per the migration manifest, and deletes the 8 rows it marks for deletion

* test: cover least-busy routing and tighten migrated router, cache and pass-through tests

Add router-level least-busy tests for the three legacy rows that had no
destination, move completion fallback and model alias tests to their mirror
files, move router batch tests next to the router, and strengthen tests
whose mutants survived (specific deployment, batch pair grouping, custom
cache key, router cache ttl). Add a unit test for configured pass-through
Authorization forwarding.

* test: tighten migrated callback, proxy config and cache ttl tests

Assert the full StandardLoggingPayload key set and the wire user on callback
tests, add an async embedding failure callback test, drive the prometheus
redis failure through a real RedisCache, use the real salt key in proxy
config tests, pin the redis ttl value and rename fallback test helpers

* test: fix semantic cache assertions and order-dependent router and callback tests

Count semantic cache embeddings on the route, drain async cache writes before
the second lookup, echo the requested model from the callback provider mock so
response_cost does not depend on model_cost entries other tests register, and
move the two-key authorization assertion to the auth failure test it belongs to

* test: cover model_list fan-out and the usage-based routing tpm limit lost in the move

* test: wait for the streamed cache entry in redis and drop deleted files from the hosted mock guard

* test: restore sync callback, audio redaction and langfuse export coverage, keep redis-compat filter on the moved file

* ci: run the remaining router-keyword legacy tests on one node

* test: refuse the redis write in-process instead of resolving an invalid host

---------

Co-authored-by: yuneng <yuneng@berri.ai>
2026-10-10 09:33:09 -07:00
devin-ai-integration[bot]
c3a23fe499
refactor: expose core private helpers under public names (#44871)
* refactor: expose core private symbols with compatibility aliases

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* types: narrow core migration diagnostics

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: preserve runtime behavior in core symbol migration

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: preserve core private usage migration behavior

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: preserve private value rebinding compatibility

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: restore optional imports and cover public helpers

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test: exempt router property from call coverage

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test: align recursive detector ignore names

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: mateo <mateo@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-07 00:05:27 +00:00
yuneng-jiang
f6882246d4
test: move tests/test_litellm root and small trees into tests/unit (#43186)
* ci: run the unit_selection.sh shard files on every event instead of only fork pull requests

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* ci: rename fork-flag to unit-flag now that it applies on every event

* test: move tests/test_litellm root and small trees into tests/unit

Pure renames, no content changes. Follow-up commits in this PR fix
references, merge the three files that already existed in tests/unit,
keep live-provider tests in tests/test_litellm and wire CI.

* test: carry tests/test_litellm conftest isolation into tests/unit

Callback lists, routing fallbacks, cached HTTP clients, logger state, AWS,
proxy-URL and keychain env, and session-end client cleanup now reset for
unit tests too. The environment isolation owns its MonkeyPatch so a test's
own monkeypatch is undone before the model-cost teardown runs.

* test: merge, split and prune the moved root and small-tree tests

Merge batches/test_batch_utils.py and the chat_completions and messages
dispatch tests into the files that already existed in tests/unit. Keep
the live Gemini interactions tests, the async image-fetch format test and
the OpenAI embedding scorer test in tests/test_litellm since they need
real network or keys. Put test_router.py under tests/unit/test_router so
the existing package no longer shadows it. Delete eight tests the audit
found superseded by stronger ones kept in this move.

* ci: run the moved root and small-tree tests under their legacy flags

Add the misc and responses-caching-types flags to unit_selection.sh and
CircleCI, extend enterprise-routing and mcp-integration, and point the
legacy GHA shards, Makefile, redis-compat workflow, merge smoke manifest
and change classifier at the new paths.

* test: make the new tests/unit directories packages

tests/unit/test_package_layout.py requires every directory to carry an
__init__.py, and without one the moved and retained
test_litellm_responses_bridge.py modules collide on import.

* test: scope the unit socket block to tests/unit in shared sessions

The GHA shards collect the legacy test-path and the unit selection in one
pytest session. The unit conftest's loopback-only block leaked into legacy
modules that reach the network at import. The legacy conftest now lifts the
restriction at collect and setup time, and the unit conftest re-applies it
when collecting its own modules.

* test: give the shard-script tests their own GITHUB_OUTPUT

They only passed where the runner set it. The CircleCI unit job's env
allowlist drops it, so the script's redirect failed there.

* test: point the router and module-deletion checks at tests/unit

router_code_coverage and code_qa_check_tests only searched tests/test_litellm,
so the moved router tests no longer counted. The two silent-experiment tests
the audit deleted were the only direct callers of those methods; they are
replaced with tests that assert the forwarded shadow request and the
recursion guard.

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-25 11:30:43 -07:00
Renamed from tests/test_litellm/test_redis.py (Browse further)