Internal

internal/app/approve

Package approve implements the approval lifecycle use case.

import "github.com/nilstate/scafld/v2/internal/app/approve"

Package approve implements the approval lifecycle use case.

Variables

ErrSpecNotDraft is returned when approval is attempted outside draft state.

Source: internal/app/approve/approve.go:15

var ErrSpecNotDraft = errors.New("approve only operates on drafts")

Functions

func Run(ctx context.Context, specs SpecStore, sessions SessionStore, workspace WorkspaceStatus, clock Clock, taskID string) (Output, error)

Source: internal/app/approve/approve.go:45

Run approves a draft spec and records approval evidence.

Types

type Clock

Source: internal/app/approve/approve.go:35

Clock supplies approval timestamps.

type Clock interface{ Now() time.Time }
Methods
  • Now func() time.Time

type Output

Source: internal/app/approve/approve.go:38

Output describes the approved task.

type Output struct {
	TaskID string      `json:"task_id"`
	Status spec.Status `json:"status"`
	Path   string      `json:"path"`
}
Fields
  • TaskID string `json:"task_id"`
  • Status spec.Status `json:"status"`
  • Path string `json:"path"`

type SessionStore

Source: internal/app/approve/approve.go:25

SessionStore is the session evidence port used by approval.

type SessionStore interface {
	Append(context.Context, string, session.Entry, string) (session.Session, error)
}
Methods
  • Append func(context.Context, string, session.Entry, string) (session.Session, error)

type SpecStore

Source: internal/app/approve/approve.go:18

SpecStore is the spec persistence port used by approval.

type SpecStore interface {
	Load(context.Context, string) (spec.Model, string, error)
	Save(context.Context, string, spec.Model) error
	Find(string) (string, error)
}
Methods
  • Load func(context.Context, string) (spec.Model, string, error)
  • Save func(context.Context, string, spec.Model) error
  • Find func(string) (string, error)

type WorkspaceStatus

Source: internal/app/approve/approve.go:30

WorkspaceStatus captures dirty workspace state before task execution begins.

type WorkspaceStatus interface {
	ChangedFiles(context.Context) ([]string, error)
}
Methods
  • ChangedFiles func(context.Context) ([]string, error)