fix(artifacts): preserve inline display names#5914
Open
he-yufeng wants to merge 2 commits into
Open
Conversation
Collaborator
|
I have analyzed Pull Request #5914, which addresses a key bug in the ADK repository where the I have compiled the comprehensive analysis into a premium PR Analysis Report artifact. Please inspect the report directly here: 📖 analysis_report.md Key Summary of the Analysis
Open Decision Points & Refinements (Nits)I recommend asking the contributor to address the following minor styling nits so the codebase maintains strict style alignment:
|
Collaborator
|
Hi @he-yufeng , Thank you for your contribution! We appreciate you taking the time to submit this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FileArtifactServiceandGcsArtifactServicecurrently preserve the bytes and MIME type ofinline_dataartifacts, but dropinline_data.display_nameon load. That leaves downstream converters without the user-facing filename even when the caller provided one.This stores the display name alongside the artifact payload and restores it when loading binary artifacts:
custom_metadataremains unchanged when artifact version metadata is listed or fetchedFixes #5833.
Tested
PYTHONPATH=src python -m pytest tests/unittests/artifacts/test_artifact_service.py::test_save_load_preserves_inline_data_display_name -qPYTHONPATH=src python -m py_compile src/google/adk/artifacts/file_artifact_service.py src/google/adk/artifacts/gcs_artifact_service.py tests/unittests/artifacts/test_artifact_service.pypython -m pyink --check src/google/adk/artifacts/file_artifact_service.py src/google/adk/artifacts/gcs_artifact_service.py tests/unittests/artifacts/test_artifact_service.pygit diff --checkI also ran the full artifact-service test file locally with
PYTHONPATH=src. It passed all GCS/in-memory/display-name cases, with two existing Windows-only failures in tests that parsefile:///C:/...URIs back withPath(unquote(parsed.path)), producing/C:/...; those are unrelated to this change.pre-commit run --files ...passed the format/import hooks, but the two repository-local bash hooks could not run on this Windows checkout because/bin/bashis unavailable.