Files
sencho/backend/src/__tests__/auto-update-digest-gate.test.ts
T
Anso 719180f156 fix(fleet): verify update status before removing readiness cards (#1697)
* fix(fleet): verify update status before removing readiness cards

Full-stack Apply now rechecks persisted status after the health gate starts, reloads the live preview before dropping a card, and invalidates the hub fleet aggregation so cleared updates cannot resurrect from a stale cache.

Closes #1686

* fix(fleet): align persisted update status with preview semver detection

Share digest-plus-tag detection so post-Apply sidebar status matches Fleet and Anatomy.

* fix(fleet): keep tag-only updates advisory for Compose automation

Expose digestUpdate vs tagUpdate from checkImage so scheduled and API auto-update only apply same-tag digest drift Compose can pull.

* docs: clarify scheduled auto-update applies digest drift only

Document that higher pinned tags stay advisory until Compose is changed, matching schedule and Run Now behavior.

* docs: require Compose pin edits for higher-tag advisories

Stop recommending Apply now or Update as remedies that cannot rewrite a pinned image tag.

* docs: clarify Apply now pulls pinned tags only

Align the detection-cadence bullet with digest-rebuild vs higher-tag guidance.

* fix(fleet): keep tag advisories after apply and scheduled updates

Tag-only previews were treated as cleared on Fleet reload, and scheduled/
Run Now paths wiped status without rechecking. Align post-update verification
with the manual Apply path (health gate first, recheck, no blind clear) and
block digest apply when sibling image checks failed.

* fix(fleet): clear eslint unused-arg and containers assignment
2026-07-26 03:09:21 -04:00

39 lines
1.2 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import {
createAutoUpdateDigestGateState,
messageWhenDigestApplyBlockedByCheckErrors,
recordAutoUpdateImageCheck,
} from '../helpers/autoUpdateDigestGate';
describe('autoUpdateDigestGate', () => {
it('blocks digest apply when sibling check errors exist', () => {
const state = createAutoUpdateDigestGateState();
recordAutoUpdateImageCheck(state, 'nginx:latest', {
hasUpdate: true,
digestUpdate: true,
tagUpdate: false,
});
recordAutoUpdateImageCheck(state, 'redis:latest', {
hasUpdate: false,
digestUpdate: false,
tagUpdate: false,
checkStatus: 'failed',
error: 'registry timeout',
});
const msg = messageWhenDigestApplyBlockedByCheckErrors('web', state);
expect(msg).toContain('image check(s) failed');
expect(msg).toContain('registry timeout');
});
it('does not block when digest update exists without check errors', () => {
const state = createAutoUpdateDigestGateState();
recordAutoUpdateImageCheck(state, 'nginx:latest', {
hasUpdate: true,
digestUpdate: true,
tagUpdate: false,
});
expect(messageWhenDigestApplyBlockedByCheckErrors('web', state)).toBeNull();
});
});