From 97c6915682a74ed49da1324fcf69438fd52190a2 Mon Sep 17 00:00:00 2001 From: Eric Viana Date: Tue, 4 Aug 2026 12:18:55 -0300 Subject: [PATCH] fix(api-sync): default --check to the committed snapshot, not spec-current spec-current.json only exists on the api-sync-data branch, so a bare --check on a fresh clone of main failed on a missing file. Mirrors the node patcher's defaulting: apply reads spec-current, everything else asserts against the committed snapshot. Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs --- scripts/api-sync.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/api-sync.php b/scripts/api-sync.php index bb6e454..dc11f4d 100644 --- a/scripts/api-sync.php +++ b/scripts/api-sync.php @@ -2098,7 +2098,10 @@ function runCli(array $argv, string $root): void $mode = $opts['apply'] ? 'apply' : 'check'; // Resolved and validated once, right where they enter the program (see resolveReadablePath()/ // resolveWritablePath() above), not re-trusted as raw strings at each later read/write. - $specPath = resolveReadablePath($opts['spec'] ?? ($root.'/.api-sync/spec-current.json'), '--spec'); + // Non-apply modes assert against committed state, so the snapshot is the right + // default: spec-current.json only exists on the api-sync-data branch. + $defaultSpec = $mode === 'apply' ? '/.api-sync/spec-current.json' : '/.api-sync/spec-snapshot.json'; + $specPath = resolveReadablePath($opts['spec'] ?? ($root.$defaultSpec), '--spec'); $reportPath = $opts['report'] !== null ? resolveWritablePath($opts['report'], '--report') : null; $map = loadJson($root.'/.api-sync/spec-map.json');