Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughVersion bumped to 4.3.3 and YAML sync logic switched to remote-first: signatures/returns updated ( Changes
Sequence Diagram(s)sequenceDiagram
participant Remote as Remote Source
participant Sync as Sync Module
participant Local as Local FS
participant Cleanup as Cleanup Logic
Remote->>Sync: send remoteTestCases (id, description)
Local->>Sync: readTestCasesFromDir(startDir) -> localTestCases (+ filePath)
Sync->>Sync: build maps by id (remoteTestCasesById, localTestCasesById)
Sync->>Cleanup: compare entries
alt ID matches but description differs
Cleanup->>Local: delete local file (use filePath)
Cleanup->>Local: possibly remove parent dir
end
alt Local entry not present in remote
Cleanup->>Local: delete orphaned local file (use filePath)
Cleanup->>Local: removeEmptyDirectoriesRecursively(fileDir, root)
end
Cleanup->>Sync: cleanup complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/tools/sync/yaml.ts`:
- Around line 272-280: The ENOENT occurs because files may already be removed by
an earlier recursive fs.rmSync call; in the loop that iterates localTestCases
and deletes by localTestCase.filePath (the block using remoteTestCasesById,
fs.rmSync(localTestCase.filePath) and removeEmptyDirectoriesRecursively), guard
the deletion by checking the file exists first (e.g., with fs.existsSync or
try/catch around fs.rmSync) before calling fs.rmSync and then call
removeEmptyDirectoriesRecursively only when a deletion actually happened; update
the logic around the localTestCases loop to skip removal if
localTestCase.filePath is missing to avoid double-deletes and ENOENT errors.
♻️ Duplicate comments (1)
src/tools/sync/yaml.ts (1)
180-182: Return type has unnecessary optional marker.The function signature declares
filePath?: string(optional), but line 184 shows the internal array type as{ filePath: string }(required), and line 192 always providesfilePath. The external type should match the actual behavior.♻️ Proposed fix
export const readTestCasesFromDir = ( startDir: string, -): Array<SyncTestCase & { filePath?: string }> => { +): Array<SyncTestCase & { filePath: string }> => {
Summary by CodeRabbit
Chores
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.