Skip to content

Log raw NotFound detail in _read_schema - #26

Open
Gutts-n wants to merge 1 commit into
mainfrom
fix/log-notfound-detail-in-read-schema
Open

Gutts-n wants to merge 1 commit into
mainfrom
fix/log-notfound-detail-in-read-schema

Conversation

@Gutts-n

@Gutts-n Gutts-n commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Why

Follow-up to #25 (wired LOG_LEVEL). With DEBUG logging actually working
now, confirmed the ckan:resource-update-stress 404 still shows up only
as the generic wrapped message ("Not Found") at the error-handler layer
— because _read_schema's except NotFound: return None never captured
or logged the original exception at all. There was nothing more to see
at any log level, by design of this specific except clause, not because
logging was misconfigured.

What changed

datastore/infrastructure/engines/bigquery/backend.py: _read_schema's
NotFound handler now logs the resource_id, the exact table ref queried,
and the raw exception (%s on the NotFound instance includes Google's
response body) at DEBUG before returning None. Still returns None
for the caller exactly as before — behavior unchanged, only adds
visibility.

What was verified

  • Ran the full test suite (pytest tests/ -k "not integration"):
    494 passed, same as baseline, same two pre-existing unrelated
    failures in tests/test_datastore_dump.py excluded (confirmed
    pre-existing on main in Wire LOG_LEVEL config into logging.basicConfig #25).
  • Ran tests/engines/bigquery/ specifically: 94 passed.

Context

Investigating a persistent datastore_search 404 for resources that
have real, verified data in BigQuery — datastore_authorize succeeds,
IAM checks out with the same read-only service account, and a fresh
BigQuery client can query the same table instantly, but the live service
consistently 404s. google.api_core.exceptions.NotFound from
tables.get was the confirmed source of the 404, but its detail was
never captured anywhere in the request path. This PR closes that gap —
next occurrence of this bug should show the real Google API response.

Deployment

Needs a rebuild + redeploy of the datastore image, same as #25.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 38a234ee-3c04-4a96-a34c-a1a593414b64


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant