mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-20 11:36:17 +00:00
SqlScheduledTaskRepository._to_domain raised InvalidScheduleError for a row whose stored schedule no longer parses -- the same error the aggregate raises for a client-submitted schedule, which the router maps to 422. A stored fault therefore told the client its perfectly fine request was wrong, and made the row unrepairable over HTTP: PATCH reads the task before writing, so the fix path 422'd too. Enum rebuild failures were worse -- a raw ValueError crossed the boundary untranslated. The rebuild is now translated to a dedicated CorruptStoredScheduleError, raised only by the persistence adapter and deliberately absent from the router's status table, so it falls through to the unclassified-500 branch: a server-side fault reported as one. List reads keep skipping and logging the bad row. Pinned by tests/test_schedule_corrupt_rows.py against a real sqlite database.
84 lines
2.0 KiB
Python
84 lines
2.0 KiB
Python
"""Schedule bounded context: standing instructions to run a prompt on time.
|
|
|
|
Public API of the context. Import domain objects, commands, errors, and the
|
|
service from here; import ports from `deerflow.domain.schedule.ports` -- they
|
|
are contracts consumed by adapters and tests, not everyday call-site symbols.
|
|
"""
|
|
|
|
from deerflow.domain.schedule.commands import (
|
|
UNSET,
|
|
ContextChange,
|
|
CreateScheduledTask,
|
|
DeleteTask,
|
|
PauseTask,
|
|
ResumeTask,
|
|
TriggerTask,
|
|
UnsetType,
|
|
UpdateScheduledTask,
|
|
)
|
|
from deerflow.domain.schedule.exceptions import (
|
|
ActiveRunConflictError,
|
|
CorruptStoredScheduleError,
|
|
InvalidContextModeError,
|
|
InvalidScheduleError,
|
|
LaunchFailedError,
|
|
ScheduleError,
|
|
TaskNotFoundError,
|
|
TaskNotMutableError,
|
|
ThreadBusyError,
|
|
ThreadNotFoundError,
|
|
)
|
|
from deerflow.domain.schedule.model import (
|
|
ACTIVE_RUN_STATUSES,
|
|
TERMINAL_RUN_STATUSES,
|
|
TERMINAL_TASK_STATUSES,
|
|
ContextMode,
|
|
DispatchOutcome,
|
|
RunStatus,
|
|
ScheduledRun,
|
|
ScheduledTask,
|
|
SchedulePolicy,
|
|
ScheduleSpec,
|
|
ScheduleType,
|
|
TaskStatus,
|
|
TriggerKind,
|
|
)
|
|
from deerflow.domain.schedule.service import DispatchResult, ScheduleService
|
|
|
|
__all__ = [
|
|
"ACTIVE_RUN_STATUSES",
|
|
"TERMINAL_RUN_STATUSES",
|
|
"TERMINAL_TASK_STATUSES",
|
|
"UNSET",
|
|
"ActiveRunConflictError",
|
|
"ContextChange",
|
|
"ContextMode",
|
|
"CorruptStoredScheduleError",
|
|
"CreateScheduledTask",
|
|
"DeleteTask",
|
|
"DispatchOutcome",
|
|
"DispatchResult",
|
|
"InvalidContextModeError",
|
|
"InvalidScheduleError",
|
|
"LaunchFailedError",
|
|
"PauseTask",
|
|
"ResumeTask",
|
|
"RunStatus",
|
|
"ScheduleError",
|
|
"SchedulePolicy",
|
|
"ScheduleService",
|
|
"ScheduleSpec",
|
|
"ScheduleType",
|
|
"ScheduledRun",
|
|
"ScheduledTask",
|
|
"TaskNotFoundError",
|
|
"TaskNotMutableError",
|
|
"TaskStatus",
|
|
"ThreadBusyError",
|
|
"ThreadNotFoundError",
|
|
"TriggerKind",
|
|
"TriggerTask",
|
|
"UnsetType",
|
|
"UpdateScheduledTask",
|
|
]
|