Skip to content

Adopt the shared Lambda mapper and qualify native request validation - #190

Merged
stevehu merged 7 commits into
masterfrom
fix-shared-lambda-runtime-mapper
Oct 27, 2026
Merged

stevehu merged 7 commits into
masterfrom
fix-shared-lambda-runtime-mapper

Conversation

@stevehu

@stevehu stevehu commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Use the shared LambdaRuntimeMappers.mapper() API in Main and test utilities instead of rebuilding the permissive event mapper. Compatibility tests use the public API rather than reflection.

Expand the Runtime smoke fixture to run OpenAPI specification and validation middleware, tolerate an unknown event field, validate referenced query/header/body schemas, reject invalid values in each, and check unknown-path (404) and method-mismatch (405) responses. Existing health and builder-error checks remain. Status and injection configuration are copied directly from the packaged application's config/status.yml and config/config.yml; the synthetic OpenAPI document and handler/validator settings remain explicit controlled fixtures.

Local validation using a task-owned Maven cache: full clean verify passed (98 tests, 4 skipped, zero failures or errors); 4 native packaging script tests passed. The expanded smoke passed through the JVM Runtime. GraalVM execution is covered separately by this PR's CI; no live AWS execution.

The expanded native smoke exposed missing fixture configuration and native metadata. The fixture now supplies service and validation-error status configuration explicitly. reflect.json registers getOverlay() on MapOverlay$1 and ListOverlay$1, plus SSMS.FACTORY and the PSMS no-argument constructor required by the fixed OpenAPI path cache. The corrected JVM smoke and a local GraalVM native build/smoke both pass all four paths. Local native compilation used the cached community Java 25 image, four build threads and a 4 GB heap. No library behavior or general cache configuration changed.

Prior-head remote CI: https://github.com/networknt/light-lambda-native/actions/runs/40503060286 passed at 5a8725c270ee265de73a50be9dcaf2f454493e6f. Downloaded reports confirm 98 tests, 4 skipped, zero failures/errors; the strict artifact audit has no failures and no Jackson 2 dependencies. That run built the earlier AWS stack candidate 9d59c6a74112a15f702cfd76ceb401680ad05518. Logs contain both native smoke success markers, covering API Gateway binding, health, builder-error serialization, unknown event fields and referenced query-schema rejection.

Both AWS prerequisites are now merged: networknt/light-aws-lambda#169 and networknt/light-aws-lambda#170. The manifest pins actual AWS master 5913c7c25b01b6d384fd9c39014dc91d63dfc35e, the #170 squash merge, which includes #169's merge as an ancestor. All other pins are unchanged, and the workflow's manifest validation passes locally.

Review follow-up 13585d518fc61b81793972ee903f7edffab8b909: test imports/spacing are cleaned up, and the expanded eight-invocation fixture passes through both the JVM Runtime and the existing locally built GraalVM executable. All 3 focused Java compatibility tests pass with no skips/failures/errors. The local executable was built before the merged AWS repin; current-head CI remains the authority for the complete pinned stack.

The application reflection entries remain intentionally until equivalent metadata ships from their owning libraries. README records the exact entries and requires coordinated consumer migration with updated source pins and native smoke results before removing them. No cross-repository metadata move or general default-resource qualification is claimed by this PR.

Current-head CI: https://github.com/networknt/light-lambda-native/actions/runs/40512704226 is pending. This is the source/native qualification against merged AWS master; earlier green runs do not substitute for it. Keep this PR draft until the current run succeeds and its source pins, strict artifact audit and expanded native smoke results are checked.

@stevehu stevehu changed the title Adopt the shared Lambda runtime mapper Adopt the shared Lambda mapper and qualify native request validation Oct 27, 2026
@stevehu

stevehu commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Review of head 0768962. I read the diff and the head files and checked GitHub read-only; I did not run any build. The test run on this head was still in progress and the PR is still a draft. I found no blockers.

State I checked: #168, #169 and #170 are merged, AWS master is 5913c7c (#170), and the manifest now pins exactly that SHA, so this PR is the first to qualify against merged AWS master. The earlier green run built an older candidate, as the description says, so I would wait for the current run (checking the source pins, the strict artifact audit and both native smoke markers) before leaving draft.

The change itself looks right: Main and the test utilities use LambdaRuntimeMappers.mapper(), the reflection-based tests are gone, and the smoke now runs the specification and validator middleware with an unknown event field and a count=invalid query rejected through a referenced schema (400 and ERR11004).

Four minor points:

  1. Third-party reflection metadata per app. reflect.json now has hand-written entries for Caffeine SSMS/PSMS and jsonoverlay MapOverlay$1/ListOverlay$1, and light-gateway carries its own copy of the Caffeine entries (it also lists SS, which this file does not). Each native consumer rediscovers the same entries by failing a smoke test, and the lists drift. They belong with the owning libraries or in one shared file.
  2. Single validation path in the smoke. It covers one query parameter validated through a referenced schema. A native-only failure in body or header validation (the paths the AWS PRs changed: RequestValidator, StringNode, the schema copies) would ship green. One case with a JSON body against a referenced object schema would exercise the heavier overlay path.
  3. Private status catalog. The fixture writes its own ERR11004 text, which can diverge from the shipped catalog. The comment explains why native cannot read JVM resources, and the test asserts only the code, so this is a note.
  4. Style. Jackson3NativeCompatibilityTest has a leftover double blank line and a wildcard static import after the reflection helper was removed.

@stevehu

stevehu commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Review of head 13585d5. I read the delta and the workflow and ran nothing. The PR is still a draft and test had no result yet when I looked.

My earlier points look addressed or accepted. The smoke now covers a valid query, header and body, and invalid query, header and body (400 ERR11004), an unknown path (404 ERR10007) and a method mismatch (405 ERR10008), plus the builder-error case. It reads config/status.yml and config/config.yml from the shaded lambda-native-*.jar instead of a private copy, and says the fixture settings are not default-config qualification. The test imports and spacing are tidy, and the README documents the version-specific reflection entries and that moving them is deferred, which is fine.

Two small notes, neither blocking:

  1. One launch per case. The smoke starts the native binary once per case (eight launches), each with its own temp config and mock Runtime API, so CI time grows with each case and the startups are the slowest part. One process serving several queued events would also be closer to how Lambda's Runtime API loop works.
  2. Jar lookup by glob. It finds the jar through target/lambda-native-*.jar and fails unless exactly one matches, so a stale jar from an earlier version breaks a local run until --application-jar is given. CI is unaffected because it runs clean install. Reading the final name from the metadata native-image-linux.sh already evaluates would remove the glob.

I would wait for the current-head test run, which covers the expanded native cases, before leaving draft.

@stevehu
stevehu marked this pull request as ready for review October 27, 2026 13:37
Copilot AI balanced review requested due to automatic review settings October 27, 2026 13:37

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@stevehu
stevehu merged commit 5ba49d7 into master Oct 27, 2026
1 check passed
@stevehu
stevehu deleted the fix-shared-lambda-runtime-mapper branch October 27, 2026 13:41
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