Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

test(intermediates): keep the suites to data-loss, isolation and regression coverage

Josh Corbettf8e2f2775ef6
diff --git a/invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.browser.test.tsx b/invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.browser.test.tsx
index a35642ee9e..dd8ff5c50c 100644
--- a/invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.browser.test.tsx
@@ -317,32 +317,6 @@ describe('IntermediatesManager', () => {
expect(host.textContent).not.toContain('intermediates.owner.showMine');
});
- it('identifies the account in repeated admin row selections', async () => {
- dependencies.getIntermediatesSummary.mockImplementation((params: { ownerId: string | null }) =>
- Promise.resolve(
- summaryOf(
- params.ownerId
- ? [row(null, null, 1)]
- : [
- row(null, null, 1),
- { ...row(null, null, 1), userDisplayName: 'Alice', userEmail: '[email protected]', userId: 'bob' },
- ]
- )
- )
- );
- await renderManager({ canClearOthersIntermediates: true });
- await act(() => host.querySelector<HTMLButtonElement>('[aria-label="intermediates.owner.showEveryone"]')!.click());
- await vi.waitFor(() => expect(host.querySelectorAll('[role="list"] li')).toHaveLength(2));
-
- const names = [...host.querySelectorAll('[role="list"] li [aria-label]')].map((element) =>
- element.getAttribute('aria-label')
- );
- expect(names).toEqual([
- 'intermediates.list.selectRowForOwner(name=intermediates.list.unassigned,owner=intermediates.owner.nameWithEmail([email protected],name=Alice))',
- 'intermediates.list.selectRowForOwner(name=intermediates.list.unassigned,owner=intermediates.owner.nameWithEmail([email protected],name=Alice))',
- ]);
- });
-
it('fetches a focused project by id even when it is outside the first page', async () => {
dependencies.getIntermediatesSummary.mockImplementation((params: { projectId?: string }) =>
Promise.resolve(summaryOf(params.projectId === 'p55' ? [row('p55', 'Far project', 2)] : [row('p1', 'First', 1)]))
@@ -391,49 +365,6 @@ describe('IntermediatesManager', () => {
);
});
- it.each([
- ['its rows', { currentUserId: 'alice' }, 'Alice'],
- ['the entry point', { currentUserId: 'alice', focusOwner: { ownerId: 'bob-3f1c9a7e', ownerLabel: 'Bob' } }, 'Bob'],
- ['the signed-in account', { currentUserId: 'carol-5d2e8b10', currentUserLabel: 'Carol' }, 'Carol'],
- ['nothing', { currentUserId: 'dave-9a0b1c2d' }, 'intermediates.owner.unknownAccount'],
- ] as const)('names the account filter from %s without showing its id', async (_source, options, name) => {
- if (name !== 'Alice') {
- dependencies.getIntermediatesSummary.mockReset().mockResolvedValue(summaryOf([]));
- }
- await renderManager({ canClearOthersIntermediates: true, ...options });
- await vi.waitFor(() => expect(host.textContent).toContain(`intermediates.owner.filtered(name=${name})`));
- const ownerId = 'focusOwner' in options ? options.focusOwner.ownerId : options.currentUserId;
- expect(host.textContent).not.toContain(ownerId);
- });
-
- it('tells apart rows of accounts that have neither a name nor an email', async () => {
- const anonymous = (userId: string): IntermediatesRow => ({
- ...row(null, null, 1),
- userDisplayName: null,
- userEmail: null,
- userId,
- });
- dependencies.getIntermediatesSummary
- .mockReset()
- .mockResolvedValue(summaryOf([anonymous('0a1b2c3d-first'), anonymous('9f8e7d6c-second')]));
- await renderManager({ canClearOthersIntermediates: true });
- const showEveryone = await vi.waitFor(() => {
- const button = host.querySelector<HTMLButtonElement>('button[aria-label="intermediates.owner.showEveryone"]');
- expect(button).not.toBeNull();
- return button!;
- });
- await act(() => showEveryone.click());
- const labels = await vi.waitFor(() => {
- const found = [...host.querySelectorAll('[role="list"] [aria-label]')].map((node) =>
- node.getAttribute('aria-label')
- );
- expect(found).toHaveLength(2);
- return found;
- });
- expect(new Set(labels).size).toBe(2);
- expect(labels[0]).toContain('intermediates.owner.unknownAccountWithId(id=0a1b2c3d)');
- });
-
it('re-follows a running operation after a reload by asking the server', async () => {
const { activeOperationStore } = await import('@features/intermediates/data/operationStore');
const running = { ...operationOf('running'), operationId: 'op-running' };
@@ -533,20 +464,6 @@ describe('IntermediatesManager', () => {
expect(first![0]).toEqual({ previewId: 'preview-force' });
});
- it('picks up a running operation on Refresh when nothing is followed', async () => {
- const running = { ...operationOf('running'), operationId: 'op-elsewhere' };
- dependencies.listIntermediatesOperations.mockResolvedValueOnce([]).mockResolvedValue([running]);
- dependencies.getIntermediatesOperation.mockResolvedValue(running);
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('Portraits'));
- expect(host.textContent).not.toContain('intermediates.operation.status.running');
-
- await act(() => host.querySelector<HTMLButtonElement>('[aria-label="intermediates.refresh"]')!.click());
-
- await vi.waitFor(() => expect(host.textContent).toContain('intermediates.operation.status.running'));
- expect(dependencies.listIntermediatesOperations).toHaveBeenCalledTimes(2);
- });
-
it('never mistakes an earlier finished run for a timed-out start', async () => {
const { activeOperationStore } = await import('@features/intermediates/data/operationStore');
// Retained on the server from before this preview (its created_at is older than the preview's).
@@ -604,26 +521,6 @@ describe('IntermediatesManager', () => {
expect(dependencies.createIntermediatesPreview).toHaveBeenCalledTimes(2);
});
- it('names the owner of another account’s affected documents for an administrator', async () => {
- const dialog = await openForceDialogReadyToConfirm({ canClearOthersIntermediates: true });
- const items = [...dialog.querySelectorAll('li')].map((item) => item.textContent ?? '');
- expect(items.filter((text) => text.includes('affectedOwner'))).toEqual([
- expect.stringContaining('intermediates.dialog.affectedOwner(owner=Bob)'),
- ]);
- expect(dialog.textContent).toContain('intermediates.dialog.forceWarning');
- expect(dialog.textContent).not.toContain('intermediates.dialog.forceWarningOwn');
- });
-
- it('counts the affected documents the server left out of the list', async () => {
- dependencies.createIntermediatesPreview.mockImplementation(({ mode }: { mode: 'safe' | 'force' }) =>
- Promise.resolve({ ...previewOf(mode, 4), affectedDocumentsTotal: mode === 'force' ? 204 : 0 })
- );
- const dialog = await openForceDialogReadyToConfirm();
- const items = [...dialog.querySelectorAll('li')].map((item) => item.textContent ?? '');
- expect(items).toHaveLength(forceAffectedDocuments.length + 1);
- expect(items.at(-1)).toBe('intermediates.dialog.affectedMore(count=200)');
- });
-
it('reports a failed start in the dialog and follows nothing', async () => {
const { activeOperationStore } = await import('@features/intermediates/data/operationStore');
const dialog = await openForceDialogReadyToConfirm();
@@ -670,30 +567,6 @@ describe('IntermediatesManager', () => {
expect(isDeleteUnavailable()).toBe(true);
});
- it('refreshes measured sizes while an open summary is still being measured', async () => {
- const initial = summaryOf([{ ...row('p1', 'Portraits', 1), reclaimableBytes: 0, unknownSizeCount: 1 }]);
- initial.measuring = true;
- initial.totals.reclaimableBytes = 0;
- initial.totals.unknownSizeCount = 1;
- const measured = summaryOf([row('p1', 'Portraits', 1)]);
- dependencies.getIntermediatesSummary.mockImplementationOnce(() => Promise.resolve(initial));
- dependencies.getIntermediatesSummary.mockImplementation(() => Promise.resolve(measured));
-
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('intermediates.list.unmeasured(count=1)'));
- await act(() => host.querySelector<HTMLButtonElement>('[role="list"] li [aria-label]')!.click());
- expect(host.textContent).toContain('intermediates.selection.estimate');
- await vi.waitFor(
- () => {
- expect(dependencies.getIntermediatesSummary.mock.calls.length).toBeGreaterThan(1);
- expect(host.textContent).toContain('1.0 MB');
- expect(host.textContent).toContain('size=1.0 MB');
- expect(host.querySelector('[aria-label="intermediates.stats.measuringNote"]')).toBeNull();
- },
- { timeout: 8_000 }
- );
- }, 10_000);
-
it('previews the delete, starts the operation, and reports it once it settles', async () => {
await renderManager({ focusProjectId: 'p1' });
await vi.waitFor(() => expect(host.textContent).toContain('Portraits'));
@@ -774,29 +647,6 @@ describe('IntermediatesManager', () => {
await vi.waitFor(() => expect(host.textContent).toContain('intermediates.empty.title'));
});
- it('shows a rejected preview with the server’s reason and a retry', async () => {
- dependencies.createIntermediatesPreview
- .mockRejectedValueOnce(new ApiError('Too many documents would break; narrow the scope', 422))
- .mockImplementation(({ mode }: { mode: 'safe' | 'force' }) => Promise.resolve(previewOf(mode, 4)));
- await renderManager({ focusProjectId: 'p1' });
- await vi.waitFor(() => expect(host.textContent).toContain('Portraits'));
- await act(() => buttonWithText('intermediates.list.delete', host).click());
- const dialog = await vi.waitFor(() => {
- const element = document.querySelector<HTMLElement>('[role="alertdialog"]');
- expect(element).not.toBeNull();
- return element!;
- });
- await vi.waitFor(() => expect(dialog.textContent).toContain('Too many documents would break; narrow the scope'));
- expect(
- [...dialog.querySelectorAll('button')].some(
- (button) => button.textContent?.includes('intermediates.dialog.confirm') && !button.disabled
- )
- ).toBe(false);
-
- await act(() => buttonWithText('common.retry', dialog).click());
- await vi.waitFor(() => expect(dialog.textContent).toContain('intermediates.dialog.reclaim'));
- });
-
it('preselects the requested project in single-user mode, where the session names no account', async () => {
await renderManager({ currentUserId: null, focusProjectId: 'p2' });
await vi.waitFor(() => expect(host.textContent).toContain('Landscapes'));
@@ -807,68 +657,6 @@ describe('IntermediatesManager', () => {
expect(host.textContent).toContain('count=1');
});
- it('keeps the current rows visible but inert while the next page or a new search loads', async () => {
- const manyRows = Array.from({ length: 60 }, (_, index) => row(`p${index}`, `Project ${index}`, 1));
- let releaseNextPage!: () => void;
- const nextPageGate = new Promise<void>((resolve) => {
- releaseNextPage = resolve;
- });
- let releaseSearch!: () => void;
- const searchGate = new Promise<void>((resolve) => {
- releaseSearch = resolve;
- });
- dependencies.getIntermediatesSummary
- .mockReset()
- .mockImplementation(async (params: { offset?: number; search?: string }) => {
- const offset = params.offset ?? 0;
- if (params.search?.trim()) {
- await searchGate;
- return summaryOf([row('p1', 'Project 1', 1)]);
- }
- if (offset > 0) {
- await nextPageGate;
- }
- return { ...summaryOf(manyRows.slice(offset, offset + 50)), offset, total: manyRows.length };
- });
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('Project 0'));
-
- await act(() => buttonWithText('common.nextPage', host).click());
- const list = host.querySelector('[role="list"]')!;
- await vi.waitFor(() => expect(list.getAttribute('aria-busy')).toBe('true'));
- expect(host.textContent).toContain('Project 0');
- expect(host.textContent).toContain('common.pageNumber(page=1)');
- const staleRow = host
- .querySelector('[aria-label="intermediates.list.selectRow(name=Project 0)"]')!
- .querySelector<HTMLInputElement>('input')!;
- expect(staleRow.disabled).toBe(true);
- expect(checkbox('intermediates.list.selectAll').checked).toBe(false);
- expect(host.querySelector('[aria-label="intermediates.list.selectAll"]')!.querySelector('input')!.disabled).toBe(
- true
- );
-
- await act(() => releaseNextPage());
- await vi.waitFor(() => expect(host.textContent).toContain('Project 55'));
- expect(host.querySelector('[role="list"]')!.getAttribute('aria-busy')).toBeNull();
- expect(host.textContent).toContain('common.pageNumber(page=2)');
-
- await act(() =>
- setInputValue(host.querySelector<HTMLInputElement>('input[aria-label="intermediates.searchLabel"]')!, 'one')
- );
- await vi.waitFor(() =>
- expect(dependencies.getIntermediatesSummary).toHaveBeenLastCalledWith(
- expect.objectContaining({ search: 'one' }),
- expect.anything()
- )
- );
- expect(host.textContent).toContain('Project 55');
- expect(host.querySelector('[role="list"]')!.getAttribute('aria-busy')).toBe('true');
- await act(() => releaseSearch());
- await vi.waitFor(() => expect(host.textContent).not.toContain('Project 55'));
- expect(host.textContent).toContain('Project 1');
- expect(host.querySelector('[role="list"]')!.getAttribute('aria-busy')).toBeNull();
- });
-
it('keeps picks from another page in the estimate and the targets', async () => {
const manyRows = Array.from({ length: 60 }, (_, index) => row(`p${index}`, `Project ${index}`, 1));
dependencies.getIntermediatesSummary.mockReset().mockImplementation((params: { offset?: number }) => {
@@ -947,24 +735,6 @@ describe('IntermediatesManager', () => {
expect(dependencies.getIntermediatesSummary.mock.calls.every(([params]) => (params.limit ?? 50) <= 50)).toBe(true);
});
- it('shows a restored operation lookup failure and retries the lookup without starting cleanup', async () => {
- const { followIntermediatesOperation } = await import('@features/intermediates/data/operationStore');
- followIntermediatesOperation('op-1');
- dependencies.getIntermediatesOperation.mockRejectedValue(new ApiError('Status temporarily unavailable', 503));
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('intermediates.operation.lookupFailed'), {
- timeout: 4000,
- });
- expect(host.textContent).toContain('Status temporarily unavailable');
- await page.screenshot({ path: '../../../../artifacts/intermediates/operation-lookup-error.png' });
- dependencies.getIntermediatesOperation.mockResolvedValue(operationOf('completed'));
- await act(() => buttonWithText('common.retry', host).click());
- await vi.waitFor(() => expect(host.textContent).toContain('intermediates.operation.status.completed'));
- expect(dependencies.startIntermediatesOperation).not.toHaveBeenCalled();
- // Something was followed, so the server was not asked for the account's operations.
- expect(dependencies.listIntermediatesOperations).not.toHaveBeenCalled();
- });
-
it('stops polling an operation the server no longer knows and lets it be dismissed', async () => {
const { followIntermediatesOperation, activeOperationStore } =
await import('@features/intermediates/data/operationStore');
@@ -982,80 +752,6 @@ describe('IntermediatesManager', () => {
expect(document.activeElement).toBe(host.querySelector('[aria-label="intermediates.searchLabel"]'));
});
- it('estimates all-matching from the totals minus the excluded rows, refreshed from the visible page', async () => {
- let currentRows = Array.from({ length: 120 }, (_, index) => row(`p${index}`, `Project ${index}`, 1));
- dependencies.getIntermediatesSummary
- .mockReset()
- .mockImplementation((params: { offset?: number; limit?: number }) => {
- const offset = params.offset ?? 0;
- return Promise.resolve({
- ...summaryOf(currentRows),
- items: currentRows.slice(offset, offset + (params.limit ?? 50)),
- offset,
- });
- });
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('Project 0'));
- await act(() => checkbox('intermediates.list.selectAll').click());
- await act(() => checkbox('intermediates.list.selectRow(name=Project 1)').click());
- await vi.waitFor(() => expect(host.textContent).toContain('count=119'));
- await act(() => buttonWithText('common.nextPage', host).click());
- await vi.waitFor(() => expect(host.textContent).toContain('Project 55'));
-
- // The excluded row vanished off-page: the estimate never drops below what is visibly selected.
- currentRows = [row('p55', 'Project 55', 1)];
- await act(() => host.querySelector<HTMLButtonElement>('[aria-label="intermediates.refresh"]')!.click());
- await vi.waitFor(() => expect(host.textContent).toContain('intermediates.selection.estimate(count=1,'));
- expect(checkbox('intermediates.list.selectRow(name=Project 55)').checked).toBe(true);
- expect(isDeleteUnavailable()).toBe(false);
-
- currentRows = [row('p1', 'Project 1', 1), row('p55', 'Project 55', 1)];
- await act(() => host.querySelector<HTMLButtonElement>('[aria-label="intermediates.refresh"]')!.click());
- await vi.waitFor(() => expect(host.textContent).toContain('Project 1'));
- expect(checkbox('intermediates.list.selectRow(name=Project 1)').checked).toBe(false);
- await vi.waitFor(() =>
- expect(host.textContent).toContain(
- 'intermediates.selection.estimate(count=1,images=intermediates.counts.images(count=1)'
- )
- );
-
- // Same global totals, but all reclaimable bytes have moved to the still-selected row.
- currentRows = [row('p1', 'Project 1', 0), row('p55', 'Project 55', 2)];
- await act(() => host.querySelector<HTMLButtonElement>('[aria-label="intermediates.refresh"]')!.click());
- await vi.waitFor(() =>
- expect(host.textContent).toContain(
- 'intermediates.selection.estimate(count=1,images=intermediates.counts.images(count=2)'
- )
- );
- expect(checkbox('intermediates.list.selectRow(name=Project 1)').checked).toBe(false);
- await act(() => buttonWithText('intermediates.list.delete', host).click());
- await vi.waitFor(() =>
- expect(dependencies.createIntermediatesPreview).toHaveBeenLastCalledWith(
- { mode: 'safe', scope: matchingScope({ excluded: [{ projectId: 'p1', userId: 'alice' }] }) },
- expect.anything()
- )
- );
- });
-
- it('debounces search into one request while keeping the input responsive', async () => {
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('Portraits'));
- const search = page.getByRole('textbox', { name: 'intermediates.searchLabel' });
- const input = search.element() as HTMLInputElement;
- const before = dependencies.getIntermediatesSummary.mock.calls.length;
-
- for (const value of ['P', 'Po', 'Por', 'Port']) {
- await act(() => setInputValue(input, value));
- }
- expect(input.value).toBe('Port');
- expect(host.querySelector('[role="list"]')!.getAttribute('aria-busy')).toBe('true');
- await vi.waitFor(() => expect(host.querySelectorAll('[role="list"] li')).toHaveLength(1));
- const searches = dependencies.getIntermediatesSummary.mock.calls
- .slice(before)
- .map(([params]) => (params as { search?: string }).search);
- expect(searches).toEqual(['Port']);
- });
-
it('sends Select all under a search as a matching scope with its exclusions and no full read', async () => {
const manyRows = Array.from({ length: 60 }, (_, index) => row(`p${index}`, `Match ${index}`, 1));
dependencies.getIntermediatesSummary
@@ -1093,61 +789,6 @@ describe('IntermediatesManager', () => {
expect(dependencies.getIntermediatesSummary.mock.calls.every(([params]) => (params.limit ?? 50) <= 50)).toBe(true);
});
- it('keeps keyboard focus on the paging controls while pages load and at the last page', async () => {
- const manyRows = Array.from({ length: 60 }, (_, index) => row(`p${index}`, `Project ${index}`, 1));
- let releaseNextPage!: () => void;
- const nextPageGate = new Promise<void>((resolve) => {
- releaseNextPage = resolve;
- });
- dependencies.getIntermediatesSummary.mockReset().mockImplementation(async (params: { offset?: number }) => {
- const offset = params.offset ?? 0;
- if (offset > 0) {
- await nextPageGate;
- }
- return { ...summaryOf(manyRows.slice(offset, offset + 50)), offset, total: manyRows.length };
- });
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('Project 0'));
- const next = page.getByRole('button', { name: 'common.nextPage' }).element() as HTMLButtonElement;
- next.focus();
- await act(() => next.click());
- await vi.waitFor(() => expect(next.getAttribute('aria-disabled')).toBe('true'));
- // A second activation while the page loads is ignored instead of skipping a page.
- await act(() => next.click());
- expect(document.activeElement).toBe(next);
-
- await act(() => releaseNextPage());
- await vi.waitFor(() => expect(host.textContent).toContain('Project 55'));
- expect(host.textContent).toContain('common.pageNumber(page=2)');
- expect(next.getAttribute('aria-disabled')).toBe('true');
- expect(document.activeElement).toBe(next);
- expect(
- dependencies.getIntermediatesSummary.mock.calls.filter(
- ([params]) => (params as { offset?: number }).offset === 100
- )
- ).toHaveLength(0);
- });
-
- it('keeps Refresh focusable while it reloads', async () => {
- let releaseRefresh!: () => void;
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('Portraits'));
- dependencies.getIntermediatesSummary.mockImplementation(
- () =>
- new Promise((resolve) => {
- releaseRefresh = () => resolve(summaryOf([row('p1', 'Portraits', 4)]));
- })
- );
- const refresh = page.getByRole('button', { name: 'intermediates.refresh' }).element() as HTMLButtonElement;
- refresh.focus();
- await act(() => refresh.click());
- await vi.waitFor(() => expect(refresh.getAttribute('aria-busy')).toBe('true'));
- expect(refresh.disabled).toBe(false);
- expect(document.activeElement).toBe(refresh);
- await act(() => releaseRefresh());
- await vi.waitFor(() => expect(refresh.getAttribute('aria-busy')).toBeNull());
- });
-
it('opens the confirmation on Cancel rather than the force toggle', async () => {
await renderManager({ focusProjectId: 'p1' });
await vi.waitFor(() => expect(host.textContent).toContain('Portraits'));
@@ -1224,62 +865,6 @@ describe('IntermediatesManager', () => {
expect(host.contains(document.activeElement)).toBe(true);
});
- it('hides Retry for an operation the server has forgotten and announces the loss', async () => {
- const { followIntermediatesOperation } = await import('@features/intermediates/data/operationStore');
- followIntermediatesOperation('gone');
- dependencies.getIntermediatesOperation.mockRejectedValue(new ApiError('Not found', 404));
- await renderManager();
- await vi.waitFor(() => expect(host.textContent).toContain('intermediates.operation.lookupGone'));
- const region = host.querySelector('[role="status"][aria-live="polite"]');
- await vi.waitFor(() => expect(region?.textContent).toBe('intermediates.operation.lookupGone'));
- const panel = host.querySelector('[role="group"]')!;
- expect([...panel.querySelectorAll('button')].map((button) => button.textContent)).toEqual([
- 'intermediates.operation.dismiss',
- ]);
- });
-
- it('announces status changes and coarse progress into one live region that mounts empty', async () => {
- const { followIntermediatesOperation } = await import('@features/intermediates/data/operationStore');
- followIntermediatesOperation('op-1');
- const running = (processed: number): IntermediatesOperation => ({
- ...operationOf('running'),
- progress: { ...operationOf('running').progress, deletedImages: processed, processedImages: processed },
- targetImages: 100,
- });
- let resolveFirst!: (operation: IntermediatesOperation) => void;
- const publish = await followOperation(running(10));
- dependencies.getIntermediatesOperation.mockImplementationOnce(
- () =>
- new Promise<IntermediatesOperation>((resolve) => {
- resolveFirst = resolve;
- })
- );
- await renderManager();
- const regions = () => [...host.querySelectorAll('[role="status"][aria-live="polite"]')];
- expect(regions()).toHaveLength(1);
- expect(regions()[0]!.textContent).toBe('');
- expect(host.querySelector('[role="alert"], .chakra-alert__root[aria-live]')).toBeNull();
-
- await act(() => resolveFirst(running(10)));
- await vi.waitFor(() =>
- expect(regions()[0]!.textContent).toBe(
- 'intermediates.operation.progressAnnouncement(percent=0,status=intermediates.operation.status.running)'
- )
- );
- await publish(running(20));
- expect(host.textContent).toContain('intermediates.operation.progress(done=20,total=100)');
- expect(regions()[0]!.textContent).toBe(
- 'intermediates.operation.progressAnnouncement(percent=0,status=intermediates.operation.status.running)'
- );
- await publish(running(60));
- expect(regions()[0]!.textContent).toBe(
- 'intermediates.operation.progressAnnouncement(percent=0.5,status=intermediates.operation.status.running)'
- );
- await publish({ ...running(100), completedAt: 'later', status: 'completed' });
- expect(regions()).toHaveLength(1);
- expect(regions()[0]!.textContent).toBe('intermediates.operation.status.completed');
- });
-
it('asks the server once under StrictMode, follows the running operation and consumes the entry point intent on commit', async () => {
const { peekIntermediatesFocus } = await import('@features/intermediates/data/focus');
const running = { ...operationOf('running'), operationId: 'op-running' };
diff --git a/tests/app/services/intermediates/test_intermediates_service.py b/tests/app/services/intermediates/test_intermediates_service.py
index cd286df071..cee0982716 100644
--- a/tests/app/services/intermediates/test_intermediates_service.py
+++ b/tests/app/services/intermediates/test_intermediates_service.py
@@ -20,7 +20,7 @@ from invokeai.app.services.image_records.image_records_common import (
ImageRecordNotFoundException,
ResourceOrigin,
)
-from invokeai.app.services.intermediates import intermediates_default, intermediates_measurement
+from invokeai.app.services.intermediates import intermediates_default
from invokeai.app.services.intermediates.intermediates_base import IntermediatesCaller
from invokeai.app.services.intermediates.intermediates_common import (
IntermediatesOperation,
@@ -364,24 +364,6 @@ def test_summary_triggers_measurement_of_unmeasured_sizes(invoker: Invoker, serv
assert invoker.services.image_records.get("missing.png").file_size_bytes == 0
-def test_measurement_retries_when_an_unmeasured_file_is_still_too_new(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- monkeypatch.setattr(intermediates_measurement, "MEASURE_MIN_AGE_SECONDS", 1)
- _seed_image(invoker, "young.png", created_at=None)
- invoker.services.image_records.set_file_size_bytes("young.png", None)
-
- summary = service.get_summary(
- ALICE, owner_id=None, search=None, sort="project_name", descending=False, offset=0, limit=50
- )
- assert summary.measuring is True
-
- deadline = time.monotonic() + 4
- while time.monotonic() < deadline and invoker.services.image_records.get("young.png").file_size_bytes is None:
- time.sleep(0.02)
- assert invoker.services.image_records.get("young.png").file_size_bytes is not None
-
-
# ── previews and policy ──
@@ -526,19 +508,6 @@ def test_selection_scope_targets_exactly_the_chosen_rows(invoker: Invoker, servi
assert not any(_exists(invoker, n) for n in ("clear.png", "unassigned.png", "orphaned-project.png"))
-def test_media_created_during_the_run_is_never_collected(invoker: Invoker, service: IntermediatesService) -> None:
- _seed_image(invoker, "before.png")
- preview = service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("alice")), ALICE)
- _seed_image(invoker, "after.png", created_at=None)
-
- operation = _wait(service, _start(service, preview).operation_id)
-
- assert operation.target_images == 1
- assert (operation.progress.deleted_images, operation.progress.retained_images) == (1, 0)
- assert not _exists(invoker, "before.png")
- assert _exists(invoker, "after.png")
-
-
def test_a_row_that_was_recent_at_preview_time_stays_recent_for_the_operation(
invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
) -> None:
@@ -591,29 +560,6 @@ def test_the_final_check_keeps_targets_protected_after_the_page_read(
assert invoker.services.image_files.get_path("promoted.png").exists()
-def test_a_promoted_video_keeps_its_file(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- from invokeai.app.services.video_records.video_records_common import VideoRecordChanges
-
- _seed_video(invoker, "promoted.mp4")
- _seed_video(invoker, "gone.mp4")
- preview = service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("alice")), ALICE)
- _before_first_delete(
- invoker,
- monkeypatch,
- lambda: invoker.services.video_records.update("promoted.mp4", VideoRecordChanges(is_intermediate=False)),
- kind="video",
- )
-
- operation = _wait(service, _start(service, preview).operation_id)
-
- assert (operation.progress.deleted_videos, operation.progress.retained_videos) == (1, 1)
- assert invoker.services.video_files.get_path("promoted.mp4").exists()
- assert not invoker.services.video_files.get_path("gone.mp4").exists()
- assert list(Path(invoker.services.video_files.get_path("gone.mp4")).parent.glob(".delete_*")) == []
-
-
# ── authorization ──
@@ -888,86 +834,6 @@ def test_a_restart_forgets_operations_and_a_fresh_run_finishes_the_work(
restored.stop()
-def test_settled_operations_are_retained_per_caller_and_running_ones_are_never_dropped(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- import threading
-
- monkeypatch.setattr(intermediates_default, "MAX_RETAINED_SETTLED_OPERATIONS_PER_CALLER", 1)
- monkeypatch.setattr(intermediates_default, "MAX_RETAINED_OPERATIONS", 2)
- _seed_image(invoker, "bob.png", user_id="bob")
- release = threading.Event()
- real_delete = invoker.services.images.delete_intermediates_by_names
-
- def blocked_delete(names, guard=None):
- release.wait(10)
- return real_delete(names, guard)
-
- monkeypatch.setattr(invoker.services.images, "delete_intermediates_by_names", blocked_delete)
- empty = IntermediatesScope(
- kind="selection",
- targets=[IntermediatesScopeTarget(user_id="alice", project_id=_project(invoker, "alice", "E", {}))],
- )
-
- _, first = _run(service, ALICE, empty)
- _, second = _run(service, ALICE, empty)
- with pytest.raises(IntermediatesOperationNotFoundError):
- service.get_operation(first.operation_id, ALICE)
- assert [op.operation_id for op in service.list_operations(ALICE)] == [second.operation_id]
-
- try:
- running = _start(
- service, service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("bob")), BOB), BOB
- )
- # The worker is busy with Bob's run, so this one waits behind it: unsettled, never a candidate.
- queued = _start(
- service,
- service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("admin")), ADMIN),
- ADMIN,
- )
- # Past the global cap the oldest settled operation goes, whoever it belongs to.
- with pytest.raises(IntermediatesOperationNotFoundError):
- service.get_operation(second.operation_id, ALICE)
- assert service.get_operation(running.operation_id, BOB).status in ("pending", "running")
- assert service.get_operation(queued.operation_id, ADMIN).status == "pending"
- finally:
- release.set()
- assert _wait(service, running.operation_id, BOB).status == "completed"
- assert _wait(service, queued.operation_id, ADMIN).status == "completed"
-
-
-def test_a_crashing_page_read_does_not_strand_the_accepted_queue(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- original_ensure_worker = service._ensure_worker
- monkeypatch.setattr(service, "_ensure_worker", lambda: None)
- _seed_image(invoker, "alice.png")
- _seed_image(invoker, "bob.png", user_id="bob")
- operation_ids = [
- _start(
- service, service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner(c.user_id)), c), c
- ).operation_id
- for c in (ALICE, BOB)
- ]
-
- real_iter = service._records.iter_deletable_batches
- crashed = False
-
- def crash_once(*args, **kwargs):
- nonlocal crashed
- if not crashed:
- crashed = True
- raise OSError("storage temporarily unavailable")
- return real_iter(*args, **kwargs)
-
- monkeypatch.setattr(service._records, "iter_deletable_batches", crash_once)
- monkeypatch.setattr(service, "_ensure_worker", original_ensure_worker)
- service._ensure_worker()
-
- assert _wait(service, operation_ids[0]).status == "failed"
- assert _wait(service, operation_ids[1], BOB).status == "completed"
-
-
# ── legacy ──
@@ -1028,67 +894,6 @@ def test_inputs_added_to_an_active_session_after_it_was_scanned_are_protected(
assert second.impact.keep_active_images == 1
-def test_cleanup_rechecks_same_length_active_session_rewrites_with_an_unchanged_timestamp(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- _seed_image(invoker, "old.png")
- _seed_image(invoker, "new.png")
- item_id = _enqueue_row(invoker, session_id="parent", status="waiting", session_json='{"image_name":"old.png"}')
- preview = service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("alice")), ALICE)
- assert preview.impact.delete_images == 1
-
- def rewrite_session() -> None:
- # The queue timestamp has millisecond precision. Suppress its trigger to make the
- # same-millisecond, same-length rewrite deterministic instead of timing dependent.
- with invoker.services.image_records._db.transaction() as cursor:
- cursor.execute("DROP TRIGGER tg_session_queue_updated_at;")
- cursor.execute(
- "UPDATE session_queue SET session = ? WHERE item_id = ?;", ('{"image_name":"new.png"}', item_id)
- )
-
- _before_first_delete(invoker, monkeypatch, rewrite_session)
- assert _wait(service, _start(service, preview).operation_id).progress.retained_images == 1
- assert _exists(invoker, "new.png")
-
-
-def test_a_deactivated_caller_stops_at_the_next_batch(
- invoker: Invoker, service: IntermediatesService, monkeypatch
-) -> None:
- monkeypatch.setattr(intermediates_default, "DELETE_BATCH_SIZE", 1)
- for index in range(2):
- _seed_image(invoker, f"a-{index}.png")
- preview = service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("alice")), ALICE)
- real_get = invoker.services.users.get
- calls = {"n": 0}
-
- def deactivate_after_first_batch(user_id: str):
- user = real_get(user_id)
- calls["n"] += 1
- return user.model_copy(update={"is_active": False}) if user is not None and calls["n"] > 1 else user
-
- monkeypatch.setattr(invoker.services.users, "get", deactivate_after_first_batch)
-
- operation = _wait(service, _start(service, preview).operation_id)
-
- assert operation.status == "failed"
- assert operation.progress.deleted_images == 1
- assert sum(_exists(invoker, f"a-{index}.png") for index in range(2)) == 1
-
-
-def test_unmeasured_targets_are_reported_rather_than_counted_as_free(
- invoker: Invoker, service: IntermediatesService
-) -> None:
- _seed_image(invoker, "measured.png", size=10)
- _seed_image(invoker, "unmeasured.png")
- invoker.services.image_records.set_file_size_bytes("unmeasured.png", None)
-
- preview, operation = _run(service, ALICE, _owner("alice"))
-
- assert preview.impact.unknown_size_count == 1
- assert operation.progress.reclaimed_bytes == 10
- assert operation.progress.unknown_size_count == 1
-
-
def test_a_save_cannot_slip_between_the_final_check_and_the_delete(
invoker: Invoker, service: IntermediatesService, monkeypatch
) -> None:
@@ -1185,22 +990,6 @@ def test_active_inputs_survive_a_rolled_back_batch(
assert _exists(invoker, "consumed.png"), "an input of pending work was deleted after a rolled-back batch"
-def test_force_clear_keeps_a_newly_referenced_target(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- _seed_image(invoker, "force-race.png")
- preview = service.create_preview(IntermediatesPreviewRequest(mode="force", scope=_owner("alice")), ALICE)
- assert preview.affected_documents == []
- _before_first_delete(
- invoker, monkeypatch, lambda: _project(invoker, "alice", "Saved after preview", {"imageName": "force-race.png"})
- )
-
- finished = _wait(service, _start(service, preview).operation_id)
-
- assert finished.progress.retained_images == 1
- assert _exists(invoker, "force-race.png")
-
-
def test_the_acknowledged_documents_bound_what_a_force_clear_may_break(
invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
) -> None:
@@ -1231,19 +1020,6 @@ def test_the_acknowledged_documents_bound_what_a_force_clear_may_break(
assert _exists(invoker, "t3.png")
-def test_a_force_preview_refuses_more_acknowledged_documents_than_the_bound(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- monkeypatch.setattr(intermediates_default, "MAX_ACKNOWLEDGED_DOCUMENTS", 2)
- for index in range(3):
- _seed_image(invoker, f"doc-{index}.png")
- _project(invoker, "alice", f"Doc {index}", {"imageName": f"doc-{index}.png"})
-
- with pytest.raises(IntermediatesScopeInvalidError, match="narrow the scope"):
- service.create_preview(IntermediatesPreviewRequest(mode="force", scope=_owner("alice")), ALICE)
- assert service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("alice")), ALICE)
-
-
def test_an_account_holds_media_for_a_bounded_number_of_leases(invoker: Invoker, service: IntermediatesService) -> None:
from invokeai.app.services.intermediates.intermediates_common import (
MAX_BROWSER_HOLD_LEASES_PER_USER,
@@ -1272,21 +1048,6 @@ def test_an_account_holds_media_for_a_bounded_number_of_leases(invoker: Invoker,
assert (bob.impact.keep_active_images, bob.impact.delete_images) == (1, 0)
-def test_force_preview_lists_a_bounded_number_of_broken_documents(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- monkeypatch.setattr(intermediates_default, "MAX_AFFECTED_DOCUMENTS", 2)
- for index in range(3):
- _seed_image(invoker, f"doc-{index}.png")
- _project(invoker, "alice", f"Doc {index}", {"imageName": f"doc-{index}.png"})
-
- preview = service.create_preview(IntermediatesPreviewRequest(mode="force", scope=_owner("alice")), ALICE)
-
- assert [doc.name for doc in preview.affected_documents] == ["Doc 0", "Doc 1"]
- assert preview.affected_documents_total == 3
- assert preview.impact.delete_images == 3
-
-
def test_browser_hold_protects_unsaved_and_undo_references(invoker: Invoker, service: IntermediatesService) -> None:
from invokeai.app.services.intermediates.intermediates_common import IntermediatesBrowserHoldRequest
@@ -1380,23 +1141,6 @@ def test_the_final_check_judges_cached_media_recency_as_of_the_preview(
assert _exists(invoker, "cached.png") and not _exists(invoker, "old.png")
-def test_an_unconfirmed_preview_expires(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- from datetime import timedelta
-
- from invokeai.app.services.intermediates.intermediates_common import PREVIEW_TTL_SECONDS
-
- _seed_image(invoker, "a.png")
- preview = service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("alice")), ALICE)
- later = preview.created_at + timedelta(seconds=PREVIEW_TTL_SECONDS + 1)
- monkeypatch.setattr(intermediates_default, "_now", lambda: later)
-
- with pytest.raises(IntermediatesPreviewNotFoundError):
- _start(service, preview)
- assert _exists(invoker, "a.png")
-
-
def test_matching_scope_resolves_filtered_rows_minus_exclusions(
invoker: Invoker, service: IntermediatesService
) -> None:
@@ -1477,49 +1221,6 @@ def test_selection_paging_seeks_each_row_without_sorting_the_scope(
assert "B-TREE FOR ORDER BY" not in plan, plan
-def test_a_matching_scope_over_too_many_rows_is_refused(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- monkeypatch.setattr(intermediates_default, "MAX_RESOLVED_SCOPE_TARGETS", 1)
- _seed_image(invoker, "a.png", project_id=_project(invoker, "alice", "A", {}))
- _seed_image(invoker, "b.png")
-
- with pytest.raises(IntermediatesScopeInvalidError, match="narrow"):
- service.create_preview(
- IntermediatesPreviewRequest(mode="safe", scope=IntermediatesScope(kind="matching")), ALICE
- )
-
-
-def test_measurement_skip_set_does_not_starve_later_rows(invoker: Invoker, service: IntermediatesService) -> None:
- records = service._records
- for index in range(501):
- _seed_image(invoker, f"unmeasurable-{index}.png", with_file=False)
- invoker.services.image_records.set_file_size_bytes(f"unmeasurable-{index}.png", None)
- _seed_image(invoker, "later-measurable.png", with_file=False)
- invoker.services.image_records.set_file_size_bytes("later-measurable.png", None)
-
- records.mark_unmeasurable("image", [f"unmeasurable-{index}.png" for index in range(501)])
-
- assert records.next_unmeasured("image", 1) == [("later-measurable.png", "")]
-
-
-def test_eligible_rows_behind_protected_ones_are_not_starved(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- monkeypatch.setattr(intermediates_default, "DELETE_BATCH_SIZE", 1)
- _seed_image(invoker, "protected-first.png")
- _project(invoker, "alice", "Uses image", {"imageName": "protected-first.png"})
- for index in range(3):
- _seed_image(invoker, f"eligible-{index}.png")
-
- preview, result = _run(service, ALICE, _owner("alice"))
-
- assert preview.impact.delete_images == 3
- assert preview.impact.keep_referenced_images == 1
- assert result.progress.deleted_images == 3
- assert _exists(invoker, "protected-first.png")
-
-
@pytest.mark.parametrize("cleanup_wins_race", [False, True])
def test_running_graph_keeps_cached_media_or_recomputes_if_cleanup_won(
invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch, cleanup_wins_race: bool
@@ -1758,45 +1459,6 @@ def test_completed_nested_child_keeps_media_while_its_root_is_active(
assert completed.progress.deleted_images == completed.progress.deleted_videos == 1
-def test_child_protection_does_not_scan_unrelated_completed_history(
- invoker: Invoker, service: IntermediatesService
-) -> None:
- root = _enqueue_row(invoker, session_id="root", status="waiting")
- _enqueue_row(invoker, session_id="child", status="completed", root_item_id=root, parent_item_id=root)
- _seed_image(invoker, "produced.png", session_id="child")
- db = invoker.services.image_records._db
-
- def classify():
- instructions = 0
-
- def count_instructions():
- nonlocal instructions
- instructions += 100
- return 0
-
- db._conn.set_progress_handler(count_instructions, 100)
- try:
- classified = service._records.preview_scope(
- user_id=None, targets=None, mode="safe", is_admin=True, caller_user_id="admin", max_acknowledged=10
- )
- assert (classified.counts["image"].active, classified.deletable["image"].count) == (1, 0)
- return instructions
- finally:
- db._conn.set_progress_handler(None, 0)
-
- baseline = classify()
- with db.transaction() as cursor:
- cursor.executemany(
- "INSERT INTO session_queue (queue_id, session, session_id, batch_id, user_id, status) "
- "VALUES ('default', '{}', ?, 'history', 'alice', 'completed');",
- [(f"history-{index}",) for index in range(20_000)],
- )
- # Count SQLite VM work instead of machine-dependent elapsed time. A scan of
- # completed rows grows by orders of magnitude; indexed active-root lookups do not.
- assert 0 < baseline < 10_000
- assert classify() < 3 * baseline
-
-
@pytest.mark.parametrize("bulk", [False, True])
def test_video_cleanup_cannot_purge_files_during_staged_deletion(
invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch, bulk: bool
@@ -1877,23 +1539,6 @@ def test_legacy_client_state_protects_its_canvas_media_until_it_changes(
assert operation.progress.deleted_images == 1
[email protected]("forget", ["key", "account"])
-def test_forgetting_client_state_releases_its_media(
- invoker: Invoker, service: IntermediatesService, forget: str
-) -> None:
- client_state = invoker.services.client_state_persistence
- client_state.set_by_key("alice", "canvas", '{"image_name": "layer.png"}')
- _seed_image(invoker, "layer.png")
-
- if forget == "key":
- client_state.delete_by_key("alice", "canvas")
- else:
- client_state.delete("alice")
-
- _, operation = _run(service, ALICE, _owner("alice"))
- assert operation.progress.deleted_images == 1
-
-
def test_quarantined_projects_are_named_when_a_force_clear_would_break_them(
invoker: Invoker, service: IntermediatesService
) -> None:
@@ -1923,33 +1568,6 @@ def test_quarantined_projects_are_named_when_a_force_clear_would_break_them(
# ── bounds ──
-def test_previewing_in_a_loop_cannot_evict_another_accounts_pending_preview(
- invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
-) -> None:
- per_caller = intermediates_default.MAX_PREVIEWS_PER_CALLER
- monkeypatch.setattr(intermediates_default, "MAX_PREVIEWS", per_caller + 1)
- _seed_image(invoker, "safe.png")
- pending = service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("alice")), ADMIN)
-
- alice_previews = [
- service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("alice")), ALICE)
- for _ in range(per_caller + 2)
- ]
-
- # Alice's loop evicts only her own oldest previews; the administrator's pending one survives.
- _wait(service, _start(service, pending, ADMIN).operation_id, ADMIN)
- for evicted in alice_previews[:2]:
- with pytest.raises(IntermediatesPreviewNotFoundError):
- _start(service, evicted)
- monkeypatch.setattr(intermediates_default, "MAX_PREVIEWS", 2)
- bobs = service.create_preview(IntermediatesPreviewRequest(mode="safe", scope=_owner("bob")), BOB)
- # Past the global cap the oldest previews go, whoever made them.
- with pytest.raises(IntermediatesPreviewNotFoundError):
- _start(service, alice_previews[-2])
- assert _start(service, alice_previews[-1]).status == "pending"
- assert bobs.preview_id in service._previews
-
-
def test_legacy_clear_deletes_every_safe_image_in_bounded_batches(
invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
) -> None:
@@ -1984,24 +1602,6 @@ def test_background_measurement_never_overwrites_the_writers_size(invoker: Invok
assert invoker.services.image_records.get("written.png").file_size_bytes == 10
-def test_browser_holds_expire_shortly_after_their_last_refresh(invoker: Invoker, service: IntermediatesService) -> None:
- from invokeai.app.services.intermediates.intermediates_common import (
- BROWSER_HOLD_TTL_SECONDS,
- IntermediatesBrowserHoldRequest,
- )
-
- _seed_image(invoker, "held.png")
- service.replace_browser_hold(ALICE, "tab", IntermediatesBrowserHoldRequest(images=["held.png"]))
-
- with invoker.services.image_records._db.transaction() as cursor:
- cursor.execute(
- "SELECT (JULIANDAY(expires_at) - JULIANDAY('now')) * 86400 FROM intermediates_browser_holds"
- " WHERE media_name = 'held.png';"
- )
- remaining = cursor.fetchone()[0]
- assert remaining == pytest.approx(BROWSER_HOLD_TTL_SECONDS, abs=60)
-
-
def test_a_non_admin_force_preview_is_not_starved_by_foreign_referenced_rows(
invoker: Invoker, service: IntermediatesService, monkeypatch: pytest.MonkeyPatch
) -> None: