2.3 KiB
2.3 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 04-workflowsync-provider-dispatch | Workflow sync provider dispatch | done | 2 |
|
plan.md | ../../specs/integrations/requirements/gitlab-workflow-sync.md |
Task 04: Workflow Sync Provider Dispatch
Acceptance
workflowsyncdefines the provider-neutralRepoEntryand splitsClientProviderintoGitHubClientProviderandGitLabClientProviderexactly as the spec's## API Surface→### Backendsection states.Serviceholds both, either may be nil.fetchFilesdispatches oncfg.Provider: GitHub uses owner/name and adaptsgithub.RepoContentEntryintoRepoEntry; GitLab usescfg.ProjectPathand maps tree types (blob→ file,tree→ dir). File selection (isSyncableFile), ordering, hashing, parsing, and apply are unchanged and shared across providers.- A nil client for the configured provider yields a provider-specific,
actionable error — the hardcoded "GitHub is not authenticated" at
service.go:184becomes conditional — and the failure is recorded through the existingrecordFailurepath withlast_hashcleared.
Verification
cd apps/backend && go test ./internal/workflowsync/... -race
Files Likely Touched
apps/backend/internal/workflowsync/service.go—RepoEntry, the two interfaces,Servicefields,NewService,fetchFiles.apps/backend/internal/workflowsync/provider.go—Providesignature.apps/backend/internal/workflowsync/service_test.go.
Inputs
- Spec
## API Surface→### Backend, and## Failure Modes. service.go:182-207— currentfetchFiles.- Task 02 supplies
cfg.Providerandcfg.ProjectPath.
Risks
- Keeping
github.RepoContentEntryin the shared path would leaveworkflowsyncGitHub-coupled. Adapt at the provider boundary, not downstream. - The per-workspace mutex must still be held across the GitLab fetch, matching
the documented concurrency guarantee at
service.go:47-53.
Output Contract
SyncWorkspace fetches from whichever provider the config names, with unchanged
parse/apply/reconcile semantics and provider-appropriate errors. Tests cover
both dispatch branches and both nil-client branches. DI wiring is task 05.