Skip to content

Commit 22e9c31

Browse files
Update hypeman-go SDK to 134587a
Bumps github.com/kernel/hypeman-go to v0.28.1-0.20261001160305-134587a222ac, which carries the SDK's 2026-09-30 vulnerability remediation. This commit is on main, whereas the branch previously pinned e6c2b7b from the SDK's next branch. The Windows hypervisor primitives generated there are therefore absent, dropping InstanceLogsParamsSourceSwtpm and InstanceGPU.DevicePath. Both values are still specified by the API, so rather than regress `hypeman logs --source swtpm` and the vendor VFIO vGPU column in `hypeman ps`, read them without the generated bindings: the log source is a string-backed enum, and device_path arrives in JSON.ExtraFields. Both can go back to typed access once next lands on main. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5774c56 commit 22e9c31

6 files changed

Lines changed: 41 additions & 10 deletions

File tree

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/google/go-containerregistry v0.20.7
1313
github.com/gorilla/websocket v1.5.3
1414
github.com/itchyny/json2yaml v0.1.4
15-
github.com/kernel/hypeman-go v0.28.1-0.20260902143136-e6c2b7bc0171
15+
github.com/kernel/hypeman-go v0.28.1-0.20261001160305-134587a222ac
1616
github.com/knadh/koanf/parsers/yaml v1.1.0
1717
github.com/knadh/koanf/providers/env v1.1.0
1818
github.com/knadh/koanf/providers/file v1.2.1

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnV
8080
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
8181
github.com/itchyny/json2yaml v0.1.4 h1:/pErVOXGG5iTyXHi/QKR4y3uzhLjGTEmmJIy97YT+k8=
8282
github.com/itchyny/json2yaml v0.1.4/go.mod h1:6iudhBZdarpjLFRNj+clWLAkGft+9uCcjAZYXUH9eGI=
83-
github.com/kernel/hypeman-go v0.28.1-0.20260902143136-e6c2b7bc0171 h1:psPDtnXBaPABqymQW5lu1o9YOF7gyyxJZeQOCqcuxyo=
84-
github.com/kernel/hypeman-go v0.28.1-0.20260902143136-e6c2b7bc0171/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48=
83+
github.com/kernel/hypeman-go v0.28.1-0.20261001160305-134587a222ac h1:dAwrSu1y5hCNcqsnNq8ovzIYnJq+RcB7hjmr+qr8hy8=
84+
github.com/kernel/hypeman-go v0.28.1-0.20261001160305-134587a222ac/go.mod h1:C3X0483PGbvn6ySpvPrgSH2joOWqacu9KUYd1gIE5cI=
8585
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
8686
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
8787
github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=

‎pkg/cmd/coveragecmd_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func TestParseInstanceLogsSource(t *testing.T) {
8585
t.Run("accepts mixed-case source names", func(t *testing.T) {
8686
source, err := parseInstanceLogsSource("SwTpM")
8787
require.NoError(t, err)
88-
assert.Equal(t, hypeman.InstanceLogsParamsSourceSwtpm, source)
88+
assert.Equal(t, instanceLogsSourceSwtpm, source)
8989
})
9090

9191
t.Run("rejects unsupported source names", func(t *testing.T) {

‎pkg/cmd/logs.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import (
1010
"github.com/urfave/cli/v3"
1111
)
1212

13+
// instanceLogsSourceSwtpm is the "swtpm" value accepted by the API's log source
14+
// enum. The generated SDK does not define a constant for it yet.
15+
const instanceLogsSourceSwtpm hypeman.InstanceLogsParamsSource = "swtpm"
16+
1317
var logsCmd = cli.Command{
1418
Name: "logs",
1519
Usage: "Fetch the logs of an instance",
@@ -93,7 +97,7 @@ func parseInstanceLogsSource(raw string) (hypeman.InstanceLogsParamsSource, erro
9397
case "hypeman":
9498
return hypeman.InstanceLogsParamsSourceHypeman, nil
9599
case "swtpm":
96-
return hypeman.InstanceLogsParamsSourceSwtpm, nil
100+
return instanceLogsSourceSwtpm, nil
97101
default:
98102
return "", fmt.Errorf("invalid source: %s (must be app, vmm, hypeman, or swtpm)", raw)
99103
}

‎pkg/cmd/ps.go‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"context"
5+
"encoding/json"
56
"fmt"
67
"os"
78

@@ -123,12 +124,29 @@ func formatGPU(gpu hypeman.InstanceGPU) string {
123124
}
124125
// A vGPU is attached without a profile name shown. mdev_uuid is only populated on
125126
// mdev hosts; vendor VFIO hosts report device_path instead.
126-
if gpu.MdevUuid != "" || gpu.DevicePath != "" {
127+
if gpu.MdevUuid != "" || instanceGPUDevicePath(gpu) != "" {
127128
return "vgpu"
128129
}
129130
return "-"
130131
}
131132

133+
// instanceGPUDevicePath returns the sysfs path of the assigned vGPU device,
134+
// which the API reports on vendor VFIO hosts. The generated SDK has no typed
135+
// field for it yet, so it arrives as an extra field.
136+
func instanceGPUDevicePath(gpu hypeman.InstanceGPU) string {
137+
// Valid reports false for extra fields, so decode Raw instead; it is empty
138+
// when the field is absent.
139+
raw := gpu.JSON.ExtraFields["device_path"].Raw()
140+
if raw == "" {
141+
return ""
142+
}
143+
var devicePath string
144+
if err := json.Unmarshal([]byte(raw), &devicePath); err != nil {
145+
return ""
146+
}
147+
return devicePath
148+
}
149+
132150
// formatHypervisor returns a short abbreviation for the hypervisor
133151
func formatHypervisor(hv hypeman.InstanceHypervisor) string {
134152
switch hv {

‎pkg/cmd/ps_test.go‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cmd
22

33
import (
4+
"encoding/json"
45
"testing"
56

67
"github.com/kernel/hypeman-go"
@@ -35,10 +36,8 @@ func TestFormatGPU(t *testing.T) {
3536
expected: "vgpu",
3637
},
3738
{
38-
name: "vGPU without profile but with device path",
39-
gpu: hypeman.InstanceGPU{
40-
DevicePath: "/sys/bus/pci/devices/0000:41:00.4",
41-
},
39+
name: "vGPU without profile but with device path",
40+
gpu: instanceGPUFromJSON(t, `{"device_path":"/sys/bus/pci/devices/0000:41:00.4"}`),
4241
expected: "vgpu",
4342
},
4443
}
@@ -51,6 +50,16 @@ func TestFormatGPU(t *testing.T) {
5150
}
5251
}
5352

53+
// instanceGPUFromJSON decodes an InstanceGPU the way the API delivers it, so
54+
// fields the SDK does not type yet land in JSON.ExtraFields.
55+
func instanceGPUFromJSON(t *testing.T, raw string) hypeman.InstanceGPU {
56+
t.Helper()
57+
58+
var gpu hypeman.InstanceGPU
59+
require.NoError(t, json.Unmarshal([]byte(raw), &gpu))
60+
return gpu
61+
}
62+
5463
func TestFormatHypervisor(t *testing.T) {
5564
tests := []struct {
5665
name string

0 commit comments

Comments
 (0)