Skip to content

llm: follow-up cleanups from #5029 review (shared OIDC config, CLI/pkg separation, E2E tests) #5048

Closed

Description

@yrobla

Context

Three follow-up items raised during review of #5029 (llm localhost reverse proxy). None are blockers for that PR but should land before the stack grows further with #5033 and #5035.


1. Extract shared OIDC config type

File: pkg/llm/config.go — OIDCConfig

OIDCConfig mirrors RegistryOAuthConfig field-for-field (Issuer, ClientID, Scopes, Audience, CallbackPort, CachedRefreshTokenRef, CachedTokenExpiry). Parallel types with the same shape drift over time — validation added to one gets missed in the other.

Proposal: Extract a shared OIDC config type (e.g. in pkg/oidc or pkg/networking) that both embed, before #5033 and #5035 build further on llm.OIDCConfig. The longer the stack grows on separate types, the harder consolidation becomes.


2. Move business logic from CLI layer into pkg/llm/

File: cmd/thv/app/llm.go

Per CLAUDE.md/cli-commands convention, CLI commands should be thin wrappers — business logic belongs in pkg/. Currently living in the CLI layer:

  • deleteLLMSecrets — secret enumeration + deletion
  • Config mutation/validation orchestration in config set (partial-vs-full validation branch)
  • Formatting decisions in config show

Proposal: Move these to pkg/llm/ (e.g. a ResetConfig, DeleteCachedTokens, or SetFields method on Config). CLI commands then just parse flags and delegate. Sets the right pattern before more commands land in #5033/#5035.


3. Add E2E tests for thv llm config commands

File: cmd/thv/app/llm.go — config set/show/reset

Per project convention, CLI commands are primarily tested via E2E tests in test/e2e/. Currently no E2E coverage exists for the config subcommands.

Suggested test cases:

  • thv llm config set --gateway-url https://example.com --issuer https://auth.example.com --client-id test succeeds and thv llm config show --format json reflects the values
  • thv llm config set --gateway-url http://example.com fails (HTTPS enforcement)
  • thv llm config reset clears the config
  • thv llm config show on a clean config prints the "not configured" message

Should land before the stack is complete to avoid accumulating untested CLI surface.


References

Activity

  1. added
    llm gateway
    on Apr 24, 2026
  2. added
    enhancement
    go
    cli
    on Apr 24, 2026
  3. assigned and unassigned on Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

clienhancementgollm gatewaytesting

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions