A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: partial config leads to errors (#5683)
Dylan Madisetti0e78232bdcec
diff --git a/marimo/_server/api/endpoints/config.py b/marimo/_server/api/endpoints/config.pyindex 8909513876..973f54316c 100644--- a/marimo/_server/api/endpoints/config.py+++ b/marimo/_server/api/endpoints/config.py@@ -63,7 +63,7 @@ async def save_user_config(session = app_state.get_current_session()if session is not None:session.put_control_request(- SetUserConfigRequest(body.config),+ SetUserConfigRequest(config),from_consumer_id=ConsumerId(app_state.require_current_session_id()),diff --git a/tests/_server/api/endpoints/test_config_endpoints.py b/tests/_server/api/endpoints/test_config_endpoints.pyindex befb09f919..8a2083b4ec 100644--- a/tests/_server/api/endpoints/test_config_endpoints.py+++ b/tests/_server/api/endpoints/test_config_endpoints.py@@ -9,6 +9,7 @@ from tests._server.mocks import token_header, with_sessionif TYPE_CHECKING:from starlette.testclient import TestClient+SESSION_ID = "session-123"HEADERS = {"Marimo-Session-Id": SESSION_ID,@@ -43,3 +44,33 @@ def test_save_user_config_with_session(client: TestClient) -> None:assert response.status_code == 200, response.textassert response.headers["content-type"] == "application/json"assert "success" in response.json()+++@with_session(SESSION_ID)+def test_save_user_config_with_partial_config(client: TestClient) -> None:+ """+ Test that save_user_config endpoint works correctly with partial config++ This is a regression test for the KeyError: 'output_max_bytes' bug.+ Before the fix, sending partial config would cause runtime errors when+ the kernel tried to access missing config fields.+ """+ # Create a partial config that's missing required runtime fields+ partial_config = {+ "display": {+ "theme": "light",+ },+ }++ response = client.post(+ "/api/kernel/save_user_config",+ headers=HEADERS,+ json={+ "config": partial_config,+ },+ )++ # Verify the endpoint succeeds+ assert response.status_code == 200, response.text+ assert response.headers["content-type"] == "application/json"+ assert "success" in response.json()