Scenario 6: Before/After Binary Comparison

ObjectiveVerify the fix changes only the logger initialization and has no other behavioral differences
Maps toVerification that the specific bug is fixed with a minimal, surgical change

Verification Steps

StepCheckResultEvidence
1 Compare binary sizes PASS Before: 162,040,706 bytes; After: 162,041,058 bytes (+352 bytes)
2 Compare hcp version output PASS Identical output
3 Compare hcp --help output PASS diff confirms identical output
4 Compare destroy command behavior PASS Identical error messages and JSON log format
5 Review source diff PASS Only adds newLogger() function and ctrl.SetLogger() call

Evidence

Step 1: Binary Size Comparison

$ ls -la /tmp/hcp-before /tmp/hcp-after
-rwxr-xr-x  1 brcox  wheel  162040706 Jul 13 08:42 /tmp/hcp-before
-rwxr-xr-x  1 brcox  wheel  162041058 Jul 13 08:42 /tmp/hcp-after

+352 bytes — only the logger initialization code.

Step 2: hcp version Comparison

BEFORE:
Client Version: openshift/hypershift: 8ea96d7f8cfa3eb4e7dc93be96a04341fc5a2240. Latest supported OCP: 5.0.0
Server Version: 1eddaf8e5e593b440723b6166c88d6220850173c
Server Supports OCP Versions: 5.0, 4.23, 4.22, 4.21, 4.20, 4.19, 4.18, 4.17, 4.16, 4.15, 4.14

AFTER:
Client Version: openshift/hypershift: 8ea96d7f8cfa3eb4e7dc93be96a04341fc5a2240. Latest supported OCP: 5.0.0
Server Version: 1eddaf8e5e593b440723b6166c88d6220850173c
Server Supports OCP Versions: 5.0, 4.23, 4.22, 4.21, 4.20, 4.19, 4.18, 4.17, 4.16, 4.15, 4.14

Step 3: hcp --help Comparison

$ diff <(/tmp/hcp-before --help 2>&1) <(/tmp/hcp-after --help 2>&1)
(no output — identical)
Help output: IDENTICAL

Step 4: Destroy Command Comparison

BEFORE:
{"level":"info","ts":"2026-07-13T08:47:40-04:00","msg":"Hosted cluster not found, destroying infrastructure from user input","namespace":"clusters","name":"nonexistent","infraID":""}
Error: required inputs are missing: infrastructure ID is required

AFTER:
{"level":"info","ts":"2026-07-13T08:47:40-04:00","msg":"Hosted cluster not found, destroying infrastructure from user input","namespace":"clusters","name":"nonexistent","infraID":""}
Error: required inputs are missing: infrastructure ID is required

Step 5: Source Diff

diff --git a/product-cli/main.go b/product-cli/main.go
index 270d232ab5..328acbcc9e 100644
--- a/product-cli/main.go
+++ b/product-cli/main.go
@@ -25,10 +25,25 @@ import (
 	"github.com/openshift/hypershift/product-cli/cmd/create"
 	"github.com/openshift/hypershift/product-cli/cmd/destroy"

+	ctrl "sigs.k8s.io/controller-runtime"
+	"sigs.k8s.io/controller-runtime/pkg/log/zap"
+
+	"github.com/go-logr/logr"
 	"github.com/spf13/cobra"
+	"go.uber.org/zap/zapcore"
 )

+func newLogger(extraOpts ...zap.Opts) logr.Logger {
+	opts := []zap.Opts{zap.JSONEncoder(func(o *zapcore.EncoderConfig) {
+		o.EncodeTime = zapcore.RFC3339TimeEncoder
+	})}
+	opts = append(opts, extraOpts...)
+	return zap.New(opts...)
+}
+
 func main() {
+	ctrl.SetLogger(newLogger())
+
 	cmd := &cobra.Command{

« Scenario 5: Basic CLI Functionality Dashboard »