test(sessions): add unit tests for _session_util#6206
Open
Koushik-Salammagari wants to merge 1 commit into
Open
test(sessions): add unit tests for _session_util#6206Koushik-Salammagari wants to merge 1 commit into
Koushik-Salammagari wants to merge 1 commit into
Conversation
Adds unit-test coverage for the previously untested _session_util module: - decode_model: None passthrough, dict-to-model decoding, and invalid input. - extract_state_delta: routing of app:/user: prefixed keys (with prefix stripped), skipping of temp: keys, unprefixed keys to the session bucket, empty/None state, and a mixed-key case.
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.
Link to Issue or Description of Change
Description of the change (no existing issue):
Problem:
The
google.adk.sessions._session_utilmodule had no dedicated unit-testcoverage. Its
extract_state_deltahelper contains prefix-routing logic(
app:,user:,temp:) that is used by session services to split a flatstate dict into app/user/session deltas, and a regression here would silently
corrupt persisted session state.
Solution:
Add a focused, test-only module covering both functions and their edge cases.
No production code is changed.
Coverage added:
decode_model—Nonepassthrough, decoding a dict into a model instance,and raising on invalid data.
extract_state_delta—app:/user:prefixed keys routed to their bucketswith the prefix stripped,
temp:keys skipped entirely, unprefixed keysrouted to the session bucket, empty and
Nonestate, and a mixed-key case.Testing Plan
Unit Tests:
Manual End-to-End (E2E) Tests:
Not applicable — this is a test-only change with no runtime/user-facing impact.
Checklist