-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improved custom components handling #350
Conversation
Warning Rate limit exceeded@aaronsteers has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 52 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change improves the error handling and validation logic in the custom code compiler. The error message for empty input text in the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Compiler
Caller->>Compiler: Call _hash_text(text)
alt Text is empty
Compiler-->>Caller: Raise "Hash input text cannot be empty."
else Text is valid
Compiler-->>Caller: Return computed hash
end
Caller->>Compiler: Call validate_python_code(code_text)
alt code_text is empty
Compiler-->>Caller: Return early (nothing to validate)
else
Compiler->>Compiler: Compute expected checksum
Compiler->>Compiler: Compute actual checksum
alt Checksums mismatch
Compiler-->>Caller: Raise AirbyteCodeTamperedError with details
else Checksums match
Compiler-->>Caller: Return success
end
end
Caller->>Compiler: Call get_registered_components_module(config)
alt INJECTED_MANIFEST missing in config
Compiler-->>Caller: Raise RuntimeError
else
Compiler-->>Caller: Return registered components module
end
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py (1)
114-114
: Consider consolidating condition checks.Since we now verify that config and INJECTED_MANIFEST exist before this line, should we simplify this condition? Perhaps something like:
- if config and config.get(INJECTED_COMPONENTS_PY, None): + if config.get(INJECTED_COMPONENTS_PY, None):wdyt? This would make the code a bit cleaner since we've already established that
config
exists.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py
(4 hunks)
🧰 Additional context used
🪛 GitHub Actions: Linters
airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py
[error] 111-111: Unsupported right operand type for in ('Mapping[str, Any] | None')
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Check: 'source-pokeapi' (skip=false)
- GitHub Check: Check: 'source-amplitude' (skip=false)
- GitHub Check: Check: 'source-shopify' (skip=false)
- GitHub Check: Check: 'source-hardcoded-records' (skip=false)
- GitHub Check: Pytest (All, Python 3.11, Ubuntu)
- GitHub Check: Pytest (All, Python 3.10, Ubuntu)
🔇 Additional comments (3)
airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py (3)
48-48
: More descriptive error message looks good.The error message is now more specific about what input is empty, which helps with debugging. This is a nice improvement!
71-74
: Early validation check for empty code text looks good.Adding this early return is a nice optimization that avoids unnecessary validation when there's no code to validate. Good defensive programming practice!
84-95
: Enhanced error reporting for checksum mismatch.This change provides much more detailed information when a checksum doesn't match, including the expected and actual checksums, and the code text itself. This will make debugging much easier when tampering is detected.
Resolves: #250
test-read
call in Builder to pass__injected_components_py
to SDM/CDK #250Improves handling and logging when working with SDM custom components in test reads.
Summary by CodeRabbit