Skip to content

fix: remove unused Platform serialization code path - #648

Open
maxday wants to merge 5 commits into
mainfrom
maxday/remove-platform
Open

maxday wants to merge 5 commits into
mainfrom
maxday/remove-platform

Conversation

@maxday

@maxday maxday commented Sep 11, 2026

Copy link
Copy Markdown
Member

Issue #, if available:

Description of changes:

Target (OCI, Managed Runtime, both):

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@maxday
maxday force-pushed the maxday/remove-platform branch from a22f55f to 4570767 Compare September 11, 2026 18:45
@codecov

codecov Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.67%. Comparing base (e38423d) to head (efc77ff).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #648      +/-   ##
============================================
+ Coverage     66.03%   67.67%   +1.64%     
- Complexity      214      221       +7     
============================================
  Files            35       35              
  Lines           998      993       -5     
  Branches        143      139       -4     
============================================
+ Hits            659      672      +13     
+ Misses          287      271      -16     
+ Partials         52       50       -2     
Flag Coverage Δ
aarch64 67.67% <100.00%> (+1.64%) ⬆️
x86_64 67.27% <100.00%> (+1.63%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@maxday
maxday marked this pull request as ready for review September 11, 2026 19:00

@darklight3it darklight3it left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hey @maxday! 👋

I agree that simplifying this logic would be valuable.

However, I found a concrete compatibility concern that makes me hesitant to classify this path as unused: the AWS SDK for Android’s Lambda invoker automatically supplies the platform value that selects it.

Specifically:

This suggests that the runtime’s Gson path was intended to provide serialization semantics compatible with the Android client. I haven’t found an explicit statement confirming that intent. The AWS SDK for Android is now archived, and I couldn’t find this invoker or an equivalent direct-invocation API in the current Amplify Android repository. Existing applications may therefore still depend on the archived SDK and this behavior.

Since this PR changes both input deserialization and output serialization, I think we should treat it as potentially breaking for those callers. If you have additional information showing that this integration has been replaced, is no longer used, or that compatibility is otherwise covered, I’m happy to revisit that assessment.

If we decide to remove this path, I see three possible approaches:

  • Merge this change, remove Gson as a dependency, and release new major versions of both Serialization and the RIC from a separate branch. These versions could initially be used only by OCI-based functions and a future managed Java runtime. However, this would require maintaining the existing versions and backporting changes, so I would not recommend this approach at the moment.

  • Consolidate both paths on Jackson, while configuring and testing Jackson to preserve the serialization behavior expected by Android clients. If we can establish compatibility, we could remove Gson without introducing a breaking change.

  • Follow the migration path I documented last year: use a service-provider design to decouple serialization from the RIC, preserve the existing behavior by default, and allow customers to opt into a new implementation. This could also support a future Jackson major-version upgrade, although I would keep that as a separate design discussion rather than a prerequisite for this PR.

For the last option, separating these concerns internally would not necessarily require publishing every resulting module. In general, I think we should publish fewer libraries to Maven Central, each with a clear customer use case. For example, I don’t see a compelling reason for customers to consume our serialization implementation independently of the RIC.

Overall, I support the cleanup; I’d just like us to understand the compatibility impact and agree on a migration strategy before shipping it.

@darklight3it

Copy link
Copy Markdown
Collaborator

We decided to continue with the changes since the Android AWS SDK is officially deprecated.

darklight3it and others added 3 commits September 29, 2026 10:08
@maxday
maxday requested a review from darklight3it September 30, 2026 13:31
@darklight3it
darklight3it force-pushed the maxday/remove-platform branch 2 times, most recently from b690b2b to fdf58ff Compare October 9, 2026 11:40
@darklight3it
darklight3it force-pushed the maxday/remove-platform branch from fdf58ff to efc77ff Compare October 9, 2026 11:41
@darklight3it

darklight3it commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Ran a RIC test for the change. Results are here.

Android client context: RIC 2.12.1 vs this PR

Each handler echoes its input. Both images run the same handler jar and dependencies through the Runtime Interface Emulator and differ only in the RIC jar. Every handler is invoked with the client context the AWS Mobile SDK for Android sends, and without a client context as a control.

  • Run: 2026-10-09T11:24:18Z, aarch64, public.ecr.aws/amazoncorretto/amazoncorretto:21-al2023-headless
  • X-Amz-Client-Context (decoded): {"client":{"installation_id":"demo","app_title":"demo","app_version_name":"1.0","app_version_code":"1","app_package_name":"demo"},"custom":{},"env":{"platform":"Android","platform_version":"14","make":"Google","model":"Pixel","locale":"en_US"},"services":{}}

Summary

# Handler Request RIC 2.12.1, Android PR, Android Same without client context
1 privateFields {"name":"x"} {"name":"x"} {} yes
2 prefixedField {"mName":"x"} {"mName":"x"} {} yes
3 booleanIsField {"isActive":true} {"isActive":true} {"active":false} yes
4 noDefaultConstructor {"name":"x"} {"name":"x"} error: java.lang.RuntimeException: An error occurred during JSON parsing yes
5 dateField "" {"createdAt":"Jan 1, 2020, 12:00:00 AM"} {"createdAt":1577836800000} yes
6 computedGetter {"name":"x"} {"name":"x"} {"name":"x","displayName":"Name: x"} yes
7 readOnlyProperty {"locked":true} {"locked":true} {"locked":false} yes
8 transientField {"name":"x"} {"name":"x"} {"name":"x","cache":"y"} yes
9 untypedMap {"attributes":{"count":1}} {"attributes":{"count":1.0,"countType":"Double"}} {"attributes":{"count":1,"countType":"Integer"}} yes
10 nested {"inner":{"name":"x"},"items":[{"name":"y"}]} {"inner":{"name":"x"},"items":[{"name":"y"}]} {"inner":{},"items":[{}]} yes

"Same without client context" means RIC 2.12.1 and this PR return the same response without a client context, and it matches the PR's Android response: Android callers now get what every other caller already gets.

Per case

1. privateFields

Request: {"name":"x"}

RIC Client context Response
2.12.1 Android {"name":"x"}
2.12.1 none {}
PR Android {}
PR none {}
2. prefixedField

Request: {"mName":"x"}

RIC Client context Response
2.12.1 Android {"mName":"x"}
2.12.1 none {}
PR Android {}
PR none {}
3. booleanIsField

Request: {"isActive":true}

RIC Client context Response
2.12.1 Android {"isActive":true}
2.12.1 none {"active":false}
PR Android {"active":false}
PR none {"active":false}
4. noDefaultConstructor

Request: {"name":"x"}

RIC Client context Response
2.12.1 Android {"name":"x"}
2.12.1 none {"errorMessage":"An error occurred during JSON parsing","errorType":"java.lang.RuntimeException","stackTrace":[]}
PR Android {"errorMessage":"An error occurred during JSON parsing","errorType":"java.lang.RuntimeException","stackTrace":[]}
PR none {"errorMessage":"An error occurred during JSON parsing","errorType":"java.lang.RuntimeException","stackTrace":[]}

Runtime output (2.12.1, none):

An error occurred during JSON parsing: java.lang.RuntimeException
java.lang.RuntimeException: An error occurred during JSON parsing
Caused by: java.io.UncheckedIOException: com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `demo.Handlers$NoDefaultConstructor` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
Caused by: com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `demo.Handlers$NoDefaultConstructor` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
5. dateField

Request: ""

RIC Client context Response
2.12.1 Android {"createdAt":"Jan 1, 2020, 12:00:00 AM"}
2.12.1 none {"createdAt":1577836800000}
PR Android {"createdAt":1577836800000}
PR none {"createdAt":1577836800000}
6. computedGetter

Request: {"name":"x"}

RIC Client context Response
2.12.1 Android {"name":"x"}
2.12.1 none {"name":"x","displayName":"Name: x"}
PR Android {"name":"x","displayName":"Name: x"}
PR none {"name":"x","displayName":"Name: x"}
7. readOnlyProperty

Request: {"locked":true}

RIC Client context Response
2.12.1 Android {"locked":true}
2.12.1 none {"locked":false}
PR Android {"locked":false}
PR none {"locked":false}
8. transientField

Request: {"name":"x"}

RIC Client context Response
2.12.1 Android {"name":"x"}
2.12.1 none {"name":"x","cache":"y"}
PR Android {"name":"x","cache":"y"}
PR none {"name":"x","cache":"y"}
9. untypedMap

Request: {"attributes":{"count":1}}

RIC Client context Response
2.12.1 Android {"attributes":{"count":1.0,"countType":"Double"}}
2.12.1 none {"attributes":{"count":1,"countType":"Integer"}}
PR Android {"attributes":{"count":1,"countType":"Integer"}}
PR none {"attributes":{"count":1,"countType":"Integer"}}
10. nested

Request: {"inner":{"name":"x"},"items":[{"name":"y"}]}

RIC Client context Response
2.12.1 Android {"inner":{"name":"x"},"items":[{"name":"y"}]}
2.12.1 none {"inner":{},"items":[{}]}
PR Android {"inner":{},"items":[{}]}
PR none {"inner":{},"items":[{}]}
Images and jars

ric-old

SHA-256 Jar
0d173520f1f3 android-gson-demo-1.0.jar
fafdcb55f4e5 annotations-2.34.0.jar
575c24393cc1 aws-lambda-java-core-1.4.0.jar
2e7b8120f104 aws-lambda-java-runtime-interface-client-2.12.1.jar
0ab04580117a aws-lambda-java-serialization-1.4.1.jar
efaf784f07ae utils-lite-2.34.0.jar

ric-new

SHA-256 Jar
0d173520f1f3 android-gson-demo-1.0.jar
fafdcb55f4e5 annotations-2.34.0.jar
575c24393cc1 aws-lambda-java-core-1.4.0.jar
5c8bbd0e8dc8 aws-lambda-java-runtime-interface-client-2.12.1-SNAPSHOT.jar
0ab04580117a aws-lambda-java-serialization-1.4.1.jar
efaf784f07ae utils-lite-2.34.0.jar

This branch has not been deployed

No deployments
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