Skip to content

feat(worksource): add domain service + bindings CRUD (#1591)#1592

Merged
nextlevelshit merged 1 commit into
mainfrom
1591-worksource-service
Apr 30, 2026
Merged

feat(worksource): add domain service + bindings CRUD (#1591)#1592
nextlevelshit merged 1 commit into
mainfrom
1591-worksource-service

Conversation

@nextlevelshit
Copy link
Copy Markdown
Collaborator

Summary

  • Add internal/worksource package implementing WorkSourceService over the existing PRE-5 state.WorksourceStore
  • Six ctx-first methods: Create/List/Get/Update/Delete/Match plus typed BindingSpec validation (forge, repo glob, label filter, pipeline name, trigger enum)
  • In-memory MatchBindings filter against a WorkItemRef (Go mirror of Refactor Status Command to Use StateStore Interface #2.1 schema)
  • DeleteBinding maps to soft-delete (DeactivateBinding) so run history keeps binding context
  • Trigger names use dashed form externally, normalised to underscored state.WorksourceTrigger before persistence; glob syntax follows path.Match (double-star rejected at validate)

Related to #1591

Changes

  • internal/worksource/service.go — Service interface + implementation, CRUD over WorksourceStore
  • internal/worksource/types.goBindingSpec, BindingRecord, WorkItemRef, trigger enum
  • internal/worksource/validate.go — Spec validation (forge/repo/glob/label/pipeline/trigger)
  • internal/worksource/match.goMatchBindings filter logic
  • internal/worksource/{service,match,types}_test.go — CRUD round-trip, list filters, update-preserves-created-at, soft-delete exclusion, invalid-spec table, ctx-cancelled, match table (exact/glob/label any-of/state/kind/multi-mismatch/inactive)
  • internal/worksource/doc.go — package doc
  • specs/1591-worksource-service/{spec,plan,tasks}.md — planning artifacts

Test Plan

Phase 2.2 of epic #1565 — WorkSourceService over the existing
state.WorksourceStore (PRE-5). Six ctx-first methods (Create/List/Get/
Update/Delete/Match), typed BindingSpec validation (forge, repo glob,
label filter, pipeline name, trigger enum), and an in-memory MatchBindings
filter against a WorkItemRef.

DeleteBinding maps to soft-delete (DeactivateBinding) so run history
keeps the binding context. Trigger names use dashed form externally and
are normalised to the underscored state.WorksourceTrigger before
persistence. Glob syntax follows path.Match — double-star is rejected at
validate time with a clear error.

Coverage: CRUD round-trip, list-by-forge/repo, update-preserves-created-at,
soft-delete excluded from MatchBindings, invalid-spec rejection table,
missing-id ErrNotFound, ctx-cancelled, and a match table covering exact
repo / glob / label any-of / state / kind / multi-mismatch / inactive
excluded. Selector JSON wire form pinned by golden test.

No webui (#2.3) and no executor wiring (#2.4) in this issue.
WorkItemRef is a Go struct mirror of the #2.1 schema and is ready for a
one-line registry wire-up once that schema lands.
@nextlevelshit nextlevelshit merged commit b8f4e01 into main Apr 30, 2026
15 checks passed
@nextlevelshit nextlevelshit deleted the 1591-worksource-service branch April 30, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant