Skip to content

Commit

Permalink
feat(api): add oem mode setting (#14730)
Browse files Browse the repository at this point in the history
adds an enableOEMMode robot setting to track whether OEM mode is enabled
for the ODD

closes PLAT-186
  • Loading branch information
brenthagen authored and Carlos-fernandez committed May 20, 2024
1 parent 5cfc6cb commit 1dd14ba
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
18 changes: 18 additions & 0 deletions api/src/opentrons/config/advanced_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ class Setting(NamedTuple):
robot_type=[RobotTypeEnum.FLEX],
internal_only=True,
),
SettingDefinition(
_id="enableOEMMode",
title="Enable OEM Mode",
description="This setting anonymizes Opentrons branding in the ODD app.",
robot_type=[RobotTypeEnum.FLEX],
internal_only=True,
),
]

if (
Expand Down Expand Up @@ -692,6 +699,16 @@ def _migrate30to31(previous: SettingsMap) -> SettingsMap:
return newmap


def _migrate31to32(previous: SettingsMap) -> SettingsMap:
"""Migrate to version 32 of the feature flags file.
- Adds the enableOEMMode config element.
"""
newmap = {k: v for k, v in previous.items()}
newmap["enableOEMMode"] = None
return newmap


_MIGRATIONS = [
_migrate0to1,
_migrate1to2,
Expand Down Expand Up @@ -724,6 +741,7 @@ def _migrate30to31(previous: SettingsMap) -> SettingsMap:
_migrate28to29,
_migrate29to30,
_migrate30to31,
_migrate31to32,
]
"""
List of all migrations to apply, indexed by (version - 1). See _migrate below
Expand Down
17 changes: 16 additions & 1 deletion api/tests/opentrons/config/test_advanced_settings_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@pytest.fixture
def migrated_file_version() -> int:
return 31
return 32


# make sure to set a boolean value in default_file_settings only if
Expand All @@ -30,6 +30,7 @@ def default_file_settings() -> Dict[str, Any]:
"disableOverpressureDetection": None,
"estopNotRequired": None,
"enableErrorRecoveryExperiments": None,
"enableOEMMode": None,
}


Expand Down Expand Up @@ -379,6 +380,18 @@ def v31_config(v30_config: Dict[str, Any]) -> Dict[str, Any]:
return r


@pytest.fixture
def v32_config(v31_config: Dict[str, Any]) -> Dict[str, Any]:
r = v31_config.copy()
r.update(
{
"_version": 32,
"enableOEMMode": None,
}
)
return r


@pytest.fixture(
scope="session",
params=[
Expand Down Expand Up @@ -415,6 +428,7 @@ def v31_config(v30_config: Dict[str, Any]) -> Dict[str, Any]:
lazy_fixture("v29_config"),
lazy_fixture("v30_config"),
lazy_fixture("v31_config"),
lazy_fixture("v32_config"),
],
)
def old_settings(request: SubRequest) -> Dict[str, Any]:
Expand Down Expand Up @@ -507,4 +521,5 @@ def test_ensures_config() -> None:
"estopNotRequired": None,
"disableOverpressureDetection": None,
"enableErrorRecoveryExperiments": None,
"enableOEMMode": None,
}

0 comments on commit 1dd14ba

Please sign in to comment.