| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Forward the persisted creation time when returning file artifact version metadata so repeated get and list calls do not assign a new creation time. Keep the existing fallback when metadata is unavailable.
Merge #7113 PiperOrigin-RevId: 982032909
| Back | FazBrowse Home | New Git URL |
Description of Change
FileArtifactService saves the correct createTime to disk, but
_build_artifact_version() omits it when constructing the returned metadata.
The ArtifactVersion default then assigns the current time on every read,
so the same saved version appears newly created each time it is fetched.
This change forwards the persisted timestamp in the helper shared by
get_artifact_version() and list_artifact_versions(). It preserves the
existing fallback for unavailable metadata, canonical URI validation, and
custom metadata copying.
Reproduction
On main at 460715b6c62c8e9ab00931c502381ee0364e39b6, save an artifact,
reopen the service, and read the same version repeatedly:
Expected: each read returns the persisted creation time. Before the fix, the
timestamps differ and the assertion fails. With the fix, it passes.
Reproduced on macOS 26.6.2 arm64, Python 3.12.10, ADK 2.9.0,
google-genai 2.23.0 and Pydantic 2.13.5. No model or LiteLLM is involved.
Testing Plan
Regression and affected callers: the new regression fails before the fix
and passes afterward. It covers distinct save/read times, a zero timestamp,
reopening, multiple versions, session/user scopes, and text/binary payloads.
The artifact, Context, forwarding service, local storage, FastAPI, and
save-files plugin tests report 1,142 passed, 5 skipped, 1 xfailed.
Full unit suite via tox:
The two Python 3.12 failures are the agent/runner import-allowlist tests
detecting Homebrew's preloaded sitecustomize; both fail identically on
unchanged main with the same interpreter. Overall tox exits with code 1.
The test process excludes gcloud from PATH to prevent interactive login;
an unrelated CLI test's interactive option flow remains unverified.
Formatting and types: full pre-commit passed. The optional addlicense
binary was unavailable, so that check was skipped. Mypy reports the same
847 errors before and after the change, with no new diagnostics.
End-to-end: built the wheel, installed it in a clean environment, and
verified the public API and actual adk web HTTP routes using file artifact
storage and in-memory sessions/memory. Save/get/get/list all return HTTP 200.
The returned timestamps now match the persisted value:
Before: saved 1789339027.512842 Returned: [1789339027.515331, 1789339027.517152, 1789339027.5185258, 1789339027.5201972] After: saved 1789339026.686486 Returned: [1789339026.686486, 1789339026.686486, 1789339026.686486, 1789339026.686486]Missing, malformed, legacy missing-time, and invalid-time metadata retain
their previous fallback behavior. These checks pass before and after the fix.