mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
ESQ1-302 and ESQ1-303 both died at Graph.init -- before workflow_started, so the Builder saw an error frame with no run id and no rows, and spent runs and approvals discovering what a validation pass could have said up front. apply_repair now runs that pass (preflight_errors: the same node-data validation create_node performs, with no factory or runtime state) over the graph it is about to write and raises PreflightError, naming each node Graph.init would reject. Only NEW problems count: a pre-existing broken node the repair does not touch must not veto an unrelated fix, and a repair that heals it passes. PreflightError is a ValueError so the handlers' existing stale-intent guards already surface it as a card. The real ESQ1-303 dev draft is the fixture: preflight names node2 and its numeric value, and passes once the value is a string. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
"""Domain errors raised by the Dify Builder's Dify-service adapter.
|
|
|
|
These sit alongside (not instead of) ``core.dify_builder.errors`` --
|
|
they're specific to the OSS ``WorkflowService`` surface the adapter wraps,
|
|
so they live in this package rather than the I/O-free ``core`` layer.
|
|
"""
|
|
|
|
|
|
class WorkflowNotInitializedError(Exception):
|
|
"""Raised when an app has no draft workflow yet (``get_draft_workflow`` returns ``None``)."""
|
|
|
|
|
|
class HashMismatchError(Exception):
|
|
"""Domain re-map of ``services.errors.app.WorkflowHashNotEqualError``.
|
|
|
|
Raised when ``sync_draft_workflow``'s optimistic-concurrency check finds
|
|
the draft graph changed since it was last read. The adapter (Task 4)
|
|
catches the OSS error and re-raises this instead, so callers only need
|
|
to know about ``core``/``services.dify_builder`` error types.
|
|
"""
|
|
|
|
|
|
class PreflightError(ValueError):
|
|
"""Raised by ``apply_repair`` when the graph it was about to write would
|
|
not start: ``services.dify_builder.preflight.preflight_errors`` found a
|
|
node ``Graph.init`` would reject. A ``ValueError`` so every handler's
|
|
existing ``except ValueError`` around ``apply_repair`` (the stale-intent
|
|
guard) already turns it into a card instead of a crashed advance.
|
|
"""
|