diff --git a/package-lock.json b/package-lock.json index 771ba94..12cf238 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9371,4 +9371,4 @@ "integrity": "sha512-Xauxz4WDOmHaZHWvmi00wz7yiIYGe8Sha1voedIAZFzoqXvFblGiuxTQca+B6SHhD3uzd63wYJaQf7VkfUaEIw==" } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 736aa77..16c0317 100644 --- a/package.json +++ b/package.json @@ -103,4 +103,4 @@ "dependencies": { "yui-lint": "^0.2.0" } -} \ No newline at end of file +} diff --git a/src/store.js b/src/store.js index b564d59..b7d42c6 100644 --- a/src/store.js +++ b/src/store.js @@ -349,12 +349,14 @@ export function generateEffectiveGenome(expsKeyStates, genomes) { const activeEids = new Set(); expsKeyStates.forEach(function (expKeyStates, eid) { const active = expKeyStates.get('active'); - if (eid in genomes && active) { - const activeGenome = objects.filter(objects.deepClone(genomes[eid]), active); + if (active) { + activeEids.add(eid); + if (eid in genomes) { + const activeGenome = objects.filter(objects.deepClone(genomes[eid]), active); - if (Object.keys(activeGenome).length) { - activeEids.add(eid); - effectiveGenome = objects.deepMerge(effectiveGenome, activeGenome); + if (Object.keys(activeGenome).length) { + effectiveGenome = objects.deepMerge(effectiveGenome, activeGenome); + } } } }); diff --git a/src/tests/store.test.js b/src/tests/store.test.js index 8307836..60cd7fb 100644 --- a/src/tests/store.test.js +++ b/src/tests/store.test.js @@ -754,7 +754,47 @@ describe('store.js', () => { }, "id": "64928df20a", "_paused": false - }] + }, + { + "web": { + "jo41drmyb": { + "_is_entry_point": true, + "_predicate": { + "combinator": "and", + "rules": [ + { + "field": "web.url", + "operator": "regex64_match", + "value": "L2h0dHBzPzpcL1wvbmUyY3QuY3NiLmFwcFwvXC8/KD86JHxcP3wjKS9p" + } + ] + }, + "_initializers": true + }, + "zl0f2e2e7": { + "_is_entry_point": false, + "_predicate": { + "combinator": "and", + "rules": [ + { + "field": "web.url", + "operator": "regex64_match", + "value": "L2h0dHBzPzpcL1wvbmUyY3QuY3NiLmFwcFwvcGFnZTFcLmh0bWxcLz8oPzokfFw/fCMpL2k=" + } + ] + }, + "7ulgknqr5": { + "_values": true + }, + "_initializers": true + } + }, + "_predicate": {}, + "id": "c4154ac833", + "_paused": false, + "_optimization_metric": "SESSION", + "_include_eid_in_hash": true + }] } genomes = { "60f67d8648": { @@ -836,7 +876,6 @@ describe('store.js', () => { const result = generateEffectiveGenome(configKeyStates.experiments, genomes); - expect(Array.from(result.activeEids)).to.be.eql(["60f67d8648"]); expect(result.effectiveGenome).to.be.eql({ "web": { "2nsqubits": { @@ -865,7 +904,6 @@ describe('store.js', () => { const result = generateEffectiveGenome(configKeyStates.experiments, genomes); - expect(Array.from(result.activeEids)).to.be.eql(["60f67d8648", "64928df20a"]); expect(result.effectiveGenome).to.be.eql({ "web": { "2nsqubits": { @@ -893,6 +931,19 @@ describe('store.js', () => { } }); }); + + it('should include eid in activeEids even if there is no genome for it', () => { + context.initialize(123, 321, { + web: { + url: 'https://test.site.com/index.html' + } + }); + setActiveAndEntryKeyStates(1, context, config, allocations, configKeyStates); + + const result = generateEffectiveGenome(configKeyStates.experiments, genomes); + + expect(Array.from(result.activeEids)).to.be.eql(["60f67d8648", "64928df20a", "c4154ac833"]); + }); }); describe('Views', () => {