GoogleCloudPlatform / GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK
adk-2.0 consumer: null-safe tests for pre-2.0 rows against every new view
- Dominant language
- Python
- Stars
- 47
- Forks
- 21
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 33
Description
Parent tracker: #190 (v15 contract).
Wave: 5 — Consumer testing.
## Contract
Every new cross-event view (#212-#217) must include null-safe tests demonstrating that pre-2.0 rows (no `attributes.adk` block at all) and non-Event-originating v2 rows do not produce errors and do not appear in view output where they shouldn't.
### Per-view assertions
- **#212 `workflow_invocations`**: pre-2.0 rows excluded (no `attributes.adk.node`); non-workflow rows (`path = ""`) excluded by the explicit `NULLIF(...) IS NOT NULL` filter.
- **#213 `agent_transfer_chains`**: pre-2.0 rows excluded (no `AGENT_TRANSFER` event type before v2).
- **#214 `branch_fanout`**: pre-2.0 rows excluded by the `source_event_id IS NOT NULL` gate. **Zero-branch row**: a v2 Event-originating invocation with no branch produces a row with `distinct_branch_count = 0` (matching the policy locked in #214).
- **#215 `long_running_tool_durations`**: pre-2.0 rows excluded (no `attributes.adk.pause_kind`).
- **#216 `compaction_windows`**: pre-2.0 rows excluded (no `EVENT_COMPACTION` event type before v2).
- **#217 `scope_cardinality`**: pre-2.0 rows excluded via `source_event_id IS NOT NULL` gate.
### Generic null-identity assertion (applies to all grouped views)
Pre-2.0 rows must **not** create rows grouped under null telemetry identity fields. Concretely: no view output may contain a row where `JSON_VALUE(attributes, '$.adk.app_name')` is null **and** `user_id` / `session_id` / `invocation_id` reach the grouping. This catches the common failure mode where a view only wraps JSON accessors in `SAFE` / `COALESCE` but forgets the v2/Event gate.
## Acceptance
- [ ] Each view in #212-#217 has at least one pre-2.0 row in the test fixture and an assertion the row is correctly excluded / null-handled.
- [ ] #214 specifically: tests assert the zero-branch row (`distinct_branch_count = 0`) is emitted for v2 invocations with no branch.
- [ ] Generic null-identity assertion: no view emits rows under all-null telemetry identity.
- [ ] Tests run as part of the standard SDK test suite.
## References
- #190 (v15 acceptance criteria; null-safe handling).
- #214 zero-branch policy.
Contributor guide
Assessment
This issue has not been assessed yet.