Skip to content

refactor(config): relocate cloud-provider operations - #472

Merged
senamakel merged 13 commits into
epic/8092-inference-outfrom
epic-8092-267-config-ops
Oct 20, 2026
Merged

senamakel merged 13 commits into
epic/8092-inference-outfrom
epic-8092-267-config-ops

Conversation

@senamakel

@senamakel senamakel commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Move primary cloud selection into config operations and move cloud-provider update conversion there as well. The inference settings handler now keeps the RPC boundary and delegates credential construction; AuthStyle parsing is centralized in config schema. Direct callers use config ops, with no factory forwarding shim.

Preserve managed-versus-BYOK selection, legacy provider matching and fallback behavior, reserved-slug handling, blank and whitespace field semantics, auth aliases/errors, CA collection, and config patch application. Diagnostic rendering now sanitizes only the URL origin, keeping endpoint paths, credentials, and query values out of logs and Debug while leaving the configured routing endpoint unchanged.

Validation:

  • pnpm debug rust inference (without --lib): 630 passed, 0 failed across the selected product-feature test inventory.
  • Config domain tests: 889 passed, 0 failed.
  • Strict core all-target Clippy: default and product features passed.
  • Root and desktop app cargo check, pnpm rust:layout (including the 28-owner storage schema), pnpm docs:check, cargo fmt --all --check, and git diff --check passed.
  • The runtime and SaaS scanners retain 37 and 6 inherited findings; parent verified their source locations are unchanged from the base, with no findings introduced by this leaf.

Refs #267
Part of tinyhumansai#8092.

Moved cloud provider credential parsing and primary-cloud resolution out of the inference settings handler into dedicated config ops modules. This centralizes the logic so it can be reused and keeps the RPC handler focused on orchestration.

Auto-committed-on: dragonfly
Primary cloud selection and legacy inference slug resolution now live in
config/ops instead of the inference provider factory, so the factory
depends on config rather than owning config-derived helpers. Endpoint
redaction in ephemeral routes now uses the shared sanitize helper.

Auto-committed-on: dragonfly
The primary_cloud module's provider resolution helpers are no longer
needed, so the file is deleted. Any remaining callers should rely on the
shared factory logic instead.

Auto-committed-on: dragonfly
Moved the `crate::config::ops` imports in the provider factory modules to the top of each file alongside the other use statements. This keeps import placement consistent and avoids a trailing use declaration at the end of credentials.rs.

Auto-committed-on: dragonfly
Dropped an unused import of resolve_primary_cloud_provider_string from the chat model factory, which is no longer referenced after the provider resolution logic moved elsewhere.

Auto-committed-on: dragonfly
Relocated the resolve_primary_cloud_provider_string import from the bottom of chat_model.rs to the top with the other use statements. This is a cosmetic cleanup with no behaviour change.

Auto-committed-on: dragonfly
Dropped a redundant import of resolve_primary_cloud_provider_string from the cloud slug and routing factory modules, as it was no longer referenced.

Auto-committed-on: dragonfly
Adds a unit test asserting that AuthStyle::parse accepts the various
spellings for bearer, anthropic, openhuman_jwt and none while returning the
expected error for unknown values. Also registers the primary cloud test
module so its tests are compiled and run.

Auto-committed-on: dragonfly
Extend the ephemeral route debug test to use an endpoint containing userinfo, query, and fragment secrets, and assert that none of them appear in the debug output. This guards against future regressions where only the API key and headers are redacted.

Auto-committed-on: dragonfly
The debug logs in primary_cloud now label the redacted URL as endpoint
instead of host, matching what the value actually is. The module doc in
cloud_providers also points at config::ops::primary_cloud rather than the
old inference factory path.

Auto-committed-on: dragonfly
The primary cloud helper functions are only used within their own module, so their visibility was reduced from crate-wide to private and the now-unnecessary re-exports were dropped. New tests cover verbatim preservation of non-blank id, label, and default model values along with padded auth style errors.

Auto-committed-on: dragonfly
Extend the ephemeral route debug test to include a secret in the URL path
and assert it is not disclosed. This guards against redaction logic that
handles credentials, query, and fragment but leaks path segments.

Auto-committed-on: dragonfly
Route and BYOK diagnostics now log only the URL origin, so endpoint paths,
credentials and query values no longer leak into logs. A shared helper in each
module parses the endpoint and falls back to TinyInference's sanitizer for
malformed input, with a test covering the redaction.

Auto-committed-on: dragonfly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant