Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: allow manual updates of containers excluded from auto-update (#4139)
Kyle Mendell6c227d02de0f
diff --git a/backend/go.mod b/backend/go.modindex 8f20b4c4c..6142db149 100644--- a/backend/go.mod+++ b/backend/go.mod@@ -76,7 +76,7 @@ require (go.getarcane.app/streams v0.4.3go.getarcane.app/sys/cgroup v0.2.3go.getarcane.app/sys/crypto v0.2.1- go.getarcane.app/updater v0.9.3+ go.getarcane.app/updater v0.10.0go.uber.org/fx v1.24.0go.yaml.in/yaml/v4 v4.0.0-rc.6golang.org/x/crypto v0.57.0diff --git a/backend/go.sum b/backend/go.sumindex e19eb0c57..dac7628d9 100644--- a/backend/go.sum+++ b/backend/go.sum@@ -746,8 +746,8 @@ go.getarcane.app/sys/cgroup v0.2.3 h1:+eGLUC+3Ct+BNcPBQwC/g/psDOzjWN2vUr6KhKyNWggo.getarcane.app/sys/cgroup v0.2.3/go.mod h1:1ksFb/psBkQlOsS9D6OFydd9Evpb0mCoJzyCyb9RoL8=go.getarcane.app/sys/crypto v0.2.1 h1:A2HFmCRnDAj4/gl96apUifmw95verB5HCaPyNsHSAl8=go.getarcane.app/sys/crypto v0.2.1/go.mod h1:bA7dHfhnUCXl06+RxBJjwtoLR01J9WSZft6yoVnW4jE=-go.getarcane.app/updater v0.9.3 h1:/eTvXyc9jd75RRbA7SH99XlRoX6QLgDERofNqKVZfgI=-go.getarcane.app/updater v0.9.3/go.mod h1:rMRAzw2KX5S8Ptjs4HAoN7inIHqxdSFsCHcrQWWK+vw=+go.getarcane.app/updater v0.10.0 h1:6Nh5mo9QupiZAYQpJIZSUGftDmbjNBZqJfLzcB2pAvc=+go.getarcane.app/updater v0.10.0/go.mod h1:F7KT3jTCLKc5PS7dNPTSigqe9RglgVevkJVWSAmafHE=go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=diff --git a/backend/internal/updater/service.go b/backend/internal/updater/service.goindex 7d69628eb..47410e5b3 100644--- a/backend/internal/updater/service.go+++ b/backend/internal/updater/service.go@@ -279,7 +279,7 @@ func (s *UpdaterService) applyScopedUpdatesInternal(ctx context.Context, optionsreturn common.ErrUpdaterNoContainersMatched}- engineOpts := updater.Options{Force: options.ForceUpdate, DryRun: options.DryRun}+ engineOpts := moduleOptionsFromUpdaterOptionsInternal(options)var engineErrs []errorfor _, containerID := range containerIDs {target := schedulertypes.TargetOutcome{ID: containerID, ResourceType: "container", Status: schedulertypes.Running}@@ -459,7 +459,10 @@ func (s *UpdaterService) UpdateSingleContainer(ctx context.Context, containerIDs.updateMu.Lock()defer s.updateMu.Unlock()- moduleResult, engineErr := s.engineInternal().UpdateContainer(ctx, containerID, updater.Options{})+ // The caller picked this container, so the autoUpdateExcludedContainers+ // setting does not apply: it only governs automatic and pending runs, which+ // keep skipping the container. Labels and immutable references still do.+ moduleResult, engineErr := s.engineInternal().UpdateContainer(ctx, containerID, updater.Options{IgnoreSettingsExclusions: true})if moduleResult != nil {out = resultFromModuleInternal(moduleResult)out.ActivityID = mo.EmptyableToOption(strings.TrimSpace(activityID)).ToPointer()@@ -999,7 +1002,9 @@ func imageUpdateRecordToModuleInternal(record imageupdate.ImageUpdateRecord) upd// moduleOptionsFromUpdaterOptionsInternal narrows Arcane's request options to// what the engine acts on. Options.Type and Options.ResourceIds stay behind:// the engine never read them, and ApplyPending already routes a scoped request-// through applyScopedUpdatesInternal before reaching the engine.+// through applyScopedUpdatesInternal before reaching the engine. Settings+// exclusions always apply to these runs; only UpdateSingleContainer overrides+// them for its explicitly requested container.func moduleOptionsFromUpdaterOptionsInternal(options arcaneupdater.Options) updater.Options {return updater.Options{Force: options.ForceUpdate,diff --git a/backend/internal/updater/service_test.go b/backend/internal/updater/service_test.goindex 93e988c92..c8a5863ad 100644--- a/backend/internal/updater/service_test.go+++ b/backend/internal/updater/service_test.go@@ -274,15 +274,18 @@ func TestUpdaterService_ApplyPendingNoRecordsInternal(t *testing.T) {// Type and ResourceIds are Arcane-side scoping the engine never acted on;// ApplyPending handles a scoped request itself before reaching the engine.+// A pending run, forced or scoped, never lifts settings exclusions: that+// override belongs to UpdateSingleContainer alone.func TestUpdaterService_ModuleOptionsFromUpdaterOptionsInternal(t *testing.T) {got := moduleOptionsFromUpdaterOptionsInternal(arcaneupdater.Options{- Type: string(updater.ResourceTypeImage),- ResourceIds: []string{"image-1", "image-2"},+ Type: string(updater.ResourceTypeContainer),+ ResourceIds: []string{"container-1", "container-2"},ForceUpdate: true,DryRun: true,})assert.Equal(t, updater.Options{Force: true, DryRun: true}, got)+ assert.False(t, got.IgnoreSettingsExclusions)}func TestUpdaterService_ResultFromModulePreservesRestartedInternal(t *testing.T) {diff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex dfba01710..3233dcb01 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -614,6 +614,8 @@"containers_update_pulling_image": "Pulling latest image...","containers_update_success": "Container \"{name}\" updated successfully","containers_update_failed": "Failed to update container \"{name}\"",+ "containers_update_skipped": "Container \"{name}\" was not updated",+ "containers_update_skipped_no_reason": "The updater skipped this container without giving a reason","containers_remove_confirm_title": "Confirm Container Removal","containers_remove_confirm_message": "Are you sure you want to remove this container? This action cannot be undone.","containers_remove_force_label": "Force remove (kill the container if running)",diff --git a/frontend/src/lib/services/container-service.ts b/frontend/src/lib/services/container-service.tsindex a912693d6..75615c784 100644--- a/frontend/src/lib/services/container-service.ts+++ b/frontend/src/lib/services/container-service.ts@@ -12,6 +12,7 @@ import type {ContainerEditRequest} from '#lib/types/docker.js';import type { SearchPaginationSortRequest, Paginated } from '#lib/types/shared.js';+import type { AutoUpdateResult } from '#lib/types/automation.js';import { transformPaginationParams } from '#lib/utils/tables.js';import { downloadFromUrl } from '#lib/utils/browser-download.js';import { tryCatch } from '#lib/utils/try-catch.js';@@ -119,7 +120,7 @@ class ContainerService extends BaseAPIService {return this.handleResponse(this.api.delete(`/environments/${envId}/containers/${containerId}`, { params }));}- async updateContainer(containerId: string): Promise<any> {+ async updateContainer(containerId: string): Promise<AutoUpdateResult> {const envId = await environmentStore.getCurrentEnvironmentId();return this.handleResponse(this.api.post(`/environments/${envId}/containers/${containerId}/update`));}diff --git a/frontend/src/lib/utils/container-actions.ts b/frontend/src/lib/utils/container-actions.tsindex 36f6f6e22..fefee23eb 100644--- a/frontend/src/lib/utils/container-actions.ts+++ b/frontend/src/lib/utils/container-actions.ts@@ -4,6 +4,7 @@ import { containerService } from '#lib/services/container-service.js';import { handleApiResultWithCallbacks } from '#lib/utils/api.js';import { tryCatch } from '#lib/utils/try-catch.js';import { activityToastOptions, extractActivityId } from '#lib/utils/activity-toast.js';+import type { AutoUpdateResult } from '#lib/types/automation.js';import { toast } from 'svelte-sonner';type ContainerLifecycleAction = 'start' | 'stop' | 'restart' | 'pause' | 'unpause';@@ -134,17 +135,6 @@ export function confirmAndRemoveContainer({});}-type ContainerUpdateResultItem = {- status?: string;- error?: string;-};--type ContainerUpdateResult = {- failed?: number;- updated?: number;- items?: ContainerUpdateResultItem[];-};-type ConfirmAndUpdateContainerOptions = {containerId: string;containerName: string;@@ -170,40 +160,61 @@ export function confirmAndUpdateContainer({destructive: false,action: async () => {setLoading?.(true);- try {- const operationResult = await tryCatch(- (async () => {- if (showPullingToast) {- toast.info(m.containers_update_pulling_image());- }-- const result = (await containerService.updateContainer(containerId)) as ContainerUpdateResult;- const toastOptions = useActivityToast ? activityToastOptions(extractActivityId(result)) : undefined;-- if ((result.failed ?? 0) > 0) {- const failedItem = result.items?.find((item) => item.status === 'failed');- toast.error(- m.containers_update_failed({ name: containerName }) + (failedItem?.error ? `: ${failedItem.error}` : ''),- toastOptions- );- } else if ((result.updated ?? 0) > 0) {- toast.success(m.containers_update_success({ name: containerName }), toastOptions);- } else {- toast.info(m.image_update_up_to_date_title(), toastOptions);- }+ if (showPullingToast) {+ toast.info(m.containers_update_pulling_image());+ }+ const operationResult = await tryCatch(+ handleApiResultWithCallbacks({+ result: await tryCatch(containerService.updateContainer(containerId)),+ message: m.containers_update_failed({ name: containerName }),+ setLoadingState: (value) => setLoading?.(value),+ async onSuccess(result) {+ showContainerUpdateResultToast(result, containerName, useActivityToast);await onRefresh?.();- })()- );- if (operationResult.error !== null) {- const error = operationResult.error;- console.error('Container update failed:', error);- toast.error(m.containers_update_failed({ name: containerName }));- }- } finally {+ }+ })+ );+ if (operationResult.error !== null) {+ const error = operationResult.error;+ console.error('Container update failed:', error);+ toast.error(m.containers_update_failed({ name: containerName }));setLoading?.(false);}}}});}++/**+ * A single-container update answers 200 with a one-item result, so the outcome+ * lives in the tally: failed, updated (or restarted), skipped with the engine's+ * reason, or nothing to do. A skip is not "up to date" — the engine did not+ * apply anything, and its reason says why.+ */+function showContainerUpdateResultToast(result: AutoUpdateResult, containerName: string, useActivityToast: boolean) {+ const toastOptions = useActivityToast ? activityToastOptions(extractActivityId(result)) : undefined;+ const itemWithStatus = (status: AutoUpdateResult['items'][number]['status']) =>+ result.items?.find((item) => item.status === status);++ if ((result.failed ?? 0) > 0) {+ toast.error(m.containers_update_failed({ name: containerName }), {+ ...toastOptions,+ description: itemWithStatus('failed')?.error+ });+ return;+ }+ if ((result.updated ?? 0) + (result.restarted ?? 0) > 0) {+ toast.success(m.containers_update_success({ name: containerName }), toastOptions);+ return;+ }+ const skipped = itemWithStatus('skipped');+ if (skipped) {+ toast.info(m.containers_update_skipped({ name: containerName }), {+ ...toastOptions,+ description: skipped.error || m.containers_update_skipped_no_reason()+ });+ return;+ }+ toast.info(m.image_update_up_to_date_title(), toastOptions);+}diff --git a/frontend/src/lib/utils/update-actions.ts b/frontend/src/lib/utils/update-actions.tsindex 79ae06a7d..5fa3e013c 100644--- a/frontend/src/lib/utils/update-actions.ts+++ b/frontend/src/lib/utils/update-actions.ts@@ -20,20 +20,43 @@ export function applyScopedUpdate(type: Extract<AutoUpdateResourceType, 'containreturn imageService.runAutoUpdate({ type, resourceIds: [id] });}+type ThrowOnUpdateFailureOptions = {+ /**+ * Also reject a result whose resource was skipped. A skipped container was+ * not updated, so a selected-container bulk action must not count it as one.+ * Project runs keep their default: a skip there is a normal partial outcome.+ */+ rejectSkipped?: boolean;+};+/*** The updater reports per-resource failures in the body of a 200, so a resolved* promise alone does not mean the update landed. Bulk runners tally by* rejection, so surface those failures as a throw before they get counted as* successes.*/-export function throwOnUpdateFailure<T extends Pick<AutoUpdateResult, 'failed' | 'items'>>(result: T): T {+export function throwOnUpdateFailure<T extends Pick<AutoUpdateResult, 'failed' | 'items'>>(+ result: T,+ { rejectSkipped = false }: ThrowOnUpdateFailureOptions = {}+): T {if ((result?.failed ?? 0) > 0) {const firstError = result.items?.find((item) => item.status === 'failed')?.error;throw new Error(firstError || m.updates_bulk_update_failed());}+ if (rejectSkipped) {+ const skipped = result?.items?.find((item) => item.status === 'skipped');+ if (skipped) {+ throw new Error(skipped.error || m.containers_update_skipped_no_reason());+ }+ }return result;}+/** {@link throwOnUpdateFailure} for a single-container update: a skipped container did not update. */+export function throwOnContainerUpdateFailure<T extends Pick<AutoUpdateResult, 'failed' | 'items'>>(result: T): T {+ return throwOnUpdateFailure(result, { rejectSkipped: true });+}+/** Emits a single toast describing an updater run's updated/failed/skipped tally. */export function summarizeUpdateResult(result: AutoUpdateResult) {const options = activityToastOptions(result.activityId);diff --git a/frontend/src/routes/(app)/containers/container-table.actions.ts b/frontend/src/routes/(app)/containers/container-table.actions.tsindex 9a81e9a20..ebfae74ca 100644--- a/frontend/src/routes/(app)/containers/container-table.actions.ts+++ b/frontend/src/routes/(app)/containers/container-table.actions.ts@@ -15,7 +15,7 @@ import {import type { TableActionConfig, TableBulkActionConfig } from '#lib/utils/table-action-types.js';import { toast } from 'svelte-sonner';import { getContainerDisplayName, type ActionStatus } from './container-table.helpers';-import { throwOnUpdateFailure } from '#lib/utils/update-actions.ts';+import { throwOnContainerUpdateFailure } from '#lib/utils/update-actions.js';type BulkLoadingState = {start: boolean;@@ -227,7 +227,7 @@ export function createContainerActions({message,confirmLabel: m.common_update(),destructive: false,- run: (id) => containerService.updateContainer(id).then(throwOnUpdateFailure),+ run: (id) => containerService.updateContainer(id).then(throwOnContainerUpdateFailure),messages: {success: (count) => m.containers_bulk_update_success({ count }),partial: (success, total, failed) => m.containers_bulk_update_partial({ success, total, failed }),diff --git a/frontend/src/routes/(app)/updates/container-updates-table.svelte b/frontend/src/routes/(app)/updates/container-updates-table.svelteindex c2ff7a947..5861f24cc 100644--- a/frontend/src/routes/(app)/updates/container-updates-table.svelte+++ b/frontend/src/routes/(app)/updates/container-updates-table.svelte@@ -27,7 +27,7 @@import { confirmAndUpdateContainer } from '#lib/utils/container-actions.js';import { isAutoUpdateIgnored, isAutoUpdateLabelDisabled } from '#lib/utils/container-auto-update.js';import { bulkConfirmAndRun } from '#lib/utils/bulk-actions.js';- import { throwOnUpdateFailure } from '#lib/utils/update-actions.js';+ import { throwOnContainerUpdateFailure } from '#lib/utils/update-actions.js';import { formatImageUpdateCheckedAt, formatImageUpdateValue } from '#lib/utils/image-updates.js';import { toast } from 'svelte-sonner';@@ -154,7 +154,7 @@title: m.updates_bulk_update_confirm_title({ count: ids.length }),message: m.updates_bulk_update_confirm_message({ count: ids.length }),confirmLabel: m.common_update(),- run: (id) => containerService.updateContainer(id).then(throwOnUpdateFailure),+ run: (id) => containerService.updateContainer(id).then(throwOnContainerUpdateFailure),messages: {success: (count) => m.updates_bulk_update_success({ count }),partial: (success, total, failed) => m.updates_bulk_update_partial({ success, total, failed }),diff --git a/go.work.sum b/go.work.sumindex be92e4201..14c7165b9 100644--- a/go.work.sum+++ b/go.work.sum@@ -2682,6 +2682,8 @@ go.getarcane.app/updater v0.8.0 h1:8R79Pxj9jiH9NBRwvGJAeiG1DFcdwATKM8MN/V6Sz2Q=go.getarcane.app/updater v0.8.0/go.mod h1:Hci6Hziz1tublccxm48pKvhxmmg0n3GC6tPMu4bYl3c=go.getarcane.app/updater v0.9.1 h1:kQsBIKRAEsCv1xgt7BMClStuNDj8JB2TrjY4djhgTa4=go.getarcane.app/updater v0.9.1/go.mod h1:rMRAzw2KX5S8Ptjs4HAoN7inIHqxdSFsCHcrQWWK+vw=+go.getarcane.app/updater v0.10.0 h1:6Nh5mo9QupiZAYQpJIZSUGftDmbjNBZqJfLzcB2pAvc=+go.getarcane.app/updater v0.10.0/go.mod h1:F7KT3jTCLKc5PS7dNPTSigqe9RglgVevkJVWSAmafHE=go.lsp.dev/jsonrpc2 v0.10.0 h1:Pr/YcXJoEOTMc/b6OTmcR1DPJ3mSWl/SWiU1Cct6VmI=go.lsp.dev/jsonrpc2 v0.10.0/go.mod h1:fmEzIdXPi/rf6d4uFcayi8HpFP1nBF99ERP1htC72Ac=go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2 h1:hCzQgh6UcwbKgNSRurYWSqh8MufqRRPODRBblutn4TE=diff --git a/tests/spec/updates.spec.ts b/tests/spec/updates.spec.tsindex d346d2453..b7da9fa33 100644--- a/tests/spec/updates.spec.ts+++ b/tests/spec/updates.spec.ts@@ -1,19 +1,33 @@-import { test, expect, type Page } from '../fixtures/test.fixture';+import { test, expect, type Page, type Route } from '../fixtures/test.fixture';+import { openRowActionsMenu } from '../utils/table-actions.util';const UPDATES_ROUTE = '/updates';+const CONTAINER_UPDATE_ROUTE = /\/api\/environments\/0\/containers\/[^/]+\/update$/;+const CONTAINER_LIST_ROUTE = /\/api\/environments\/0\/containers(?:\?.*)?$/;const CONTAINERS = [{id: 'update-row-a',name: 'updates-alpha',- image: 'public.ecr.aws/docker/library/alpine:3.20'+ image: 'public.ecr.aws/docker/library/alpine:3.20',+ ignored: false},{id: 'update-row-b',name: 'updates-beta',- image: 'public.ecr.aws/docker/library/busybox:1.37'+ image: 'public.ecr.aws/docker/library/busybox:1.37',+ ignored: false+ },+ {+ // Listed in `autoUpdateExcludedContainers`: automatic runs skip it, but a+ // user may still update it explicitly (#4123).+ id: 'update-row-c',+ name: 'updates-gamma',+ image: 'public.ecr.aws/docker/library/nginx:1.27',+ ignored: true}];+const IGNORED_CONTAINER = CONTAINERS.find((container) => container.ignored)!;function containerWithUpdate(container: (typeof CONTAINERS)[number]) {return {@@ -101,9 +115,26 @@ async function stubProjectWithTagUpdate(page: Page) {});}-/** Serves the two update-pending containers so the tab always has selectable rows. */+/** Marks the ignored fixture as excluded in the setting that drives the "Ignored" badge. */+async function stubExcludedContainersSetting(page: Page) {+ const excluded = CONTAINERS.filter((container) => container.ignored)+ .map((container) => container.name)+ .join(',');+ await page.route(/\/api\/environments\/0\/settings$/, async (route) => {+ const response = await route.fetch();+ const settings = ((await response.json()) as { key: string; value: string }[]).filter(+ (setting) => setting.key !== 'autoUpdateExcludedContainers'+ );+ settings.push({ key: 'autoUpdateExcludedContainers', value: excluded });+ await route.fulfill({ response, json: settings });+ });+}++/** Serves the update-pending containers so the tab always has selectable rows; returns the number of list fetches so far. */async function stubContainersWithUpdates(page: Page) {- await page.route(/\/api\/environments\/0\/containers(?:\?.*)?$/, async (route) => {+ const fetches = { count: 0 };+ await page.route(CONTAINER_LIST_ROUTE, async (route) => {+ fetches.count++;await route.fulfill({status: 200,contentType: 'application/json',@@ -119,6 +150,98 @@ async function stubContainersWithUpdates(page: Page) {})});});+ return fetches;+}++type ContainerUpdateOutcome =+ | { kind: 'updated' }+ | { kind: 'skipped'; reason: string }+ | { kind: 'failed'; error: string }+ | { kind: 'request-error'; error: string };++function containerUpdateItem(containerId: string, status: string, error?: string) {+ const container = CONTAINERS.find((candidate) => candidate.id === containerId)!;+ return {+ resourceId: containerId,+ resourceName: container.name,+ resourceType: 'container',+ status,+ error+ };+}++/** Answers `POST .../containers/{id}/update` per container and records which ids were requested. */+async function stubContainerUpdates(page: Page, outcomes: Record<string, ContainerUpdateOutcome>) {+ const requested: string[] = [];+ await page.route(CONTAINER_UPDATE_ROUTE, async (route: Route) => {+ const containerId = new URL(route.request().url()).pathname.split('/').at(-2)!;+ requested.push(containerId);+ const outcome = outcomes[containerId] ?? { kind: 'updated' };+ if (outcome.kind === 'request-error') {+ await route.fulfill({+ status: 500,+ contentType: 'application/json',+ json: { success: false, error: outcome.error }+ });+ return;+ }+ const data =+ outcome.kind === 'updated'+ ? {+ checked: 1,+ updated: 1,+ skipped: 0,+ failed: 0,+ items: [containerUpdateItem(containerId, 'updated')]+ }+ : outcome.kind === 'skipped'+ ? {+ checked: 1,+ updated: 0,+ skipped: 1,+ failed: 0,+ items: [containerUpdateItem(containerId, 'skipped', outcome.reason)]+ }+ : {+ checked: 1,+ updated: 0,+ skipped: 0,+ failed: 1,+ items: [containerUpdateItem(containerId, 'failed', outcome.error)]+ };+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ json: { success: true, data }+ });+ });+ return requested;+}++function containerRow(page: Page, container: (typeof CONTAINERS)[number]) {+ return page.getByRole('row').filter({ hasText: container.name });+}++async function selectAllContainerRows(page: Page) {+ for (const container of CONTAINERS) {+ await containerRow(page, container).getByRole('checkbox', { name: 'Select row' }).check();+ }+}++async function confirmBulkUpdate(page: Page) {+ await page.getByRole('button', { name: `Update (${CONTAINERS.length})`, exact: true }).click();+ const dialog = page.getByRole('dialog');+ await expect(dialog).toBeVisible();+ await dialog.getByRole('button', { name: 'Update', exact: true }).click();+}++/** Runs the row-level "Update Container" action for one container through its confirm dialog. */+async function updateContainerFromRow(page: Page, container: (typeof CONTAINERS)[number]) {+ const menu = await openRowActionsMenu(page, containerRow(page, container));+ await menu.getByRole('menuitem', { name: 'Update Container', exact: true }).click();+ const dialog = page.getByRole('dialog');+ await expect(dialog).toBeVisible();+ await dialog.getByRole('button', { name: 'Update Container', exact: true }).click();}test.describe('Updates Page Project Rows', () => {@@ -139,38 +262,100 @@ test.describe('Updates Page Project Rows', () => {});test.describe('Updates Page Actions', () => {- test('applies updates to the selected container rows', async ({ page }) => {- await stubContainersWithUpdates(page);-- const updated: string[] = [];- await page.route(/\/api\/environments\/0\/containers\/[^/]+\/update$/, async (route) => {- updated.push(new URL(route.request().url()).pathname.split('/').at(-2)!);- await route.fulfill({- status: 200,- contentType: 'application/json',- body: JSON.stringify({ success: true, data: { updated: 1, failed: 0, items: [] } })- });- });+ test('applies updates to the selected container rows, including an ignored one', async ({+ page+ }) => {+ await stubExcludedContainersSetting(page);+ const listFetches = await stubContainersWithUpdates(page);+ const requested = await stubContainerUpdates(page, {});await page.goto(UPDATES_ROUTE);await page.waitForLoadState('load');+ await expect(+ containerRow(page, IGNORED_CONTAINER).getByText('Ignored', { exact: true })+ ).toBeVisible();+ const fetchesBeforeUpdate = listFetches.count;+ await selectAllContainerRows(page);+ await confirmBulkUpdate(page);++ await expect(page.getByText(`Updated ${CONTAINERS.length} resource(s)`)).toBeVisible({+ timeout: 15_000+ });+ expect(requested.sort()).toEqual(CONTAINERS.map((c) => c.id).sort());+ expect(listFetches.count).toBeGreaterThan(fetchesBeforeUpdate);for (const container of CONTAINERS) {- await page- .getByRole('row')- .filter({ hasText: container.name })- .getByRole('checkbox', { name: 'Select row' })- .check();+ await expect(+ containerRow(page, container).getByRole('checkbox', { name: 'Select row' })+ ).not.toBeChecked();}+ });- await page.getByRole('button', { name: 'Update (2)', exact: true }).click();+ test('does not count skipped or failed container updates as updated', async ({ page }) => {+ await stubExcludedContainersSetting(page);+ await stubContainersWithUpdates(page);+ const [alpha, beta] = CONTAINERS;+ const requested = await stubContainerUpdates(page, {+ [beta.id]: { kind: 'skipped', reason: 'immutable image reference' },+ [IGNORED_CONTAINER.id]: { kind: 'failed', error: 'pull failed: registry unreachable' }+ });- const dialog = page.getByRole('dialog');- await expect(dialog).toBeVisible();- await dialog.getByRole('button', { name: 'Update', exact: true }).click();+ await page.goto(UPDATES_ROUTE);+ await page.waitForLoadState('load');++ await selectAllContainerRows(page);+ await confirmBulkUpdate(page);++ await expect(+ page.getByText(`Updated 1 of ${CONTAINERS.length} resource(s), 2 failed`)+ ).toBeVisible({+ timeout: 15_000+ });+ expect(requested.sort()).toEqual([alpha.id, beta.id, IGNORED_CONTAINER.id].sort());+ });++ test('row update reports a skipped reason or the server error and recovers', async ({ page }) => {+ await stubExcludedContainersSetting(page);+ const listFetches = await stubContainersWithUpdates(page);+ const outcomes: Record<string, ContainerUpdateOutcome> = {+ [IGNORED_CONTAINER.id]: { kind: 'skipped', reason: 'immutable image reference' }+ };+ const requested = await stubContainerUpdates(page, outcomes);++ await page.goto(UPDATES_ROUTE);+ await page.waitForLoadState('load');+ const fetchesBeforeUpdate = listFetches.count;++ await updateContainerFromRow(page, IGNORED_CONTAINER);+ await expect(+ page.getByText(`Container "${IGNORED_CONTAINER.name}" was not updated`)+ ).toBeVisible({+ timeout: 15_000+ });+ await expect(page.getByText('immutable image reference')).toBeVisible();+ await expect(page.getByText('Up to Date')).toHaveCount(0);+ expect(requested).toEqual([IGNORED_CONTAINER.id]);+ await expect.poll(() => listFetches.count).toBeGreaterThan(fetchesBeforeUpdate);++ outcomes[IGNORED_CONTAINER.id] = {+ kind: 'request-error',+ error: 'pull failed: registry unreachable'+ };+ await updateContainerFromRow(page, IGNORED_CONTAINER);+ await expect(+ page.getByText(`Failed to update container "${IGNORED_CONTAINER.name}"`)+ ).toBeVisible({+ timeout: 15_000+ });+ await expect(page.getByText('pull failed: registry unreachable')).toBeVisible();+ expect(requested).toEqual([IGNORED_CONTAINER.id, IGNORED_CONTAINER.id]);- await expect(page.getByText('Updated 2 resource(s)')).toBeVisible({ timeout: 15_000 });- expect(updated.sort()).toEqual(CONTAINERS.map((c) => c.id).sort());+ // The action is usable again after both outcomes: loading state was cleared.+ const menu = await openRowActionsMenu(page, containerRow(page, IGNORED_CONTAINER));+ await expect(+ menu.getByRole('menuitem', { name: 'Update Container', exact: true })+ ).toBeEnabled();+ await page.keyboard.press('Escape');});test('Update All confirms before dispatching a host-wide updater run', async ({ page }) => {