refactor:vcs strategy refactor - #386
Open
mohamedadel96e wants to merge 2 commits into
Open
Conversation
- Introduce `VcsProviderStrategy` interface and `VcsStrategyFactory`. - Migrate `deployments`, `projects`, and `migration` modules to use provider-agnostic VCS abstractions instead of hardcoded `github.service`. - Create `/api/vcs/:provider` endpoints to handle generic operations. - Introduce `vcs.webhook.processor.ts` for handling provider-agnostic webhook push payloads. - Ensure strict TypeScript compliance and backwards compatibility for existing github projects.
Abstract version control system into generic provider architecture. - Introduce VcsProviderStrategy interface and VcsStrategyFactory. - Migrate deployments, projects, and migration modules to use provider-agnostic VCS abstractions instead of hardcoded github.service. - Create /api/vcs/:provider endpoints to handle generic operations. - Introduce vcs.webhook.processor.ts for handling provider-agnostic webhook push payloads. - Ensure strict TypeScript compliance and backwards compatibility for existing github projects.
mohamedadel96e
force-pushed
the
feat/vcs-strategy-refactor
branch
from
August 1, 2026 18:35
dbd7ecb to
41eacde
Compare
Member
|
huge, gonna review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation & Context
Currently, the codebase is tightly coupled to GitHub as the sole source code provider, primarily through direct dependencies on
github.service.tsacross deployment and project modules. As we aim to support additional providers (such as GitLab and Self-Hosted options), this hard dependency creates friction and scaling challenges.This PR resolves this technical debt by introducing a provider-agnostic Version Control System (VCS) abstraction layer using the Strategy pattern. This allows the core application to interact with git repositories purely through interfaces, decoupling it from any specific provider implementation while maintaining full backwards compatibility for existing GitHub projects.
Related issue
Closes #379
Architecture & Implementation
1. Strategy Pattern Abstraction
VcsProviderStrategyinterface that defines the contract for all repository operations (e.g., getting branches, commits, fetching files, resolving webhooks).VcsStrategyFactorywhich serves as the central resolver, dynamically returning the correct implementation (e.g.,github,gitlab) based on the project's configuredgitProvider.2. Generic API Endpoints (
/api/vcs/:provider)github.routes.tsinto a dedicated set of genericvcs.routes.tsandvcs.controller.ts.apps/dashboard/src/lib/api/) has been migrated to consume the new/api/vcs/github/routes, removing hardcoded assumptions about GitHub from the client-side API layer.3. Core Modules Migration
Refactored the core domain modules to rely entirely on
VcsStrategyFactory:build-pipeline.ts,preflight.ts, andprepare.service.tsnow resolve the appropriate strategy usingproject.gitProviderbefore executing git operations.project-crud.service.tsandproject.controller.tsdynamically handle project creation, repo linking, and tear-downs using the generic VCS interface.vcs.webhook.processor.tsnow accepts a genericVcsPushPayloadand dynamically handles incoming push events regardless of the origin.4. Database Schema Alignment
gitProvider, etc.) to ensure long-term flexibility without losing any existing GitHub data.Verification & Testing
To guarantee strict backwards compatibility and ensure no regressions were introduced, the following checks were performed locally:
prettieroutput on unmodified lines) was manually scrubbed from the diff to ensure strict compliance with the contributing guidelines. Only logical changes are included in this PR.bun run tsc --noEmitlocally on the modified packages (apps/api,apps/dashboard,packages/db). All packages compile perfectly with zero TypeScript errors.bun run testsuite across all workspaces. All 1,877 tests passed flawlessly.bun run buildcommand, successfully compiling the optimized assets and static routes for both the API and the Dashboard without issue.Screenshots
these changes don't fully close the issue if we want to support another git provider right now, we should implement each strategy.