Skip to content

fix: normalize snake_case/camelCase in passthrough methods for consistent SDK API#348

Open
Hweinstock wants to merge 1 commit intoaws:mainfrom
Hweinstock:fix/snake-case-passthrough-v3
Open

fix: normalize snake_case/camelCase in passthrough methods for consistent SDK API#348
Hweinstock wants to merge 1 commit intoaws:mainfrom
Hweinstock:fix/snake-case-passthrough-v3

Conversation

@Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Mar 16, 2026

*Issue #, if available:*#336

Description of changes:

Problem

MemoryClient and MemorySessionManager expose some methods via __getattr__ passthrough to boto3, which requires camelCase kwargs (memoryId, clientToken), while explicit SDK methods accept snake_case (memory_id,
client_token). Users have no way to know which convention to use without reading the source.

See attached issue for an example.

Solution

  • Leverage a middleware layer to accept both conventions.
  • camelCase still works (backward compat), snake_case is converted to camelCase before forwarding to boto3.
  • Passing both forms for the same param (e.g. memory_id and memoryId) raises TypeError. Malformed snake_case (e.g. a__b, _private) is rejected with ValueError.
  • provide minimal validation of snake_case input to avoid accepting bad input.

Follows the existing __getattr__ pattern — no new public API surface.

Testing

  • unit tests
  • 1 integ test updated to use snake_case for update_memory passthrough (e2e verification)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Hweinstock Hweinstock changed the title fix: normalize snake_case/camelCase in passthrough methods for consis… fix: normalize snake_case/camelCase in passthrough methods for consisten SDK API Mar 16, 2026
@codecov-commenter
Copy link

codecov-commenter commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@f8710fa). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/bedrock_agentcore/memory/client.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #348   +/-   ##
=======================================
  Coverage        ?   90.96%           
=======================================
  Files           ?       44           
  Lines           ?     4094           
  Branches        ?      628           
=======================================
  Hits            ?     3724           
  Misses          ?      203           
  Partials        ?      167           
Flag Coverage Δ
unittests 90.96% <96.55%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Hweinstock Hweinstock changed the title fix: normalize snake_case/camelCase in passthrough methods for consisten SDK API fix: normalize snake_case/camelCase in passthrough methods for consistent SDK API Mar 16, 2026
@Hweinstock Hweinstock marked this pull request as ready for review March 16, 2026 18:39
@Hweinstock Hweinstock requested a review from a team March 16, 2026 18:40
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