Files
aigc-home/docs/hel-892/wanplus-document-evidence/e2e-wanplus.py.txt
T
2026-11-01 19:07:30 +08:00

52 lines
6.4 KiB
Plaintext

from pathlib import Path
R=Path.cwd();E=R/'e2e'
for old in ['run-scail-document.py','scail-document-server.py']:
s=(E/old).read_text().replace('scail','wanplus').replace('== 140','== 141')
if old.startswith('run-'):
s=s.replace(' OUT.mkdir(parents=True, exist_ok=True)',''' data = ROOT / '.local-evidence/wanplus-document-server'
assert not data.exists(), 'Prior owned data must be reversibly quarantined before another run'
OUT.mkdir(parents=True, exist_ok=True)
(OUT / 'fresh-path-check.json').write_text(json.dumps(dict(data_path=str(data.relative_to(ROOT)), existed_before_start=False))+'\\n')''')
(E/old.replace('scail','wanplus')).write_text(s)
s=(E/'scail-document.mjs').read_text().replace('scail','wanplus')
s=s.replace("const names=[", "const names=['Wan2.1_Scail-2_动作迁移_WanAnimatePlus_v4.2',")
s=s.replace('details.length===140','details.length===141').replace('===8822','===9161').replace('140图8822','141图9161').replace('===262','===268').replace('140图262','141图268').replace('old_one_hundred_thirty_nine','old_one_hundred_forty')
a=s.index(' check(b.counts.saved_fields===195');z=s.index(' const notesBox=',a)
s=s[:a]+''' check(b.counts.saved_fields===339&&b.comments.length===6&&b.boundaries.length===1&&b.zero_saved_nodes.length===15,`${width}339原条目/六注释/一子图/15空或缺保存`);
check(b.fields.every(f=>f.named_state==='missing'&&!('named_pointer'in f)&&!('named_value'in f))&&b.fields.filter(f=>f.scope==='root').length===328,`${width}零具名与root328/internal11`);
check(b.node_bindings.length===135&&b.node_bindings.filter(x=>x.implementation_verified).length===53&&b.node_bindings.filter(x=>x.source_id.startsWith('unresolved-')).map(x=>x.node_id).sort().join(',')==='37,597,607,614,615,62,66,67,69,71'&&b.node_bindings.filter(x=>x.source_id==='unknown-no-version').length===71,`${width}53准确/十具体缺口/71未知/一宿主`);
const source=JSON.parse(fs.readFileSync('docs/hel-892/wanplus-document-evidence/source-check.json'));
const node=n=>JSON.parse(b.flow.find(x=>x.startsWith(n+' 原节点完整保存 ')).split(' 原节点完整保存 ')[1]);
const expected=JSON.parse(fs.readFileSync('docs/hel-892/wanplus-document-evidence/expected-edges.json'));
for(const [prefix,originalEdges] of Object.entries(expected)){
const scope=prefix==='root'?'root':`宿主${prefix.slice(0,-1)}内部定义`;
const rendered=b.flow.filter(x=>x.startsWith(scope+' 物理/边界记录 ')).map(x=>JSON.parse(x.split(' 物理/边界记录 ')[1]));
assert.deepEqual(rendered,originalEdges);check(true,`${width} ${scope}逐条端点与原值相等`);
}
check(b.counts.physical_edges===122&&b.node_bindings.filter(x=>node(x.node_id).mode===4).length===43,`${width}122分scope记录/43个mode4节点原留`);
assert.deepEqual(node('546').widgets_values,{});assert.deepEqual(node('629').widgets_values,[{},{}]);
check(b.zero_saved_nodes.some(n=>n.node_id==='546'&&n.state==='empty_dict')&&b.fields.filter(f=>f.json_type==='dict').length===7&&b.fields.filter(f=>f.json_type==='NoneType').length===2,`${width}546空dict/629两个完整dict/五历史/两null分列`);
check(!('frontendVersion'in d.doc_json.fixed_version)&&b.boundaries[0].proxy_state==='missing'&&node('663').mode===4&&!('proxyWidgets'in node('663').properties),`${width}前端未知/无proxy/宿主mode4`);
check(node('607').outputs[0].links.includes(930)&&node('607').outputs[1].links===null&&node('597').outputs[0].links.includes(928),`${width}普通samples930消费/denoised null/解码928原线`);
check(field('614','seed').value===246593650829984&&field('613','seed').value===325005255519842&&node('614').inputs.find(x=>x.name==='seed').link===937,`${width}两个独立seed缓存和937外线`);
check(field('619','single_frame_prefix_encoding').value==='disabled'&&field('619','loop_colormatch_reference').value==='previous_matched_frame'&&field('436','cleanup_mode').value===true,`${width}原类型/schema与清理口冲突不归一`);
check(field('667','phase1_mask').value===0.5&&field('667','phase2_mask').value===1&&field('667','phase2_start_step').value===1,`${width}TwoPhase三原值与准确默认分列`);
for(const [id,value] of [['119',true],['567',false],['621',false],['550',false]])check(field(id,'save_output').value===value,`${width} ${id}保存原开关不称无I/O`);
''' +s[z:]
a=s.index(' for(const [phrase,label]of');z=s.index(" await dialog.getByText('版本、",a)
s=s[:a]+''' for(const [phrase,label]of [['重要准确注册缺口','source-gap'],['615身份冲突','commit-gap'],['真正采样消费','samples'],['619准确8868','embeds'],['667准确1607','two-phase'],['629准确af6','bypass'],['清理436身份冲突','cleanup'],['播放693准确','sound']]){
const line=b.flow.filter(x=>x.includes(phrase)).sort((a,b)=>a.length-b.length)[0];assert.ok(line,phrase);await fixedCard.getByText(line,{exact:true}).first().evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:`${out}/${width}-${d.id}-${label}.png`});
}
''' +s[z:]
old="['264.expression','201.position_1','30.image','346.value','355.value','213:3.text','213:114.previous_frame_count','213:197.object_indices','213:19.noise_seed','213:169.switch','262:253.batch_index','262:252.source_stats','262:259.video_frame_offset','262:258.text','368:344.expression','368:370.total','368:372.position_0']"
new="['614.seed','613.seed','619.single_frame_prefix_encoding','619.loop_colormatch_reference','667.phase2_start_step','436.cleanup_mode','629.position_0','589.position_1','663.width','663:661.width','119.videopreview','567.videopreview','621.videopreview','550.videopreview','573.videopreview','615.positive_prompt','615.negative_prompt','694.value','693.audio_path','693.duration']"
assert old in s;s=s.replace(old,new)
needle=" if(typeof f.value==='string'&&Array.from(f.value).length>100){"
s=s.replace(needle,''' if(f.field==='videopreview'){
const rendered=await box.locator(':scope > pre').first().textContent();assert.deepEqual(JSON.parse(rendered),f.value);
textRenderings.push({viewport:width,kind:'history'+f.node_id,canonical_js_sha256:crypto.createHash('sha256').update(JSON.stringify(f.value)).digest('hex')});check(true,`${width} ${f.node_id}完整媒体历史逐类型/DOM核对`);
}
'''+needle)
s=s.replace('// Local GET-only:195 entries/10 Notes/111 exact/2 bounded unresolved/23 unversioned/3 boundaries.','// Local GET-only:339 entries/6 Notes/53 exact/10 bounded gaps/71 unknown/1 boundary.')
(E/'wanplus-document.mjs').write_text(s)