Files
kandev/apps/backend/internal/task/repository/sqlite/errors.go
T
Clément Fiere 0b7bc8b31b feat: decouple prompt history loading (#3146)
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
2026-08-31 19:51:49 +00:00

55 lines
2.6 KiB
Go

package sqlite
import (
"errors"
"github.com/kandev/kandev/internal/task/repository/repoerrors"
)
// ErrTaskNotFound is returned by Repository methods (GetTask, UpdateTask,
// DeleteTask, UpdateTaskState, …) when no row matches the supplied id.
// Callers should classify via errors.Is rather than substring-matching the
// formatted message, which includes the task id and is therefore brittle.
var ErrTaskNotFound = repoerrors.ErrTaskNotFound
// ErrMessageNotFound is returned when a message cursor or around target no
// longer exists. Callers should classify it with errors.Is.
var ErrMessageNotFound = repoerrors.ErrMessageNotFound
// ErrWorkspaceNotFound is returned by Repository workspace methods when no row
// matches the supplied id.
var ErrWorkspaceNotFound = repoerrors.ErrWorkspaceNotFound
// ErrTaskPlanNotFound is returned by Repository task-plan methods when no row
// matches the supplied task id.
var ErrTaskPlanNotFound = repoerrors.ErrTaskPlanNotFound
// ErrTaskEnvironmentNotFound is returned when no task environment row matches
// the supplied id. Callers should classify it with errors.Is.
var ErrTaskEnvironmentNotFound = repoerrors.ErrTaskEnvironmentNotFound
// ErrNoPrimarySession is returned by GetPrimarySessionByTaskID when the task
// has no primary session row. Callers should use errors.Is to distinguish this
// "not found" case from genuine backend/DB errors.
var ErrNoPrimarySession = errors.New("no primary session")
// ErrExternalIDConflict is returned by CreateTask (and its
// admission/capacity variants) when the insert violates
// uniq_tasks_external_id — the TOCTOU backstop for the create sequence's
// step-3 lookup. Callers should re-read by (workspace_id, external_id) and
// return the winner rather than treating this as a hard failure.
var ErrExternalIDConflict = repoerrors.ErrExternalIDConflict
// ErrOfficeSessionRaceConflict is returned by CreateTaskSession when the
// insert violates the uniq_office_task_session partial unique index — i.e.
// two callers raced past their SELECT-then-INSERT for the same
// (task_id, agent_profile_id) pair. Callers should re-read and reuse the
// winning row rather than treating this as a hard failure.
var ErrOfficeSessionRaceConflict = errors.New("office task session race conflict")
// ErrWorkflowResolutionConflict is returned by UpdateTaskIfWorkflowMatches and
// the workflow-step admission writers when a caller-supplied expected
// workflow id no longer matches the row's persisted workflow_id, checked
// atomically inside the write transaction. See repoerrors.ErrWorkflowResolutionConflict.
var ErrWorkflowResolutionConflict = repoerrors.ErrWorkflowResolutionConflict