From 976fc7ba41730a2d4a4fec850fb3ff936187da44 Mon Sep 17 00:00:00 2001 From: AlexRV12 <71396855+AlexRV12@users.noreply.github.com> Date: Mon, 21 Sep 2026 19:33:12 +0200 Subject: [PATCH] fix(cli): narrow the expiry-clear check to a variable that exists remotely Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Do7wJTnL6MG6ngFpCGW4DG --- cli/src/commands/variable/variable.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/src/commands/variable/variable.ts b/cli/src/commands/variable/variable.ts index 997e77b76a..8dac5c4bb5 100644 --- a/cli/src/commands/variable/variable.ts +++ b/cli/src/commands/variable/variable.ts @@ -161,16 +161,16 @@ export async function pushVariable( // separate step both for the up-to-date short-circuit and after the write. const { extra_perms: localPerms, ...localVariableBody } = localVariable; - // The server reads an absent `value_expires_at` as "leave the stored date alone", so - // dropping the key from the file has to be sent as an explicit `null`. `isSuperset` - // only compares keys the file still has, so a removed expiry is also invisible to it: - // without both halves the clear never applies and every later push re-reports it. - const clearsValueExpiresAt = - localVariableBody.value_expires_at === undefined && - (variable as ListableVariable | undefined)?.value_expires_at !== undefined && - (variable as ListableVariable | undefined)?.value_expires_at !== null; - if (variable) { + // The server reads an absent `value_expires_at` as "leave the stored date alone", so + // dropping the key from the file has to be sent as an explicit `null`. `isSuperset` + // only compares keys the file still has, so a removed expiry is also invisible to it: + // without both halves the clear never applies and every later push re-reports it. + const clearsValueExpiresAt = + localVariableBody.value_expires_at === undefined && + variable.value_expires_at !== undefined && + variable.value_expires_at !== null; + if (!clearsValueExpiresAt && isSuperset(localVariableBody, variable)) { log.debug(`Variable ${remotePath} is up-to-date`); } else {