Skip to content

refactor: Gateway interface split, output standardization, dedup#29

Merged
robbycochran merged 3 commits into
mainfrom
rc-fixup
Jun 5, 2026
Merged

refactor: Gateway interface split, output standardization, dedup#29
robbycochran merged 3 commits into
mainfrom
rc-fixup

Conversation

@robbycochran

Copy link
Copy Markdown
Collaborator

Summary

Addresses issues #23, #24, #27 from the code audit. Interface narrowing, output consistency, and code deduplication.

Gateway interface split (#27)

Split 22-method monolith into focused sub-interfaces aligned with OpenShell proto domains:

  • ProviderManager — provider CRUD + profiles
  • SandboxManager — sandbox lifecycle
  • InferenceConfig — inference routing
  • GatewayAdmin — gateway management, CLI detection, settings

Gateway composes all four. profile.ValidateProviders now accepts ProviderChecker (1 method) instead of full Gateway — mock went from 24 stub methods to 1.

Code deduplication (#24)

  • k8s.DefaultNamespace() — was duplicated in 3 cmd files
  • k8s.FileExists() — was duplicated in cmd/providers.go + launcher
  • Profile test mock: 24 stubs → 1

Output standardization (#23)

All cmd/ files now use status.* helpers:

  • Added: status.Warn, Warnf, Infof, Detailf, Step, Done
  • creds.go: 15 raw fmt lines → status helpers
  • deploy.go: numbered steps via status.Step
  • teardown.go: all sections via status.Section
  • providers.go: per-provider status via status.OK/Info
  • new.go: WARNING → status.Warn, sections → status.Section

Test results

Path Result
Go unit tests 47/47
Launcher tests 7/7
Bats (both) 29/29
bash + podman 19/19
Go + podman 19/19
Go + OCP (reuse-gateway) 17/17

Closes #23, #24, #27.

robbycochran and others added 3 commits June 5, 2026 00:32
…24,#27)

Gateway interface (#27):
Split into focused sub-interfaces aligned with OpenShell proto domains:
ProviderManager, SandboxManager, InferenceConfig, GatewayAdmin.
Gateway composes all four. profile.ValidateProviders now accepts
ProviderChecker (single method) instead of full Gateway — mock
dropped from 24 stubs to 1.

Code deduplication (#24):
- Extract k8s.DefaultNamespace() — was in 3 cmd files
- Extract k8s.FileExists() — was in cmd/providers.go + launcher
- Profile mock simplified (24 → 1 stub method)

Output standardization (#23):
- All cmd/ files now use status.* helpers instead of raw fmt.Print
- Added status.Warn, Warnf, Infof, Detailf, Step, Done
- creds.go: 15 raw lines → all status helpers
- deploy.go: numbered steps via status.Step
- teardown.go: all sections via status.Section
- providers.go: per-provider status via status.OK/Info
- new.go: WARNING → status.Warn, sections → status.Section
- teardownProviders: brief retry on sandbox-mid-deletion race

TODO.md: migration status updated to 11/12 native Go.

Validated: unit 47+7, bats 29+29, podman 19+19, Go+OCP 17/17.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

refactor: standardize CLI output through status package

1 participant