feat: native Go preflight, make validate#13
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/checkkinds), secret masking, JSON metadata extraction (ADC project, GWS client_id)check.go— CLI detection, gateway status (podman vs k8s auto-detected), registered provider verification viagateway.Gatewayinterface, per-provider input validation,--strictexit codecmd/preflight.go— native Go instead of bash wrapper. Supportscheck,available,namessubcommandsUSE_GO=true bats test/preflight.batsruns same 29 tests against Go binaryGateway interface expansion
Added
CLIVersion,CLIPath,InferenceModel,ActiveGatewayto thegateway.Gatewayinterface. All openshell CLI interactions incheck.gonow 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.Summarymake validateFull test matrix in one command — run before every commit:
Test results
🤖 Generated with Claude Code