diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index e639a0100..97a671947 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -297,6 +297,7 @@ jobs: name: arsonmix-gui-baseline-smoke path: | pages-wire-main-1680.png + pages-wire-main-*.png pages-v51-portrait-meter-1680.png pages-fader-rollback-console-1680.png pages-fader-rollback-detail-1680.png diff --git a/site/preview-v2/assets/mixer-wire-dots.css b/site/preview-v2/assets/mixer-wire-dots.css index 598c6c9ee..b02449415 100644 --- a/site/preview-v2/assets/mixer-wire-dots.css +++ b/site/preview-v2/assets/mixer-wire-dots.css @@ -936,28 +936,35 @@ box-shadow:inset 0 1px 2px #07141c!important; } -/* WIRE A2: MAIN-color cable stubs. Source and pinned MAIN consume the SAME - data-wire-main-edge identity. Scoped to the existing WIRE CSS owner. - No new layout box, no cross-bank SVG, no hit area or compositor animation. */ -/* Position source stub on the actual 12px OUT PIN, not the wider - caption-bearing button: accurate at every density and browser width. */ -.console-body.wire-routing-v15 .strip .wire-tray - .wire-node-out[data-wire-main-edge] .wire-pin{position:relative;overflow:visible} -.console-body.wire-routing-v15 .strip .wire-tray - .wire-node-out[data-wire-main-edge] .wire-pin::after, -.console-body.wire-routing-v15 #master .wire-tray - .wire-node-in[data-wire-main-edge]::before{ - content:"";position:absolute;left:calc(50% - 1.25px);width:2.5px; - height:12px;background:var(--main-wire-hue,#a04b65); - border-radius:0 0 4px 4px;box-shadow:1px 0 #09121f,0 0 0 1px #111e29; - pointer-events:none;z-index:1; +/* WIRE A2: two measured, local SVG fragments of one accepted MAIN edge. + Existing WIRE component owns material; jack hitboxes and console geometry + stay untouched. A tiny cubic sag replaces the former straight pseudo-stub. */ +.console-body.wire-routing-v15 .strip .send-section.wire-section{ + position:relative; } -.console-body.wire-routing-v15 .strip .wire-tray - .wire-node-out[data-wire-main-edge] .wire-pin::after{top:10px;transform:rotate(-8deg);transform-origin:top center} -.console-body.wire-routing-v15 #master .wire-tray - .wire-node-in[data-wire-main-edge]::before{ - top:23px;transform:rotate(8deg);transform-origin:top center; - border-radius:4px 4px 0 0; +.console-body.wire-routing-v15 .strip .wire-main-fragment{ + position:absolute;inset:0;width:100%;height:100%; + display:block;overflow:hidden;z-index:2;pointer-events:none; +} +.console-body.wire-routing-v15 .strip .wire-main-fragment .wire-main-shadow, +.console-body.wire-routing-v15 .strip .wire-main-fragment .wire-main-jacket, +.console-body.wire-routing-v15 .strip .wire-main-fragment .wire-main-sheen{ + fill:none;stroke-linecap:round;stroke-linejoin:round; +} +.console-body.wire-routing-v15 .strip .wire-main-fragment .wire-main-shadow{ + stroke:#061019;stroke-width:5.4; +} +.console-body.wire-routing-v15 .strip .wire-main-fragment .wire-main-jacket{ + stroke:var(--main-wire-hue,#a04b65);stroke-width:3.4; +} +.console-body.wire-routing-v15 .strip .wire-main-fragment .wire-main-sheen{ + stroke:#ffffff45;stroke-width:.8;opacity:.7; +} +.console-body.wire-routing-v15 .strip .wire-main-fragment .wire-main-plug{ + fill:#9eabb2;stroke:#152530;stroke-width:1.3; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-main-fragment{ + display:none; } /* Folded 23px WIRE retains two discreet color fragments tied to exact graph IDs. The accepted V52 fader, V51 meter and V54 jack material remain unchanged. */ diff --git a/site/preview-v2/assets/wire-graph-model.js b/site/preview-v2/assets/wire-graph-model.js index 1c541cbe7..6d8a2d49d 100644 --- a/site/preview-v2/assets/wire-graph-model.js +++ b/site/preview-v2/assets/wire-graph-model.js @@ -141,21 +141,58 @@ const edges=existingEdges.map(e=>({...e})),seen=new Set(edges.map(edgeKey)); nextId=Math.max(nextId,1,...edges.map(e=>e.id+1)); const names=new Map(channels.map(c=>[c.name,c.id])); + if(names.size!==channels.length)return {ok:false,error:'AMBIGUOUS_LEGACY_NAME'}; const add=(src,dst,kind='send',mode='send',levelDb=0)=>{ - if(!validId(src)||!validId(dst)||src===dst||seen.has(src+':'+dst))return; - seen.add(src+':'+dst); + if(!validId(src)||!validId(dst)||src===dst)return 'INVALID_LEGACY_ROUTE'; + const key=src+':'+dst; + if(seen.has(key))return 'DUPLICATE_LEGACY_ROUTE'; + seen.add(key); edges.push({id:nextId++,sourceId:src,destId:dst,kind,mode,levelDb,enabled:true}); + return null; + }; + const importSend=(t,slot)=>{ + if(!slot||typeof slot!=='object')return 'INVALID_LEGACY_SEND_SLOT'; + if(!slot.sendOn)return null; + if(!names.has(slot.send))return 'UNRESOLVED_LEGACY_SEND'; + const gain=Number(slot.sendLevel); + if(!Number.isFinite(gain))return 'INVALID_LEGACY_SEND_GAIN'; + return add(t.id,names.get(slot.send),'send','send',Math.max(-60,Math.min(6,gain))); }; for(const t of channels){ - const out=t.output==='Master'?mainId:names.get(t.output); - if(out)add(t.id,out,'primary',out===mainId?'postFader':'routeOnly'); - if(Array.isArray(t.sendSlots))for(let i=0;i=slots.length) + return {ok:false,error:'INVALID_LEGACY_ACTIVE_SEND'}; + for(let i=0;in.toFixed(2)).join(' ')+ + ' C'+c1.map(n=>n.toFixed(2)).join(' ')+','+ + c2.map(n=>n.toFixed(2)).join(' ')+','+ + end.map(n=>n.toFixed(2)).join(' '); + const sig=edge.id+':'+sectionRect.width.toFixed(1)+':'+sectionRect.height.toFixed(1)+':'+path; + if(layer?.dataset.geometry===sig)return; + if(!layer){ + layer=document.createElementNS('http://www.w3.org/2000/svg','svg'); + layer.setAttribute('class','wire-main-fragment'); + layer.setAttribute('aria-hidden','true'); + section.appendChild(layer); + } + layer.dataset.geometry=sig;layer.dataset.edgeId=String(edge.id); + layer.setAttribute('viewBox','0 0 '+sectionRect.width+' '+sectionRect.height); + const p=(className,d)=>''; + layer.innerHTML=p('wire-main-shadow',path)+p('wire-main-jacket',path)+ + p('wire-main-sheen',path)+ + ''; + layer.style.setProperty('--main-wire-hue',master.color); +} function syncMainWireFragments(){ const selectedSources=selection().filter(t=>t.kind!=='master'); const focus=armedWireSource()||(selectedSources.length===1?selectedSources[0]:null); @@ -1536,6 +1583,7 @@ for(const t of tracks){ const edge=wireFor(t.id,master.id); const lane=document.querySelector('.strip[data-id="'+t.id+'"]'); + paintMainWireFragment(lane,edge,false); for(const el of [lane?.querySelector('.wire-node-out'),lane?.querySelector('.wire-fold-summary')]){ if(!el)continue; if(edge)el.setAttribute('data-wire-main-edge',String(edge.id)); @@ -1543,6 +1591,7 @@ el.style.setProperty('--main-wire-hue',master.color); } } + paintMainWireFragment(masterEl,selected,true); for(const el of [masterEl.querySelector('.wire-node-in'),masterEl.querySelector('.wire-fold-summary')]){ if(!el)continue; if(selected)el.setAttribute('data-wire-main-edge',String(selected.id)); diff --git a/tests/pages_wire_first_canonical_main_smoke.py b/tests/pages_wire_first_canonical_main_smoke.py index 91e823c8b..92ca4b023 100644 --- a/tests/pages_wire_first_canonical_main_smoke.py +++ b/tests/pages_wire_first_canonical_main_smoke.py @@ -78,9 +78,91 @@ def drag_to(point,escape=False): page.locator("#wireWsUndo").click() assert source.get_attribute("data-wire-main-edge")==original,"Retarget Undo did not restore MAIN" + +def audit_visual_matrix(browser): + """Nine real Chromium renders: viewport, density, focus, collapse, plug.""" + for width,height in ((1366,768),(1680,900),(1920,1080)): + for density in ("comfort","standard","compact"): + page=browser.new_page(viewport={"width":width,"height":height}, + reduced_motion="reduce") + errors=[] + page.on("pageerror",lambda exc: errors.append(str(exc))) + page.goto(PAGE.as_uri()) + page.locator("#densitySelect").select_option(density) + body=page.locator(".console-body") + # Narrow/Compact intentionally locks the WIRE bay folded to keep + # 23px physical geometry. It has graph-bound compact contacts, + # not a full cable overlay; the rail refuses expansion by design. + if density=="compact": + assert "collapsed-send" in (body.get_attribute("class") or "") + initial=edge(page,1,"out") + assert initial and page.locator( + '#tracks .strip[data-id="1"] .wire-fold-summary' + ).get_attribute("data-wire-main-edge")==initial + assert page.locator( + '#master .wire-fold-summary' + ).get_attribute("data-wire-main-edge")==initial + assert page.locator(".wire-main-fragment").count()==0 + page.screenshot(path=str(PAGE.parents[2]/ + f"pages-wire-main-{width}x{height}-{density}.png")) + assert not errors,(width,height,density,errors) + page.close() + continue + if "collapsed-send" in (body.get_attribute("class") or ""): + page.locator('.section-rail [data-section="send"]').click() + pair=page.evaluate("""() => { + const src=document.querySelector('#tracks .strip[data-id="1"]'); + const main=document.querySelector('#master'); + const fragment=src?.querySelector('.wire-main-fragment'); + const incoming=main?.querySelector('.wire-main-fragment'); + const dot=src?.querySelector('.wire-node-out .wire-pin'); + const jack=main?.querySelector('.wire-node-in .wire-arrow'); + function position(svg,pin){ + if(!svg||!pin)return null; + const r=svg.getBoundingClientRect(),p=pin.getBoundingClientRect(); + const c=svg.querySelector('.wire-main-plug'); + const x=Number(c?.getAttribute('cx')),y=Number(c?.getAttribute('cy')); + if(!Number.isFinite(x)||!Number.isFinite(y))return null; + return {error:Math.hypot(r.left+x-(p.left+p.width/2), + r.top+y-(p.top+p.height/2)), + bounded:x>0&&x0&&yx.querySelector('.wire-node-out[data-wire-main-edge]')).length, + painted:strips.filter(x=>x.querySelector('.wire-main-fragment')).length}; + }""") + assert pair["source"] and pair["source"]==pair["main"]==pair["connected"],( + width,height,density,"MAIN fragments do not share exact graph edge",pair) + assert pair["sources"]==pair["painted"],( + width,height,density,"one physical MAIN fragment per connected source",pair) + for side in ("sourceGeometry","mainGeometry"): + geom=pair[side] + assert geom and geom["bounded"] and geom["cubic"] and geom["error"]<=1.1,( + width,height,density,side,"misaligned or clipped MAIN plug",geom) + # Selecting CH5 changes the MAIN plug edgeId, not other connections. + page.locator('#tracks .strip[data-id="5"] .strip-identity-top').click() + focused=page.locator('#master .wire-main-fragment').get_attribute("data-edge-id") + assert focused==edge(page,5,"out") and focused!=pair["source"],( + width,height,density,"focused MAIN edge selection") + page.locator('.section-rail [data-section="send"]').click() + assert page.locator('.wire-main-fragment').count()==0,( + width,height,density,"collapsed MAIN fragments not retired") + page.locator('.section-rail [data-section="send"]').click() + assert page.locator('#master .wire-main-fragment').get_attribute("data-edge-id")==focused + page.screenshot(path=str(PAGE.parents[2]/ + f"pages-wire-main-{width}x{height}-{density}.png")) + assert not errors,(width,height,density,errors) + page.close() + def run(): with sync_playwright() as pw: browser=pw.chromium.launch(headless=True) + audit_visual_matrix(browser) for width in (1366,1680,1920): page=browser.new_page(viewport={"width":width,"height":900}) errors=[] @@ -95,6 +177,20 @@ def run(): control=main_button(page,5) assert page.locator('#master .wire-node-in').get_attribute("data-wire-main-edge")==initial assert control.get_attribute("aria-pressed")=="true" + if "collapsed-send" in (page.locator(".console-body").get_attribute("class") or ""): + page.locator('.section-rail [data-section="send"]').click() + # One graph edge paints TWO measured local cubic cables, never a + # cross-bank line. Geometry and edge identity survive all widths. + source_stub=page.locator('#tracks .strip[data-id="5"] .wire-main-fragment') + main_stub=page.locator('#master .wire-main-fragment') + assert source_stub.count()==1 and main_stub.count()==1,( + width,"missing paired physical MAIN cables") + assert source_stub.get_attribute("data-edge-id")==initial + assert main_stub.get_attribute("data-edge-id")==initial + assert " C" in source_stub.locator(".wire-main-jacket").get_attribute("d") + assert " C" in main_stub.locator(".wire-main-jacket").get_attribute("d") + assert page.locator('#tracks .strip[data-id="6"] .wire-main-fragment').count()==1 + # Distinct disconnect is reversible and only affects this channel. control.click() assert edge(page,5,"out") is None,(width,"MAIN disconnect not real") @@ -196,7 +292,7 @@ def run(): assert edge(page,5,"out") is None,"Snapshot SAFE overwrote live MAIN route" page.close() browser.close() - print("PASS WIRE A: real Chrome MAIN edgeId, physical plug Escape/unplug/replug/Undo, cycle guard, Scene/SAFE, 3 widths") + print("PASS WIRE A: nine Chromium viewport/density cable audits plus exact-edge MAIN gesture, Scene/SAFE, Undo") if __name__=="__main__": run() diff --git a/tests/wire_graph_canonical_model.test.cjs b/tests/wire_graph_canonical_model.test.cjs index 84a088a23..a8a5a2aeb 100644 --- a/tests/wire_graph_canonical_model.test.cjs +++ b/tests/wire_graph_canonical_model.test.cjs @@ -43,6 +43,66 @@ const legacy=graph.migrateLegacy([{...channels[0],send:'CH2',sendOn:true,sendLev channels[1],channels[2]],9); assert.equal(legacy.ok,true); assert.equal(legacy.edges.filter(e=>e.sourceId===1&&e.destId===2).length,1); +// Imported saved patches must never vanish because a renamed destination is +// missing. No partial migration/ghost route is allowed on Scene recall. +const badOutput=graph.migrateLegacy([{...channels[0],output:'Deleted Bus'},channels[1],channels[2]],9); +assert.equal(badOutput.error,'UNRESOLVED_LEGACY_OUTPUT'); +const badSend=graph.migrateLegacy([{...channels[0],send:'Deleted Bus',sendOn:true, + sendSlots:[{send:'Deleted Bus',sendOn:true,sendLevel:-6}],activeSend:0}, + channels[1],channels[2]],9); +assert.equal(badSend.error,'UNRESOLVED_LEGACY_SEND'); +const badGain=graph.migrateLegacy([{...channels[0],send:'CH2',sendOn:true, + sendSlots:[{send:'CH2',sendOn:true,sendLevel:NaN}],activeSend:0,sendLevel:NaN}, + channels[1],channels[2]],9); +assert.equal(badGain.error,'INVALID_LEGACY_SEND_GAIN'); +const badSplit=graph.migrateLegacy([{...channels[0],input:'CH99 PRE-FX SPLIT'},channels[1],channels[2]],9); +assert.equal(badSplit.error,'INVALID_EDGE'); +const unrecognizedSplit=graph.migrateLegacy([{...channels[0],input:'CH?? PRE-FX SPLIT'},channels[1],channels[2]],9); +assert.equal(unrecognizedSplit.error,'UNRESOLVED_LEGACY_SPLIT'); +// A legacy migration is transactional: never silently drop duplicated slots, +// unknown source indices, ambiguous names, or an older single live SEND. +const duplicateLegacySend=graph.migrateLegacy([ + {...channels[0],send:'CH2',sendOn:true,sendLevel:-6,activeSend:0, + sendSlots:[{send:'CH2',sendOn:true,sendLevel:-6}, + {send:'CH2',sendOn:true,sendLevel:-12}]}, + channels[1],channels[2]],9); +assert.equal(duplicateLegacySend.error,'DUPLICATE_LEGACY_ROUTE'); +assert.equal(graph.migrateLegacy([{...channels[0],name:'CH2'},channels[1],channels[2]],9).error, + 'AMBIGUOUS_LEGACY_NAME'); +assert.equal(graph.migrateLegacy([{...channels[0],sendSlots:[null],activeSend:0}, + channels[1],channels[2]],9).error,'INVALID_LEGACY_SEND_SLOT'); +assert.equal(graph.migrateLegacy([{...channels[0],sendSlots:[{}],activeSend:3}, + channels[1],channels[2]],9).error,'INVALID_LEGACY_ACTIVE_SEND'); +assert.equal(graph.migrateLegacy([{...channels[0],input:'CH0 PRE-FX SPLIT'}, + channels[1],channels[2]],9).error,'INVALID_LEGACY_ROUTE'); +const singleSlotLegacy=graph.migrateLegacy([{...channels[0],send:'CH2',sendOn:true,sendLevel:-9}, + channels[1],channels[2]],9); +assert.equal(singleSlotLegacy.ok,true,'legacy single live SEND must remain audible'); +assert.equal(singleSlotLegacy.edges.filter(e=>e.sourceId===1&&e.destId===2).length,1); +const mixedDuplicate=graph.migrateLegacy(channels,9,[base.edges[0]],base.nextId); +assert.equal(mixedDuplicate.error,'DUPLICATE_LEGACY_ROUTE'); +// Deterministic random edit sequences check that no rejected candidate +// changes graph data and all accepted candidates remain acyclic. +let seed=0x5eeda11; +const rand=()=>{seed=(Math.imul(seed,1664525)+1013904223)>>>0;return seed;}; +for(let sequence=0;sequence<32;sequence++){ + let cur={channels,mainId:9,edges:base.edges.map(e=>({...e})),nextId:base.nextId}; + for(let step=0;step<48;step++){ + const src=1+(rand()%3),dst=[1,2,3,9][rand()%4]; + const existing=cur.edges.filter(e=>e.sourceId===src); + const pick=existing.length?existing[rand()%existing.length]:null; + const op=pick&&(rand()%3===0)?{type:'REMOVE',sourceId:src,edgeId:pick.id}: + {type:'CONNECT',sourceId:src,destId:dst}; + const oldJson=JSON.stringify(cur),result=graph.applyWireTransaction(cur,[op]); + assert.equal(JSON.stringify(cur),oldJson,'pure reducer must never mutate input'); + if(result.ok){ + cur={...cur,edges:result.edges,nextId:result.nextId}; + assert.equal(graph.validateCandidateGraph(channels,9,cur.edges).ok,true); + assert.equal(new Set(cur.edges.map(e=>e.id)).size,cur.edges.length); + assert.equal(new Set(cur.edges.map(e=>e.sourceId+':'+e.destId)).size,cur.edges.length); + } + } +} // Safety contract: every entry point (including Scenes and untrusted imports) // must fail closed for unknown kinds/taps, never silently create a SEND. const unknownKind={...state.edges[0],kind:'phantom'};