Skip to content

fix(core): detect bundled SDK via version stamp - #717

Open
nvasiu wants to merge 1 commit into
mainfrom
feat/bundled-stamp-detection
Open

nvasiu wants to merge 1 commit into
mainfrom
feat/bundled-stamp-detection

Conversation

@nvasiu

@nvasiu nvasiu commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available:

N/A

Description of changes:

The managed runtime now stamps a +bundled local 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.

@nvasiu
nvasiu deployed to ai-pr-review-runtime September 10, 2026 18:04 — with GitHub Actions Active
@nvasiu
nvasiu deployed to ai-pr-review-runtime September 10, 2026 18:12 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@nvasiu
nvasiu force-pushed the feat/bundled-stamp-detection branch from 7469710 to f30b5b7 Compare September 15, 2026 22:39
@nvasiu
nvasiu deployed to ai-pr-review-runtime September 15, 2026 22:45 — with GitHub Actions Active
@github-actions

This comment has been minimized.

@nvasiu
nvasiu force-pushed the feat/bundled-stamp-detection branch from f30b5b7 to bc34fea Compare September 15, 2026 23:12
@nvasiu
nvasiu deployed to ai-pr-review-runtime September 15, 2026 23:13 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

Codex AI review

No actionable findings. Residual risk: static review only; tests were not executed.

Reviewed commit bc34feaedc219cb224cad8d13eefa11f75373951. Workflow run

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 ''}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants