Skip to content

fix(errors): report template misses as not-exist instead of unsupported-language - #197

Merged
zhangwenjun-huawei merged 3 commits into
project-openan:devfrom
wushunhao:fix/template-not-found-message
Sep 20, 2026
Merged

zhangwenjun-huawei merged 3 commits into
project-openan:devfrom
wushunhao:fix/template-not-found-message

Conversation

@wushunhao

@wushunhao wushunhao commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Port of the error-message part of project-openan/a2a-t-sdk-python#59. The built-in fallback for missing local_file business content already exists in the Java SDK, so this PR only carries the follow-up message fix.

When a template is missing, template.not_found used to claim the language was unsupported even when the templateUri itself did not exist, misdirecting callers.

  • Reword the bilingual message to a plain does-not-exist:
    • zh-CN: 模板「{template_uri}」不存在
    • en-US: Template '{template_uri}' does not exist
  • The declared fact parameters (template_uri, language) and the error-code contract are unchanged; the language is fixed configuration, so the message no longer echoes it while the facts still carry it for programmatic diagnosis.
  • Clarify the ErrorCatalog Javadoc that a message template may render a subset of the declared facts.
  • Sync the zh/en API reference error tables.
  • Add ErrorMessagesResourceTest pinning the rendered message in both languages; the retained facts are pinned by LlmBackedPromptMetadataExtractorTest.

Verification

  • ErrorMessagesResourceTest: 2 passed
  • LlmBackedPromptMetadataExtractorTest: 9 passed
  • mvn -B clean verify -pl '!a2a-t-corpus' (the CI command) on a clean checkout of the head: BUILD SUCCESS for every module
  • Reviewed by three concurrent review passes (correctness, tests/CI, docs/port fidelity) with no blocker/major findings

Signed-off-by: w00609601 wushunhao1@huawei.com

…ed-language

The template.not_found message claimed the language was unsupported even when the templateUri itself did not exist, which misdirected callers. Reword the bilingual message to a plain does-not-exist statement: the language is fixed configuration, so the message no longer echoes it, while the declared fact parameters (template_uri, language) and the error-code contract stay unchanged - facts still carry the language for programmatic diagnosis.

Also clarify the ErrorCatalog Javadoc that a message template may render a subset of the declared facts, sync the zh/en API reference error tables, and add ErrorMessagesResourceTest pinning both languages and the retained language fact.

Signed-off-by: w00609601 <wushunhao1@huawei.com>
@wushunhao
wushunhao requested a review from a team as a code owner September 18, 2026 09:26
…essage

LlmBackedPromptMetadataExtractorTest asserted the rendered message echoed the configured language. After the template.not_found message was reworded to a plain does-not-exist, the language stays in the facts only; assert the message omits it and the facts keep it for programmatic diagnosis.

Signed-off-by: w00609601 <wushunhao1@huawei.com>
Three concurrent reviews returned APPROVE with two minor findings: the TEMPLATE_NOT_FOUND constant Javadoc still framed the failure as a language problem, and ErrorMessagesResourceTest carried a tautological third case. Reword the constant Javadoc to describe the trigger (missing for the configured language) and the message (names the URI), and drop the redundant case since the retained facts are already pinned by LlmBackedPromptMetadataExtractorTest.

Signed-off-by: w00609601 <wushunhao1@huawei.com>
@wushunhao

Copy link
Copy Markdown
Contributor Author

Review and follow-up

Three independent review passes were run in parallel with distinct lenses (correctness/contract integrity, tests/CI, docs/port fidelity). All three returned APPROVE with no blocker or major findings. Two minor findings were raised and have been addressed in 82fa5cdd:

  1. ErrorCatalog.TEMPLATE_NOT_FOUND constant Javadoc still framed the failure as a language problem. Reworded to describe the trigger (the template is missing for the configured language) and what the message renders (the template URI only).
  2. ErrorMessagesResourceTest carried a tautological third case with an over-described Javadoc. It was dropped: the retained language fact is already pinned at runtime by LlmBackedPromptMetadataExtractorTest.

Verification

  • ErrorMessagesResourceTest: 2 passed
  • LlmBackedPromptMetadataExtractorTest: 9 passed
  • mvn -B clean verify -pl '!a2a-t-corpus' (the exact CI command) on a clean checkout of 82fa5cdd: BUILD SUCCESS for every module
  • CI checks: Build & Test, DCO, EasyCLA all pass

Notes

  • Port fidelity: the message wording matches a2a-t-sdk-python#59 (b4f9d795) exactly, and the declared fact parameters (template_uri, language) plus the error-code contract are unchanged. Java has no corpus mapping file on main and no placeholder-equality gate to relax, so those parts of the Python change have no Java counterpart.
  • Design docs: no spec/impl update was needed — this is a bug fix that does not change design facts (code, trigger, aliases all unchanged).
  • Known nit: the first commit message still says "pinning ... the retained language fact" (the phrase was written before the third case was dropped). The final state is covered by the later commits; history is left as-is rather than force-pushed.

@wushunhao
wushunhao changed the base branch from main to dev September 20, 2026 06:09
@zhangwenjun-huawei
zhangwenjun-huawei merged commit 8e70b00 into project-openan:dev Sep 20, 2026
3 checks passed
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