Files
craft-ai-integrations/tools/mutation/mutation_generic.py
Jeremy 4effe6a190 feat(ai-comfyui): import a selection workflow and run it with the picture sent first (#80)
Adds the `image.segment` capability to imported ComfyUI workflows. A selection workflow maps a
text prompt and one source picture; the picture is uploaded, the graph is queued with the name
ComfyUI gave it, and every queued graph gets a sink name of its own so a repeat is not answered
from cache with no output. Clicks or a box are refused in plain words before anything is sent,
and a stored workflow file may declare a source binding and no mask.

The answer is the graph's image as it comes. Checking the mask is the next change.
2026-10-21 22:09:09 +01:00

18 lines
1.2 KiB
Python

"""Deliberate-bug cases for group `gs`: the generic `image.segment` route on ComfyUI (the scratch
sinks, the plain refusal of clicks and the stored selection workflow).
Loaded by mutation_check.py. Each case breaks one rule and names the test that should notice.
Format: (name, file, old, new, package, test target, test filter).
"""
PV = 'crates/ai-comfyui/src/provider.rs'
WF = 'crates/ai-comfyui/src/workflow.rs'
LB = 'crates/ai-comfyui/src/library.rs'
CC = 'craft-ai-comfyui'
GS_CASES = [
('sink-not-unique', PV, ' crate::scratch::route_sinks(&mut graph)?;\n', '', CC, 'segment_route', 'every_selection_has_its_own_sink'),
('clicks-get-the-generic-refusal', WF, 'if self.capability.as_str() == "image.segment" {\n "This', 'if false {\n "This', CC, 'segment_route', 'clicks_are_refused'),
('stored-selection-takes-a-mask', LB, ' if self.mask.is_some() {\n return Err(AiError::invalid("a selection workflow has no mask binding"));\n }\n', '', CC, 'segment_route', 'a_stored_workflow_can_be'),
('plain-import-of-a-selection', WF, 'if capability.as_str() == "image.segment" {', 'if false {', CC, 'segment_route', 'a_selection_workflow_needs'),
]