From f2ce6ef0d3a7d1f0b9fe347a849e556017df69a4 Mon Sep 17 00:00:00 2001 From: Irina Shestak Date: Tue, 6 Apr 2021 10:32:26 -0400 Subject: [PATCH] fix(rover): store SupergraphConfig in BTreeMap (#423) SupergraphConfig was previously stored in a HashMap, the implementation of which is non-deterministic in Rust. This commit changes it over to a BTreeMap which ensures correct ordering. closes #422 --- installers/npm/package-lock.json | 12 ++++++------ src/command/supergraph/config.rs | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/installers/npm/package-lock.json b/installers/npm/package-lock.json index 7e13bdb97..39065b7e9 100644 --- a/installers/npm/package-lock.json +++ b/installers/npm/package-lock.json @@ -29,9 +29,9 @@ } }, "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.1.tgz", + "integrity": "sha512-qyTw2VPYRg31SlVU5WDdvCSyMTJ3YSP4Kz2CidWZFPFawCiHJdCyKyZeXIGMJ5ebMQYXEI56kDR8tcnDkbZstg==" }, "node_modules/binary-install": { "version": "0.1.1", @@ -306,9 +306,9 @@ } }, "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.1.tgz", + "integrity": "sha512-qyTw2VPYRg31SlVU5WDdvCSyMTJ3YSP4Kz2CidWZFPFawCiHJdCyKyZeXIGMJ5ebMQYXEI56kDR8tcnDkbZstg==" }, "binary-install": { "version": "0.1.1", diff --git a/src/command/supergraph/config.rs b/src/command/supergraph/config.rs index cdf1032ce..9a6b5f1b6 100644 --- a/src/command/supergraph/config.rs +++ b/src/command/supergraph/config.rs @@ -4,12 +4,14 @@ use camino::Utf8PathBuf; use harmonizer::ServiceDefinition as SubgraphDefinition; use serde::{Deserialize, Serialize}; -use std::collections::HashMap; +use std::collections::BTreeMap; + use std::fs; #[derive(Debug, Clone, Serialize, Deserialize)] pub(crate) struct SupergraphConfig { - pub(crate) subgraphs: HashMap, + // Store config in a BTreeMap, as HashMap is non-deterministic. + pub(crate) subgraphs: BTreeMap, } #[derive(Debug, Clone, Serialize, Deserialize)]