Skip to content

feat(web_core): add MessageErrorMapper, JSON Pointer error paths, and conformance parity - #3579

Merged
gspencergoog merged 8 commits into
mainfrom
feat/web-core-conformance-parity
Oct 29, 2026
Merged

gspencergoog merged 8 commits into
mainfrom
feat/web-core-conformance-parity

Conversation

@gspencergoog

@gspencergoog gspencergoog commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implement renderer-to-agent outbound error mapping, RFC 6901 JSON Pointer error paths, and headless core conformance runner parity in @a2ui/web_core.

Reviewer Focus

  • typescript/core/web_core/src/processing/message-error-mapper.ts:
    • extractEnvelopeErrorContext and mapErrorToRendererMessage map internal core errors to versioned ErrorMessage envelopes across v0.9, v0.9.1, and v1.0 protocols.
    • Correlation of functionCallId for envelope-level faults on callRendererFunction.
    • Normalization of RFC 6901 JSON Pointer paths (/components/0, /components/0/children/1).
  • Dual-path error emission in MessageProcessor.ts and SurfaceGroupModel.ts:
    • Mapped ErrorMessage payloads are dispatched to surface.onError, model.onError, and outboundListener callbacks before errors are re-thrown in processMessages.
    • processMessagesWithErrors provides a non-throwing alternative for batch processing.
  • Action context resolution in GenericBinder.ts:
    • Resolves individual entries in event.context without treating literal map keys path or call as binding directives.

Unit tests and CHANGELOG updates can be skimmed.

Changes

  • Outbound error mapping:
    • Added src/processing/message-error-mapper.ts implementing MessageErrorMapper, extractEnvelopeErrorContext, and normalizeJsonPointer.
    • Re-exported error mapper utilities from src/processing/index.ts, src/v0_9/index.ts, and src/v1_0/index.ts.
  • Error processing and event emission:
    • Added onError event hooks to SurfaceGroupModel and SurfaceComponentsModel.
    • Added processMessagesWithErrors to MessageProcessor.
    • Updated MessageProcessor.processMessages to emit mapped ErrorMessage instances to error listeners before rethrowing.
  • Structured validation paths:
    • Updated payload-validator.ts and validation-helpers.ts to emit structured A2uiErrorDetail lists with canonical RFC 6901 JSON Pointer paths.
  • Context binding and resolution:
    • Updated GenericBinder in src/resolution/generic-binder.ts to evaluate action context entries individually.
    • Aligned NodeResolver diagnostics with conformance expectations.
  • Conformance test harness:
    • Updated tests/conformance/conformance_test.mjs and tests/conformance/node-resolution.ts to validate expectError.details, expectError.rendererError, strictMode, ValidationResult severity properties (isValid, validationErrors, validationResults), and surfaceId-scoped RPC dispatch.
  • Documentation:
    • Updated CHANGELOG.md for @a2ui/web_core.

Impact & Risks

  • Outbound ErrorMessage notifications are now emitted when processing invalid messages, giving agents structured feedback on protocol violations.
  • Existing callers of MessageProcessor.processMessages continue to receive thrown errors; error listener callbacks are invoked prior to the throw.
  • Action context bindings now cleanly separate literal dictionary keys from binding directives.

Testing

Run the build, conformance tests, and linter:

yarn --cwd typescript/core/web_core build
yarn --cwd typescript/core/web_core test:conformance
yarn --cwd typescript/core/web_core lint

🤖 Agent-generated

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces structured outbound renderer error mapping and reporting. It adds helper utilities mapErrorToRendererMessage and extractEnvelopeErrorContext to map internal A2uiError instances into spec-compliant ErrorMessage envelopes, and updates MessageProcessor to emit these errors via errorHandler, onError, and a new processMessagesWithErrors method. Additionally, it enhances validation errors with precise RFC 6901 JSON Pointer paths and updates conformance tests to validate these behaviors. The review feedback suggests replacing the in operator with Object.hasOwn in several files to avoid potential prototype lookup issues.

Comment thread typescript/core/web_core/src/catalog/types.ts Outdated
Comment thread typescript/core/web_core/src/processing/adapters/v1_0.ts
Comment thread typescript/core/web_core/src/processing/message-error-mapper.ts Outdated
@gspencergoog
gspencergoog force-pushed the feat/web-core-conformance-parity branch from 9f1b254 to 720309d Compare October 27, 2026 15:58
@gspencergoog
gspencergoog removed this pull request from stack #3588 October 27, 2026 16:00
@gspencergoog
gspencergoog changed the base branch from main to fix/dynamic-boolean-coercion October 27, 2026 16:00
@gspencergoog
gspencergoog added this pull request to stack #3654 October 27, 2026 16:00
@gspencergoog
gspencergoog force-pushed the feat/web-core-conformance-parity branch 2 times, most recently from c53e138 to c23724a Compare October 27, 2026 16:24
@gspencergoog
gspencergoog removed this pull request from stack #3654 October 27, 2026 17:10
@gspencergoog
gspencergoog added this pull request to stack #3655 October 27, 2026 17:12
@gspencergoog
gspencergoog force-pushed the feat/web-core-conformance-parity branch from c23724a to dea7347 Compare October 27, 2026 17:18
@gspencergoog
gspencergoog marked this pull request as ready for review October 27, 2026 19:32
@gspencergoog
gspencergoog requested a review from ditman October 27, 2026 19:47
@gspencergoog
gspencergoog force-pushed the feat/web-core-conformance-parity branch 3 times, most recently from c237880 to 862a59b Compare October 27, 2026 21:52
Base automatically changed from fix/dynamic-boolean-coercion to main October 27, 2026 23:51
@gspencergoog
gspencergoog requested a review from nan-yu October 28, 2026 00:06
@gspencergoog
gspencergoog force-pushed the feat/web-core-conformance-parity branch 3 times, most recently from a0164e5 to 1cac8c9 Compare October 28, 2026 21:50

@ditman ditman 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.

Thanks for taking a stab at this. I unleashed Carbon on this and it found a few things; most of them actually look legit, I'm surprised. LMK if things are not actionable enough, I can ask it to be more specific or prepare better suggestions!

Comment thread typescript/core/web_core/tests/conformance/conformance_test.mjs Outdated
Comment thread typescript/core/web_core/tests/conformance/node-resolution.ts Outdated
Comment thread typescript/core/web_core/tests/conformance/conformance_test.mjs Outdated
Comment thread typescript/core/web_core/src/processing/message-error-mapper.ts Outdated
Comment thread typescript/core/web_core/src/processing/message-error-mapper.ts
Comment thread typescript/core/web_core/src/state/validation-helpers.ts Outdated
Comment thread typescript/core/web_core/src/resolution/data-context.ts Outdated
Comment thread typescript/core/web_core/src/v1_0/index.ts Outdated
Comment thread typescript/core/web_core/src/v0_9/index.ts Outdated
Comment thread typescript/core/web_core/CHANGELOG.md Outdated
@gspencergoog
gspencergoog force-pushed the feat/web-core-conformance-parity branch 2 times, most recently from 7fe475c to 7dccce8 Compare October 29, 2026 00:55
@gspencergoog
gspencergoog force-pushed the feat/web-core-conformance-parity branch from 7dccce8 to 05bcd94 Compare October 29, 2026 16:55
@gspencergoog
gspencergoog removed this pull request from stack #3655 October 29, 2026 17:01

@ditman ditman 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.

Thanks for addressing the Round 1 feedback. Can you please fix the small leftover from earlier?

  • Breaking OutboundMessageListener union widening (src/rpc/rpc-handler.ts): Now that MessageProcessor.handleProcessingError routes errors exclusively through errorHandler / onError and no longer calls outboundListener, OutboundMessageListener never receives ErrorMessage. Reverting rpc-handler.ts avoids an unannounced breaking compile-time change for @a2ui/web_core/v1_0 consumers narrowing OutboundMessageListener's message parameter.

The rest of my comments are nits, take as needed!

Comment thread typescript/core/web_core/src/rpc/rpc-handler.ts Outdated
Comment thread typescript/core/web_core/tests/conformance/conformance_test.mjs Outdated
Comment thread typescript/core/web_core/src/processing/message-processor.ts
Comment thread typescript/core/web_core/src/processing/message-error-mapper.ts Outdated
Comment thread typescript/core/web_core/src/resolution/generic-binder.ts Outdated
…closures

Revert OutboundMessageListener to omit ErrorMessage so @a2ui/web_core/v1_0
callers are not widened, drop redundant ProcessingErrorMessage and ErrorMessage
aliases from message-error-mapper, track per-item ErrorEnvelopeContext during
prepareOperations across multi-message arrays, restore async closure syntax in
GenericBinder.bindAction, and remove the duplicate strictMode spread in
conformance_test.mjs.
@gspencergoog
gspencergoog merged commit cf92be7 into main Oct 29, 2026
55 of 60 checks passed
@gspencergoog
gspencergoog deleted the feat/web-core-conformance-parity branch October 29, 2026 20:58
@github-project-automation github-project-automation Bot moved this from Todo to Done in A2UI Oct 29, 2026
gspencergoog added a commit to gspencergoog/A2UI that referenced this pull request Oct 29, 2026
Resolve conflicts in @a2ui/web_core with PR a2ui-project#3579 (DataContext.resolveAction delegation, MessageErrorMapper, and node-resolution conformance steps) while preserving ActionDispatchOptions and extension metadata propagation.
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