Skip to content

Commit 773d605

Browse files
doublegateclaude
andcommitted
fix(ci): check sync-introduced files instead of pre-existing directories
The upstream-sync workflow's verification step checked for the existence of src/web/ and other excluded directories, but these already exist in the repo. This caused every sync attempt to fail. Now uses git diff to verify only that the sync step itself did not introduce excluded files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2cfe7b7 commit 773d605

1 file changed

Lines changed: 36 additions & 22 deletions

File tree

.github/workflows/upstream-sync.yml

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -207,37 +207,51 @@ jobs:
207207
echo "All files synced successfully"
208208
fi
209209
210-
- name: Verify no excluded files
210+
- name: Verify no excluded files introduced by sync
211211
if: steps.changes.outputs.needs_sync == 'true'
212212
run: |
213-
echo "Verifying no excluded files were copied..."
213+
echo "Verifying sync did not introduce excluded files..."
214214
EXCLUDED_FOUND=0
215215
216-
# Check for web UI files
217-
if [ -d "src/web" ]; then
218-
echo "ERROR: src/web/ directory found!"
219-
EXCLUDED_FOUND=1
220-
fi
221-
222-
# Check for browser tests
223-
if [ -d "tests/browser" ]; then
224-
echo "ERROR: tests/browser/ directory found!"
225-
EXCLUDED_FOUND=1
226-
fi
227-
228-
# Check for excluded config files
229-
for file in nightwatch.json postcss.config.js .devcontainer; do
230-
if [ -e "$file" ]; then
231-
echo "ERROR: Excluded file $file found!"
232-
EXCLUDED_FOUND=1
216+
# Check git diff for any new/modified files outside src/core/operations/
217+
# The sync should ONLY touch src/core/operations/*.mjs files
218+
CHANGED_FILES=$(git diff --name-only HEAD 2>/dev/null || git diff --cached --name-only 2>/dev/null || true)
219+
UNEXPECTED_FILES=""
220+
221+
while IFS= read -r file; do
222+
if [ -n "$file" ]; then
223+
case "$file" in
224+
src/core/operations/*.mjs)
225+
# Expected - operation files are the sync target
226+
;;
227+
src/web/*)
228+
echo "ERROR: Sync introduced src/web/ file: $file"
229+
EXCLUDED_FOUND=1
230+
UNEXPECTED_FILES="$UNEXPECTED_FILES $file"
231+
;;
232+
tests/browser/*)
233+
echo "ERROR: Sync introduced tests/browser/ file: $file"
234+
EXCLUDED_FOUND=1
235+
UNEXPECTED_FILES="$UNEXPECTED_FILES $file"
236+
;;
237+
nightwatch.json|postcss.config.js|.devcontainer/*)
238+
echo "ERROR: Sync introduced excluded file: $file"
239+
EXCLUDED_FOUND=1
240+
UNEXPECTED_FILES="$UNEXPECTED_FILES $file"
241+
;;
242+
*)
243+
echo "Note: Non-operation file changed: $file (reviewing...)"
244+
;;
245+
esac
233246
fi
234-
done
247+
done <<< "$CHANGED_FILES"
235248
236249
if [ $EXCLUDED_FOUND -eq 1 ]; then
237-
echo "CRITICAL: Excluded files detected! Sync failed."
250+
echo "CRITICAL: Sync introduced excluded files! Reverting sync changes."
251+
echo "Unexpected files: $UNEXPECTED_FILES"
238252
exit 1
239253
else
240-
echo "Verification passed: No excluded files found"
254+
echo "Verification passed: Sync only modified operation files"
241255
fi
242256
243257
- name: Install dependencies

0 commit comments

Comments
 (0)