Skip to content

fix(a2a): map string product images to line item image_url - #208

Open
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/a2a-product-image-shapes
Open

fix(a2a): map string product images to line item image_url#208
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/a2a-product-image-shapes

Conversation

@FanouZeng-TT

Copy link
Copy Markdown
Contributor

Description

_get_line_item in a2a/business_agent/src/business_agent/store.py only
handles product images inside a list guard, then checks the same value
for str again inside that guard:

if isinstance(product.image, list):
    if isinstance(product.image, str):
        image_url = product.image

The inner branch is unreachable, so a legal single-string Product.image
never reaches the line item's item.image_url. Product.image is declared
as str | list[str] | list[ImageObject] | None, so all three non-null
shapes should project a URL onto the checkout line item.

Fix: handle a plain string first, then a non-empty list (first element
kept: a string as-is, an ImageObject mapped to .url). List behavior is
unchanged; the single-string shape is restored.

Category (Required)

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

N/A

Checklist

  • I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

Screenshots / Logs (if applicable)

  • pre-fix: single-string image produces item.image_url == None
  • post-fix: single string, list[str], list[ImageObject], and None all behave correctly
  • uv run --group dev ruff check and ruff format --check
  • uvx pre-commit run --all-files
  • git diff --check

@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Aug 24, 2026
@carolinerg1 carolinerg1 added status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Aug 25, 2026
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.

3 participants