Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creates deterministic ordering of features for experimenter manifest #4819

Merged
merged 3 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGES_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ Use the template below to make assigning a version number during the release cut

## Xcode

- Bumped Xcode version from 13.1.0 -> 13.2.1
- Bumped Xcode version from 13.1.0 -> 13.2.1

## Nimbus FML
### What's fixed
- Fixes a bug where each time the fml is run, the ordering of features in the experimenter json is changed. ([#4819](https://github.com/mozilla/application-services/pull/4819))
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use std::collections::HashMap;
use std::collections::BTreeMap;
use std::fmt::Display;

use serde::Serialize;
Expand Down Expand Up @@ -32,7 +32,7 @@ struct ExperimenterFeatureManifest {
#[derive(Debug, Default, Clone, Serialize)]
pub struct Variables(serde_json::Value);

impl TryFrom<FeatureManifest> for HashMap<String, ExperimenterFeatureManifest> {
impl TryFrom<FeatureManifest> for BTreeMap<String, ExperimenterFeatureManifest> {
type Error = crate::error::FMLError;
fn try_from(fm: FeatureManifest) -> Result<Self> {
fm.feature_defs
Expand Down Expand Up @@ -139,7 +139,7 @@ pub(crate) fn generate_manifest(
_config: Config,
cmd: GenerateExperimenterManifestCmd,
) -> Result<()> {
let experiment_manifest: HashMap<String, ExperimenterFeatureManifest> = ir.try_into()?;
let experiment_manifest: BTreeMap<String, ExperimenterFeatureManifest> = ir.try_into()?;
let output_str = serde_json::to_string_pretty(&experiment_manifest)?;
std::fs::write(cmd.output, output_str)?;
Ok(())
Expand Down