From f89566e1bf704da39f4ca25ec82a116b2219f7d1 Mon Sep 17 00:00:00 2001 From: Sebastien La Duca Date: Fri, 26 Jun 2026 12:33:53 -0700 Subject: [PATCH 1/3] feat(sfcompute-v2): adopt sfc-go Capacities to Pools rename sfc-go renamed the Capacities resource to Pools (capResp.PoolResponse, client.Pools.Fetch) and the instance create/list filter field from capacity to pool (ListInstancesRequest.Pool is now a repeatable []string). Update the V2 integration to the new SDK shape. Co-Authored-By: Claude Opus 4.8 (1M context) --- go.mod | 4 ++-- go.sum | 4 ++-- v1/providers/sfcomputev2/instance.go | 4 ++-- v1/providers/sfcomputev2/instancetype.go | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 30b2ca7..363eb35 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/brevdev/cloud -go 1.25.1 +go 1.25.10 require ( github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b @@ -22,7 +22,7 @@ require ( github.com/nebius/gosdk v0.0.0-20250826102719-940ad1dfb5de github.com/pkg/errors v0.9.1 github.com/sfcompute/nodes-go v0.1.0-alpha.4 - github.com/sfcompute/sfc-go v0.1.0-preview.2 + github.com/sfcompute/sfc-go v0.1.0-preview.2.0.20260626173751-becf3866cc44 github.com/stretchr/testify v1.11.1 golang.org/x/crypto v0.52.0 golang.org/x/text v0.37.0 diff --git a/go.sum b/go.sum index 79ea892..4f9ee32 100644 --- a/go.sum +++ b/go.sum @@ -162,8 +162,8 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sfcompute/nodes-go v0.1.0-alpha.4 h1:oFBWcMPSpqLYm/NDs5I1jTvzgx9rsXDL9Ghsm30Hc0Q= github.com/sfcompute/nodes-go v0.1.0-alpha.4/go.mod h1:nUviHgK+Fgt2hDFcRL3M8VoyiypC8fc0dsY8C30QU8M= -github.com/sfcompute/sfc-go v0.1.0-preview.2 h1:IzLovv15bnfh+nwgPK1/rKidCNome9rq06j0vnrzKf0= -github.com/sfcompute/sfc-go v0.1.0-preview.2/go.mod h1:vhUpRpAHKitZzzWPg87RjreC+pzK57PGe4ZuSIQSk94= +github.com/sfcompute/sfc-go v0.1.0-preview.2.0.20260626173751-becf3866cc44 h1:V3OcrL4ImkDj3ymnSGJC/iOW/mAMvyp59KCqZZabOdw= +github.com/sfcompute/sfc-go v0.1.0-preview.2.0.20260626173751-becf3866cc44/go.mod h1:SDgYqB2R6gFM+bzLBeF/Fb+J1HHaTlDuStSkiFuMWDU= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= diff --git a/v1/providers/sfcomputev2/instance.go b/v1/providers/sfcomputev2/instance.go index 16efc80..f1e593b 100644 --- a/v1/providers/sfcomputev2/instance.go +++ b/v1/providers/sfcomputev2/instance.go @@ -57,7 +57,7 @@ func (c *SFCClientV2) CreateInstance(ctx context.Context, attrs v1.CreateInstanc cloudInit := sshKeyCloudInit(attrs.PublicKey) req := components.CreateInstanceRequest{ - Capacity: c.GetDefaultCapacityResourcePath(), + Pool: c.GetDefaultCapacityResourcePath(), Image: c.GetDefaultImageResourcePath(), InstanceSku: sku, CloudInitUserData: &cloudInit, @@ -133,7 +133,7 @@ func (c *SFCClientV2) ListInstances(ctx context.Context, args v1.ListInstancesAr capacityID := c.GetDefaultCapacityResourcePath() resp, err := c.client.Instances.List(ctx, operations.ListInstancesRequest{ Workspace: c.GetWorkspaceResourcePath(), - Capacity: &capacityID, + Pool: []string{capacityID}, }) if err != nil { return nil, errors.WrapAndTrace(err) diff --git a/v1/providers/sfcomputev2/instancetype.go b/v1/providers/sfcomputev2/instancetype.go index 6b622fd..9d0562f 100644 --- a/v1/providers/sfcomputev2/instancetype.go +++ b/v1/providers/sfcomputev2/instancetype.go @@ -140,23 +140,23 @@ func (c *SFCClientV2) GetInstanceTypes(ctx context.Context, args v1.GetInstanceT func (c *SFCClientV2) skuFreeCapacity(ctx context.Context) (map[string]int, error) { capacityID := c.GetDefaultCapacityResourcePath() - capResp, err := c.client.Capacities.Fetch(ctx, capacityID, nil) + capResp, err := c.client.Pools.Fetch(ctx, capacityID, nil) if err != nil { return nil, errors.WrapAndTrace(err) } - if capResp.CapacityResponse == nil { + if capResp.PoolResponse == nil { return map[string]int{}, nil } now := time.Now().Unix() free := make(map[string]int) - for skuID, schedule := range capResp.CapacityResponse.AllocationSchedule.ByInstanceSku { + for skuID, schedule := range capResp.PoolResponse.AllocationSchedule.ByInstanceSku { free[skuID] = currentScheduleAllocation(schedule, now) } resp, err := c.client.Instances.List(ctx, operations.ListInstancesRequest{ Workspace: c.GetWorkspaceResourcePath(), - Capacity: &capacityID, + Pool: []string{capacityID}, }) if err != nil { return nil, errors.WrapAndTrace(err) From 8adf44acfde0ba67374b6d14a96375b49d2cc67e Mon Sep 17 00:00:00 2001 From: Sebastien La Duca Date: Fri, 26 Jun 2026 13:11:35 -0700 Subject: [PATCH 2/3] fix(sfcompute-v2): use sfc:pool resource-path scheme The pool rename also changed the resource-path prefix from sfc:capacity: to sfc:pool:. Update GetDefaultPoolResourcePath (renamed from GetDefaultCapacityResourcePath) so the path the API receives is valid. Co-Authored-By: Claude Opus 4.8 (1M context) --- v1/providers/sfcomputev2/brev_constants.go | 4 ++-- v1/providers/sfcomputev2/instance.go | 6 +++--- v1/providers/sfcomputev2/instancetype.go | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/v1/providers/sfcomputev2/brev_constants.go b/v1/providers/sfcomputev2/brev_constants.go index 5cf7aac..2e238fb 100644 --- a/v1/providers/sfcomputev2/brev_constants.go +++ b/v1/providers/sfcomputev2/brev_constants.go @@ -15,8 +15,8 @@ const ( brevDefaultImageResourcePath = "sfc:image:sfcompute:public:ubuntu-24.04.4-cuda-12.8" ) -func (c *SFCClientV2) GetDefaultCapacityResourcePath() string { - return fmt.Sprintf("sfc:capacity:%s:%s:default", c.organization, c.workspace) +func (c *SFCClientV2) GetDefaultPoolResourcePath() string { + return fmt.Sprintf("sfc:pool:%s:%s:default", c.organization, c.workspace) } func (c *SFCClientV2) GetWorkspaceResourcePath() string { diff --git a/v1/providers/sfcomputev2/instance.go b/v1/providers/sfcomputev2/instance.go index f1e593b..f3c1076 100644 --- a/v1/providers/sfcomputev2/instance.go +++ b/v1/providers/sfcomputev2/instance.go @@ -57,7 +57,7 @@ func (c *SFCClientV2) CreateInstance(ctx context.Context, attrs v1.CreateInstanc cloudInit := sshKeyCloudInit(attrs.PublicKey) req := components.CreateInstanceRequest{ - Pool: c.GetDefaultCapacityResourcePath(), + Pool: c.GetDefaultPoolResourcePath(), Image: c.GetDefaultImageResourcePath(), InstanceSku: sku, CloudInitUserData: &cloudInit, @@ -130,10 +130,10 @@ func (c *SFCClientV2) ListInstances(ctx context.Context, args v1.ListInstancesAr v1.LogField("location", c.location), ) - capacityID := c.GetDefaultCapacityResourcePath() + poolID := c.GetDefaultPoolResourcePath() resp, err := c.client.Instances.List(ctx, operations.ListInstancesRequest{ Workspace: c.GetWorkspaceResourcePath(), - Pool: []string{capacityID}, + Pool: []string{poolID}, }) if err != nil { return nil, errors.WrapAndTrace(err) diff --git a/v1/providers/sfcomputev2/instancetype.go b/v1/providers/sfcomputev2/instancetype.go index 9d0562f..fc98add 100644 --- a/v1/providers/sfcomputev2/instancetype.go +++ b/v1/providers/sfcomputev2/instancetype.go @@ -138,25 +138,25 @@ func (c *SFCClientV2) GetInstanceTypes(ctx context.Context, args v1.GetInstanceT // per-SKU allocation from the capacity schedule and the per-SKU consumption from the instance // list, issuing exactly two API calls. func (c *SFCClientV2) skuFreeCapacity(ctx context.Context) (map[string]int, error) { - capacityID := c.GetDefaultCapacityResourcePath() + poolID := c.GetDefaultPoolResourcePath() - capResp, err := c.client.Pools.Fetch(ctx, capacityID, nil) + poolResp, err := c.client.Pools.Fetch(ctx, poolID, nil) if err != nil { return nil, errors.WrapAndTrace(err) } - if capResp.PoolResponse == nil { + if poolResp.PoolResponse == nil { return map[string]int{}, nil } now := time.Now().Unix() free := make(map[string]int) - for skuID, schedule := range capResp.PoolResponse.AllocationSchedule.ByInstanceSku { + for skuID, schedule := range poolResp.PoolResponse.AllocationSchedule.ByInstanceSku { free[skuID] = currentScheduleAllocation(schedule, now) } resp, err := c.client.Instances.List(ctx, operations.ListInstancesRequest{ Workspace: c.GetWorkspaceResourcePath(), - Pool: []string{capacityID}, + Pool: []string{poolID}, }) if err != nil { return nil, errors.WrapAndTrace(err) @@ -233,7 +233,7 @@ func (c *SFCClientV2) selectAvailableSku(ctx context.Context) (string, error) { return skuID, nil } } - return "", fmt.Errorf("no instance SKU with available capacity in %s", c.GetDefaultCapacityResourcePath()) + return "", fmt.Errorf("no instance SKU with available capacity in %s", c.GetDefaultPoolResourcePath()) } func (c *SFCClientV2) GetLocations(_ context.Context, _ v1.GetLocationsArgs) ([]v1.Location, error) { From 7b24b3a919fed19b7450e7504e5528299bc61c25 Mon Sep 17 00:00:00 2001 From: Sebastien La Duca Date: Fri, 26 Jun 2026 13:35:54 -0700 Subject: [PATCH 3/3] chore: bump sfc-go to v0.1.0-preview.3 Co-Authored-By: Claude Opus 4.8 (1M context) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 363eb35..3fc037d 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/nebius/gosdk v0.0.0-20250826102719-940ad1dfb5de github.com/pkg/errors v0.9.1 github.com/sfcompute/nodes-go v0.1.0-alpha.4 - github.com/sfcompute/sfc-go v0.1.0-preview.2.0.20260626173751-becf3866cc44 + github.com/sfcompute/sfc-go v0.1.0-preview.3 github.com/stretchr/testify v1.11.1 golang.org/x/crypto v0.52.0 golang.org/x/text v0.37.0 diff --git a/go.sum b/go.sum index 4f9ee32..1b2c00d 100644 --- a/go.sum +++ b/go.sum @@ -162,8 +162,8 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sfcompute/nodes-go v0.1.0-alpha.4 h1:oFBWcMPSpqLYm/NDs5I1jTvzgx9rsXDL9Ghsm30Hc0Q= github.com/sfcompute/nodes-go v0.1.0-alpha.4/go.mod h1:nUviHgK+Fgt2hDFcRL3M8VoyiypC8fc0dsY8C30QU8M= -github.com/sfcompute/sfc-go v0.1.0-preview.2.0.20260626173751-becf3866cc44 h1:V3OcrL4ImkDj3ymnSGJC/iOW/mAMvyp59KCqZZabOdw= -github.com/sfcompute/sfc-go v0.1.0-preview.2.0.20260626173751-becf3866cc44/go.mod h1:SDgYqB2R6gFM+bzLBeF/Fb+J1HHaTlDuStSkiFuMWDU= +github.com/sfcompute/sfc-go v0.1.0-preview.3 h1:azKThmbm9ljQ+z8RP4039XwV4bJMTcYKNpKcxrpNf5A= +github.com/sfcompute/sfc-go v0.1.0-preview.3/go.mod h1:SDgYqB2R6gFM+bzLBeF/Fb+J1HHaTlDuStSkiFuMWDU= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=