Skip to content

Commit 9da00b1

Browse files
authored
Prevent queued experiment from being selected as most recent (#3846)
1 parent 1ae63e6 commit 9da00b1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

extension/src/experiments/model/status/collect.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,16 @@ describe('collectFinishedRunningExperiments', () => {
356356
expect(finishedRunning).toStrictEqual({})
357357
})
358358

359-
it('should return the most recently created and unseen (without a status) experiment if there is no longer an experiment running in the workspace', () => {
359+
it('should return the most recently created and unseen and unqueued (without a status) experiment if there is no longer an experiment running in the workspace', () => {
360360
const latestCreatedId = 'exp-123'
361361
const finishedRunning = collectFinishedRunningExperiments(
362362
{},
363363
[
364+
{
365+
Created: '2023-12-01T10:48:24',
366+
id: 'exp-queued',
367+
status: ExperimentStatus.QUEUED
368+
},
364369
{ Created: '2022-12-02T10:48:24', id: 'exp-456' },
365370
{ Created: '2022-10-02T07:48:24', id: 'exp-789' },
366371
{ Created: '2022-12-02T07:48:25', id: latestCreatedId },

extension/src/experiments/model/status/collect.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ const getMostRecentExperiment = (
293293
coloredStatus: ColoredStatus
294294
): Experiment | undefined =>
295295
experiments
296-
.filter(({ id }) => coloredStatus[id] === undefined)
296+
.filter(
297+
({ id, status }) => coloredStatus[id] === undefined && !isQueued(status)
298+
)
297299
.sort(({ Created: aCreated }, { Created: bCreated }) => {
298300
if (!aCreated) {
299301
return 1

0 commit comments

Comments
 (0)