apply_specs cannot replay a replace_ops batch that wires an autogrow slot (dot guard in _slot_ref)

Abierto
#1,034 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
cli, testing

Línea de trabajo

Read _slot_ref in comfy_cli/workflow_ops.py and the regression test TestOpModel::test_replace_ops_batch_is_replayable_through_apply_specs in tests/comfy_cli/command/test_workflow_edit.py. The issue describes how dotted autogrow slot names become unresolved refs in apply_specs. Done means the test passes without xfail and the same replace_ops batch replays through both consumers.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Problem

apply_specs cannot replay any replace_ops batch that wires an autogrow slot. The whole batch is discarded with ValueError: input '1' not found on node <id>; inputs: ['images'].

replace_ops returns one array that is meant to replay through both consumers — apply_op (the op path) and apply_specs (the spec path). That is the "one artifact, both consumers" contract in docs/op-vocabulary-v1.md §8.8.

The spec-form connect refs are minted by _slot_ref (comfy_cli/workflow_ops.py, ~line 1151). It preferred the slot name, but refused any name containing a dot and fell back to $alias.<slot index>. Autogrow slots are named images.image0, images.image1, … so the dot guard fired on every one of them.

The index fallback cannot resolve on the spec path. apply_specs re-mints each node from the live catalog, so a freshly added BatchImagesNode has only the bare images input — there is no slot at index 1 for $batchimagesnode.1 to address. The connect raises, and apply_specs aborts the remainder, so nothing from the batch is applied.

The guard's stated reason was that _split_ref_slot partitions on the first dot and so would mis-resolve a dotted name. That is not what happens: an alias is re.sub(r"[^a-z0-9_]", "", class_type.lower()), which never contains a dot, so partitioning on the first dot yields the alias and hands back the entire remainder — dots included — as the slot name. $batchimagesnode.images.image0 splits correctly.

Repro

import copy
from comfy_cli import workflow_ops
# `new` = any workflow with a BatchImagesNode whose autogrow base has wired slots
# (images.image0 … images.image2); `g` = a Graph built from object_info.
old = {"nodes": [], "links": [], "last_node_id": 0, "last_link_id": 0}
batch = workflow_ops.replace_ops(old, new)
workflow_ops.apply_op(...)      # replays fine, all 3 slots wired
workflow_ops.apply_specs(copy.deepcopy(old), g, batch)
# ValueError: input '1' not found on node 3909371455067170; inputs: ['images'].
# No changes were applied — the batch was discarded.

A runnable version is TestOpModel::test_replace_ops_batch_is_replayable_through_apply_specs in tests/comfy_cli/command/test_workflow_edit.py.

Impact

Every caller that emits a replace_ops batch and replays it through the spec path loses the whole batch, not just the autogrow wiring — apply_specs discards on the first failing spec. That covers templates fetch --emit-ops, generate, and recipe replay, for any workflow using an autogrow node such as BatchImagesNode.

It was invisible until now because the only existing replace_ops test used a link-less workflow.

Expected

replace_ops mints a connect ref the spec path can resolve, so the same array replays through apply_op and apply_specs with the same wiring.

Fix

Drop the dot guard in _slot_ref so dotted autogrow names are emitted verbatim. Filed alongside https://github.com/Comfy-Org/comfy-cli/pull/848, which applies that one-line change and turns the test above from a strict xfail into a real passing regression pin.

Task Decomposition

Not decomposed: this is a one-line production change (removing a single condition in _slot_ref) plus the test that pins it, already implemented in #848. Complexity tier: trivial. No sub-tasks or dependencies. Acceptance: TestOpModel::test_replace_ops_batch_is_replayable_through_apply_specs passes without an xfail marker and fails on the parent commit.

Lenguaje dominante
Python
Estrellas
1k
Forks
176
Merge medio
1 d 11 h
PR fusionados (30 d)
87

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Comfy-Org/comfy-cli

Todos los issues de Comfy-Org/comfy-cli

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.