Skip to content

feat: expose AWS request_id response metadata for JSON and Query protocols#34

Merged
chris-armstrong merged 3 commits into
mainfrom
response-metadata
Jul 6, 2026
Merged

feat: expose AWS request_id response metadata for JSON and Query protocols#34
chris-armstrong merged 3 commits into
mainfrom
response-metadata

Conversation

@chris-armstrong

Copy link
Copy Markdown
Owner

Exposes AWS request IDs returned in responses by adding a Smaws_Lib.Response metadata wrapper and generating request_with_metadata operation bindings alongside the existing request ones.

Changes:

  • Add Smaws_Lib.Response module (response + request_id metadata)
  • Track x-amzn-requestid / x-amz-request-id headers in AwsJson
  • Extract <ResponseMetadata>/<RequestId> in AwsQuery response parsing
  • Generate both request and request_with_metadata for JSON and Query protocol operations
  • Regenerate all affected SDKs and protocol conformance tests

Runtime + codegen build and tests pass.

…ocols

- Add Smaws_Lib.Response module (response + request_id metadata)
- Track x-amzn-requestid/x-amz-request-id in AwsJson.request_with_metadata
- Extract <ResponseMetadata>/<RequestId> in AwsQuery response parser
- Generate both request and request_with_metadata bindings for JSON/Query ops
- Update AwsQuery response parser regression test for new tuple return type
Re-run code generation so the new request_with_metadata operation
bindings and updated mli/serializer interfaces are reflected across
all generated SDKs and aws.protocoltests.json/aws.protocoltests.query
conformance tests.

@chris-armstrong chris-armstrong left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Missing response metadata on error part of result, revising

…protocols

- AwsJson.request_with_metadata now returns Error(error, { request_id }),
  extracting x-amzn-requestid/x-amz-request-id for both success and errors.
- AwsQuery.request_with_metadata now extracts <RequestId> from <ErrorResponse>
  and returns Error(error, { request_id }).
- Update generated mli signatures to (output Response.t, error * Response.metadata) result.
- Add regression tests for JSON error metadata and Query error RequestId.
- Update STS example to use request_with_metadata and print request_id.
- Add STS GetCallerIdentityError example using invalid credentials to exercise
  the error metadata path against live AWS.
@chris-armstrong
chris-armstrong merged commit 77d499c into main Jul 6, 2026
3 checks passed
chris-armstrong added a commit that referenced this pull request Jul 17, 2026
Land the restXml protocol implementation plan (`refactorings/restxml-protocol.md`
+ `.todo.md`), revised after a three-agent review (plan-vs-codebase audit,
spec-conformance audit, guidelines/risk audit) against the current tree
(AwsQuery is already on main via PRs #33/#34/#35).

Key plan changes from the original draft:

- Re-baseline the current-state inventory against main (AwsQuery is
  context-based; Protocol.t dispatch exists; AwsProtocolQuery.ml is the codegen
  template; appliesTo/Float/Stack.Empty fixes present; shape count 21->23).
- Reclassify xmlNamespace `prefix` (G6b) as a blocker — the conformance model
  requires it; add service-level default namespace handling.
- Resolve Q3: httpPayload on a structure emits the structure's own root element
  as the body (not bare members). Fix httpPayload blob = raw, not base64.
- Add missing conformance-required behaviors to scope: httpResponseCode,
  idempotencyToken auto-fill, enum/intEnum, per-binding timestamp defaults,
  httpQuery/httpQueryParams precedence, greedy-label "/" non-encoding,
  empty-prefix httpPrefixHeaders + httpHeader precedence, list-valued
  httpQueryParams, null/empty handling, xmlNamespace on list/map/members,
  endpoint/hostLabel host-prefix substitution.
- State the noErrorWrapping root (<Error>) definitively; correct the false claim
  that the targeted namespaces exercise it (they use the wrapped envelope;
  noErrorWrapping is for S3, Phase 9).
- Fold the AwsQuery review failure modes into the design: skip-siblings in the
  error-envelope parse, Failure catch, separate RestXml.Error (not folded into
  the JSON-shaped AwsErrors), String.equal error dispatch, strengthened Phase
  5/6 checkpoints, full-envelope error mock.
- Ban the two requestCompression test IDs (out of scope; separate plan).
- Resolve Q1-Q6.

No restXml implementation yet; plan only.
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.

1 participant