Adds issueops.Lifecycle — Create, Update, Close, Reopen — reached from the storage handle via store.IssueLifecycle(), implemented once and shared by the CLI and linked library consumers. Three backends implement it and a shared conformance suite asserts them against one spec. The bd CLI's create, update, close and reopen now route through it. Fixes several defects that predate this change and became visible once the write paths were forced to agree: swallowed metadata-edit failures, a claim applied before field validation, missing value validation on title/priority/estimate, silently dropped create edges to missing targets, infra-typed creates landing in the wrong table, a dropped SourceRepo, closed_by_session written but never read, and a compound update writing twice. Behavior changes needing release notes: create with an occupied explicit id now fails instead of silently overwriting; a compound update is one atomic operation with one hook and one version commit; reparenting replaces all parent edges; reopening something not closed reports nothing to do.
31 lines
788 B
Go
31 lines
788 B
Go
//go:build cgo
|
|
|
|
package embeddeddolt
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/steveyegge/beads/internal/storage"
|
|
)
|
|
|
|
func TestEmbeddedDoltStoreIssueLifecycleBuildsOperations(t *testing.T) {
|
|
lifecycle, err := (&EmbeddedDoltStore{}).IssueLifecycle()
|
|
if err != nil {
|
|
t.Fatalf("IssueLifecycle() error = %v", err)
|
|
}
|
|
if lifecycle == nil {
|
|
t.Fatal("IssueLifecycle() returned nil operations")
|
|
}
|
|
}
|
|
|
|
func TestEmbeddedDoltStoreIssueLifecycleRejectsNilStore(t *testing.T) {
|
|
lifecycle, err := (*EmbeddedDoltStore)(nil).IssueLifecycle()
|
|
if lifecycle != nil {
|
|
t.Fatalf("IssueLifecycle() lifecycle = %T, want nil", lifecycle)
|
|
}
|
|
var unsupported *storage.ErrUnsupported
|
|
if !errors.As(err, &unsupported) {
|
|
t.Fatalf("IssueLifecycle() error = %v, want *storage.ErrUnsupported", err)
|
|
}
|
|
}
|