fix: preserve external INT Width and Height facade bindings

Preserve V3.8/V3.9 external dimension links across workflow restore, disable linked facade editing and keep saved Manual reserve values. Document Manual versus First Image authority in both READMEs; add frontend/CPU regressions without changing backend schemas, Sampling, Run Storage or earlier Review/cache repairs.

Validation: 1569 CPU passed, 1 skipped; 22/22 new frontend and 60/60 Review cases; Chrome save/reload and five tab round trips. One V3.9 GPU smoke generation produced exactly 480x640, 96 frames at 24fps and 4-second audio in 107.3s. This is a single short resolution check, not long-form acceptance. Official workflows/ZIPs, package version and historical Releases unchanged.
This commit is contained in:
ukr8b3g-cmyk
2026-10-01 19:55:39 +09:00
parent 21a857115d
commit 1f6aec11cd
10 changed files with 324 additions and 35 deletions
+130
View File
@@ -0,0 +1,130 @@
// Reuse the existing real-production-JS harness; do not copy UI predicates.
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const vm = require('node:vm');
const ROOT = process.env.H3_TEST_ROOT || path.resolve(__dirname, '..');
const harness = fs.readFileSync(path.join(__dirname, 'frontend_review_queue.cjs'), 'utf8');
const marker = harness.indexOf('(async()=>{');
assert(marker > 0);
const scope = {require, process, console, __dirname, setTimeout, clearTimeout, setImmediate, structuredClone};
vm.runInNewContext(harness.slice(0, marker) + '\nglobalThis.fixtures={environment,project};', scope);
const {environment, project} = scope.fixtures;
const results = [];
const widget = (e,n,name) => e.w(n,name);
const sources = ['width','height'];
const slot = (name, link=null) => ({name,type:'INT',widget:{name},link});
function readyInputs(e,n) {
for (const name of ['model','clip','video_vae','sampler','sigmas']) n.inputs.push({name,link:100});
}
async function test(name, body) {
const e = environment();
try { await body(e); results.push({name,pass:true}); }
catch(error) { results.push({name,pass:false,error:error.stack}); }
finally { e.close(); }
}
(async()=>{
for (const nodeClass of ['H3ContinuumSamplerV38','H3ContinuumSamplerV39']) {
await test(`${nodeClass}: current slots bind to dimension and duration Facades`, async e=>{
const n=e.makeNode(312,'fixture',nodeClass);
for (const [name,label] of [['width','Width'],['height','Height'],['chunks','Chunks'],['chunk_seconds','Seconds per Chunk']]) {
const s=slot(name); n.inputs.push(s); e.f.configureNode(n);
assert.equal(s._widget,e.w(n,label));
assert.equal(n.getWidgetFromSlot(s),e.w(n,label));
assert.equal(n.getSlotFromWidget(e.w(n,label)),s);
assert.equal(n.getSlotFromWidget(e.w(n,name)),s);
}
const getter=n.getWidgetFromSlot; e.f.configureNode(n); assert.equal(n.getWidgetFromSlot,getter);
assert.equal(n.inputs.length,4);
});
await test(`${nodeClass}: restored replacement slots rebind without duplicate sockets`, async e=>{
const n=e.makeNode(312,'fixture',nodeClass); n.inputs.push(slot('width'),slot('height'));
e.f.configureNode(n); const old=n.inputs;
n.inputs=[slot('width',41),{name:'height',type:'INT',link:42}];
e.f.configureNode(n); e.f.configureNode(n);
for (const [i,label] of ['Width','Height'].entries()) {
assert.notEqual(n.inputs[i],old[i]); assert.equal(n.inputs[i]._widget,e.w(n,label));
assert.equal(n.getWidgetFromSlot(n.inputs[i]),e.w(n,label));
assert.equal(n.getSlotFromWidget(e.w(n,label)),n.inputs[i]);
}
assert.equal(n.inputs.length,2);
});
for (const linkedAxes of [['width'],['height'],sources]) {
await test(`${nodeClass}: linked ${linkedAxes.join('+')} reserve survives First Image preview`, async e=>{
const n=e.makeNode(312,'fixture',nodeClass); e.w(n,'width').value=640; e.w(n,'height').value=768;
n.inputs.push(...sources.map((name,i)=>slot(name,linkedAxes.includes(name)?41+i:null)),{name:'first_frame',link:45});
e.app.graph._nodes.push({id:900,mode:0,imgs:[{naturalWidth:1920,naturalHeight:1080}]});
e.app.graph.links[45]={origin_id:900,origin_slot:0};
e.w(n,'size_source').value='First Image'; e.f.configureNode(n);
assert.equal(e.w(n,'size_source').value,'First Image');
for(const name of linkedAxes) assert.equal(e.w(n,name).value,name==='width'?640:768);
e.w(n,'Size Source').callback('Manual'); e.f.configureNode(n);
for(const name of sources) {
const facade=e.w(n,name==='width'?'Width':'Height');
assert.equal(facade.disabled,linkedAxes.includes(name));
if(linkedAxes.includes(name)) { facade.callback(1024); assert.equal(e.w(n,name).value,name==='width'?640:768); }
}
for(const s of n.inputs) if(linkedAxes.includes(s.name))s.link=null;
e.f.configureNode(n);
for(const name of linkedAxes) {
const facade=e.w(n,name==='width'?'Width':'Height'); assert.equal(facade.disabled,false);
assert.equal(facade.value,name==='width'?640:768); facade.callback(1024); assert.equal(e.w(n,name).value,1024);
}
});
}
for (const linkedAxes of [[],['width'],['height'],sources]) {
await test(`${nodeClass}: Manual summary and API adapter ${linkedAxes.join('+')||'native'}`, async e=>{
const n=e.makeNode(312,'fixture',nodeClass); readyInputs(e,n);
e.w(n,'run_storage').value='Off'; e.w(n,'width').value=640; e.w(n,'height').value=768;
n.inputs.push(...sources.map((name,i)=>slot(name,linkedAxes.includes(name)?41+i:null)));
e.f.configureNode(n);
const summary=e.w(n,'Ready to Queue').detail;
assert.equal(e.w(n,'Ready to Queue').headline,'Ready to Queue');
if(linkedAxes.length===2) assert.match(summary,/Width.*Height.*connected/i);
else if(linkedAxes.length===1) {
assert.match(summary,new RegExp(`${linkedAxes[0]}.*connected`,'i'));
assert.match(summary,new RegExp(linkedAxes[0]==='width'?'Height 768':'Width 640'));
} else assert.match(summary,/640.*768/);
const inputs=await e.inputs(n);
for(const name of linkedAxes)inputs[name]=[name==='width'?'901':'902',0];
const response=await e.api.queuePrompt(0,{output:{[n.id]:{class_type:nodeClass,inputs}},workflow:n.serialize()});
const actual=e.submissions.at(-1).data.output[n.id].inputs;
for(const name of sources) assert.deepEqual(actual[name],linkedAxes.includes(name)?[name==='width'?'901':'902',0]:name==='width'?640:768);
assert(!Object.hasOwn(actual,'Width')); assert(!Object.hasOwn(actual,'Height'));
await e.emit('execution_success',{prompt_id:response.prompt_id});
e.w(n,'Size Source').callback('First Image'); e.f.configureNode(n);
const fallback=e.w(n,'Ready to Queue').detail;
if(linkedAxes.length) assert.match(fallback,/Fallback.*connected/i);
else assert.match(fallback,/640.*768/);
});
}
await test(`${nodeClass}: native reserve and links survive recreated workflow lifecycle`, async e=>{
const n=e.makeNode(312,'fixture',nodeClass); e.w(n,'width').value=640; e.w(n,'height').value=768;
n.inputs.push(slot('width',41),slot('height',42)); e.f.configureNode(n);
const saved=n.serialize(), savedInputs=JSON.parse(JSON.stringify(n.inputs,(key,value)=>key==='_widget'?undefined:value));
const nativeCount=saved.widgets_values.length;
for(let i=0;i<5;i++) {
e.app.extension.beforeConfigureGraph?.(); e.app.graph._nodes=[];
const restored=e.makeNode(312,'fixture',nodeClass,false); e.app.extension.nodeCreated(restored);
restored.configure(saved); restored.inputs=structuredClone(savedInputs);
e.app.extension.loadedGraphNode(restored); await e.finishRestore();
assert.equal(e.w(restored,'width').value,640); assert.equal(e.w(restored,'height').value,768);
assert.equal(restored.serialize().widgets_values.length,nativeCount);
assert.deepEqual(restored.inputs.map(s=>s.link),[41,42]);
assert.equal(restored.inputs[0]._widget,e.w(restored,'Width')); assert.equal(restored.inputs[1]._widget,e.w(restored,'Height'));
}
});
await test(`${nodeClass}: external INT edits retain Review safety guard`, async e=>{
const n=e.makeNode(312,'fixture',nodeClass);
const upstream={id:901,comfyClass:'PrimitiveInt',mode:0,widgets:[{name:'value',value:640}],inputs:[]};
e.app.graph._nodes.push(upstream); e.app.graph.links[41]={origin_id:901,origin_slot:0};
n.inputs.push(slot('width',41)); e.w(n,'generation_mode').value='Review Each Chunk'; e.f.configureNode(n);
await e.load(n,project(1)); assert(e.visible(n,'Use it and continue'));
upstream.widgets[0].value=672; n.__h3ContinuumProductionUxRefresh?.();
assert(e.f.reviewSettingsChanged(n)); assert(!e.visible(n,'Use it and continue'));
upstream.widgets[0].value=640; n.__h3ContinuumProductionUxRefresh?.();
assert(!e.f.reviewSettingsChanged(n)); assert(e.visible(n,'Use it and continue'));
});
}
console.log(JSON.stringify(results,null,2)); if(results.some(r=>!r.pass))process.exitCode=1;
})();
+58
View File
@@ -0,0 +1,58 @@
"""Issue #25 leaves backend dimensions, execution and identity unchanged."""
import json
import os
import shutil
import subprocess
from pathlib import Path
import pytest
from ComfyUI_H3_Continuum_Join.v3.driving_nodes import H3ContinuumSamplerV38, H3ContinuumSamplerV39
from ComfyUI_H3_Continuum_Join.v3.resolution import resolve_h3_size_source
ROOT = Path(__file__).resolve().parents[1]
@pytest.mark.parametrize('cls', [H3ContinuumSamplerV38, H3ContinuumSamplerV39])
def test_external_size_schema_remains_native_required_int(cls):
required = cls.INPUT_TYPES()['required']
assert list(required).index('height') == list(required).index('width') + 1
for axis in ('width', 'height'):
kind, options = required[axis]
assert kind == 'INT'
assert options['default'] == (736 if axis == 'width' else 416)
assert (options['min'], options['max'], options['step']) == (32, 16384, 32)
assert 'forceInput' not in options and 'defaultInput' not in options
@pytest.mark.parametrize('width,height', [(641,768),(640,767),(0,768),(True,768),(640,False),(16416,768)])
def test_external_resolved_dimension_uses_existing_validation(width, height):
with pytest.raises((TypeError, ValueError)):
resolve_h3_size_source(size_source='Manual', width=width, height=height)
def test_external_resolved_dimension_equals_manual_and_missing_first_fallback():
manual = resolve_h3_size_source(size_source='Manual', width=640, height=768)
assert (manual.width, manual.height) == (640,768)
fallback = resolve_h3_size_source(size_source='First Image', width=640, height=768)
assert (fallback.width, fallback.height) == (manual.width, manual.height)
def test_external_dimensions_do_not_override_active_first_image():
class Image:
shape = (1,1080,1920,3)
expected = resolve_h3_size_source(size_source='First Image', first_frame=Image())
external = resolve_h3_size_source(size_source='First Image', width=641, height=True, first_frame=Image())
assert external == expected
def test_external_int_frontend_gate():
runner = shutil.which('node')
assert runner, 'Node.js is required for frontend tests'
result = subprocess.run([runner, str(ROOT/'tests/frontend_external_int_size.cjs')],
env={**os.environ, 'H3_TEST_ROOT':str(ROOT)},
capture_output=True, text=True, encoding='utf-8', timeout=45)
records = json.loads(result.stdout)
assert len(records) == 22
failures = [r for r in records if not r['pass']]
assert result.returncode == 0 and not failures, result.stdout + result.stderr
+1
View File
@@ -415,6 +415,7 @@ def test_size_source_frontend_migrates_legacy_and_disables_the_correct_widgets(t
_js_function(source, "setWidgetVisible", "hidePersistentWidget"),
_js_function(source, "hidePersistentWidget", "settingValue"),
_js_function(source, "attachRefresh", "transientProductionWidgets"),
_js_function(source, "linkedInput", "removeUnusedLegacyInputs"),
_js_function(
source,
"configureResolutionPresetWidgets",