Skip to content

feat: native Go preflight, make validate#13

Merged
robbycochran merged 5 commits into
mainfrom
rc-more-go
Jun 5, 2026
Merged

feat: native Go preflight, make validate#13
robbycochran merged 5 commits into
mainfrom
rc-more-go

Conversation

@robbycochran

@robbycochran robbycochran commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Ports the last Python dependency (providers.py, 320 lines) to native Go and adds infrastructure for consistent output formatting and full-matrix validation.

Native Go preflight (internal/preflight/)

  • preflight.go — types, TOML loading, input checking (env/file/check kinds), secret masking, JSON metadata extraction (ADC project, GWS client_id)
  • check.go — CLI detection, gateway status (podman vs k8s auto-detected), registered provider verification via gateway.Gateway interface, per-provider input validation, --strict exit code
  • cmd/preflight.go — native Go instead of bash wrapper. Supports check, available, names subcommands
  • Dual-path bats: USE_GO=true bats test/preflight.bats runs same 29 tests against Go binary

Gateway interface expansion

Added CLIVersion, CLIPath, InferenceModel, ActiveGateway to the gateway.Gateway interface. All openshell CLI interactions in check.go now go through the interface — same gRPC swap point as sandbox operations.

Status output helpers (internal/status/)

Replaces ~30 scattered fmt.Printf(" ✓ ...") / fmt.Printf(" ✗ ...") calls with:

  • status.OK / status.Fail / status.Info — level 1 (2-space indent)
  • status.Detail — level 2 (4-space)
  • status.Sub — level 3 (6-space)
  • status.Section / status.Summary

make validate

Full test matrix in one command — run before every commit:

  1. Go unit tests (harness + launcher)
  2. Bats preflight (Python path)
  3. Bats preflight (Go path)
  4. Integration: bash + podman
  5. Integration: Go + podman
  6. Integration: bash + OCP
  7. Integration: Go + OCP

Test results

Path Result
Go unit tests 28/28
Launcher tests 7/7
Bats preflight (Python) 29/29
Bats preflight (Go) 29/29
bash + podman (full) 19/19
Go + podman (full) 19/19
bash + OCP (full) 17/17

🤖 Generated with Claude Code

robbycochran and others added 5 commits June 4, 2026 16:54
Rewrite providers.py (320 lines Python) as internal/preflight/ (Go).
Same output format — all 29 bats tests pass against both Python and Go
implementations. The Go binary no longer needs python3 or tomllib.

Preflight checks: CLI detection, gateway status (podman vs k8s),
registered provider verification, per-provider input validation
(env vars, files, shell commands), secret masking, file metadata
extraction (ADC project, GWS client_id).

Bats tests gain USE_GO=true mode — same 29 tests run against the
Go harness binary via env var override for TOML paths.

Verified: bats 29/29 (both paths), Go tests 28/28, integration 19/19.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port providers.py (320 lines Python) to internal/preflight/ (Go).
Eliminates python3/tomllib dependency from the harness CLI. All 29
bats tests pass against both Python and Go implementations.

Preflight checks: CLI detection, gateway status (podman vs k8s),
registered provider verification, per-provider input validation
(env vars, files, shell commands), secret masking, file metadata
extraction (ADC project, GWS client_id).

Bats tests gain USE_GO=true mode — same 29 tests run against the
Go binary via env var overrides for TOML paths.

Add `make validate` target: runs the full test matrix (unit tests,
bats both paths, integration {bash,go} x {podman,ocp}) in one
command. Run before every commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add CLIVersion, CLIPath, InferenceModel, ActiveGateway to the Gateway
interface. check.go now uses the interface for all openshell operations
instead of shelling out directly — same swap point as sandbox ops.

Add make validate target: full 6-step test matrix in one command.

Update all mocks (cmd/new_test.go, profile_test.go) for new methods.

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

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New internal/status/ package provides OK, Fail, Info, Detail, Sub,
Section, Summary helpers at consistent indent levels (2/4/6 spaces).
Replaces ~30 scattered fmt.Printf calls with checkmark/x formatting.

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

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@robbycochran robbycochran merged commit 384f95d into main Jun 5, 2026
@robbycochran robbycochran deleted the rc-more-go branch June 13, 2026 14:02
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