Skip to content

Commit 616d5bd

Browse files
author
Andrei Neagu
committed
Merge remote-tracking branch 'upstream/master' into pr-osparc-fixes-for-new-services
2 parents 32312fb + b422df3 commit 616d5bd

File tree

8 files changed

+24
-16
lines changed

8 files changed

+24
-16
lines changed

services/efs-guardian/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ mako==1.3.5
262262
# alembic
263263
markdown-it-py==3.0.0
264264
# via rich
265-
markupsafe==3.0.1
265+
markupsafe==3.0.2
266266
# via mako
267267
mdurl==0.1.2
268268
# via markdown-it-py

services/efs-guardian/requirements/_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ lazy-object-proxy==1.10.0
164164
# via openapi-spec-validator
165165
lupa==2.4
166166
# via fakeredis
167-
markupsafe==3.0.1
167+
markupsafe==3.0.2
168168
# via
169169
# -c requirements/_base.txt
170170
# jinja2

services/resource-usage-tracker/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ mako==1.3.2
278278
# alembic
279279
markdown-it-py==3.0.0
280280
# via rich
281-
markupsafe==2.1.5
281+
markupsafe==3.0.2
282282
# via mako
283283
matplotlib==3.8.3
284284
# via prometheus-api-client

services/resource-usage-tracker/requirements/_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ mako==1.3.2
149149
# -c requirements/../../../requirements/constraints.txt
150150
# -c requirements/_base.txt
151151
# alembic
152-
markupsafe==2.1.5
152+
markupsafe==3.0.2
153153
# via
154154
# -c requirements/_base.txt
155155
# jinja2

services/web/server/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ mako==1.2.2
402402
# alembic
403403
markdown-it-py==3.0.0
404404
# via rich
405-
markupsafe==2.1.1
405+
markupsafe==3.0.2
406406
# via
407407
# jinja2
408408
# mako

services/web/server/requirements/_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ markdown-it-py==3.0.0
149149
# via
150150
# -c requirements/_base.txt
151151
# rich
152-
markupsafe==2.1.1
152+
markupsafe==3.0.2
153153
# via
154154
# -c requirements/_base.txt
155155
# jinja2

services/web/server/src/simcore_service_webserver/application_settings.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
# NOTE: to mark a plugin as a DEV-FEATURE annotated it with
5757
# `Field(json_schema_extra={_X_DEV_FEATURE_FLAG: True})`
5858
# This will force it to be disabled when WEBSERVER_DEV_FEATURES_ENABLED=False
59-
_X_DEV_FEATURE_FLAG: Final[str] = "x-dev-feature"
59+
_X_FEATURE_UNDER_DEVELOPMENT: Final[str] = "x-dev-feature"
6060

6161

6262
class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
@@ -108,10 +108,9 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
108108
WEBSERVER_FUNCTIONS: Annotated[
109109
bool,
110110
Field(
111-
validation_alias=AliasChoices("WEBSERVER_FUNCTIONS"),
112-
json_schema_extra={_X_DEV_FEATURE_FLAG: True},
111+
json_schema_extra={_X_FEATURE_UNDER_DEVELOPMENT: True},
113112
),
114-
] = False
113+
] = True
115114

116115
WEBSERVER_LOGLEVEL: Annotated[
117116
LogLevel,
@@ -406,8 +405,8 @@ def _build_vcs_release_url_if_unset(cls, values):
406405

407406
@model_validator(mode="before")
408407
@classmethod
409-
def _enable_only_if_dev_features_allowed(cls, data: Any) -> Any:
410-
"""Force disables plugins marked 'under development' when WEBSERVER_DEV_FEATURES_ENABLED=False"""
408+
def _disable_features_under_development_in_production(cls, data: Any) -> Any:
409+
"""Force disables plugins marked '_X_FEATURE_UNDER_DEVELOPMENT' when WEBSERVER_DEV_FEATURES_ENABLED=False"""
411410

412411
dev_features_allowed = TypeAdapter(bool).validate_python(
413412
data.get("WEBSERVER_DEV_FEATURES_ENABLED", False)
@@ -423,7 +422,8 @@ def _enable_only_if_dev_features_allowed(cls, data: Any) -> Any:
423422
field.json_schema_extra(json_schema)
424423

425424
assert isinstance(json_schema, dict) # nosec
426-
if json_schema.get(_X_DEV_FEATURE_FLAG):
425+
if json_schema.get(_X_FEATURE_UNDER_DEVELOPMENT):
426+
assert not dev_features_allowed # nosec
427427
_logger.warning(
428428
"'%s' is still under development and will be forcibly disabled [WEBSERVER_DEV_FEATURES_ENABLED=%s].",
429429
field_name,

services/web/server/tests/unit/isolated/test_application_settings.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
1313
from pytest_simcore.helpers.typing_env import EnvVarsDict
1414
from simcore_service_webserver.application_settings import (
15-
_X_DEV_FEATURE_FLAG,
15+
_X_FEATURE_UNDER_DEVELOPMENT,
1616
APP_SETTINGS_KEY,
1717
ApplicationSettings,
1818
setup_settings,
@@ -130,17 +130,25 @@ def test_disabled_plugins_settings_to_client_statics(
130130
)
131131

132132
class DevSettings(ApplicationSettings):
133-
TEST_FOO: Annotated[bool, Field(json_schema_extra={_X_DEV_FEATURE_FLAG: True})]
133+
TEST_FOO: Annotated[
134+
bool, Field(json_schema_extra={_X_FEATURE_UNDER_DEVELOPMENT: True})
135+
]
134136
TEST_BAR: Annotated[
135-
int | None, Field(json_schema_extra={_X_DEV_FEATURE_FLAG: True})
137+
int | None, Field(json_schema_extra={_X_FEATURE_UNDER_DEVELOPMENT: True})
136138
]
137139

138140
settings = DevSettings.create_from_envs()
139141

140142
if is_dev_feature_enabled:
143+
assert settings.WEBSERVER_DEV_FEATURES_ENABLED is True
144+
assert settings.WEBSERVER_FUNCTIONS is True
145+
141146
assert settings.TEST_FOO is True
142147
assert settings.TEST_BAR == 42
143148
else:
149+
assert settings.WEBSERVER_DEV_FEATURES_ENABLED is False
150+
assert settings.WEBSERVER_FUNCTIONS is False
151+
144152
assert settings.TEST_FOO is False
145153
assert settings.TEST_BAR is None
146154

0 commit comments

Comments
 (0)