Skip to content

fix(dart/core): report unknown envelope keys at their paths - #4197

Merged
polina-c merged 1 commit into
a2ui-project:mainfrom
leoafarias:fix/envelope-key-path
Nov 20, 2026
Merged

polina-c merged 1 commit into
a2ui-project:mainfrom
leoafarias:fix/envelope-key-path

Conversation

@leoafarias

Copy link
Copy Markdown
Contributor

Description

Fixes #4194.

MessageProcessor sends path: "/version" for an unknown envelope key (extra next to createSurface) and for a misspelled type (createSurfac), so an agent correcting its message edits the wrong field. _inferEnvelopeDetail picks /version because the unknown-key message always contains "Expected 'version'".

Solution

  1. _readEnvelope now sets the rejected key as the error's JSON Pointer, so extra reports /extra and createSurfac reports /createSurfac.
  2. _inferEnvelopeDetail uses that pointer when it names a top-level key of the envelope; other errors keep the existing inference. Details keep their dot paths, like messages.1.extra.
  3. Updated dart/a2ui_core/CHANGELOG.md.

Verification

  1. Added 8 tests to dart/a2ui_core/test/processor_test.dart: both cases, pointer escaping, a key containing version and the detail path, plus controls for an unsupported version, a valid message and a body error. The five unknown-key tests fail on main.
  2. dart test in dart/a2ui_core passes (2,370 tests, conformance suite included), and so do dart analyze and scripts/fix_format.sh --check.

Pre-launch Checklist

One time:

For this PR:

  • I have updated the relevant CHANGELOG.md file.
  • I updated/added relevant documentation.
  • My code changes (if any) have tests.
  • If my branch is on a fork, I have verified that scripts/e2e_test.sh passes.

I haven't run a sample or scripts/e2e_test.sh: both need an agent backed by a live model and an API key I don't have set up here.

If you need help, consider asking for advice on the discussion board.

@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 updates the MessageProcessor to report unknown envelope keys and misspelled message types at the key's JSON Pointer instead of /version. It also ensures that validation error details retain dot paths and the message index. Comprehensive unit tests have been added to verify these changes. I have no further feedback to provide.

@github-actions github-actions Bot added the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Nov 12, 2026
@Varun-S10 Varun-S10 self-assigned this Nov 13, 2026
@github-actions github-actions Bot removed the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Nov 13, 2026
@Varun-S10

Copy link
Copy Markdown
Collaborator

Hi @leoafarias, thank you for raising this PR and we verified that it reports unknown envelope keys at their own JSON Pointer path. The pr will be reviewed. Thank you for your patience and understanding.
Hi @gspencergoog, could you please take a look?

@github-actions github-actions Bot added the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Nov 20, 2026
@polina-c

Copy link
Copy Markdown
Collaborator

From triage bot, suggestion:

For humans

TL;DR
Case: this PR fixes a small Dart core bug, with tests, and is already queued for review.
Suggestion: review it, assign gspencergoog and add the type and component labels.

Summary:
The PR makes the Dart a2ui_core MessageProcessor report an unknown envelope key, such as extra or the misspelled createSurfac, at its own JSON Pointer instead of /version. It fixes #4194 and adds 8 tests.

Targeted issues:
#4194

Suggestion:
Assign gspencergoog to review the PR, and add type: bug and component: core sdk. Varun-S10 assigned themselves, verified the fix and asked gspencergoog to take a look a week ago, but no team member has reviewed the PR yet. gspencergoog is an owner of the file: they wrote 7 of the last 20 commits to processor.dart, as many as nan-yu.

The PR meets the review criteria:

  1. It is a small bug fix with tests. The bug is still on main: _inferEnvelopeDetail returns /version for every error whose message contains version, and the unknown-key message always does.
  2. It does not overlap with other work. Five other open PRs change processor.dart (#3304, #4170, #4261, #4114 and #2265), but none of them changes the envelope error code, and the PR has no merge conflicts.
  3. The team can maintain it: the change adds 21 lines of library code, in processor.dart and messages.dart, plus tests.

Its CI runs on the latest commit wait for a maintainer to approve them.

  1. Add labels: type: bug, component: core sdk
  2. Assign: gspencergoog

To adjust and apply this suggestion, run in your a2ui checkout:

tools/internal/triage_new/triage_ui.sh https://github.com/a2ui-project/a2ui/pull/4197
For software
<a2ui>
root = TriageSuggestion(
  tldr="""Case: this PR fixes a small Dart core bug, with tests, and is already queued for review.
Suggestion: review it, assign `gspencergoog` and add the type and component labels.""",
  summary="The PR makes the Dart `a2ui_core` `MessageProcessor` report an unknown envelope key, such as `extra` or the misspelled `createSurfac`, at its own JSON Pointer instead of `/version`. It fixes [#4194](https://github.com/a2ui-project/a2ui/issues/4194) and adds 8 tests.",
  suggestion="""Assign `gspencergoog` to review the PR, and add `type: bug` and `component: core sdk`. `Varun-S10` assigned themselves, [verified](https://github.com/a2ui-project/a2ui/pull/4197#issuecomment-6847320743) the fix and asked `gspencergoog` to take a look a week ago, but no team member has reviewed the PR yet. `gspencergoog` is an owner of the file: they wrote [7 of the last 20 commits](https://github.com/a2ui-project/a2ui/commits/main/dart/a2ui_core/lib/src/processing/processor.dart) to `processor.dart`, as many as `nan-yu`.

The PR meets the review criteria:

1. It is a small bug fix with tests. The bug is still on `main`: [`_inferEnvelopeDetail`](https://github.com/a2ui-project/a2ui/blob/172cf31e1acbce31c4e60d82b2edbd923b279dd8/dart/a2ui_core/lib/src/processing/processor.dart#L587-L597) returns `/version` for every error whose message contains `version`, and the unknown-key message always does.
2. It does not overlap with other work. Five other open PRs change `processor.dart` ([#3304](https://github.com/a2ui-project/a2ui/pull/3304), [#4170](https://github.com/a2ui-project/a2ui/pull/4170), [#4261](https://github.com/a2ui-project/a2ui/pull/4261), [#4114](https://github.com/a2ui-project/a2ui/pull/4114) and [#2265](https://github.com/a2ui-project/a2ui/pull/2265)), but none of them changes the envelope error code, and the PR has no merge conflicts.
3. The team can maintain it: the change adds 21 lines of library code, in `processor.dart` and `messages.dart`, plus tests.

Its CI runs on the latest commit [wait for a maintainer](https://github.com/a2ui-project/a2ui/pull/4197/checks) to approve them.""",
  added_labels=["type: bug", "component: core sdk"],
  new_assignees=["gspencergoog"],
  targeted_issues=[4194]
)
</a2ui>

🤖 Agent-generated

@polina-c

Copy link
Copy Markdown
Collaborator

From triage bot, suggestion:

For humans

TL;DR
Case: this PR fixes a small Dart core bug, with tests, for a P2 issue.
Suggestion: review it, and add the type and component labels.

Summary:
The PR makes the Dart a2ui_core MessageProcessor report an unknown envelope key, such as extra or the misspelled createSurfac, at its own JSON Pointer instead of /version. It fixes #4194 and adds 8 tests.

Targeted issues:
#4194

Suggestion:
Review the PR, and add type: bug and component: core sdk.

Suggest no assignee, because no team member has submitted a review. Varun-S10, who is assigned, verified the fix and asked gspencergoog to take a look. Only gemini-code-assist reviewed it, and bot reviews do not count. A possible reviewer is gspencergoog, who wrote 7 of the last 20 commits to processor.dart, as many as nan-yu.

The PR meets the review criteria:

  1. It is a small bug fix with tests: 21 added lines of library code and 130 lines of tests. The bug is still on main: _inferEnvelopeDetail returns /version for every error whose message contains version, and the unknown-key message always does.
  2. It does not overlap with other work. Six other open PRs change processor.dart (#2265, #3304, #4114, #4170, #4261 and #4336), but none of them changes the envelope error code, no other open PR changes messages.dart, and this PR has no merge conflicts with main.
  3. The team can maintain it: the fix sets a JSON Pointer on the unknown-key error, and _inferEnvelopeDetail uses it before its existing inference.

Its CI runs on the latest commit wait for a maintainer to approve them.

  1. Add labels: type: bug, component: core sdk

Reply:

Thanks for the fix and the tests. This is a small bug fix for #4194, so we will review it.

To adjust and apply this suggestion, run in your a2ui checkout:

tools/internal/triage_new/triage_ui.sh https://github.com/a2ui-project/a2ui/pull/4197
For software
<a2ui>
root = TriageSuggestion(
  tldr="""Case: this PR fixes a small Dart core bug, with tests, for a P2 issue.
Suggestion: review it, and add the type and component labels.""",
  summary="The PR makes the Dart `a2ui_core` `MessageProcessor` report an unknown envelope key, such as `extra` or the misspelled `createSurfac`, at its own JSON Pointer instead of `/version`. It fixes [#4194](https://github.com/a2ui-project/a2ui/issues/4194) and adds 8 tests.",
  suggestion="""Review the PR, and add `type: bug` and `component: core sdk`.

Suggest no assignee, because no team member has submitted a review. `Varun-S10`, who is assigned, [verified](https://github.com/a2ui-project/a2ui/pull/4197#issuecomment-6847320743) the fix and asked `gspencergoog` to take a look. Only `gemini-code-assist` [reviewed](https://github.com/a2ui-project/a2ui/pull/4197#pullrequestreview-5879203775) it, and bot reviews do not count. A possible reviewer is `gspencergoog`, who wrote 7 of the [last 20 commits](https://github.com/a2ui-project/a2ui/commits/main/dart/a2ui_core/lib/src/processing/processor.dart) to `processor.dart`, as many as `nan-yu`.

The PR meets the review criteria:

1. It is a small bug fix with tests: 21 added lines of library code and 130 lines of tests. The bug is still on `main`: [`_inferEnvelopeDetail`](https://github.com/a2ui-project/a2ui/blob/172cf31e1acbce31c4e60d82b2edbd923b279dd8/dart/a2ui_core/lib/src/processing/processor.dart#L587-L597) returns `/version` for every error whose message contains `version`, and the [unknown-key message](https://github.com/a2ui-project/a2ui/blob/172cf31e1acbce31c4e60d82b2edbd923b279dd8/dart/a2ui_core/lib/src/core/messages.dart#L256-L259) always does.
2. It does not overlap with other work. Six other open PRs change `processor.dart` ([#2265](https://github.com/a2ui-project/a2ui/pull/2265), [#3304](https://github.com/a2ui-project/a2ui/pull/3304), [#4114](https://github.com/a2ui-project/a2ui/pull/4114), [#4170](https://github.com/a2ui-project/a2ui/pull/4170), [#4261](https://github.com/a2ui-project/a2ui/pull/4261) and [#4336](https://github.com/a2ui-project/a2ui/pull/4336)), but none of them changes the envelope error code, no other open PR changes `messages.dart`, and this PR has no merge conflicts with `main`.
3. The team can maintain it: the fix sets a JSON Pointer on the unknown-key error, and `_inferEnvelopeDetail` uses it before its existing inference.

Its CI runs on the latest commit [wait for a maintainer](https://github.com/a2ui-project/a2ui/pull/4197/checks) to approve them.""",
  reply="Thanks for the fix and the tests. This is a small bug fix for [#4194](https://github.com/a2ui-project/a2ui/issues/4194), so we will review it.",
  added_labels=["type: bug", "component: core sdk"],
  targeted_issues=[4194]
)
</a2ui>

🤖 Agent-generated

@polina-c
polina-c enabled auto-merge (squash) November 20, 2026 23:17
@github-actions github-actions Bot removed the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Nov 20, 2026
@polina-c
polina-c merged commit f5efbad into a2ui-project:main Nov 20, 2026
53 of 55 checks passed
gspencergoog added a commit that referenced this pull request Nov 23, 2026
…st (#4371)

## Summary

Applies `dart format` to two files in `dart/a2ui_core` so that the
`format-check` and `dart_a2ui_core` formatting jobs pass on `main`
again. They have failed on `main`, and on every PR based on it, since
#4197 merged.

## Changes

- `dart/a2ui_core/lib/src/processing/processor.dart`: one statement is
wrapped the way Dart 3.13 formatting wraps it.
- `dart/a2ui_core/test/processor_test.dart`: one list literal is
re-indented, and one call is wrapped with a trailing comma.

The diff is the formatter's output and nothing else. With whitespace and
trailing commas removed, both files are identical before and after.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: a2ui_core reports an unknown envelope key at /version, the same path as an unsupported version

3 participants