From b12eb249cc6a0887f37f0e654020fd6763b701bf Mon Sep 17 00:00:00 2001 From: Parker Rule Date: Fri, 28 Aug 2026 10:28:58 -0400 Subject: [PATCH] test(cli): preserve standard builds alongside flat mode --- .github/workflows/_integration_test.yml | 10 +++++++++- libs/cli/langgraph_cli/cli.py | 7 ++++--- libs/cli/tests/unit_tests/cli/test_cli.py | 8 ++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_integration_test.yml b/.github/workflows/_integration_test.yml index 1cba1f5b9..bdc100632 100644 --- a/.github/workflows/_integration_test.yml +++ b/.github/workflows/_integration_test.yml @@ -58,7 +58,12 @@ jobs: if: (steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch') working-directory: ${{ matrix.example.workdir }} run: | - langgraph build --single-user-layer -t ${{ matrix.example.tag }} + langgraph build -t ${{ matrix.example.tag }} + - name: Build flattened service + if: ${{ (steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch') && matrix.example.name == 'A' }} + working-directory: ${{ matrix.example.workdir }} + run: | + langgraph build --flat -t ${{ matrix.example.tag }}-flat - name: Test service ${{ matrix.example.name }} if: ${{ (steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch') &&env.HAS_LANGSMITH_API_KEY == 'true' }} working-directory: ${{ matrix.example.workdir }} @@ -72,6 +77,9 @@ jobs: # Run the integration test using the built tag REPO_ROOT=$(git rev-parse --show-toplevel) timeout 60 python "$REPO_ROOT/.github/scripts/run_langgraph_cli_test.py" -t ${{ matrix.example.tag }} + if [ "${{ matrix.example.name }}" = "A" ]; then + timeout 60 python "$REPO_ROOT/.github/scripts/run_langgraph_cli_test.py" -t ${{ matrix.example.tag }}-flat + fi - name: Build JS service if: ${{ (steps.changed-files.outputs.all || github.event_name == 'workflow_dispatch') &&matrix.example.name == 'A' }} diff --git a/libs/cli/langgraph_cli/cli.py b/libs/cli/langgraph_cli/cli.py index ce5ff2fde..ec2c26fe2 100644 --- a/libs/cli/langgraph_cli/cli.py +++ b/libs/cli/langgraph_cli/cli.py @@ -409,10 +409,11 @@ For production use, requires a license key in env var LANGGRAPH_CLOUD_LICENSE_KE help="Custom build command to run from the langgraph.json directory. If not provided, uses default build process.", ) @click.option( - "--single-user-layer", + "--flat", + "single_user_layer", is_flag=True, - envvar="LANGGRAPH_CLI_SINGLE_USER_LAYER", - help="Combine generated Python build steps into one image layer when supported.", + envvar="LANGGRAPH_CLI_FLAT", + help="Flatten generated Python build steps into one image layer when supported.", ) @click.argument("docker_build_args", nargs=-1, type=click.UNPROCESSED) @cli.command( diff --git a/libs/cli/tests/unit_tests/cli/test_cli.py b/libs/cli/tests/unit_tests/cli/test_cli.py index 8b3ae47c6..2ae32cc4f 100644 --- a/libs/cli/tests/unit_tests/cli/test_cli.py +++ b/libs/cli/tests/unit_tests/cli/test_cli.py @@ -320,6 +320,14 @@ def test_top_level_help_truncates_command_descriptions_to_single_line() -> None: assert "[Beta] List LangSmith Deployments." in deploy_list_line +def test_build_help_includes_flat_option() -> None: + result = CliRunner().invoke(cli, ["build", "--help"]) + + assert result.exit_code == 0 + assert "--flat" in result.output + assert "--single-user-layer" not in result.output + + def test_dev_command_requires_ssl_certfile_and_keyfile_together(tmp_path) -> None: config_path = tmp_path / "langgraph.json" config_path.write_text(