Skip to content

fix(cdk): improve OAuth error messages in DeclarativeOauth2Authenticator#960

Draft
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774353383-improve-oauth-error-messages
Draft

fix(cdk): improve OAuth error messages in DeclarativeOauth2Authenticator#960
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774353383-improve-oauth-error-messages

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Summary

Improves user-facing error and warning messages in DeclarativeOauth2Authenticator by removing internal class name leakage ("OAuthAuthenticator") and replacing vague language with specific, actionable descriptions.

All changes are string-only — no logic or control flow changes.

Method Before After
get_client_secret() (warning) "OAuthAuthenticator was unable to evaluate client_secret parameter hence it'll be empty" "OAuth client_secret resolved to an empty value. If this is unexpected, verify the 'client_secret' in your connector configuration."
get_client_id() "OAuthAuthenticator was unable to evaluate client_id parameter" "OAuth client_id resolved to an empty value. Verify the 'client_id' in your connector configuration."
get_token_refresh_endpoint() "OAuthAuthenticator was unable to evaluate token_refresh_endpoint parameter" "OAuth token refresh endpoint resolved to an empty value. Verify the 'token_refresh_endpoint' in your connector configuration."
__post_init__() (3 validators) "OAuthAuthenticator configuration error: ..." "OAuth configuration is missing/incomplete. ..."

Resolves https://github.com/airbytehq/airbyte-internal-issues/issues/16098
Related to https://github.com/airbytehq/oncall/issues/11312

Review & Testing Checklist for Human

  • Verify no downstream code matches on old error strings: Grep airbyte and airbyte-platform-internal repos for "OAuthAuthenticator was unable" or "OAuthAuthenticator configuration error" to confirm nothing catches these ValueError messages by string content.
  • Verify the client_secret warning stays as warning-only: The issue notes that some APIs (e.g., Bing Ads public client OAuth) legitimately allow empty client_secret. Confirm that keeping this as logger.warning() rather than raising an exception is the correct behavior.
  • Spot-check message quality: Confirm the new messages are clear to a non-technical user and follow the writing-good-error-messages guidelines.

Notes

  • The client_secret empty case is intentionally kept as a warning (not an error) because public OAuth client flows legitimately omit client_secret. This is unchanged behavior — only the message text was improved.
  • All 29 existing OAuth unit tests pass. No tests asserted on the old message strings.
  • This is a CDK-level fix, not a connector-level fix — no connector version bump needed.

Link to Devin session: https://app.devin.ai/sessions/e66ccb78189644d2a21651edfd6e08e5

Remove internal class name 'OAuthAuthenticator' from user-facing error
messages and warnings. Replace vague language with specific, actionable
descriptions following the writing-good-error-messages guidelines.

Changes:
- get_client_secret(): Replace warning with clear description that
  client_secret resolved to empty value
- get_client_id(): Replace error with descriptive message about empty
  client_id resolution
- get_token_refresh_endpoint(): Replace error with descriptive message
  about empty endpoint resolution
- __post_init__(): Replace validation errors to remove class name leakage

Co-Authored-By: bot_apk <apk@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1774353383-improve-oauth-error-messages#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1774353383-improve-oauth-error-messages

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

@github-actions
Copy link
Copy Markdown

PyTest Results (Fast)

3 934 tests  ±0   3 923 ✅ +1   7m 25s ⏱️ +16s
    1 suites ±0      11 💤  - 1 
    1 files   ±0       0 ❌ ±0 

Results for commit 08093ab. ± Comparison against base commit 0e57414.

@github-actions
Copy link
Copy Markdown

PyTest Results (Full)

3 937 tests  ±0   3 925 ✅ ±0   11m 13s ⏱️ -1s
    1 suites ±0      12 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 08093ab. ± Comparison against base commit 0e57414.

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.

0 participants