fix(sources): sort by the shown name; start the benchmark's Undo window in its trigger

Local review round 3 (Greptile; Codex was clean):

- Name order compared the stored title, while the rows show a URL-named
  or credential-bearing source by its host: a source stored as
  get.php?username=… sorted by its hidden account details. sortPlaylists
  takes the list's name function, and Sources and the switcher pass
  sourceSortName, the name they display.
- The Xtream delete benchmark clicked Remove while preparing, which starts
  the four-second Undo window; capture setup before the trigger could
  outlast it, so the delete committed on its own before the measurement
  and the close button was gone. Preparation now stops at the open menu,
  and the trigger clicks Remove and then the toast's close button, with
  the trigger time taken right before the commit click as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-10-13 18:15:09 +02:00
1 parent 123bc170e9
commit 85e6cb3816
10 files changed
+102 -10

No files matched your search

@@ -207,7 +207,11 @@ describe('Xtream Playwright scenario driver', () => {
fake.asPage(),
scenarioOptions(XTREAM_SCENARIO_ID.DELETE_LARGE)
);
// Preparation stops at the open menu: Remove would start the Undo
// window, which commits on its own before a slow capture setup ends.
assert.equal(fake.clicksMatching('filter(Remove playlist)'), 0);
await prepared.trigger();
assert.equal(fake.clicksMatching('filter(Remove playlist)'), 1);
const armIndex = fake.log.indexOf('evaluate:install-operation');
const clickIndex = fake.log.findIndex(
(entry) =>
@@ -19,6 +19,7 @@ import {
prepareXtreamSourceActionTrigger,
waitForXtreamCancellationTerminal,
waitForXtreamCatalogTerminal,
removeXtreamSource,
waitForXtreamSourceRowGone,
} from './xtream-scenario-ui';
import { assertXtreamMockOrigin } from './xtream-control-client';
@@ -202,8 +203,12 @@ function createPreparedScenario(state: PreparedState): PreparedXtreamScenario {
'delete-playlist'
);
}
let commit = state.trigger;
if (state.options.scenarioId === XTREAM_SCENARIO_ID.DELETE_LARGE) {
commit = await removeXtreamSource(state.page, state.trigger);
}
const triggerEpochMs = Date.now();
await state.trigger.click();
await commit.click();
return {
scenarioId: state.options.scenarioId,
triggerEpochMs,
@@ -87,9 +87,9 @@ export async function prepareXtreamSourceActionTrigger(
return confirmation;
}
// Delete leaves the list at once and offers Undo; the toast's close
// button commits it without waiting out the Undo window, so the
// measurement starts when the delete does.
// Remove starts the Undo window, which commits on its own after four
// seconds: preparation stops at the open menu, and the trigger removes
// and commits at once (removeXtreamSource).
const more = row.locator('.source-row__more');
await assertTriggerReady(more, 'xtream-source-delete-menu');
await more.click();
@@ -98,6 +98,18 @@ export async function prepareXtreamSourceActionTrigger(
.filter({ hasText: 'Remove playlist' })
.first();
await assertTriggerReady(remove, 'xtream-source-delete');
return remove;
}
/**
* Clicks Remove and returns the Undo toast's close button, which commits the
* delete without waiting out the Undo window: the measured delete starts
* with that click.
*/
export async function removeXtreamSource(
page: Page,
remove: Locator
): Promise<Locator> {
await remove.click();
const commit = page.locator(
'mat-snack-bar-container.app-toast .source-removal-toast__close'