Version
main at 7607854c8d6b6509b52a9296d7ce149968c011ba (2026-07-22).
Installation method
Source inspection and unit-test analysis.
Describe the bug
Equivalent sets of compute instances do not currently have a canonical discovery order before provider calls. Several paths derive ordered slices from unordered maps or from upstream list encounter order:
pkg/engines/slurm/slurm.go:128-153: aggregateComputeInstances ranges over the i2n map and appends regions on first encounter. The returned []ComputeInstances region order therefore depends on Go map iteration. TestAggregateComputeInstances uses ElementsMatch, which masks this property.
internal/k8s/utils.go:107-133: GetComputeInstances preserves the first-seen region order from NodeList.Items instead of defining a canonical region order.
pkg/engines/slinky/engine.go:249-282: the Slinky-specific builder repeats the same first-seen-region behavior.
pkg/topology/request.go:122-130: GetNodeNameList ranges over each Instances map without sorting. This list feeds both bare-metal pdsh and getIbTree, so the host/probe sequence can vary for the same logical request.
pkg/providers/aws/instance_topology.go:61-66: DescribeInstanceTopologyInput.InstanceIds is built directly from an Instances map.
The final Slurm serializers already sort many topology structures, so this report does not claim that every successful run emits different topology.conf bytes. The nondeterminism occurs earlier: region API fan-out order, explicit provider request order, InfiniBand probe-host order, logs/metrics, and which error is returned first when more than one region or probe can fail.
Minimum reproducible example
A deterministic regression test can construct the same logical mapping through every permutation of input node order, for example:
instances := map[string]string{
"i-b": "node-b",
"i-a": "node-a",
"i-c": "node-c",
}
regions := map[string]string{
"node-b": "region-b",
"node-a": "region-a",
"node-c": "region-b",
}
Today, the Slurm aggregation test cannot assert one exact result because region creation follows map iteration. Likewise, a fake AWS client or fake IBNetDiscover runner can observe different ID/host call order unless the caller sorts first.
Expected deterministic behavior
Define one canonical ordering at the ComputeInstances boundary:
- regions sorted lexicographically;
- instance IDs sorted lexicographically within each region whenever converted to a slice;
- node names sorted lexicographically for host-oriented command/probe lists.
The ordering should be applied before external provider/API/exec calls, not only during final serialization. Canonicalization must not mutate the caller-owned request and must not change the canonical topology.Graph shape.
Proposed implementation
- Add small shared sorting helpers near
topology.ComputeInstances rather than duplicating ordering logic across engines/providers.
- Make Slurm, Kubernetes, and Slinky aggregation return regions in the same canonical order.
- Make
GetNodeNameList return a sorted list while preserving its current membership semantics.
- Sort AWS explicit
InstanceIds before DescribeInstanceTopology; audit other map-to-request conversions in DSX/OCI/InfiniBand and use the same helper where applicable.
- Keep provider discovery sequential unless concurrency is separately designed; deterministic sequencing also makes first-error precedence stable.
Acceptance criteria
Alternatives considered
Sorting only the final topology.conf or JSON output is insufficient because provider calls and failure selection have already occurred. Relying on Kubernetes list order is also insufficient because it would leave the Slurm and Go-map paths unordered and would make engine behavior inconsistent.
By submitting this issue, I agree to follow the project's Code of Conduct and contributing guidelines. I searched open and closed issues and PRs for ComputeInstances ordering, map iteration, provider call order, GetNodeNameList, InfiniBand probe order, and region ordering; I found no duplicate.
Version
mainat7607854c8d6b6509b52a9296d7ce149968c011ba(2026-07-22).Installation method
Source inspection and unit-test analysis.
Describe the bug
Equivalent sets of compute instances do not currently have a canonical discovery order before provider calls. Several paths derive ordered slices from unordered maps or from upstream list encounter order:
pkg/engines/slurm/slurm.go:128-153:aggregateComputeInstancesranges over thei2nmap and appends regions on first encounter. The returned[]ComputeInstancesregion order therefore depends on Go map iteration.TestAggregateComputeInstancesusesElementsMatch, which masks this property.internal/k8s/utils.go:107-133:GetComputeInstancespreserves the first-seen region order fromNodeList.Itemsinstead of defining a canonical region order.pkg/engines/slinky/engine.go:249-282: the Slinky-specific builder repeats the same first-seen-region behavior.pkg/topology/request.go:122-130:GetNodeNameListranges over eachInstancesmap without sorting. This list feeds both bare-metalpdshandgetIbTree, so the host/probe sequence can vary for the same logical request.pkg/providers/aws/instance_topology.go:61-66:DescribeInstanceTopologyInput.InstanceIdsis built directly from anInstancesmap.The final Slurm serializers already sort many topology structures, so this report does not claim that every successful run emits different
topology.confbytes. The nondeterminism occurs earlier: region API fan-out order, explicit provider request order, InfiniBand probe-host order, logs/metrics, and which error is returned first when more than one region or probe can fail.Minimum reproducible example
A deterministic regression test can construct the same logical mapping through every permutation of input node order, for example:
Today, the Slurm aggregation test cannot assert one exact result because region creation follows map iteration. Likewise, a fake AWS client or fake
IBNetDiscoverrunner can observe different ID/host call order unless the caller sorts first.Expected deterministic behavior
Define one canonical ordering at the
ComputeInstancesboundary:The ordering should be applied before external provider/API/exec calls, not only during final serialization. Canonicalization must not mutate the caller-owned request and must not change the canonical
topology.Graphshape.Proposed implementation
topology.ComputeInstancesrather than duplicating ordering logic across engines/providers.GetNodeNameListreturn a sorted list while preserving its current membership semantics.InstanceIdsbeforeDescribeInstanceTopology; audit other map-to-request conversions in DSX/OCI/InfiniBand and use the same helper where applicable.Acceptance criteria
[]ComputeInstancesfor every permutation of the same logical nodes.GetNodeNameListhas an exact-order test; callers receive the same host sequence for permuted map construction.make qualifypasses, documentation impact is evaluated, and the user-visible determinism fix is recorded underCHANGELOG.md[Unreleased].Alternatives considered
Sorting only the final
topology.confor JSON output is insufficient because provider calls and failure selection have already occurred. Relying on Kubernetes list order is also insufficient because it would leave the Slurm and Go-map paths unordered and would make engine behavior inconsistent.By submitting this issue, I agree to follow the project's Code of Conduct and contributing guidelines. I searched open and closed issues and PRs for ComputeInstances ordering, map iteration, provider call order,
GetNodeNameList, InfiniBand probe order, and region ordering; I found no duplicate.