feat: handle third_party code and add DatabaseSettings#24
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
|
|
Claude finished @olivermeyer's task in 2m 30s —— View job Code Review Complete ✅Reviewing PR #24: feat: handle third_party code and add DatabaseSettings Todo List
Review SummaryThis PR adds two well-designed features with excellent test coverage (100% on new code). The implementation is clean, backward-compatible, and follows project conventions. No blocking issues found. I have a few suggestions for improvements below. ✅ Strengths
💡 Suggestions (Non-blocking)1. TODOs in Production CodeLocation: Three TODOs reference Bridge-specific defaults that should be removed: # TODO(oliverm): remove the default; it should not reference Bridge
DEFAULT_AUTH0_ROLE_CLAIM = "https://aignostics-platform-bridge/role"
# TODO(oliverm): make mandatory
internal_org_id: str | None = None
# TODO(oliverm): make mandatory and remove default
auth0_role_claim: str = DEFAULT_AUTH0_ROLE_CLAIMSuggestion: Create GitHub issues to track these and remove the inline TODOs. This keeps the codebase clean and makes TODOs more visible/trackable. 2. Error Message ContextLocation: The error message in msg = f"No database URL configured. Set {ctx.env_prefix}DB_URL or pass db_url explicitly."Suggestion: Include the context name for better debugging: msg = f"No database URL configured for {ctx.name}. Set {ctx.env_prefix}DB_URL or pass db_url explicitly."3. Type Annotation PrecisionLocation: The def with_engine(...) -> Any:Suggestion: While this is acceptable for a dual-mode decorator, consider using a 4. URL Path Replacement Edge CasesLocation: The return urllib.parse.urlunparse(parsed._replace(path=f"/{self.db_name}"))Consideration: This works well for standard database URLs, but could be fragile if the path contains multiple segments (e.g., 🔍 Detailed AnalysisFeature 1: Third-party Code Injection (
|
09030e8 to
4e7bbbc
Compare
4e7bbbc to
ca0ea35
Compare
|

Auto-inject third party code
Bridge automatically adds code in the
third_partymodule tosys.path. I'm adding the same here.Add DatabaseSettings
The database utils in Bridge depend on the system service to get database information. That's not possible in the context of a library. I suggest we add a
DatabaseSettingsobject which is automatically added to theFoundryContextifPROJECT_NAME_DB_URLis set. The setting values are taken from the env (e.g.PROJECT_NAME_DB_POOL_SIZE).