fix: resolve GitLab "Not Found" error in comment deletion #167
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The GitLab integration was failing with a "Not Found" error during comment cleanup, causing the entire VCS reporting to fail. This occurred when the
removeExistingCommentsfunctionality attempted to delete stale comment/discussion IDs that were no longer valid.Error message:
Root Cause
@gitbeaker/restpackage was missing from dependenciesSolution
🔧 GitLabMRService.ts
deleteNoteWithErrorHandling()method with comprehensive 404 error handlingdeleteDiscussion()with try-catch blocks for missing discussionsPromise.allSettled()with ES2015-compatible sequential processing🔧 GitLabAdapter.ts
Promise.all()with individual error handling for each deletion🔧 GitLab.spec.ts
📦 package.json
@gitbeaker/coreand@gitbeaker/restdependenciesKey Features
✅ 404 Error Resilience: System continues processing even when individual comments/discussions are not found
✅ Partial Failure Handling: Logs warnings for failed deletions but continues with successful ones
✅ ID Validation: Validates IDs before attempting deletion operations
✅ Detailed Logging: Provides clear feedback on success/failure ratios
✅ Backward Compatibility: No breaking changes to existing functionality
Testing
Files Changed
package.json- Added missing GitBeaker dependenciessrc/Provider/GitLab/GitLab.spec.ts- Added comprehensive error handling testssrc/Provider/GitLab/GitLabAdapter.ts- Enhanced error handling and loggingsrc/Provider/GitLab/GitLabMRService.ts- Added 404 error resilienceImpact
This fix resolves the GitLab "Not Found" error completely, ensuring reliable comment management and preventing integration failures due to stale comment references.