Skip to content

[Design][#8431] Gate client resources on validated bound configuration #8502

Open

Description

@klT45

Current Implementation Locations

ShenyuClientCommonBeanConfiguration binds ShenyuRegisterCenterConfig and ShenyuClientConfig, then calls ShenyuClientRegisterRepositoryFactory.newInstance. The factory may initialize a repository and register shutdown hooks. Protocol starters construct legacy listeners and/or ClientRegisterConfigImpl; listener base construction starts the singleton publisher. The seven business starters are HTTP, WebSocket, gRPC, Dubbo, SOFA, TARS and MCP. They currently share the global registration enable flag; this task will not invent per-protocol enable settings.

Candidate Plans

Global annotations on shared DTOs would impose business-client rules on Admin/gateway consumers. Classpath scans or hard-coded bean-name inference could validate disabled/excluded starters. Instead, each active starter declares a small concrete validator for its protocol; the existing common repository bean waits for all declarations, validates the bound objects, then invokes the unchanged factory.

Decisions

  • Apply common checks before repository construction or cache reuse. Validate relevant protocol entries through the active starter declarations only; preserve custom SPI properties and opaque custom transport addresses.
  • Built-in HTTP registration requires nonempty comma-separated HTTP/HTTPS server URLs with usable ports. Reuse the transport's URL parser and discard raw parser exceptions. Do not print supplied values, credentials or arbitrary extension keys in errors.
  • Preserve global blank/default namespace semantics and the existing semicolon separator; reject empty/whitespace namespace entries in a nonblank list. Preserve protocol defaults/fallbacks, distinguishing HTTP's legacy app-name fallback from its opt-in path. Do not normalize free-form Properties keys into incorrect kebab-case aliases.
  • Validate integer port formats/ranges for the enabled protocol. Keep HTTP/WebSocket absent or supported nonpositive automatic sentinels deferred; do not resolve a web server during bean construction. Validate gRPC/TARS required settings and RPC ports according to current consumers. Host/interface auto-discovery remains optional. Existing random-bound-port resolution remains owned by [ISSUE #8426] Resolve actually bound server port for client registration when server.port=0 #8453, an unmerged related PR rather than a dependency.
  • Validate only actual numeric configuration consumers (including the integer millisecond shutdown delays); existing finite failback timing has no configurable retry knobs. Keep extension-owned settings delegated. Validate discovery requirements only when the corresponding discovery path is enabled.
  • Use property names and fixed corrective guidance in errors, with no raw values or parser causes. Validation itself allocates no scheduler, publisher or network client. Invalid configuration must fail before those owners are called, avoiding partial cleanup work.
  • Add common starter metadata/hints and a documented inventory of owners, syntax, default resolution, disable behavior, automatic vs advertised ports, discovery, and extension handling. Test real YAML/properties binding and metadata consistency.

Impact Scope

No database changes, SQL upgrades, Admin authorization changes or gateway/data-sync payload changes. The change remains independent of #8500 and #8453; single-starter defaults and existing listener behavior are retained. Coordination with the independent client migration is documented in the implementation PR.

Verification

First reproduce invalid HTTP address/port/shutdown values with the actual MVC starter and prove the resource factory/publisher must not be invoked. Add common validation, active-vs-inactive protocol, disabled registration, custom SPI, secret-safe diagnostics, namespace, numeric boundary, alias and YAML/properties binding coverage. Verify both legacy and opt-in configuration shapes, and valid automatic input without early port resolution. Run Maven-wrapper affected module/dependency tests through verify (Checkstyle/RAT), the pinned new-code quality gate, durable specs and author self-review before publishing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to 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