[ENH] Make missing GOOGLE_API_KEY a fatal error and update related components - #18
Open
markmikkelsen wants to merge 2 commits into
Open
[ENH] Make missing GOOGLE_API_KEY a fatal error and update related components#18markmikkelsen wants to merge 2 commits into
markmikkelsen wants to merge 2 commits into
Conversation
Previously, a missing or invalid GOOGLE_API_KEY was handled gracefully (logged a warning, exited 0). This changes the behavior so that a missing or Drive-API-rejected key raises `GoogleApiKeyError` and fails the run. Per-doc 403/404s (e.g., a BEP doc that isn't link-shared) are still tolerated — only key-level errors are fatal. Updates docs, tests, CLI handlers, and the inject orchestrator accordingly.
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.
This pull request changes how the
bids-schema collect bep-docsprocess handles missing or invalid Google Drive API keys. Previously, a missing or invalidGOOGLE_API_KEYwould only log a warning and skip the collection phase, but now it is treated as a fatal error: the collector raises an exception and the run fails. This ensures that BEP Google Doc activity is always collected when required and that failures due to API key issues are surfaced clearly. The PR also updates documentation, error handling, and tests to reflect this stricter behavior.Key changes:
Behavior and Error Handling:
GoogleApiKeyErrorand fails the run ifGOOGLE_API_KEYis missing or invalid, instead of logging a warning and skipping the phase. This applies to both missing keys and keys rejected by the Drive API (e.g., invalid, expired, or blocked). [1] [2] [3] [4] [5]bids_schema/cli.py) now catchesGoogleApiKeyErrorand surfaces it as aclick.ClickExceptionfor user-friendly error messages. [1] [2]Documentation:
.github/workflows/inject.yml,AGENTS.md, and code docstrings to document that a missing or invalidGOOGLE_API_KEYis now a fatal error, not a warning. [1] [2] [3]tools/inject-schema-fully-autoto fail fast with a clear error message if the API key is missing.Testing:
GoogleApiKeyErrorto be raised, and that per-document permission errors are still handled gracefully. [1] [2]These changes make the BEP Google Doc activity collection phase more robust and ensure that missing or invalid API credentials are surfaced immediately, preventing silent data staleness.