Skip to content

Commit 20c8de0

Browse files
committed
fix(ports): resolve contract drift in ToolchainDownload and RegistryToolchain
- Sync RegistryToolchain with registry.ToolchainInfo (remove UpstreamVersion, field only exists in toolchain.RegistryToolchain not in registry index) - Sync ToolchainDownload with toolchain.RegistryToolchain (add UpstreamVersion as optional, fix SHA256→Sha256 casing to match implementation) - Fix bidirectional assertions in assertions.go for field name consistency - All 15 TestPortFieldCounts pass
1 parent 4fdbe92 commit 20c8de0

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

cli/toob-cli/internal/ports/assertions.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,16 @@ func assertToolchainFromPort() {
119119
func assertToolchainDownloadToPort() {
120120
var r toolchain.RegistryToolchain
121121
_ = ToolchainDownload{
122-
Version: r.Version, URLs: r.URLs, SHA256: r.Sha256,
122+
Version: r.Version, UpstreamVersion: r.UpstreamVersion,
123+
URLs: r.URLs, Sha256: r.Sha256,
123124
}
124125
}
125126

126127
func assertToolchainDownloadFromPort() {
127128
var p ToolchainDownload
128129
_ = toolchain.RegistryToolchain{
129-
Version: p.Version, URLs: p.URLs, Sha256: p.SHA256,
130+
Version: p.Version, UpstreamVersion: p.UpstreamVersion,
131+
URLs: p.URLs, Sha256: p.Sha256,
130132
}
131133
}
132134

cli/toob-cli/internal/ports/ports.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,19 @@ type RegistryIntegration struct {
174174
Description string `json:"description" port:"optional"`
175175
}
176176

177-
// RegistryToolchain defines toolchain download metadata in registry.json.
177+
// RegistryToolchain defines toolchain metadata in registry.json.
178178
type RegistryToolchain struct {
179-
Path string `json:"path" port:"optional"`
180-
Version string `json:"version" port:"required"`
181-
UpstreamVersion string `json:"upstream_version" port:"required"`
179+
Path string `json:"path" port:"optional"`
180+
Version string `json:"version" port:"required"`
182181
}
183182

184183
// ToolchainDownload is the extended toolchain entry used by toolchain/manager.go
185184
// for auto-provisioning. Includes download URLs and checksums per OS/arch.
186185
type ToolchainDownload struct {
187-
Version string `json:"version" port:"required"`
188-
URLs map[string]string `json:"urls" port:"required"` // Key: {os}_{arch}
189-
SHA256 map[string]string `json:"sha256" port:"required"` // Key: {os}_{arch}
186+
Version string `json:"version" port:"required"`
187+
UpstreamVersion string `json:"upstream_version" port:"optional"`
188+
URLs map[string]string `json:"urls" port:"required"`
189+
Sha256 map[string]string `json:"sha256" port:"required"`
190190
}
191191

192192
// HardwareJSON is the parsed content of chips/{chip}/hardware.json.

0 commit comments

Comments
 (0)