test(desktop): contract-skew tests read REQUIRED_BACKEND_CONTRACT instead of a frozen 6

This commit is contained in:
teknium1
2026-09-14 06:22:08 -07:00
committed by Teknium
parent d3a44784b1
commit 1782bf79c8
2 changed files with 4 additions and 3 deletions

View File

@@ -85,6 +85,7 @@ const {
$backendUpdateStatus,
applyBackendUpdate,
$backendUpdateApply,
REQUIRED_BACKEND_CONTRACT,
reportBackendContract,
applyUpdates,
applyEverythingUpdate,
@@ -194,7 +195,7 @@ describe('reportBackendContract', () => {
})
it('dismisses the toast when the backend meets the contract', () => {
reportBackendContract(6)
reportBackendContract(REQUIRED_BACKEND_CONTRACT)
expect(dismissSpy).toHaveBeenCalledWith('backend-contract-skew')
expect(notifySpy).not.toHaveBeenCalled()
})
@@ -234,7 +235,7 @@ describe('reportBackendContract', () => {
lastToast().onDismiss()
notifySpy.mockClear()
reportBackendContract(6) // backend updated → satisfied, snooze cleared
reportBackendContract(REQUIRED_BACKEND_CONTRACT) // backend updated → satisfied, snooze cleared
reportBackendContract(5) // a later regression must warn immediately
expect(notifySpy).toHaveBeenCalledTimes(1)
})

View File

@@ -105,7 +105,7 @@ function isUpdateToastSnoozed(): boolean {
// v7: requires JSON-RPC server->client requests for every blocking prompt
// (approval/clarify/sudo/secret/vault/MCP setup); a v6 backend's
// `<kind>.request` notifications would never render a card.
const REQUIRED_BACKEND_CONTRACT = 7
export const REQUIRED_BACKEND_CONTRACT = 7
const SKEW_TOAST_ID = 'backend-contract-skew'
// The contract check runs on every session.resume (applyRuntimeInfo), so
// without a snooze the warning re-popped on every thread the user opened, even