-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: cleanup backend endpoints #14418
Conversation
📝 WalkthroughWalkthroughThe pull request involves a significant reduction in functionality across multiple components of the backend Designer application. Several controllers, services, interfaces, and test classes have been removed, primarily related to Kubernetes deployments, languages, process modeling, repository management, text keys, and texts. The changes suggest a strategic simplification of the application's architecture, removing endpoints and services that may no longer be required or have been replaced by alternative implementations. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (9)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14418 +/- ##
==========================================
- Coverage 95.68% 95.68% -0.01%
==========================================
Files 1891 1891
Lines 24583 24574 -9
Branches 2823 2823
==========================================
- Hits 23523 23514 -9
Misses 799 799
Partials 261 261 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Veldig fint å få ryddet bort ting som ikke er i bruk! Jeg har ingenting å utsette på dette, men foreslår at @mirkoSekulic også tar en titt for å verifisere at vi ikke fjerner noe viktig.
PS.: Ta også en kikk på konfliktene, @Konrad-Simso.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Skal se på konfliktene, det handler nok om FluentAssertions |
# Conflicts: # backend/tests/Designer.Tests/Controllers/ProcessModelingController/GetTemplatesTests.cs # backend/tests/Designer.Tests/Controllers/ProcessModelingController/SaveProcessDefinitionFromTemplateTests.cs # backend/tests/Designer.Tests/GiteaIntegrationTests/RepositoryController/RepositoryControllerGiteaIntegrationTests.cs # backend/tests/Designer.Tests/Services/ProcessModelingServiceTests.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
backend/tests/Designer.Tests/Services/ProcessModelingServiceTests.cs (1)
Line range hint
33-47
: Consider enhancing test maintainability and coverage.The test method could benefit from the following improvements:
- Add cleanup logic for the test repository to prevent test data accumulation
- Extract the expected "data" value into a constant or test data provider
- Add more test cases to cover different scenarios
Consider applying these changes:
public class ProcessModelingServiceTests : FluentTestsBase<ProcessModelingServiceTests> { + private const string EXPECTED_DATA_TASK_TYPE = "data"; + private readonly AltinnGitRepositoryFactory _altinnGitRepositoryFactory; private readonly IAppDevelopmentService _appDevelopmentService; public string CreatedTestRepoPath { get; set; } // ... constructor ... [Theory] [InlineData("ttd", "app-with-process-and-layoutsets", "testUser")] + [InlineData("ttd", "another-app-with-process", "testUser")] // Add more test cases public async Task GetTaskTypeFromProcessDefinition_GivenProcessDefinition_ReturnsTaskType(string org, string app, string developer) { string targetRepository = TestDataHelper.GenerateTestRepoName(); CreatedTestRepoPath = await TestDataHelper.CopyRepositoryForTest(org, app, developer, targetRepository); IProcessModelingService processModelingService = new ProcessModelingService(_altinnGitRepositoryFactory, _appDevelopmentService); // Act string taskType = await processModelingService.GetTaskTypeFromProcessDefinition(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, targetRepository, developer), "layoutSet1"); // Assert - Assert.Equal("data", taskType); + Assert.Equal(EXPECTED_DATA_TASK_TYPE, taskType); } + + public override void Dispose() + { + base.Dispose(); + if (!string.IsNullOrEmpty(CreatedTestRepoPath)) + { + TestDataHelper.DeleteDirectory(CreatedTestRepoPath); + } + } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
backend/tests/Designer.Tests/Controllers/ProcessModelingController/GetTemplatesTests.cs
(1 hunks)backend/tests/Designer.Tests/Controllers/ProcessModelingController/SaveProcessDefinitionFromTemplateTests.cs
(1 hunks)backend/tests/Designer.Tests/GiteaIntegrationTests/RepositoryController/RepositoryControllerGiteaIntegrationTests.cs
(0 hunks)backend/tests/Designer.Tests/Mocks/IGiteaMock.cs
(0 hunks)backend/tests/Designer.Tests/Services/ProcessModelingServiceTests.cs
(1 hunks)backend/tests/Designer.Tests/Services/SourceControlLoggingDecoratorTests.cs
(0 hunks)frontend/packages/shared/src/api/paths.js
(4 hunks)
💤 Files with no reviewable changes (3)
- backend/tests/Designer.Tests/GiteaIntegrationTests/RepositoryController/RepositoryControllerGiteaIntegrationTests.cs
- backend/tests/Designer.Tests/Mocks/IGiteaMock.cs
- backend/tests/Designer.Tests/Services/SourceControlLoggingDecoratorTests.cs
🚧 Files skipped from review as they are similar to previous changes (2)
- backend/tests/Designer.Tests/Controllers/ProcessModelingController/SaveProcessDefinitionFromTemplateTests.cs
- frontend/packages/shared/src/api/paths.js
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: Run dotnet build and test (macos-latest)
- GitHub Check: Format check
- GitHub Check: Build environment and run e2e test
- GitHub Check: Run dotnet build and test (windows-latest)
- GitHub Check: Analyze
- GitHub Check: Run integration tests against actual gitea and db
- GitHub Check: Run dotnet build and test (ubuntu-latest)
- GitHub Check: Typechecking and linting
- GitHub Check: Testing
- GitHub Check: CodeQL
🔇 Additional comments (2)
backend/tests/Designer.Tests/Controllers/ProcessModelingController/GetTemplatesTests.cs (1)
1-1
: Verify the safe removal of process template functionality.The removal of this test file aligns with the PR objectives to clean up unused backend endpoints. However, let's verify that no other components depend on the removed process template functionality.
Let's check for any remaining references to the removed endpoints:
✅ Verification successful
Process template functionality safely removed ✅
The verification confirms that the removal of the process template functionality is safe. The remaining template and process modeling references in the codebase are unrelated, belonging to different features such as data modeling and application templates.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any remaining references to the removed process template functionality # Check for any remaining references to GetTemplates endpoint echo "Checking for GetTemplates endpoint references..." rg -l "GetTemplates|SaveProcessDefinitionFromTemplate" --type cs # Check for any remaining template-related API calls in frontend code echo "Checking frontend code for template API calls..." rg -l "process.*template.*api" --type ts --type js # Check for any remaining references in configuration or documentation echo "Checking configuration and documentation..." rg -l "process.*template" --type json --type yaml --type mdLength of output: 492
Script:
#!/bin/bash # Try more granular, case-insensitive searches echo "Checking for any template-related controller files..." fd -e cs "Template" "ProcessModel" backend/src echo "Checking for template references in C# files..." rg -i "template" --type cs -l echo "Checking for process modeling references..." rg -i "processmodel" --type cs -l echo "Checking for API endpoint definitions..." rg -i "api.*template|template.*api" --type cs --type ts --type js -l echo "Checking for specific template methods..." ast-grep --pattern 'class $_ { $$$ $_Template$_($$$) { $$$ } $$$ }'Length of output: 4244
backend/tests/Designer.Tests/Services/ProcessModelingServiceTests.cs (1)
Line range hint
1-47
: Verify complete removal of process definition template functionality.The removal of
GetProcessDefinitionTemplates_GivenVersion_ReturnsListOfTemplates
test method should be accompanied by the removal of all related functionality. Let's verify this cleanup is complete.✅ Verification successful
Process definition template functionality has been properly removed
The removal of the test method is consistent with the codebase state. All process definition template-related functionality has been cleaned up, and the remaining template references in the codebase are for unrelated features (resource management and app templates).
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining references to process definition templates # Check for any remaining references to GetProcessDefinitionTemplates rg -l "GetProcessDefinitionTemplates" # Check for any remaining template-related code rg -l "ProcessDefinitionTemplate" # Check for any remaining references to template functionality in interfaces ast-grep --pattern 'interface IProcessModelingService { $$$ GetProcessDefinitionTemplates($$$) { $$$ } $$$ }'Length of output: 195
Script:
#!/bin/bash # Broader search for template-related code rg -l "template" -g "**/*Process*.cs" # Check for any process-related endpoints in controllers ast-grep --pattern 'public class $_ : ControllerBase { $$$ Template($$$) { $$$ } $$$ }' # Check process modeling service implementation rg -A 5 "class ProcessModelingService" # Check for any remaining template configurations rg -l "template" -g "**/appsettings*.json"Length of output: 1983
Script:
#!/bin/bash # Check template usage in ProcessModelingService rg "template" -C 5 backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs # Check template config in appsettings cat backend/src/Designer/appsettings.Development.json # Check interface definition cat backend/src/Designer/Services/Interfaces/IProcessModelingService.csLength of output: 5533
1c45ef0
to
216b568
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The automatic tests should be sufficient to approve this PR 💯
backend/tests/Designer.Tests/Controllers/ProcessModelingController/GetTemplatesTests.cs
Outdated
Show resolved
Hide resolved
...signer.Tests/Controllers/ProcessModelingController/SaveProcessDefinitionFromTemplateTests.cs
Outdated
Show resolved
Hide resolved
This reverts commit d39bfff.
Description
Remove unused endpoints and respective tests.
Related Issue(s)
Verification
Summary by CodeRabbit
Based on the comprehensive summary of changes, here are the high-level release notes:
Removed Features
API Changes
Testing Impact
These changes suggest a significant refactoring of the application's backend, focusing on streamlining and potentially removing certain management capabilities.