Wire catalog policy, v2 manifests, stage access, activation metadata fixes, and coordinator instance advance around frozen workflow snapshots. Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
2.2 KiB
Go
48 lines
2.2 KiB
Go
package projectinstance
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"chat-agent-system/internal/workflowdef"
|
|
)
|
|
|
|
var (
|
|
ErrNotAvailable = errors.New("project instance store not available")
|
|
ErrProjectNotFound = errors.New("project not found")
|
|
ErrForbiddenNotCreator = errors.New("forbidden: only project creator can configure workflow")
|
|
ErrPlanFrozen = errors.New("plan frozen: workflow already active")
|
|
ErrWorkflowAlreadyActive = errors.New("workflow already active for project")
|
|
ErrPlanChangedReconfirm = errors.New("plan changed: reconfirm required")
|
|
ErrInvalidPlan = errors.New("invalid workflow plan")
|
|
ErrValidationFailed = errors.New("workflow plan validation failed")
|
|
ErrTokenInvalid = errors.New("activation token invalid or expired")
|
|
ErrConcurrentConflict = errors.New("conflict: project version mismatch")
|
|
ErrPlanRevisionConflict = errors.New("conflict: plan revision mismatch")
|
|
ErrWorkflowVersionNotFound = errors.New("workflow version not found or not published")
|
|
ErrLegacySwitchBlocked = errors.New("legacy workflow switch blocked: use project settings activation")
|
|
ErrInstanceNotFound = errors.New("workflow instance not found")
|
|
ErrStageGateNotReady = errors.New("stage gate not ready: required documents not approved")
|
|
ErrStageNotActive = errors.New("stage is not the active stage")
|
|
ErrInvalidStage = errors.New("invalid stage key for instance")
|
|
ErrInstanceRevisionConflict = errors.New("conflict: instance config revision mismatch")
|
|
ErrEmptyWorkflow = errors.New("empty workflow: at least one enabled document required to activate")
|
|
ErrTerminationNotAllowed = errors.New("termination not allowed for instance state")
|
|
)
|
|
|
|
// ValidationError 保留具体校验问题,供 HTTP 层返回可操作的错误信息。
|
|
type ValidationError struct {
|
|
Issues []workflowdef.ValidationIssue
|
|
}
|
|
|
|
func (e *ValidationError) Error() string {
|
|
return ErrValidationFailed.Error()
|
|
}
|
|
|
|
func (e *ValidationError) Unwrap() error {
|
|
return ErrValidationFailed
|
|
}
|
|
|
|
func newValidationError(result workflowdef.ValidationResult) error {
|
|
return &ValidationError{Issues: result.Issues}
|
|
}
|