effort

package
v0.50.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package effort owns repository-local immutable effort residents and their memory.

Index

Constants

View Source
const SchemaVersion = 2

Variables

View Source
var ErrManagedTopologyPresent = errors.New("managed topology present")

ErrManagedTopologyPresent classifies the restartable-finish refusal that managed Git topology for the slug still exists. Callers branch on errors.Is; the prose stays the user-facing protocol.

Functions

func RandomUUIDv4

func RandomUUIDv4() (string, error)

RandomUUIDv4 is the production identity allocator. It is exported because the composition root, not this package, decides what allocates an effort's internal identity.

func ValidateCurrentOwner

func ValidateCurrentOwner(path string, info os.FileInfo) error

ValidateCurrentOwner applies the platform's no-follow owner check to an existing path.

Types

type CorruptError

type CorruptError struct {
	Path string
	Err  error
}

CorruptError identifies resident input that must be preserved byte-for-byte.

func (*CorruptError) Error

func (e *CorruptError) Error() string

func (*CorruptError) Unwrap

func (e *CorruptError) Unwrap() error

type Dependencies

type Dependencies struct {
	Clock                 func() time.Time
	UUID                  func() (string, error)
	Worktrees             func(context.Context) ([]awfgit.WorktreeRegistration, error)
	BranchExists          func(context.Context, string) (bool, error)
	ValidateRef           func(context.Context, string) (bool, error)
	ExpectedArchiveMarker func() ([]byte, error)
	// Fault is the durability-boundary hook the restartable-finish tests
	// interrupt the service at. It is the one optional member: a nil Fault
	// injects nothing, which is what production wants and what "no fault
	// injection configured" means.
	Fault func(stage string) error
}

Dependencies is everything the service reaches the outside world through: the clock, the identity allocator, the three Git questions it asks, and tree removal. Every one is supplied by the composition root, because a service that quietly substituted its own would make what a caller composed unverifiable from the call site.

The Git dependencies are stated as this package's own questions rather than as a repository object, so the service depends on what it asks and not on who answers. Each is bound to the checkout the service was opened against, so none of them names a root.

type DiagnosticFact added in v0.46.0

type DiagnosticFact struct {
	Label   string
	Value   string
	Literal bool
}

DiagnosticFact is one domain-owned observable fact in an effort refusal. Literal marks values whose whitespace must be preserved by presentation.

type DiagnosticInfo added in v0.46.0

type DiagnosticInfo struct {
	Condition string
	State     string
	Cause     string
	Changed   []DiagnosticFact
	Actions   []RecoveryAction
}

DiagnosticInfo carries effort failure semantics without depending on a CLI presentation representation.

func DiagnosticFor added in v0.46.0

func DiagnosticFor(err error) (DiagnosticInfo, bool)

DiagnosticFor extracts modeled effort failure semantics while preserving the original error and mechanism identities for callers.

type FinishResult

type FinishResult struct {
	ArchivePath string
}

FinishResult identifies the archived resident after a successful move.

type NewInput

type NewInput struct {
	Slug  string
	Title string
}

NewInput carries the caller-selected immutable identity and independent descriptive title for one effort creation.

type Record

type Record struct {
	SchemaVersion int       `json:"-"`
	ID            string    `json:"id"`
	Slug          string    `json:"slug"`
	Title         string    `json:"title"`
	CreatedAt     time.Time `json:"createdAt"`
	MemoryPath    string    `json:"memoryPath"`
}

Record is the public effort view. SchemaVersion belongs to the containing reply, while static state carries it directly.

type RecoveryAction

type RecoveryAction struct{ Text string }

RecoveryAction is one independently executable ordered remedy for a failed effort operation. Its meaning remains model-owned until presentation maps it.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service owns immutable effort residents and restartable finish.

func Open

func Open(roots awfgit.ControlRoots, deps Dependencies) (*Service, error)

Open resolves the resident paths owned by roots and composes the service over the dependencies it is given. The control roots arrive already resolved so one command resolves them once, and so the service and the worktree manager provably reason about the same repository identity.

func (*Service) Finish

func (s *Service) Finish(ctx context.Context, slug string) (FinishResult, error)

func (*Service) List

func (s *Service) List() ([]Record, error)

func (*Service) New

func (s *Service) New(ctx context.Context, input NewInput) (Record, error)

func (*Service) Show

func (s *Service) Show(slug string) (Record, error)

Directories

Path Synopsis
Package application owns effort lifecycle and managed-worktree use cases.
Package application owns effort lifecycle and managed-worktree use cases.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL