From beb50b120fac5de7a88e0354db88ee5f05029c74 Mon Sep 17 00:00:00 2001 From: lrlna Date: Tue, 6 Apr 2021 13:05:19 +0200 Subject: [PATCH] fix(rover): store SupergraphConfig in BTreeMap 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 0d5c868a2..71bf4cf59 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)]