Skip to content

fix: README onboarding and EventsTableNotFoundError (#485) - #486

Merged
haiyuan-eng-google merged 5 commits into
mainfrom
fix/485-readme-and-not-found
Sep 20, 2026
Merged

haiyuan-eng-google merged 5 commits into
mainfrom
fix/485-readme-and-not-found

Conversation

@caohy1988

@caohy1988 caohy1988 commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #485.

What

A new user following README.md top to bottom hit two blockers before the first render(): the Prerequisites link returned 404, and the Quick Start silently assumed table_id="agent_events" and the client's default location, so a read against any other table or region failed with a bare NotFound whose only earlier signal was the swallowed schema-verification warning.

README

  • A "How this fits together" block replaces the dead link: producers (the ADK BigQueryAgentAnalyticsPlugin and the LangChain/LangGraph BigQueryCallbackHandler, both writing the same agent_events schema) and this SDK as the read-only consumer. This is item C from the issue's follow-up comment as well as the broken-link item.
  • The Quick Start passes table_id="agent_events" and location="US" explicitly, each with a one-line comment on when to change it, and says what happens when they are wrong.

Client

  • get_trace() and list_traces() route reads through _read_rows(), which re-raises google.api_core.exceptions.NotFound as EventsTableNotFoundError: a NotFound subclass (existing except NotFound handlers keep working) whose message names the fully qualified table and the location and says to pass table_id= and location=. Other errors pass through unchanged. Exported at the package top level.
  • _verify_schema's catch-all warning now names the table, the exception type and the same fix, so it no longer reads like an auth problem.

CHANGELOG: Unreleased / Fixed entry.

Not in scope

Items A and B in the issue's follow-up comment belong to google/adk-python and the LangChain docs respectively.

Test plan

  • Tests written first and watched fail: TestEventsTableNotFound (5) failed on the missing import; TestReadmeOnboarding (4) failed on the README content.
  • pytest tests/test_sdk_client.py tests/test_pr16_fixes.py — 134 passed. Three failures are environment-only and reproduce identically on the untouched tree (test_compute_drift_with_embedding_model, two TestFetchSessionMetadata cases); CI on the same head is green for them.
  • pyink --check clean on the four Python files; git diff --check clean.
  • Rebased onto main after chore: Update quickstart sample #484 merged; the PR is one commit.
A new user following README top to bottom hit two blockers before the
first render: the Prerequisites link pointed at the retired
contributing/extensions exporter directory (404), and the Quick Start
assumed table_id="agent_events" and the client's default location, so
a read against any other table or region failed with a bare NotFound
whose only earlier signal was the swallowed schema warning.

README: a "How this fits together" block names both producers (the ADK
BigQueryAgentAnalyticsPlugin and the LangChain/LangGraph
BigQueryCallbackHandler) and this SDK as the consumer, replacing the dead
link; the Quick Start passes table_id="agent_events" and location="US"
explicitly with a comment on each, and says what to expect when they
are wrong.

Client: get_trace() and list_traces() route their reads through
_read_rows(), which re-raises google.api_core.exceptions.NotFound as
EventsTableNotFoundError, a NotFound subclass that names the fully
qualified table and the location and says to pass table_id= and
location=. Other errors pass through unchanged. The schema-verification
warning now names the table, the exception type and the same fix. The
error is exported at the package top level.

Tests, written first: TestEventsTableNotFound (get_trace, list_traces,
NotFound compatibility, other errors unchanged, warning text) and
TestReadmeOnboarding (dead link gone, producers block, explicit
constructor arguments, error mentioned).
@caohy1988
caohy1988 force-pushed the fix/485-readme-and-not-found branch from cb8512c to db20516 Compare September 18, 2026 22:47

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fresh solo review of the full diff at db20516. I found three P2 regressions in the new exception handling and recommend addressing them before merge; each inline comment includes a reproduction and a suggested fix.

Validation: 347 local tests passed (137 in the two changed test files and 210 related identity/client/telemetry regressions). Current CI is green; Python 3.11 reports 5,193 passed / 80 skipped. The actual README quickstart works for empty and populated results using real SDK methods with cloud boundaries mocked, and the documentation links resolve. No live BigQuery or model calls were made.

Comment thread src/bigquery_agent_analytics/client.py Resolved
Comment thread src/bigquery_agent_analytics/client.py Resolved
Comment thread src/bigquery_agent_analytics/client.py Resolved
caohy1988 added a commit that referenced this pull request Sep 19, 2026
…tadata

Review follow-ups on #486:

- _read_rows() takes the table the query actually reads, so evaluation
  paths that override the constructor's table (dataset=) get an error
  naming that table instead of the default one. Regression:
  evaluate(PerformanceEvaluator(), dataset="golden_events").
- Only a NotFound whose message names the queried table or its dataset
  (Table proj:ds.table / Dataset proj:ds, colon or dotted) becomes
  EventsTableNotFoundError; a missing job or a job-location mismatch is
  re-raised untouched, identity preserved.
- The wrapper forwards the original errors, details, response and error
  info, so handlers reading NotFound's structured fields keep their data;
  the chained cause stays.

Tests written first and watched fail: override table named, job NotFound
passes through, structured metadata preserved; the dataset-not-found case
keeps passing after the narrowing.
…tadata

Review follow-ups on #486:

- _read_rows() takes the table the query actually reads, so evaluation
  paths that override the constructor's table (dataset=) get an error
  naming that table instead of the default one. Regression:
  evaluate(PerformanceEvaluator(), dataset="golden_events").
- Only a NotFound whose message names the queried table or its dataset
  (Table proj:ds.table / Dataset proj:ds, colon or dotted) becomes
  EventsTableNotFoundError; a missing job or a job-location mismatch is
  re-raised untouched, identity preserved.
- The wrapper forwards the original errors, details, response and error
  info, so handlers reading NotFound's structured fields keep their data;
  the chained cause stays.

Tests written first and watched fail: override table named, job NotFound
passes through, structured metadata preserved; the dataset-not-found case
keeps passing after the narrowing.
@caohy1988
caohy1988 force-pushed the fix/485-readme-and-not-found branch from d74a8b9 to e0c04f9 Compare September 19, 2026 02:38

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fresh solo review of the complete diff at e0c04f98148e64df9763eb3fb1984065bb457d4b against 71c6ea37c0c8493e676c415008aa79de90fc262f.

The original three reproductions now pass: evaluation overrides identify the actual table, missing-job errors retain the original exception, and structured error metadata survives. One narrower P2 remains in the newly added source matcher, detailed inline; I recommend fixing it before merge. No P0/P1 findings.

Validation: 351 focused tests passed across the client, README regressions, trace identity, labels, PR123 regressions and telemetry suites. Additional probes covered query/result/pagination failures, overrides, structured ErrorInfo, Forbidden passthrough, and the actual QueryJob.result() missing-job path with its reload boundary mocked. Current CI is green; the Python 3.11 full-suite log reports 5,197 passed and 80 skipped. No live BigQuery or model calls, and no repository changes.

Comment thread src/bigquery_agent_analytics/client.py Resolved
Residual P2 on #486 (discussion_r4052121395): _not_found_names_source
no longer uses lowercase substring checks that misclassify prefix
collisions (agent_events vs agent_events_archive, ds vs ds_archive)
or case-distinct names in case-sensitive datasets. Extract and
compare complete resource tokens with case respect; keep job
NotFound passthrough. Adds negative tests and intent/spec/plan under
intent/pr486-not-found-names/.

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second-seat verdict: APPROVE (posted as COMMENT because this identity cannot approve its own PR; blind review, Fable off review as author).

Verified residual P2 from discussion_r4052121395 against intent/pr486-not-found-names/{intent,spec,plan}.md at cc78a6b (format-only delta over 340eca0, semantics identical):

  • Complete token match: Client._not_found_names_source extracts the full token after Table/Dataset via regex and compares by exact set membership against both colon and dotted expected forms. No .lower(), no substring in.
  • Case respect: message kept as-is; (?i) applies only to the Table/Dataset keyword, token comparison is exact. New test_case_distinct_table_name_is_not_translated (AGENT_EVENTS) asserts identity passthrough.
  • Prefix-collision negatives: new test_table_prefix_collision_is_not_translated (agent_events_archive) and test_dataset_prefix_collision_is_not_translated (ds_archive) both assert identity passthrough (excinfo.value is original, not EventsTableNotFoundError).
  • Job passthrough: existing test_job_not_found_is_not_translated green; Job messages match neither regex.

Verification: python3 -m pytest tests/test_sdk_client.py::TestEventsTableNotFound -q -> 12 passed.

Non-blocking nit: no positive test exercises the dotted project.dataset.table form (existing positives use colon form); implementation handles it via the expected sets. Consider adding one. No merge performed.

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astra blind review: COMMENT — one residual P2; no P0/P1 found.

Reviewed 340eca0 and the formatting-only follow-up cc78a6b (current head; identical client.py AST). The requested underscore-prefix and case-distinct negatives are fixed, and job NotFound identity is preserved. A remaining table-name-with-spaces collision is described inline, so complete resource-name matching is not fully closed.

Validation:

  • 16 focused NotFound/onboarding tests passed.
  • Broader client/onboarding run: 142 passed, 2 failed. Both failures reproduce on base 71c6ea3 and are local ADK/OpenTelemetry import incompatibilities (missing GEN_AI_TOOL_DEFINITIONS), not PR regressions.
  • 48 independent mocked checks passed across colon/dotted references, exact/prefix/case variants, job passthrough, query/result/iteration error stages, and structured metadata/error_info preservation.
  • Skimmed the README, exported exception, schema warning, and evaluation table override. Producer documentation links resolve. Format check is now green on cc78a6b; the CI test matrix was still running when checked.

No implementation changes or merge performed.

Comment thread src/bigquery_agent_analytics/client.py Resolved
Astra P2 on #486: capture Table/Dataset resource names through the
BQ "was not found" terminator so identifiers with spaces are not
truncated, and add space-suffix negative + exact-match positive tests.

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astra blind re-review — APPROVE for the residual space-token P2 only at 518fb5ce83f82e0ca04cfd7cfefa91ee6580a5ef.

The finding in #486 (comment) is closed within the requested scope. _not_found_names_source now captures Table/Dataset identifiers through the was not found terminator, preserving embedded spaces and case before comparison with the expected resource names.

Verified:

  • Configured agent_events + missing agent_events archive re-raises the identical original NotFound.
  • Configured agent_events archive + that exact missing name translates to EventsTableNotFoundError.
  • Prior underscore-prefix, case-distinct, and job-NotFound regressions remain green.

Validation: python3 -m pytest tests/test_sdk_client.py::TestEventsTableNotFound -q -p no:cacheprovider — 14 passed. An independent hermetic matrix passed 56 cases across colon/dotted forms, query/result failure stages, Table/Dataset parsing (including synthetic dataset-space cases), missing terminators, and case-preserved identity checks. The predecessor parser reproduced both space-name failures.

No remaining finding in this P2. Reviewed independently against the code and intent/spec/plan; no other review was read and no other reviewer was summoned. This is scoped approval, not a full-PR re-review. Submitted as COMMENT because the authenticated GitHub account is the PR author. No merge performed.

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blind re-review (second dual-LGTM seat) of HEAD 518fb5c against intent/pr486-not-found-names/{intent,spec,plan}.md. Scope: Client._not_found_names_source + TestEventsTableNotFound only. (Tried APPROVE; GitHub blocks self-approve on this account, so recording this as COMMENT with explicit APPROVE intent.)

  1. Complete token match, case respected: impl builds expected colon/dotted table+dataset tokens and compares with exact equality (no .lower(), no substring). Prefix negatives (agent_events_archive, ds_archive) and case-distinct negative (AGENT_EVENTS) all miss the expected sets -> passthrough. Holds.

  2. Spaces preserved via BQ terminator: Table/Dataset tokens captured with (.+?) through case-insensitive ' was not found', replacing the old [^\s,;]+ truncation. Space-suffix negative ('agent_events archive' vs configured 'agent_events') misses -> passthrough; exact-with-spaces positive (configured 'agent_events archive') hits -> translates. Holds.

  3. Job NotFound passthrough: 'Not found: Job ...' matches neither Table nor Dataset pattern -> re-raised as the identical original exception (existing test_job_not_found_is_not_translated asserts identity). Holds.

Verification: repo suite could not execute here (only pytest available is on Python 3.8, which cannot parse pre-existing 3.9+ syntax at tests/test_sdk_client.py:1777, untouched by this diff). Instead ran the method body verbatim in a standalone harness: 11/11 spec cases pass (exact colon/dotted, both prefix negatives, case negative, space-suffix negative, exact-with-spaces positive, job passthrough, dataset positive, override-table positive, terminator-less ambiguous negative).

No scope drift: diff touches only client.py matching logic (+re import, docstring) and the five specified negative/positive tests. Verdict: APPROVE (intent; recorded as comment due to self-approve block). No merge performed.

@haiyuan-eng-google
haiyuan-eng-google merged commit 818b3af into main Sep 20, 2026
15 checks passed
caohy1988 added a commit that referenced this pull request Sep 21, 2026
…ap, dashboards extras

Version bump 0.5.2 -> 0.5.3 and the changelog cut for everything merged
since v0.5.2 (2026-09-05), 6 commits. No public API is removed or renamed.

In the wheel: EventsTableNotFoundError, a NotFound subclass raised by
get_trace() / list_traces() reads against a missing events table, naming
the table, the location and the Client() arguments to check (#485, #486);
the extractor-compilation smoke gate applies memory_limit_mb as headroom
above the child's post-import address space instead of an absolute
RLIMIT_AS (#480); new streamlit / dashboards extras, with all now including
dashboards (#480); the package quick-start docstring (#484). Repo side: the
Streamlit agent analytics dashboard (#480), grafana/ moved to
dashboards/grafana/ (#481), ANALYST_TIMEOUT_S and the removal of the
pre-#395 engine compat scaffolding in the skill-evolution job (#483), the
OKF Attested Computation receipt spike (#479), and the README onboarding
fixes (#484, #485).

Entries the Unreleased section lacked are added in this cut: #479, #480,
Deploy section, since deploy/ and scripts/ are not in the wheel. The #486
bullet is carried verbatim.
haiyuan-eng-google pushed a commit that referenced this pull request Sep 21, 2026
…ap, dashboards extras (#487)

Version bump 0.5.2 -> 0.5.3 and the changelog cut for everything merged
since v0.5.2 (2026-09-05), 6 commits. No public API is removed or renamed.

In the wheel: EventsTableNotFoundError, a NotFound subclass raised by
get_trace() / list_traces() reads against a missing events table, naming
the table, the location and the Client() arguments to check (#485, #486);
the extractor-compilation smoke gate applies memory_limit_mb as headroom
above the child's post-import address space instead of an absolute
RLIMIT_AS (#480); new streamlit / dashboards extras, with all now including
dashboards (#480); the package quick-start docstring (#484). Repo side: the
Streamlit agent analytics dashboard (#480), grafana/ moved to
dashboards/grafana/ (#481), ANALYST_TIMEOUT_S and the removal of the
pre-#395 engine compat scaffolding in the skill-evolution job (#483), the
OKF Attested Computation receipt spike (#479), and the README onboarding
fixes (#484, #485).

Entries the Unreleased section lacked are added in this cut: #479, #480,
Deploy section, since deploy/ and scripts/ are not in the wheel. The #486
bullet is carried verbatim.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants