Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Add UndeployAll() using label selectors to clean up monorepo components on project deletion (replaces name-based Undeploy in DeleteProject and the direct undeploy handler) - Add ResourceGC background worker that periodically finds K8s resources whose project label has no matching DB record, deletes after 1h safety window - Widen deployer client type from *kubernetes.Clientset to kubernetes.Interface for testability - UndeployAll accumulates errors via errors.Join instead of failing fast - Add checkout/checkin sidecar dev flow: temporary git tokens, branch checkout, review on checkin with cleanup workers - Add interactive sessions: pod binding, command execution, SSE streaming, ephemeral preview URLs with session cleanup workers - Add GET /workers/pool endpoint for aggregate capacity and queue depth - Add sessions:read and sessions:execute auth scopes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
110 lines
4.0 KiB
Go
110 lines
4.0 KiB
Go
package domain
|
|
|
|
import "errors"
|
|
|
|
// Domain errors - these are business-level errors that should be translated
|
|
// to appropriate HTTP status codes or gRPC error codes by the presentation layer.
|
|
var (
|
|
// Generic errors
|
|
ErrNotFound = errors.New("not found")
|
|
|
|
// Project errors
|
|
ErrProjectNotFound = errors.New("project not found")
|
|
ErrProjectNotRunning = errors.New("project is not running")
|
|
ErrInvalidProjectName = errors.New("invalid project name")
|
|
|
|
// Template errors
|
|
ErrTemplateNotFound = errors.New("template not found")
|
|
|
|
// Command errors
|
|
ErrCommandNotFound = errors.New("command not found")
|
|
ErrCommandTimeout = errors.New("command timed out")
|
|
ErrCommandCancelled = errors.New("command was cancelled")
|
|
ErrLimitExceeded = errors.New("concurrent command limit exceeded")
|
|
ErrInvalidCommand = errors.New("invalid command")
|
|
ErrCommandSanitization = errors.New("command failed sanitization")
|
|
|
|
// Agent errors
|
|
ErrInvalidAgentProvider = errors.New("invalid agent provider")
|
|
ErrPromptRequired = errors.New("prompt is required")
|
|
ErrInvalidTimeout = errors.New("timeout cannot be negative")
|
|
|
|
// Credential errors
|
|
ErrCredentialNotFound = errors.New("credential not found")
|
|
|
|
// Work queue errors
|
|
ErrWorkTaskNotFound = errors.New("work task not found")
|
|
|
|
// Worker pool errors
|
|
ErrWorkerNotFound = errors.New("worker not found")
|
|
ErrWorkerIDRequired = errors.New("worker ID is required")
|
|
ErrWorkerHostnameRequired = errors.New("worker hostname is required")
|
|
|
|
// Build errors
|
|
ErrBuildNotFound = errors.New("build not found")
|
|
|
|
// API Key errors
|
|
ErrKeyNotFound = errors.New("api key not found")
|
|
ErrKeyRevoked = errors.New("api key has been revoked")
|
|
ErrKeyExpired = errors.New("api key has expired")
|
|
ErrKeyInvalid = errors.New("invalid api key format")
|
|
|
|
// Authorization errors
|
|
ErrUnauthorized = errors.New("unauthorized")
|
|
ErrForbidden = errors.New("forbidden")
|
|
ErrInsufficientScope = errors.New("insufficient scope")
|
|
ErrIPNotAllowed = errors.New("ip address not allowed")
|
|
|
|
// Rate limiting errors
|
|
ErrRateLimited = errors.New("rate limit exceeded")
|
|
|
|
// Webhook errors
|
|
ErrWebhookNotFound = errors.New("webhook not found")
|
|
ErrInvalidWebhook = errors.New("invalid webhook configuration")
|
|
|
|
// Domain errors
|
|
ErrDuplicateDomain = errors.New("domain already exists")
|
|
ErrDomainNotFound = errors.New("domain not found")
|
|
|
|
// Component errors
|
|
ErrInvalidComponentName = errors.New("invalid component name")
|
|
ErrInvalidComponentType = errors.New("invalid component type")
|
|
ErrDuplicateComponent = errors.New("component already exists")
|
|
ErrComponentNotFound = errors.New("component not found")
|
|
|
|
// Audit errors
|
|
ErrAuditNotFound = errors.New("audit log entry not found")
|
|
|
|
// Operation errors
|
|
ErrOperationNotFound = errors.New("operation not found")
|
|
|
|
// Conversation errors
|
|
ErrConversationNotFound = errors.New("conversation not found")
|
|
ErrMessageNotFound = errors.New("message not found")
|
|
|
|
// Blueprint errors
|
|
ErrBlueprintNotFound = errors.New("blueprint not found")
|
|
|
|
// Question errors
|
|
ErrQuestionNotFound = errors.New("question not found")
|
|
|
|
// Session errors
|
|
ErrSessionNotFound = errors.New("session not found")
|
|
ErrSessionNotActive = errors.New("session is not active")
|
|
ErrSessionExists = errors.New("active session already exists")
|
|
|
|
// Checkout errors
|
|
ErrCheckoutNotFound = errors.New("checkout not found")
|
|
ErrCheckoutExpired = errors.New("checkout has expired")
|
|
ErrCheckoutAlreadyExists = errors.New("active checkout already exists for branch")
|
|
ErrCheckoutNotActive = errors.New("checkout is not active")
|
|
ErrBranchNotFound = errors.New("branch not found")
|
|
ErrBranchProtected = errors.New("branch is protected")
|
|
ErrInvalidCheckoutID = errors.New("invalid checkout ID")
|
|
|
|
// Infrastructure errors (should typically be wrapped)
|
|
ErrDatabaseConnection = errors.New("database connection error")
|
|
ErrKubernetesError = errors.New("kubernetes error")
|
|
ErrRegistryUnavailable = errors.New("container registry unavailable")
|
|
)
|