Repository navigation
Allow finalize hooks to be installed on awslambdaric 4.x - #43
Conversation
awslambdaric 4.x (Lambda Managed Instances / multi-concurrent support) relocated post_invocation_result/post_invocation_error off LambdaRuntimeClient onto a shared BaseLambdaRuntimeClient, subclassed by both the standard LambdaRuntimeClient and the new LambdaMultiConcurrentRuntimeClient. Patch that base class for 4.x so the finalize hooks fire in both standard and multi-concurrent runtime paths. Add version-branch tests covering 2.x/3.x, 4.x (standard + multi-concurrent) and the unsupported-version error path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This PR is missing a Jira ticket reference in the title or description. |
|
🥷 Code experts: jpogozelski-xoi jpogozelski-xoi has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
There was a problem hiding this comment.
Pull request overview
Extends xoto3.lam.finalize to support awslambdaric 4.x by installing post-invocation finalize hooks on the new shared runtime client base class, ensuring hooks run in both standard and multi-concurrent (LMI) execution paths.
Changes:
- Update finalize hook installation to patch a target runtime client class (2.x/3.x:
bootstrap.LambdaRuntimeClient; 4.x:lambda_runtime_client.BaseLambdaRuntimeClient). - Add isolated subprocess-based tests that validate hook behavior across awslambdaric 2.x, 3.x, 4.x (standard + multi-concurrent), and unsupported majors.
- Bump project version to 2.2.0 and document the awslambdaric 4.x support in
CHANGES.md.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| xoto3/lam/finalize.py | Add awslambdaric 4.x-aware hook installation by patching BaseLambdaRuntimeClient. |
| tests/xoto3/lam/finalize_test.py | New coverage validating finalize hooks across awslambdaric majors using synthetic packages in fresh interpreters. |
| pyproject.toml | Version bump to 2.2.0. |
| CHANGES.md | Changelog entry for 2.2.0 noting awslambdaric 4.x finalize support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add a second matrix axis to the unit-test job covering awslambdaric 2.x, 3.x and 4.x. Wheel availability is ragged (2.x stops at cp312, 3.x at cp314, 4.x at cp315), so the axis is an explicit include list of only installable (python, awslambdaric) pairs rather than a full cross-product. The 3.15 x 4.x cell is marked experimental (allow-prereleases + continue-on-error) for future-proofing. The mypy job is unchanged since it does not depend on the awslambdaric version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a weekly (and manually dispatchable) workflow that installs the latest awslambdaric unconstrained and asserts xoto3.lam.finalize still installs its post-invocation hook onto the real runtime client. A future major that finalize does not yet handle leaves the hook uninstalled, so the canary fails and flags that a new supported code path is needed -- the check that would have caught 4.0 automatically. scripts/canary_check.py exercises the real awslambdaric wheel, complementing the hermetic synthetic-package unit tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
awslambdaric4.x inxoto3.lam.finalize, mirroring Allow xoto3.lam.finalize to run on awslambdaric 3.x #37 (which did the same for 3.x).post_invocation_result/post_invocation_erroroffLambdaRuntimeClientonto a new sharedBaseLambdaRuntimeClient.LambdaRuntimeClient(standard mode) andLambdaMultiConcurrentRuntimeClient(multi-concurrent mode). Patching the base class for 4.x makes the finalize hooks fire in both runtime paths — patching onlyLambdaRuntimeClientwould silently skip multi-concurrent workers.finalizerelies on is otherwise unchanged; 4.x adds aninvocation_idpositional to the post-invocation methods, which the existing*args, **kwargswrapper already absorbs.Changes
xoto3/lam/finalize.py__install_post_invocation_hooksto take the target client class instead of thebootstrapmodule.bootstrap.LambdaRuntimeClient; 4.x → patchlambda_runtime_client.BaseLambdaRuntimeClient; else log unimplemented.tests/xoto3/lam/finalize_test.py(new; finalize previously had no coverage)awslambdaricpackage (sidesteps import-time hook-install state).pyproject.toml/CHANGES.md2.1.0→2.2.0+ changelog entry. (Dev-dep boundawslambdaric = ">=2.0.0"already permits 4.x — unchanged.)Testing
poetry run pytest tests→ 125 passed (new finalize tests included).poetry run mypy xoto3→ clean (also clean on the new test file).black/isortapplied per the pinned pre-commit revs.