MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / compareExperimentLists

Function compareExperimentLists

scripts/check_experiments.js:208–267  ·  view source on GitHub ↗

* Compares list of experiments, fires error if an experiment is registered without telemetry entry.

(mainImplList, userMetricsList)

Source from the content-addressed store, hash-verified

206 * Compares list of experiments, fires error if an experiment is registered without telemetry entry.
207 */
208function compareExperimentLists(mainImplList, userMetricsList) {
209 // Ensure both lists are valid
210 let errorFound = false;
211 if (!mainImplList) {
212 console.log(
213 'Changes to Devtools Experiment registration have prevented this check from finding registered experiments.',
214 );
215 console.log(
216 'Please update scripts/check_experiments.js to account for the new experiment registration.',
217 );
218 errorFound = true;
219 }
220 if (!userMetricsList) {
221 console.log(
222 'Changes to Devtools Experiment UserMetrics enum have prevented this check from finding experiments registered for telemetry.',
223 );
224 console.log(
225 'Please update scripts/check_experiments.js to account for the new experiment telemetry format.',
226 );
227 errorFound = true;
228 }
229 if (errorFound) {
230 process.exit(1);
231 }
232
233 // Ensure both lists match
234 const missingTelemetry = mainImplList.filter(
235 experiment => !userMetricsList.includes(experiment),
236 );
237 const staleTelemetry = userMetricsList.filter(
238 experiment => !mainImplList.includes(experiment),
239 );
240 if (missingTelemetry.length) {
241 console.log(
242 'Devtools Experiments have been added without corresponding histogram update!',
243 );
244 console.log(missingTelemetry.join('\n'));
245 console.log(
246 'Please ensure that the DevtoolsExperiments enum in UserMetrics.ts is updated with the new experiment.',
247 );
248 console.log(
249 'Please ensure that a corresponding CL is opened against chromium.src/tools/metrics/histograms/metadata/dev/enums.xml to update the DevtoolsExperiments enum',
250 );
251 errorFound = true;
252 }
253 if (staleTelemetry.length) {
254 console.log(
255 'Devtools Experiments that are no longer registered are still listed in the telemetry enum!',
256 );
257 console.log(staleTelemetry.join('\n'));
258 console.log(
259 'Please ensure that the DevtoolsExperiments enum in UserMetrics.ts is updated to remove these stale experiments.',
260 );
261 errorFound = true;
262 }
263 if (errorFound) {
264 process.exit(1);
265 }

Callers 1

mainFunction · 0.85

Calls 4

logMethod · 0.65
exitMethod · 0.65
filterMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected