Skip to content

fix(sdk): add bounded timeout to validateHealthyPlatformConnection #3414

@marythought

Description

@marythought

Context

validateHealthyPlatformConnection (the gate run by WithConnectionValidation) calls checkPlatformHealth(context.Background(), …) with no deadline. If a custom http.Client has no timeout configured, sdk.New() can block indefinitely on a network stall.

Surfaced in #3412 (CodeRabbit major-priority review).

Proposal

Wrap the call in a bounded context. Open question: hard-coded 5s, configurable via a new WithConnectionValidationTimeout(d) option, or derive from an existing config?

Acceptance

  • sdk.New() cannot block longer than the configured timeout when validation is enabled
  • Test: covers the timeout path against a hanging server (httptest.Server with a slow handler)
  • Documented in WithConnectionValidation doc comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions