feat(worksource): add domain service + bindings CRUD (#1591)#1592
Merged
Conversation
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.
This was referenced Apr 30, 2026
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.
Summary
internal/worksourcepackage implementingWorkSourceServiceover the existing PRE-5state.WorksourceStoreBindingSpecvalidation (forge, repo glob, label filter, pipeline name, trigger enum)MatchBindingsfilter against aWorkItemRef(Go mirror of Refactor Status Command to Use StateStore Interface #2.1 schema)DeleteBindingmaps to soft-delete (DeactivateBinding) so run history keeps binding contextstate.WorksourceTriggerbefore persistence; glob syntax followspath.Match(double-star rejected at validate)Related to #1591
Changes
internal/worksource/service.go— Service interface + implementation, CRUD over WorksourceStoreinternal/worksource/types.go—BindingSpec,BindingRecord,WorkItemRef, trigger enuminternal/worksource/validate.go— Spec validation (forge/repo/glob/label/pipeline/trigger)internal/worksource/match.go—MatchBindingsfilter logicinternal/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 docspecs/1591-worksource-service/{spec,plan,tasks}.md— planning artifactsTest Plan
go test ./internal/worksource/...passes (CRUD round-trip + match table + invalid-spec rejection + ctx-cancelled)WorkItemRefready for one-line registry wire-up once Refactor Status Command to Use StateStore Interface #2.1 schema lands