2.5 KiB
2.5 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 02-workflowsync-config-provider | Workflow sync config provider field and schema | done | 1 | plan.md | ../../specs/integrations/requirements/gitlab-workflow-sync.md |
Task 02: Workflow Sync Config Provider Field And Schema
Acceptance
workflow_sync_configsgainsprovider TEXT NOT NULL DEFAULT 'github'andproject_path TEXT NOT NULL DEFAULT ''via idempotentADD COLUMNmigrations following theaddPollEnabledColumnpattern, wired intoinitSchema(). Both are replay-safe on an existing database, and existing rows read back asprovider = "github"with unchanged behavior.ConfigandSetConfigRequestcarryProviderandProjectPath, and the select columns,scanConfig, andUpsertConfigForWorkspaceround-trip them.Normalize()is provider-conditional exactly as the spec's## Data Model→### Config / SetConfigRequestsection states: empty provider defaults togithub; unknown provider isErrInvalidConfig; GitHub requires owner+name and forbidsproject_path; GitLab requires a multi-segmentproject_pathwith no spaces, no empty segments, no./..segment, no leading/trailing slash, and forbids owner/name.
Verification
cd apps/backend && go test ./internal/workflowsync/... -race
Files Likely Touched
apps/backend/internal/workflowsync/models.go— struct fields,Normalize().apps/backend/internal/workflowsync/store.go—createTablesSQL,initSchema, twoadd*Columnmethods,configSelectColumns,scanConfig,UpsertConfigForWorkspace.apps/backend/internal/workflowsync/models_test.go,apps/backend/internal/workflowsync/store_test.go.
Inputs
- Spec
## Data Model. store.go:60-66(addPollEnabledColumn) is the migration precedent — the ALTER always runs anddb.IsDuplicateColumnErrorswallows the replay.- Note this package owns its own schema; it is not part of
internal/task/repository/sqlite/base_migrations.go.
Risks
- Adding the column to
createTablesSQLalone would leave existing databases without it. Both the CREATE and the ALTER are required. - Relaxing slash validation globally would let a malformed GitHub config through. Keep the GitHub branch's existing checks byte-for-byte.
Output Contract
Config reads and writes carry provider identity, validation rejects cross-provider field mixing, and both migrations pass a fresh-DB and a same-DB replay test. No fetch behavior changes yet.