Skip to content
This repository was archived by the owner on Nov 22, 2025. It is now read-only.

Commit ef0ccde

Browse files
pacphiclaude
andcommitted
fix(ci): add explicit filesystem sync to prevent 0-byte file issue in integration-resilient
The integration-resilient workflow was failing with a critical filesystem buffer flush issue: test files were created successfully but had 0 bytes after machine restart. This occurred because file data remained in the buffer cache and was never flushed to the persistent volume. Root Cause Analysis: - integration.yml (working): 2 explicit sync commands + 15s total wait before restart - integration-resilient.yml (failing): 0 sync commands + 0s wait before restart - Result: File metadata (inode, timestamp) persisted but content was lost from buffer cache Changes: - Add initial sync after file write + 2s sleep for verification - Add second sync before restart + 3s sleep with file verification - Add 10s wait for final buffer flush before machine restart - Increase post-restart wait from 10s to 45s to match integration.yml - Add comprehensive file size/content verification between sync operations This replicates integration.yml's proven sync strategy and should achieve 100% pass rate by eliminating the race condition between buffer cache writes and machine restarts. Fixes: Persistent 0-byte file failures in integration-resilient workflow Tested: Matches working integration.yml sync pattern (lines 281-323) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent daf56ba commit ef0ccde

1 file changed

Lines changed: 37 additions & 4 deletions

File tree

.github/workflows/integration-resilient.yml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,46 @@ jobs:
310310
echo "Test file: $TEST_FILE"
311311
echo "Test data: $TEST_DATA"
312312
313-
if ssh_command_retry "${{ steps.app-name.outputs.app_name }}" \
314-
"/bin/bash -c 'echo \"$TEST_DATA\" > $TEST_FILE && cat $TEST_FILE'"; then
313+
# Create test file with explicit sync operations (matching integration.yml)
314+
echo "Creating test file with content: $TEST_DATA"
315+
if ssh_command_retry "${{ steps.app-name.outputs.app_name }}" "/bin/bash -c '
316+
echo \"Creating and syncing test file...\"
317+
echo \"$TEST_DATA\" > $TEST_FILE
318+
sync
319+
sleep 2
320+
echo \"Verifying file was written correctly...\"
321+
if [ -f \"$TEST_FILE\" ]; then
322+
file_size=\$(wc -c < \"$TEST_FILE\")
323+
echo \"File created with size: \$file_size bytes\"
324+
cat \"$TEST_FILE\"
325+
else
326+
echo \"ERROR: File was not created\"
327+
exit 1
328+
fi
329+
'"; then
315330
echo "✅ Volume write successful"
316331
else
317332
echo "❌ Volume write failed"
318333
exit 1
319334
fi
320335
336+
# Force filesystem sync before restart (matching integration.yml)
337+
echo "Forcing filesystem sync before restart..."
338+
ssh_command_retry "${{ steps.app-name.outputs.app_name }}" "/bin/bash -c '
339+
echo \"Syncing filesystem before restart...\"
340+
sync
341+
echo \"Sync completed\"
342+
sleep 3
343+
echo \"Final file verification before restart:\"
344+
ls -la \"$TEST_FILE\" 2>/dev/null || echo \"File not found\"
345+
wc -c \"$TEST_FILE\" 2>/dev/null || echo \"Cannot get file size\"
346+
cat \"$TEST_FILE\" 2>/dev/null || echo \"Cannot read file\"
347+
'"
348+
349+
# Wait additional time for any remaining buffer flushes (matching integration.yml)
350+
echo "Waiting for buffer flush before restart..."
351+
sleep 10
352+
321353
# Restart machine
322354
echo "🔄 Restarting machine..."
323355
MACHINE_ID=$(flyctl status -a "${{ steps.app-name.outputs.app_name }}" --json | jq -r '.Machines[0].id')
@@ -329,8 +361,9 @@ jobs:
329361
exit 1
330362
fi
331363
332-
# Wait for machine to be ready again
333-
sleep 10
364+
# Wait for machine to restart and become ready (increased from 10s)
365+
echo "Waiting for machine to restart and become ready..."
366+
sleep 45
334367
wait_for_machine_ready "${{ steps.app-name.outputs.app_name }}"
335368
336369
# Verify persistence with comprehensive check

0 commit comments

Comments
 (0)