Refactor Remote Dev to a single common service class
Issue: Minimize/DRY Service Layer in Remote Developmen... (#452476 - closed)
What does this MR do and why?
- Refactors Remote Dev domain to use a single common service class
- Other related cleanup/refactors
- Relevant updates to related docs and READMEs
See the issue at Minimize/DRY Service Layer in Remote Developmen... (#452476 - closed) for the background context on this decision.
Details
Because of the Layered Architecture used by the Remote Development bounded context, there is intentionally no use-case-specific logic in the Service Layer.
Therefore, we have refactored the Service Layer for this domain to be a single reusable CommonService
class.
This allows the following benefits for the Service Layer:
- It is DRY with minimal repetition of logic across multiple service classes
- Multiple specs do not need to be written, run, and maintained for multiple service classes
- The behavior of the service layer is cohesive - it only has a limited set of specific and explicit responsibilities:
- Accept the arguments passed from the API layer, and pass them to the correct
Main
class in the Domain Logic layer. - Inject additional dependencies, such as Remote Development Settings and logger, into the Domain Logic layer.
- Convert the "
response_hash
" return value from the Domain Logic layer into aServiceResponse
object. - Enforce at runtime the Functional Patterns used within the domain.
- Accept the arguments passed from the API layer, and pass them to the correct
On the last point, we have updated the domain documentation to be explicit about our decision to enforce the functional patterns we are using at runtime.
This MR also updates the development guidelines for Service Classes to make it explicit that while this MR introduces a nonstandard approach for calling the Remote Development Workspaces Service Layer, the contract for the return value is still respected and consistent with the requirement that Service Classes should return a ServiceResponse object
Acceptance Criteria
-
Refactor the service tier to a single class. -
Add additional support for enforcement of patterns used in the Domain Layer of the Remote Development bounded context -
Better error message for pattern violation - give guidance on how to make class method private -
Move extended modules' private singleton declarations into module itself
-
-
Update the ee/lib/remote_development/README.rb
to describe new Service Layer approach with examples -
Update the ee/lib/remote_development/README.rb
to be explicit about patterns, including clarification on decision to enforce patterns at runtime, and not just the linter or spec level. -
Update docs.gitlab.com regarding Service Class interface and contracts
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Merge request reports
Activity
assigned to @cwoolley-gitlab
added pipelinetier-1 label
- A deleted user
added backend documentation labels
6 Warnings This merge request is quite big (1378 lines changed), please consider splitting it into multiple merge requests. 48aca9d5: The commit subject must contain at least 3 words. For more information, take a look at our Commit message guidelines. 48aca9d5: Commits that change 30 or more lines across at least 3 files should describe these changes in the commit body. For more information, take a look at our Commit message guidelines. 2786ce7a: The commit subject may not be longer than 72 characters. For more information, take a look at our Commit message guidelines. 2786ce7a: The commit subject must not end with a period. For more information, take a look at our Commit message guidelines. This merge request does not refer to an existing milestone. 1 Message This MR contains docs in the /doc/development directory, but any Maintainer (other than the author) can merge. You do not need tech writer review. Reviewer roulette
Category Reviewer Maintainer backend @ivaneG
(UTC+1, 1 hour behind author)
@nbelokolodov
(UTC+12, 10 hours ahead of author)
~"Tooling" Reviewer review is optional for ~"Tooling" @hkhanna2
(UTC+8, 6 hours ahead of author)
Please check reviewer's status!
Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by Ghost Useradded 1 commit
- 367956d1 - Refactor Remote Dev to a single common service class
added 1 commit
- ba9ff3ee - Refactor Remote Dev to a single common service class
- Resolved by Chad Woolley
@hkhanna2 Care to take the first review pass at this one? Thanks...
requested review from @hkhanna2
added 1 commit
- a5fb1397 - Refactor Remote Dev to a single common service class
- A deleted user
added development guidelines docsimprovement maintenancerefactor typemaintenance labels and removed typefeature label
removed featureaddition label
mentioned in issue #452476 (closed)
added 1 commit
- aff9aacc - Refactor Remote Dev to a single common service class
added 1 commit
- 531179f7 - Refactor Remote Dev to a single common service class