Add --base-url flag for connector testability#74
Add --base-url flag for connector testability#74robert-chiniquy wants to merge 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughThis pull request adds support for overriding the Temporal Cloud API base URL through configuration, enabling users to specify a custom endpoint for testing purposes. The implementation spans configuration structure definitions, field registration, and client initialization logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
russellhaering
left a comment
There was a problem hiding this comment.
LGTM - base-url flag implementation looks correct. Clean integration via the existing functional options pattern (client.WithAPIAddress). Default behavior preserved when baseURL is empty.
Reworked for RunConnector architecture. Adds base-url config field with WithHidden and ExportTargetCLIOnly, wires through to client.WithAPIAddress(). Ref: ConductorOne/baton-prismhr#13 (comment)
3c7b215 to
37e645b
Compare
|
Claude finished @robert-chiniquy's task in 1m 14s —— View job PR Review: Add --base-url flag for connector testabilityBlocking Issues: 0 | Suggestions: 0
Security IssuesNone found. Correctness IssuesNone found. SuggestionsNone. SummaryClean, minimal change that adds a
No documentation staleness concern — Both existing approvals (russellhaering, gontzess) align with this assessment. LGTM. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/connector/connector.go (1)
85-115:⚠️ Potential issue | 🔴 CriticalAdd a
Close()method to properly close the underlying gRPC connection.The constructor creates a
*grpc.ClientConnviaNewConnectionWithAPIKey(), passes it to the gRPC stub, but never stores or closes it. The connection reference is lost afterNew()returns—it lives on only within the gRPC stub's internal state. Without an explicitClose()method onConnector, the connection is never closed, creating a resource leak. Per coding guidelines (**/pkg/connector/connector.go): Implement Close() method for connectors that create clients and properly close them.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/connector/connector.go` around lines 85 - 115, The Connector currently creates a gRPC connection via client.New (which uses NewConnectionWithAPIKey) but never retains or closes the underlying *grpc.ClientConn; add a field to the Connector struct (e.g., conn *grpc.ClientConn) and update New to capture and store the returned connection when building the cloudServiceClient (or obtain it from client.New if it returns both), then implement a Close() method on Connector that closes the stored conn (and also invokes any Close/Shutdown on cloudServiceClient if available) so the gRPC connection is properly released; reference the New function, the Connector type, and the cloudServiceClient field when making these changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@pkg/connector/connector.go`:
- Around line 85-115: The Connector currently creates a gRPC connection via
client.New (which uses NewConnectionWithAPIKey) but never retains or closes the
underlying *grpc.ClientConn; add a field to the Connector struct (e.g., conn
*grpc.ClientConn) and update New to capture and store the returned connection
when building the cloudServiceClient (or obtain it from client.New if it returns
both), then implement a Close() method on Connector that closes the stored conn
(and also invokes any Close/Shutdown on cloudServiceClient if available) so the
gRPC connection is properly released; reference the New function, the Connector
type, and the cloudServiceClient field when making these changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 61f39ca1-d97a-4166-9300-92bace4dced3
📒 Files selected for processing (3)
pkg/config/conf.gen.gopkg/config/config.gopkg/connector/connector.go
Summary
Adds the
--base-urlCLI flag to enable overriding the default API endpoint for testing purposes.Changes
BaseURLFieldto configuration--base-urlis provided, it takes precedence over the default API URLFiles Modified
Testing
The connector can now be tested against mock servers:
Related
Part of the Connector Testability initiative.
Summary by CodeRabbit