fix: remove dead HostIndex field and unreachable nil branch - #197
Open
andrewwhitecdw wants to merge 1 commit into
Open
Conversation
Greptile SummaryThis PR completes removal of the obsolete Spectrum-X
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "fix: remove dead HostIndex field and unr..." | Re-trigger Greptile |
Signed-off-by: andrewwhitecdw <andrewwhitecdw@users.noreply.github.com>
andrewwhitecdw
force-pushed
the
codequality/addressing-remove-dead-hostindex-field-and
branch
from
August 17, 2026 22:08
7364c0c to
8cd44d6
Compare
Author
|
@greptile-apps thanks for the catch. The remaining
Verification:
The branch has been force-pushed; please re-review. |
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.
This PR removes the dead
HostIndexfield fromtopologyEndpointand the unreachable nil branch that used it.Changes
pkg/networkoperatorplugin/spectrumx/addressing.go: remove theHostIndexfield fromtopologyEndpointand always derive host indices withcountHostIndex.pkg/networkoperatorplugin/spectrumx/air_topology.go: remove the now-removedHostIndexinitialization innormalizeAIRHostLink.pkg/networkoperatorplugin/spectrumx/air_topology_test.go: remove assertions on the removedHostIndexfield.pkg/networkoperatorplugin/spectrumx/addressing_test.go: update the 3-tier AIR topology expectation to reflect count-based host indexing (the single host in the test now receives index0instead of the parsed hostname index3).Details
addressing.gotype topologyEndpoint struct { Node string `json:"node"` Interface string `json:"interface"` Attrs topologyAttributes `json:"attributes"` - HostIndex *int `json:"-"` }key := hostIndexKey(host.Attrs) index, ok := hostIndexes[key+"|"+host.Node] if !ok { - if host.HostIndex != nil { - index = *host.HostIndex - } else { - index = countHostIndex(hostIndexes, key) - } + index = countHostIndex(hostIndexes, key) hostIndexes[key+"|"+host.Node] = index }air_topology.goTesting
go test ./pkg/networkoperatorplugin/spectrumx/...— passgo build ./...— passgo test ./...— pass