test: add unit tests for remy provider [IDE-2052]#1330
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
/describe |
|
PR Description updated to latest commit (2c0fbaf) |
PR Reviewer Guide 🔍
|
8c0d6a5 to
c1286ff
Compare
2c0fbaf to
72120e8
Compare
|
/describe |
|
PR Description updated to latest commit (72120e8) |
|
Addressing bot finding — Compilation Error (ExportedWorkspaceEditFromContent): The The bot finding was raised against an earlier commit. The current PR head ( No fix needed — false positive against stale commit. |
4ab7fd6 to
131f83f
Compare
72120e8 to
0e94ef1
Compare
|
/describe |
|
PR Description updated to latest commit (0e94ef1) |
131f83f to
51106db
Compare
0e94ef1 to
694c381
Compare
Comprehensive unit test coverage for domain/snyk/remediation: - Guards: empty FindingId, ContentRoot, FilePath, non-absolute path, non-git-repo ContentRoot - Worktree isolation: runner receives isolated worktree path, not real workspace - Runner error propagation - No-changes → nil edit - Single-file WorkspaceEdit keyed by real workspace path (not worktree path) - Multi-file partitioning and cache serving (runner called exactly once on cache hit) - Cache eviction via InvalidateFile (runner re-invoked after file evicted) - Stat-based cache invalidation (file deleted → cacheValid fails → re-run) - Subdir workspace: ContentRoot is monorepo subfolder, Changes keyed by gitRoot/relPath - parseDiffHunks: malformed header, no-newline marker, consecutive insertion merge, negative startLine, startLine exceeds file length - Regression: deletion of "--" lines (SQL comments) not dropped as header - workspaceEditFromContent: empty content/diff errors - NewRemyProvider with nil runner sets default gafRunner - FileChangeNotifier interface implemented by remyProvider
694c381 to
bed5a75
Compare
51106db to
24aa3d9
Compare
User description
Summary
domain/snyk/remediation/remy_test.gocovering:InvalidateFileand stat-based mtime invalidationContentRootis monorepo subfolder, Changes keyed bygitRoot/relPathparseDiffHunksregression: deletion of--lines not silently droppedparseDiffHunksedge cases: malformed header, no-newline marker, consecutive insertionsPR Stack — Merge Order
flowchart LR main(["main"]) PR1["#1326 PR-1\nfindingId + kind"] PR2["#1327 PR-2\nCA provider"] PR3["#1328 PR-3\nremy initial"] PR4["#1329 PR-4\nworktree impl"] PR5["#? PR-5 ← YOU ARE HERE\nunit tests"] PR6["#? PR-6\ninteg+smoke tests"] main --> PR1 --> PR2 --> PR3 --> PR4 --> PR5 --> PR6 style PR5 fill:#ffd700,color:#000Depends on: #1329
Test plan
go test -race ./domain/snyk/remediation/...passes — 83%+ coveragePR Type
Tests
Description
Add comprehensive unit tests for
remediation.RemiProvider.Cover input validation, worktree isolation, caching, and diff parsing edge cases.
Refactor shared git helper functions into a common test file.
File Walkthrough
remy_test.go
Add comprehensive unit tests for remy providerdomain/snyk/remediation/remy_test.go
for the
remediation.RemiProvider.worktree isolation, caching mechanisms, sub-directory workspaces, and
various diff parsing edge cases.
runners.
remy_provider_test.go
Remove duplicated git helpersdomain/snyk/remediation/remy_provider_test.go
initGitRepoandcommitFilewere removed from thisfile.
remy_test.gofile.