langgraph/libs/cli/tests/unit_tests
raghavverma-langchain c6335a4255
fix(cli): omit an empty secrets list when updating a deployment (#9737)
## Summary

`langgraph deploy` builds its secrets list from `.env`, so without one
(or with one that has no values) it sent `secrets: []` on every update.
the control plane already reads an empty list on update as "keep the
current values", so nothing changed, but the request said "replace with
nothing". now updates leave `secrets` out when there's nothing to send

- the check lives in the two update methods on the host backend client,
so local builds, remote builds and `--push-to` / `--image-uri` updates
all get it
- creating a deployment still sends `secrets`, even when empty, since
the control plane requires it there
- no change when your `.env` has variables: the full list is still sent
and replaces the deployment's variables as before
- the js cli gets the same change in langchain-ai/langgraphjs#3414

## Test Plan
- [x] `make test` passes in `libs/cli` (743 tests). ruff and format are
clean; `ty` only reports the two `contextmanager` deprecation warnings
that are also on main
- [x] New client test: an update with an empty list omits `secrets`.
Updated the four deploy command tests that expected `"secrets": []` on
update. All of these fail without the change
- [x] New client test: a remote-build update still forwards a non-empty
list. Fails if that update drops `secrets`
- [ ] After release, `langgraph deploy` without a `.env` against an
existing deployment keeps the variables set in the UI

## Demo

real cli runs, main vs this branch, against a local server that records
each request, with no .env in the project. the control plane handles
both requests the same way; the difference is the `secrets` field in the
update

<img width="1100" alt="langgraph deploy update request before and after"
src="https://github.com/user-attachments/assets/578b6edf-170f-4e4a-95d0-84a9ec97bc9a"
/>
2026-11-20 10:33:23 -08:00
..
cli fix(cli): omit an empty secrets list when updating a deployment (#9737) 2026-11-20 10:33:23 -08:00
graphs [CLI] Support http config (#3505) 2025-02-19 08:52:00 -08:00
multiplatform feat(cli): add multiplatform support 2025-04-10 23:52:49 +02:00
__init__.py libs: add cli, sdk-py, sdk-js and move core langgraph 2024-06-17 20:37:25 -04:00
agent.py ci: migrate to uv! (#4698) 2025-05-15 17:39:14 -07:00
conftest.py feat(cli): deploy to BYOC data planes with only an API key (#9692) 2026-11-13 20:21:54 -05:00
deployment_metrics.json feat(cli): add deploy metrics command (#9479) 2026-11-05 18:20:14 -05:00
helpers.py libs: add cli, sdk-py, sdk-js and move core langgraph 2024-06-17 20:37:25 -04:00
pipconfig.txt cli: Reduce to test and build commands (#838) 2024-06-26 11:53:44 -07:00
test_archive.py chore: enforce PLC0415 in tests for the remaining packages (#8547) 2026-08-07 09:40:18 -04:00
test_config.json [CLI] Support http config (#3505) 2025-02-19 08:52:00 -08:00
test_config.py feat(cli): use Agent Server flags with hidden deployment aliases (#9666) 2026-11-12 09:51:38 -05:00
test_dependency_tracking.py chore(langgraph): Track ADK/other library usage when deploying using cli (#7939) 2026-05-29 13:46:10 -07:00
test_deploy_agents.py feat(cli): use Agent Server flags with hidden deployment aliases (#9666) 2026-11-12 09:51:38 -05:00
test_deploy_helpers.py feat(cli): deploy to BYOC data planes with only an API key (#9692) 2026-11-13 20:21:54 -05:00
test_deployment_metrics.py feat(cli): add deploy metrics command (#9479) 2026-11-05 18:20:14 -05:00
test_docker.py fix(cli): remove discontinued local debugger image (#8543) 2026-11-11 20:43:53 -05:00
test_exec.py fix(cli): stop printing subprocess stdin in verbose output (#9350) 2026-10-19 13:45:42 +00:00
test_host_backend.py fix(cli): omit an empty secrets list when updating a deployment (#9737) 2026-11-20 10:33:23 -08:00
test_image_reference.py feat(cli): add --image-uri flag for self-hosted deployments (#8482) 2026-09-22 11:50:02 -04:00
test_logs_helpers.py feat(cli): add remote build support for langgraph deploy (#7234) 2026-04-02 16:39:30 +01:00
test_util.py feat(cli): add --json to deploy list (#9395) 2026-10-26 09:45:57 -04:00