fix(cli): narrow the expiry-clear check to a variable that exists remotely

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Do7wJTnL6MG6ngFpCGW4DG
This commit is contained in:
AlexRV12
2026-09-21 19:33:12 +02:00
co-authored by Claude Opus 5
parent 2077765843
commit 976fc7ba41
+9 -9
View File
@@ -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 {