Conversation
This comment has been minimized.
This comment has been minimized.
7469710 to
f30b5b7
Compare
This comment has been minimized.
This comment has been minimized.
f30b5b7 to
bc34fea
Compare
Codex AI reviewNo actionable findings. Residual risk: static review only; tests were not executed. Reviewed commit |
| connect_timeout=5, | ||
| read_timeout=50, | ||
| user_agent_extra=f"aws-durable-execution-sdk-python/{__version__}{'-bundled' if _is_in_var_dir() else ''}", | ||
| user_agent_extra=f"aws-durable-execution-sdk-python/{__version__.removesuffix('+bundled')}{'-bundled' if _is_bundled(__version__) else ''}", |
There was a problem hiding this comment.
the literal "+bundled" now appears twice (here and in _is_bundled), and this f-string does three things on one line.
I'd pull the mapping into one small helper next to _is_bundled, so there's one place that owns the label and one place to test the mapping directly:
_BUNDLED_LOCAL_LABEL: str = "+bundled"
def _is_bundled(version: str) -> bool:
"""True if the managed Lambda runtime appended the ``+bundled`` local label to this install."""
return version.endswith(_BUNDLED_LOCAL_LABEL)
def _user_agent_version(version: str) -> str:
"""Return the version segment reported in the boto3 user agent.
The managed runtime appends ``+bundled`` to ``__version__`` at image build
time. The user agent reports that install as ``<public version>-bundled``.
The ``-bundled`` form predates the label and matches the JS SDK, so existing
telemetry queries keep working. Any other local label is reported unchanged.
"""
if _is_bundled(version):
return f"{version.removesuffix(_BUNDLED_LOCAL_LABEL)}-bundled"
return version
and here:
user_agent_extra=f"aws-durable-execution-sdk-python/{_user_agent_version(__version__)}",
Reason: the two __version__-patched tests then become a plain parametrized test on _user_agent_version, with no boto3 mock needed. Not blocking.
|
|
||
| @patch( | ||
| "aws_durable_execution_sdk_python.lambda_service._is_in_var_dir", | ||
| "aws_durable_execution_sdk_python.lambda_service._is_bundled", |
There was a problem hiding this comment.
these two patch _is_bundled while the real __version__ (no label) flows through removesuffix, and the two new tests below patch __version__ and exercise the real _is_bundled. The new pair covers everything the old pair does. I'd keep the new pair and drop these two, or keep one of these purely as a "boto3 wiring" check. Also __version__.split('+')[0] in the assertions doesn't match the source's removesuffix behaviour; harmless today because __about__.py never carries a +, but it would diverge the day it does.
Issue #, if available:
N/A
Description of changes:
The managed runtime now stamps a
+bundledlocal version label onto the installed durable SDK. This update reads the stamp to determine if the SDK is installed in the managed runtime (replacing the old method of checking the installation folder, which was unreliable).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.