diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 75231ddc6..d833184cb 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -195,7 +195,7 @@ jobs: needs: quick # Both 8D-SonKu and SOF native-owner PRs share ONE actual Chromium runner. # Preserve fast-only checks for unrelated GUI and engine branches. - if: ${{ (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feat/8d-sonku-') || startsWith(github.head_ref, 'test/sof-native-'))) || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/feat/8d-sonku-') && inputs.expected_sha != '') }} + if: ${{ (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feat/8d-sonku-') || startsWith(github.head_ref, 'test/sof-native-') || startsWith(github.head_ref, 'integration/sof-sonku-main-'))) || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/feat/8d-sonku-') && inputs.expected_sha != '') }} runs-on: ubuntu-latest timeout-minutes: 12 steps: @@ -216,6 +216,12 @@ jobs: # job (zero additional browser runners and zero Windows recompiles). - name: Native SOF PRE/POST, SEND ON, EdgeId gain and ACK/readback Chromium run: python tests/approved_native_sof_chromium_smoke.py + - name: Integrated V65 WIRE motion, SOF and actual native WIRE regression + if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/sof-sonku-main-') }} + run: | + python tests/pages_v60_fader_wire_tactile_smoke.py + python tests/approved_native_wire_gain_smoke.py + python tests/sof_contextual_console_smoke.py - name: Render original 8D-SonKu headphone candidate through exact native HRTF run: | g++ -std=c++20 -O2 -Wall -Wextra -pedantic tools/sonku_offline_listening.cpp -o /tmp/sonku-listening @@ -242,7 +248,10 @@ jobs: uses: actions/upload-artifact@v4 with: name: ArSonMix-SOF-PCM-Bridge-${{ github.run_id }} - path: arsonmix-native-sof-*.png + path: | + arsonmix-native-sof-*.png + arsonmix-v60-*.png + native-wire-gain-*.png if-no-files-found: ignore retention-days: 7 diff --git a/installer/ArSonMixAutoUpdate.ps1 b/installer/ArSonMixAutoUpdate.ps1 index 4e955c33c..415b87050 100644 --- a/installer/ArSonMixAutoUpdate.ps1 +++ b/installer/ArSonMixAutoUpdate.ps1 @@ -18,6 +18,9 @@ $local=$env:LOCALAPPDATA if([string]::IsNullOrWhiteSpace($local)){exit 0} $root=Join-Path $local 'ArSonMix\Updates' $statePath=Join-Path $root 'state.json' +# Consent is a usability acknowledgement, never a cryptographic trust boundary. +# The worker independently verifies both published installers before execution. +$approvalPath=Join-Path $root 'approved.json' $logPath=Join-Path $root 'last-result.txt' $mutex=$null $locked=$false @@ -72,6 +75,31 @@ function Find-Asset([object]$release,[string]$name,[int64]$minBytes) { if($items.Count -ne 1){return $null} return $items[0] } +# Older approved installations can fall beyond GitHub's first 100 releases. +# Traverse only bounded pages; fail closed rather than guess the baseline. +function Read-PublishedReleases([hashtable]$headers) { + $result=[Collections.Generic.List[object]]::new() + $tags=[Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal) + for([int]$page=1; $page -le 10; $page++) { + $uri=if($page -eq 1){$api}else{$api+'&page='+$page} + $batch=Invoke-RestMethod -Uri $uri -Headers $headers -TimeoutSec 25 + if($null -eq $batch){Fail 'GitHub returned no release list'} + $rows=@($batch) + if($rows.Count -gt 100){Fail 'GitHub release page exceeds hard bound'} + foreach($release in $rows) { + if($null -eq $release -or + $null -eq $release.PSObject.Properties['tag_name'] -or + [string]::IsNullOrWhiteSpace([string]$release.tag_name) -or + -not $tags.Add([string]$release.tag_name)){ + Fail 'Invalid or duplicated GitHub release page' + } + $result.Add($release) + } + if($rows.Count -lt 100){return ,$result.ToArray()} + } + Fail 'GitHub release history exceeds 1000 entries; defer rather than guess baseline' +} + function Approved-Installer([object]$release) { if($null -eq $release -or $release.draft -or [string]$release.target_commitish -cnotmatch '^[a-f0-9]{40}$' -or @@ -176,6 +204,23 @@ function Should-RetryInstaller([int]$attempts,[bool]$success,[bool]$oldRemains) # throws and must not spawn a second installer while the first runs. return (-not $success -and $oldRemains -and $attempts -ge 1 -and $attempts -lt 2) } +function Test-UserApproval([object]$approval,[object]$transaction) { + if($null -eq $transaction -or + $transaction.operation -cnotin @('repair','upgrade')) {return $false} + if($transaction.operation -ceq 'repair'){return $true} + # Approval is only a usability gate. It does NOT authenticate publisher. + return ($null -ne $approval -and + [string]$approval.candidateSha -ceq [string]$transaction.candidateSha -and + [string]$approval.previousSha -ceq [string]$transaction.previousSha -and + [string]$approval.candidateTag -ceq [string]$transaction.candidateTag) +} + +function Test-InstallableAssetPair([string]$newPath,[object]$newAsset, + [string]$oldPath,[object]$oldAsset) { + return ((Test-StagedAsset $newPath $newAsset) -and + (Test-StagedAsset $oldPath $oldAsset)) +} + function Get-InstalledImageStatus([object]$build) { try { $hash=[string]$build.exeSha256 @@ -270,7 +315,7 @@ function Restore-InstalledRelease([string]$sourceSha) { # than trusting local update state as installation authority. $headers=@{Accept='application/vnd.github+json';'User-Agent'='ArSonMix-SmartUpdater/1'; 'X-GitHub-Api-Version'='2022-11-28'} - $releases=Invoke-RestMethod -Uri $api -Headers $headers -TimeoutSec 25 + $releases=Read-PublishedReleases $headers $sourceRelease=$null foreach($release in $releases) { if([string]$release.target_commitish -ceq $sourceSha -and @@ -345,7 +390,7 @@ function Launch-WithHealth([string]$expectedSha) { do { if($process.HasExited){return $false} if(Test-Path -LiteralPath $marker -PathType Leaf) { - if((Get-Content -LiteralPath $marker -Raw).Trim() -ceq 'GUI_READY' -and + if((Get-Content -LiteralPath $marker -Raw).Trim() -ceq 'GUI_READY_NO_AUDIO' -and (Test-InstalledRelease $expectedSha)) { Start-Sleep -Seconds 2 $process.Refresh() @@ -466,10 +511,58 @@ if($PolicySelfTest) { $stored.digest='sha256:'+('0'*64) if(Test-CompleteStagedTransaction $transaction){throw 'Corrupted staged transaction reused'} } finally {$root=$previousRoot} + # Last-mile policy: tamper with EITHER installer, not just the candidate. + $pairFolder=Join-Path ([IO.Path]::GetTempPath()) ('ArSonMix-VerifiedPair-'+[guid]::NewGuid().ToString('N')) + try { + [IO.Directory]::CreateDirectory($pairFolder) | Out-Null + $oldSample=Join-Path $pairFolder 'previous.exe' + $newSample=Join-Path $pairFolder 'candidate.exe' + $known=New-Object byte[] 2097152 + [IO.File]::WriteAllBytes($oldSample,$known) + [IO.File]::WriteAllBytes($newSample,$known) + $fingerprint=(Get-FileHash -LiteralPath $newSample -Algorithm SHA256).Hash.ToLowerInvariant() + $identity=[pscustomobject]@{size=2097152;digest='sha256:'+$fingerprint} + if(-not (Test-InstallableAssetPair $newSample $identity $oldSample $identity)){ + throw 'Valid pair rejected' + } + $known[10]=123 + [IO.File]::WriteAllBytes($oldSample,$known) + if(Test-InstallableAssetPair $newSample $identity $oldSample $identity){ + throw 'Tampered rollback accepted' + } + [IO.File]::WriteAllBytes($oldSample,(New-Object byte[] 2097152)) + $known[11]=17 + [IO.File]::WriteAllBytes($newSample,$known) + if(Test-InstallableAssetPair $newSample $identity $oldSample $identity){ + throw 'Tampered candidate accepted' + } + Write-Output 'ARSONMIX_UPDATER_LAST_MILE_PAIR_PASS' + } finally { + Remove-Item -LiteralPath $pairFolder -Recurse -Force -ErrorAction SilentlyContinue + } if(-not (Should-RetryInstaller 1 $false $true)){throw 'First transient retry rejected'} if(Should-RetryInstaller 2 $false $true){throw 'Repeated installer retry accepted'} if(Should-RetryInstaller 1 $false $false){throw 'Missing old version retried'} if(Should-RetryInstaller 1 $true $true){throw 'Successful install retried'} + # Test same-version repair and exact candidate acknowledgement offline. + $transaction=[pscustomobject]@{ + operation='upgrade';candidateSha=('a'*40);previousSha=('b'*40); + candidateTag='v0.5.0-alpha.6'} + $goodAck=[pscustomobject]@{ + candidateSha=('a'*40);previousSha=('b'*40);candidateTag='v0.5.0-alpha.6'} + if(-not (Test-UserApproval $goodAck $transaction)) {throw 'Exact update acknowledgement rejected'} + if(Test-UserApproval $null $transaction) {throw 'Missing acknowledgement accepted'} + $goodAck.candidateSha='c'*40 + if(Test-UserApproval $goodAck $transaction) {throw 'Different release acknowledgement accepted'} + $goodAck.candidateSha='a'*40 + $goodAck.previousSha='c'*40 + if(Test-UserApproval $goodAck $transaction) {throw 'Different baseline acknowledgement accepted'} + $goodAck.previousSha='b'*40 + $goodAck.candidateTag='v0.5.0-alpha.7' + if(Test-UserApproval $goodAck $transaction) {throw 'Different version acknowledgement accepted'} + $transaction.operation='repair' + if(-not (Test-UserApproval $null $transaction)) {throw 'Same-version repair incorrectly gated'} + Write-Output 'ARSONMIX_UPDATER_USER_ACK_POLICY_PASS' Write-Output 'ARSONMIX_UPDATER_EXACT_IMAGE_POLICY_PASS' Write-Output 'ARSONMIX_UPDATER_RETRY_POLICY_PASS' Write-Output 'ARSONMIX_UPDATER_CACHE_AND_RECOVERY_PASS' @@ -576,7 +669,7 @@ try { Write-State $state $headers=@{Accept='application/vnd.github+json';'User-Agent'='ArSonMix-SmartUpdater/1'; 'X-GitHub-Api-Version'='2022-11-28'} - $releases=Invoke-RestMethod -Uri $api -Headers $headers -TimeoutSec 25 + $releases=Read-PublishedReleases $headers $state.lastCheckUtc=[DateTime]::UtcNow.ToString('o') Write-State $state $current=$null @@ -665,15 +758,28 @@ try { $oldPath=Join-Path $stage $oldName # Validate both independently. Do not build nested arrays here: # PowerShell 5.1 pipeline unrolling can flatten the pair boundaries. - if(-not (Test-StagedAsset $newPath $state.newAsset) -or - -not (Test-StagedAsset $oldPath $state.previousAsset)) { + if(-not (Test-InstallableAssetPair $newPath $state.newAsset $oldPath $state.previousAsset)) { Fail 'Offline staged install/rollback bytes not verified' } + # A published upgrade must be acknowledged once by the user in the + # lightweight GUI prompt. A missing/stale/corrupt token defers installation, + # without breaking mixer startup or forcing an active audio session closed. + # Same-release binary repair is separate and does not require this consent. + if($state.operation -ceq 'upgrade') { + $approval=$null + if(Test-Path -LiteralPath $approvalPath -PathType Leaf) { + try {$approval=Read-Json $approvalPath} catch { } + } + if(-not (Test-UserApproval $approval $state)) { + Log-Result 'UPDATE_WAITING_FOR_USER_OK' + exit 0 + } + } # Re-query public release to reject a revoked or replaced candidate. # No network is needed *during* live audio; if offline on close, defer. $headers=@{Accept='application/vnd.github+json';'User-Agent'='ArSonMix-SmartUpdater/1'; 'X-GitHub-Api-Version'='2022-11-28'} - $liveReleases=Invoke-RestMethod -Uri $api -Headers $headers -TimeoutSec 25 + $liveReleases=Read-PublishedReleases $headers $approved=$null $approvedOld=$null foreach($release in $liveReleases) { @@ -729,6 +835,12 @@ try { finally {$process.Dispose()} } if((Read-Json $provenance).sourceCommit -cne $installedSha) {Log-Result 'DEFER_VERSION_CHANGED';exit 0} + # Reverify after GitHub re-query and process-exit waiting, immediately + # before Inno touches installed files. Old rollback bytes are included. + if(-not (Test-InstallableAssetPair $newPath $state.newAsset $oldPath $state.previousAsset)) { + Log-Result 'INSTALLER_BYTES_CHANGED_UPDATE_DEFERRED' + exit 0 + } $state.phase='installing' $state.installAttempts=[int]$state.installAttempts+1 Write-State $state @@ -744,6 +856,7 @@ try { $state.blockedTag='' Write-State $state Log-Result ($(if($state.operation -ceq 'repair'){'REPAIRED '}else{'HEALTHY '})+$new.tag_name) + Remove-Item -LiteralPath $approvalPath -Force -ErrorAction SilentlyContinue Clear-StagedVendorFiles $state exit 0 } @@ -755,9 +868,9 @@ try { $state.retryAfterUtc=[DateTime]::UtcNow.AddMinutes(30).ToString('o') Write-State $state Log-Result ('INSTALLER_TRANSIENT_FAILURE_RETRY_NEXT_EXIT '+$new.tag_name) - try {[Diagnostics.Process]::Start($exe) | Out-Null} catch { - Log-Result 'PREVIOUS_EXE_RELAUNCH_FAILED' - } + # Do not surprise the operator by restarting audible audio after Quit. + # The previous verified EXE remains available on next deliberate launch. + Log-Result 'PREVIOUS_EXE_RETAINED_FOR_NEXT_MANUAL_LAUNCH' exit 0 } # An installer failure leaves the previous app intact or may be partial. @@ -770,7 +883,7 @@ try { Write-State $state if($actualSha -ceq $installedSha) { Log-Result ('INSTALLER_FAILED_PREVIOUS_VERSION_RETAINED '+$new.tag_name) - [Diagnostics.Process]::Start($exe) | Out-Null + # A failed post-exit update must not auto-start an audible mixer. exit 0 } foreach($process in [Diagnostics.Process]::GetProcessesByName('ArSonMix')) { @@ -787,12 +900,15 @@ try { } # Roll back by running the previously authenticated Inno installer, # not by copying arbitrary stale binaries over an installed application. + if(-not (Test-StagedAsset $oldPath $oldAsset)){ + Fail 'Rollback installer modified after verified stage' + } if(Run-Installer $oldPath) { if(Test-InstalledRelease $installedSha) { $state.phase='rolled-back' Write-State $state Log-Result ('ROLLED_BACK '+$new.tag_name) - [Diagnostics.Process]::Start($exe) | Out-Null + # Restored version is ready for the next deliberate user launch. exit 0 } } diff --git a/site/preview-v2/index.html b/site/preview-v2/index.html index 2a1058a83..eed76a44b 100644 --- a/site/preview-v2/index.html +++ b/site/preview-v2/index.html @@ -414,6 +414,8 @@ // Invalid/canceled operations never touch selection. const accepted=ops.filter(op=>['CONNECT','ROUTE_ONLY','RETARGET'].includes(op.type)).at(-1); if(accepted){ + if(String(accepted.sourceId)===wireRetractOverlay?.dataset.wireRetract) + stopWireRetraction(); const committed=accepted.edgeId!=null? wireEdges.find(e=>e.enabled&&e.id===accepted.edgeId&&e.destId===accepted.destId): wireEdges.find(e=>e.enabled&&e.sourceId===accepted.sourceId&&e.destId===accepted.destId); @@ -478,7 +480,7 @@ if(type==='CONNECT')op.mode=source.wireTapMode==='split'?'split':'send'; const ok=wireGraphCommit([op]); closeRouteChoice();if(!ok)return false; - render();kickWireSpring(source.id,dest.id); + render();selectTrack(source);kickWireSpring(source.id,dest.id); say(source.name+' → '+dest.name+' · '+(kind==='only'?'ROUTE ONLY':'PARALLEL SEND')+' · reference only'); return true; } @@ -512,7 +514,8 @@ {type:'RETARGET',sourceId,edgeId:edge.id,destId:nextDestId}; if(!wireGraphCommit([op],{record:false}))return false; wireAnchorId=nextDestId;render(); - if(nextDestId!==null&&nextDestId!==master.id)kickWireSpring(sourceId,nextDestId); + // A receiver relocation must kick AFTER its new source-focused SVG exists. + // The pointerup coordinator owns that visual effect, not graph admission. say('WIRE '+(nextDestId===null?'unplugged':'replugged')+' · edge '+edge.id+' · reference only'); return true; } @@ -993,36 +996,39 @@ wireMotionGeometry.set(key,[x0,y0,x1,y1,limit]); return wirePathData(x0,y0,x1,y1,limit,wireMotion.key===key?wireMotion.offset:0); } -/* V61 real cable whip: a short upward flick at the receiving IN socket, - travelling back toward the OUT plug with a damped sinusoidal tail. - Physical plugs stay welded; amplitude and oscillation decay toward OUT. - Only a committed/retargeted cable animates, for a bounded half-second. */ -const WIRE_IMPACT_TRAVEL_MS=330,WIRE_IMPACT_SETTLE_MS=170; +/* V62 damped cable whip: receiving IN flicks upward first, then the sine + travels toward OUT at a readable tempo with much stronger end damping. + No background oscillator, no per-frame DOM rebuild, both plugs stay fixed. */ +const WIRE_IMPACT_TRAVEL_MS=520,WIRE_IMPACT_SETTLE_MS=160; const WIRE_IMPACT_DURATION_MS=WIRE_IMPACT_TRAVEL_MS+WIRE_IMPACT_SETTLE_MS; function wireImpactPathData(x0,y0,x1,y1,limit,elapsedMs){ - const span=Math.abs(x1-x0),ceiling=Math.max(12,Math.min(100,Number(limit)||72)); + const span=Math.abs(x1-x0),chord=Math.hypot(x1-x0,y1-y0); + const ceiling=Math.max(12,Math.min(100,Number(limit)||72)); const sag=Math.max(10,Math.min(ceiling,Math.min(ceiling-5,28+Math.sqrt(span)*1.55))); const c=sag*4/3; - const u=Math.max(0,Math.min(1,elapsedMs/WIRE_IMPACT_TRAVEL_MS)); - // Physical launch occurs at the IN end (t=1), never at OUT (t=0). - // Ease-out front makes the receiving plug flick briskly, rather than creep. - const front=1-Math.pow(1-u,1.55); - const settle=Math.max(0,Math.min(1,(elapsedMs-WIRE_IMPACT_TRAVEL_MS)/WIRE_IMPACT_SETTLE_MS)); + // A short physical patch cable has little slack: scale its displacement, + // number of visible lobes AND propagation time, continuously with length. + // Long cables preserve the user-approved V62 520ms whip and end damping. + const length01=Math.max(0,Math.min(1,(chord-95)/300)); + const longMix=length01*length01*(3-2*length01); + const travel=360+160*longMix; + const width=.65-.29*longMix; // broad single curl at short distances + const u=Math.max(0,Math.min(1,elapsedMs/travel)); + const front=1-Math.pow(1-u,1.45); + const settle=Math.max(0,Math.min(1,(elapsedMs-travel)/WIRE_IMPACT_SETTLE_MS)); const fade=Math.pow(1-settle,2); - const strength=Math.min(22,Math.max(14,Math.sqrt(span)*1.6))*fade; + const amplitude=Math.min(22,Math.max(14,Math.sqrt(span)*1.6))* + (.27+.73*longMix)*fade; let d='M '+x0.toFixed(1)+' '+y0.toFixed(1); for(let i=1;i<=64;i++){ const t=i/64,v=1-t; const x=v*v*v*x0+3*v*v*t*x0+3*v*t*t*x1+t*t*t*x1; const y=v*v*v*y0+3*v*v*t*(y0+c)+3*v*t*t*(y1+c)+t*t*t*y1; - const distance=1-t; // distance travelled from IN toward OUT - const passed=front-distance; // material behind the advancing wavefront + const distance=1-t,passed=front-distance; const tether=Math.min(1,t/.025,(1-t)/.025); - // Finite causal travelling sine: first lobe moves UP at the IN socket, - // trailing lobes alternate and decay over time AND along cable length. const wave=passed>0? - -strength*Math.sin(2*Math.PI*passed/.34)* - Math.exp(-2.2*passed-1.35*distance)*tether:0; + -amplitude*Math.sin(2*Math.PI*passed/width)* + Math.exp(-2.1*passed-2.9*distance)*tether:0; d+=' L '+x.toFixed(1)+' '+(y+wave).toFixed(1); } return d; @@ -1056,6 +1062,135 @@ paint(wireImpactPathData(...geometry,0)); requestAnimationFrame(step); } +/* V62 physically unplugged WIRE: graph REMOVE happens first, then a + noninteractive cable jacket falls and reels back to its real OUT jack. + Own overlay SVG is independent of the canonical routing/PCM projection. + A canceled drag cannot call this effect. Reduced-motion skips it. */ +/* V64 unplug/reel: the OUT socket is the ONLY impulse source. + Unplug removes routing immediately; this detached SVG is visual only. + The free plug is pulled straight home while a damped traveling sine + starts at OUT and crosses the shortening, naturally slack cable. + No falling, hanging pause, constant wobble or phantom input edge. */ +/* V65 fast elastic cable reel. OUT is the sole impulse source. + Single visual-only transient, no synthetic route or native DSP mutation. + The travelling wave spans the shrinking jacket and the detached plug + is a FREE end: it moves with the final wave rather than being pinned. */ +/* V66 fast, lively elastic recoil: OUT stays fixed while a travelling + whip reaches the entire shrinking cable. The disconnected dot is free: + a damped tip response makes it wobble rather than ride a rigid chord. + Visual-only; graph REMOVE always commits before this animation exists. */ +const WIRE_RETRACT_MS=330; +let wireRetractToken=0,wireRetractOverlay=null; +function stopWireRetraction(){ + ++wireRetractToken; + wireRetractOverlay?.remove();wireRetractOverlay=null; +} +function wireRetractPose(x0,y0,rx,ry,elapsedMs){ + const p=Math.max(0,Math.min(1,elapsedMs/WIRE_RETRACT_MS)); + // Fast pull from the first frame, no preceding fall/hang/idle phase. + const remaining=Math.pow(1-p,2.65); + const x=x0+(rx-x0)*remaining,y=y0+(ry-y0)*remaining; + const chord=Math.hypot(rx-x0,ry-y0); + const length01=Math.max(0,Math.min(1,(chord-90)/270)); + const longMix=length01*length01*(3-2*length01); + // Front originates at OUT and reaches the loose tip early enough that + // the tip can swing repeatedly BEFORE the wire disappears. + const front=1.42*(1-Math.pow(1-Math.min(1,p/.40),1.35)); + const catchUp=Math.max(0,Math.min(1,(front-.78)/.30)); + const width=.59-.24*longMix; + const sag=Math.min(44,Math.max(10,Math.sqrt(chord)*2.1))* + Math.pow(remaining,.78); + const amplitude=Math.min(32,Math.max(14,Math.sqrt(chord)*1.5))* + (.46+.54*longMix)*Math.pow(remaining,.29)* + Math.min(1,p/.07)*Math.min(1,chord*remaining/55); + const recoil=amplitude*.13*catchUp* + Math.sin(2*Math.PI*Math.max(0,p-.19)/.26); + return {p,x,y,remaining,sag,front,catchUp,width,amplitude,recoil,phase:'reel'}; +} +function wireRetractWave(pose,t){ + const passed=pose.front-t; + const travelling=passed>0? + -Math.sin(2*Math.PI*passed/pose.width)* + Math.exp(-.77*passed-.35*t):0; + // The travelling pulse excites an inertial after-swing at the FREE tip. + // Its influence smoothly increases toward that end, without moving OUT. + const lag=Math.max(0,pose.p-.19); + const tipSwing=1.15*pose.catchUp*Math.sin(2*Math.PI*lag/.26)* + Math.exp(-1.25*lag)*Math.pow(t,1.65); + return pose.amplitude*Math.min(1,t/.04)*(travelling+tipSwing); +} +function wireRetractPathData(x0,y0,rx,ry,elapsedMs){ + const pose=wireRetractPose(x0,y0,rx,ry,elapsedMs); + const dx=pose.x-x0,dy=pose.y-y0; + const norm=Math.max(1,Math.hypot(dx,dy)); + const nx=-dy/norm,ny=dx/norm,tx=dx/norm,ty=dy/norm; + let d='M '+x0.toFixed(1)+' '+y0.toFixed(1); + for(let i=1;i<=64;i++){ + const t=i/64; + const wave=wireRetractWave(pose,t); + const surge=pose.recoil*t*t; + const x=x0+dx*t+nx*wave+tx*surge; + const y=y0+dy*t+pose.sag*Math.sin(Math.PI*t)+ny*wave+ty*surge; + d+=' L '+x.toFixed(1)+' '+y.toFixed(1); + } + const endWave=wireRetractWave(pose,1); + return {d,pose:{...pose, + tipX:pose.x+nx*endWave+tx*pose.recoil, + tipY:pose.y+ny*endWave+ty*pose.recoil}}; +} +function startWireRetraction(sourceId,releasePoint){ + stopWireRetraction(); + if(document.hidden||window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches)return; + const viewport=document.getElementById('viewport'); + const out=viewport?.querySelector('.strip[data-id="'+sourceId+'"] .wire-node-out'); + const source=wireSourceTrack(sourceId),vp=viewport?.getBoundingClientRect?.(); + const jack=wireJackRect(out); + if(!source||!vp?.width||!vp.height||!jack?.width||!releasePoint)return; + const x0=jack.left-vp.left+jack.width*.5,y0=jack.top-vp.top+jack.height*.5; + const rx=Math.max(2,Math.min(vp.width-2,releasePoint.x-vp.left)); + const ry=Math.max(2,Math.min(vp.height-2,releasePoint.y-vp.top)); + const svgNS='http://www.w3.org/2000/svg'; + const svg=document.createElementNS(svgNS,'svg'); + svg.id='wireRetractLayer';svg.classList.add('routing-wire-overlay'); + svg.dataset.wireRetract=String(sourceId); + svg.setAttribute('viewBox','0 0 '+vp.width+' '+vp.height); + svg.style.clipPath='none'; + svg.style.pointerEvents='none';svg.style.zIndex='4';svg.style.filter='none'; + const mk=(tag,attrs)=>{ + const el=document.createElementNS(svgNS,tag); + for(const [key,value] of Object.entries(attrs))el.setAttribute(key,String(value)); + svg.appendChild(el);return el; + }; + const shadow=mk('path',{'data-wire-retract-shadow':'true',fill:'none', + stroke:'#07151a','stroke-width':5.4,'stroke-linecap':'round',opacity:.5}); + const jacket=mk('path',{'data-wire-retract-jacket':'true',fill:'none', + stroke:source.color||'#8be0ff','stroke-width':3.45, + 'stroke-linecap':'round',opacity:.96}); + const plug=mk('circle',{'data-wire-retract-plug':'true',fill:source.color||'#8be0ff', + stroke:'#102b36','stroke-width':1.2,r:5.2}); + viewport.appendChild(svg);wireRetractOverlay=svg; + const token=wireRetractToken; + let began=null; + function step(now){ + if(token!==wireRetractToken||!svg.isConnected)return; + if(document.hidden||window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches){ + stopWireRetraction();return; + } + if(began===null)began=now; + const elapsed=Math.min(WIRE_RETRACT_MS,Math.max(0,now-began)); + const shape=wireRetractPathData(x0,y0,rx,ry,elapsed); + svg.dataset.wirePhase=shape.pose.phase; + shadow.setAttribute('d',shape.d);jacket.setAttribute('d',shape.d); + // Visual plug follows the same free endpoint as the final SVG sample. + plug.setAttribute('cx',shape.pose.tipX.toFixed(1)); + plug.setAttribute('cy',shape.pose.tipY.toFixed(1)); + plug.setAttribute('r',Math.max(0,5.8*Math.pow(shape.pose.remaining,.48)).toFixed(2)); + if(elapsed(lab.getProperty("nativeChannelIdPcmActive",false)) || - logicalMixer_.loaded()) { + if (!updaterProbeMode_ && + (static_cast(lab.getProperty("nativeChannelIdPcmActive",false)) || + logicalMixer_.loaded())) { const auto error=saveMixerSession(resumeMain); if(error.isNotEmpty()) diagnostics_.record("DYNAMIC_MIXER_EXIT_SAVE_REJECTED",error); @@ -525,6 +540,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr juce::uint32 webViewStartupTick_ = 0; juce::uint32 guiReadyTick_ = 0; bool audioEngineStarted_ = false; + const bool updaterProbeMode_ = isAutoUpdateHealthProbe(); bool setupLaunching_ = false; unsigned int timerTicks_ = 0; // Opt-in and bounded: message-thread timing only, NEVER the audio callback. @@ -6824,8 +6840,9 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr #if defined(_WIN32) // A startup splash can delay HWND creation; attach once the real JUCE // peer exists. Never install a low-level keyboard hook. - if(auto* peer=getPeer()) - hotkeys_.attach(peer->getNativeHandle()); + if (!updaterProbeMode_) + if(auto* peer=getPeer()) + hotkeys_.attach(peer->getNativeHandle()); #endif if(deviceApply_.busy())return; // a vendor modal loop may re-enter JUCE // Always disabled unless the user explicitly starts a bounded trace. @@ -6865,10 +6882,15 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr diagnostics_.record ("WEBVIEW2_GUI_READY_TIMEOUT", "No native ArSonMix UI handshake"); engine_.stop(); if (onStartupStage_) onStartupStage_ (3); // dismiss splash before error dialog - showWebViewStartupError ("The embedded mixer did not initialize in 10 seconds." - " Check the WebView2 Runtime and browser-cache folder permissions."); + if (!updaterProbeMode_) + showWebViewStartupError ("The embedded mixer did not initialize in 10 seconds." + " Check the WebView2 Runtime and browser-cache folder permissions."); return; } + // Health probes verify WebView/native readiness without opening any + // audio device, restoring plugins or writing a replacement .smix. + if (updaterProbeMode_ && audioEngineStarted_) + return; // First visible GUI frame must precede device discovery. Reuse the // existing timer; never add a worker or poll the audio callback. if (!audioEngineStarted_) @@ -6877,6 +6899,12 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr juce::Time::getMillisecondCounter() - guiReadyTick_ < 150u) return; audioEngineStarted_ = true; + if (updaterProbeMode_) + { + diagnostics_.record ("UPDATER_GUI_PROBE", "Native bridge ready; device and session intentionally untouched"); + if (onStartupStage_) onStartupStage_ (2); + return; + } auto saved = juce::XmlDocument::parse ( machineSettingsDirectory().getChildFile ("audio-devices.xml")); startupError_ = engine_.start (saved.get()); @@ -7135,6 +7163,71 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr } }; +#if defined(_WIN32) +// A non-modal desktop notice: no JUCE modal loop, no loss of live mixer controls. +// The close X dismisses without consent; ONLY the OK action writes approval. +// Update installation remains strictly deferred until a normal mixer exit. +class ArSonMixUpdateNotice final : public juce::DocumentWindow +{ +public: + ArSonMixUpdateNotice (const juce::String& tag, std::function onAccept) + : DocumentWindow ("ArSonMix · Update", juce::Colour (0xff141d27), closeButton), + onAccept_ (std::move (onAccept)) + { + panel_.message = "Version " + tag + " is ready.\n" + "It will install automatically after you close ArSonMix.\n" + "Your session and audio will not be interrupted."; + panel_.ok.onClick = [this] + { + // Never say OK succeeded when the per-user approval file is + // unreadable/unwritable: leave this NON-modal window available + // for a retry without interrupting audio. + if (onAccept_ && onAccept_()) + { + setVisible (false); + return; + } + panel_.message = "Could not save update approval.\n" + "Your mixer remains available.\n" + "Check disk permissions, then choose Retry."; + panel_.ok.setButtonText ("Retry"); + panel_.repaint(); + }; + setUsingNativeTitleBar (false); + setTitleBarHeight (31); + setResizable (false, false); + setContentNonOwned (&panel_, false); + centreWithSize (428, 185); + setVisible (true); + toFront (true); + } + void closeButtonPressed() override { setVisible (false); } + +private: + struct Panel final : juce::Component + { + juce::String message; + juce::TextButton ok {"OK"}; + Panel() + { + addAndMakeVisible (ok); + ok.setColour (juce::TextButton::buttonColourId, juce::Colour (0xff377bc7)); + ok.setColour (juce::TextButton::textColourOffId, juce::Colours::white); + } + void resized() override { ok.setBounds (getWidth() - 106, getHeight() - 43, 88, 29); } + void paint (juce::Graphics& g) override + { + g.fillAll (juce::Colour (0xff141d27)); + g.setColour (juce::Colour (0xffe5edf7)); + g.setFont (juce::Font (juce::FontOptions (14.0f))); + g.drawFittedText (message, 20, 15, getWidth() - 40, getHeight() - 69, + juce::Justification::topLeft, 3); + } + } panel_; + std::function onAccept_; +}; +#endif + class ConsoleApp final : public juce::JUCEApplication, private juce::Timer { public: @@ -7165,7 +7258,8 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer #endif // Paint the approved dark native splash BEFORE browser cache I/O, // WebView2 initialization, device scan or native console construction. - splash_ = std::make_unique(); + if (!isAutoUpdateHealthProbe()) + splash_ = std::make_unique(); startTimer (90); // one-shot handoff after Windows first paint } void timerCallback() override @@ -7182,7 +7276,24 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer } #endif if (startupAttempted_) + { +#if defined(_WIN32) + if (isAutoUpdateHealthProbe()) + { + // Give the supervisor time to observe GUI_READY_NO_AUDIO, + // then quit by JUCE's ordinary message-thread teardown. + if (updateProbeCompleteTick_ != 0 && + juce::Time::getMillisecondCounter() - updateProbeCompleteTick_ >= 3500u) + { + systemRequestedQuit(); + return; + } + } + else if (++updatePromptTicks_ % 40 == 0) + serviceSmartUpdateAcknowledgement(); +#endif return; + } startupAttempted_ = true; // Remain active only as a lightweight update handshake (4 Hz). // Do not touch audio-device selection, callback, or GUI geometry. @@ -7191,12 +7302,25 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer if (!folder.createDirectory().wasOk() && !folder.isDirectory()) { splash_.reset(); + // The updater's GUI-only validation must never strand an invisible + // error dialog. Return control to the supervisor, which will keep + // the authenticated rollback installer available. + if (isAutoUpdateHealthProbe()) + { + systemRequestedQuit(); + return; + } showWebViewStartupError ("Cannot create the browser-cache folder: " + folder.getFullPathName()); return; } if (!juce::WebBrowserComponent::areOptionsSupported (webViewOptions())) { splash_.reset(); + if (isAutoUpdateHealthProbe()) + { + systemRequestedQuit(); + return; + } showWebViewStartupError ("The native browser backend could not be initialized on this machine."); return; } @@ -7223,16 +7347,23 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer .getChildFile ("health"); if (healthDir.createDirectory().wasOk()) healthDir.getChildFile (probe + ".ready") - .replaceWithText ("GUI_READY"); + .replaceWithText ("GUI_READY_NO_AUDIO"); } #endif - if (window_) window_->toFront (true); + if (isAutoUpdateHealthProbe()) + { + if (window_) window_->setVisible (false); + updateProbeCompleteTick_ = juce::Time::getMillisecondCounter(); + } + else if (window_) + window_->toFront (true); } }); #if defined(_WIN32) - launchSmartUpdater (false); + if (!isAutoUpdateHealthProbe()) + launchSmartUpdater (false); #endif // Opaque cover exactly matches the large HWND, not a small 740×420 // card leaving white WebView2 edges exposed during first paint. @@ -7245,6 +7376,9 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer void shutdown() override { stopTimer(); +#if defined(_WIN32) + updateNotice_.reset(); +#endif window_.reset(); splash_.reset(); #if defined(_WIN32) @@ -7256,7 +7390,8 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer // Avoid starting setup while Windows is signing out/shutting down: // Windows may terminate installer midway through file replacement. // A staged transaction remains available on the next normal exit. - if (!innoIsClosing && ::GetSystemMetrics (SM_SHUTTINGDOWN) == 0) + if (!innoIsClosing && !isAutoUpdateHealthProbe() && + ::GetSystemMetrics (SM_SHUTTINGDOWN) == 0) launchSmartUpdater (true); if (installerShutdownEvent_ != nullptr) { @@ -7272,6 +7407,64 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer } private: #if defined(_WIN32) + void serviceSmartUpdateAcknowledgement() + { + // The separately running updater has already staged and SHA-checked + // both packages. Never claim a prompt can validate publisher identity. + if (!window_) + return; + const auto local = juce::SystemStats::getEnvironmentVariable ("LOCALAPPDATA", {}); + if (local.isEmpty()) + return; + const auto folder = juce::File (local).getChildFile ("ArSonMix") + .getChildFile ("Updates"); + const auto stateFile = folder.getChildFile ("state.json"); + if (!stateFile.existsAsFile() || stateFile.getSize() > 8192) + return; + const auto state = juce::JSON::parse (stateFile.loadFileAsString()); + const auto* object = state.getDynamicObject(); + if (object == nullptr || object->getProperty ("phase").toString() != "staged" + || object->getProperty ("operation").toString() != "upgrade") + return; + const auto tag = object->getProperty ("candidateTag").toString(); + const auto candidate = object->getProperty ("candidateSha").toString(); + const auto previous = object->getProperty ("previousSha").toString(); + if (tag.length() > 60 || !tag.startsWith ("v") + || candidate.length() != 40 || previous.length() != 40 + || !candidate.containsOnly ("0123456789abcdef") + || !previous.containsOnly ("0123456789abcdef")) + return; + const auto approvalFile = folder.getChildFile ("approved.json"); + if (approvalFile.existsAsFile() && approvalFile.getSize() <= 2048) + { + const auto saved = juce::JSON::parse (approvalFile.loadFileAsString()); + if (const auto* ack = saved.getDynamicObject()) + if (ack->getProperty ("candidateTag").toString() == tag + && ack->getProperty ("candidateSha").toString() == candidate + && ack->getProperty ("previousSha").toString() == previous) + return; // Already acknowledged; no repeat dialog. + } + if (lastUpdatePromptedSha_ == candidate) + return; // Never nag during one mixer session. + if (updateNotice_ && updateNotice_->isVisible()) + return; // Do not open another notice over a currently visible one. + lastUpdatePromptedSha_ = candidate; + // The approved user need not see download progress or installer flags. + // Unlike NativeMessageBox::showAsync, this floating notice is NON-modal: + // a performer can still move faders or patch WIRE during a live session. + updateNotice_ = std::make_unique (tag, + [approvalFile, tag, candidate, previous] + { + auto approval = juce::DynamicObject::Ptr (new juce::DynamicObject()); + approval->setProperty ("candidateTag", tag); + approval->setProperty ("candidateSha", candidate); + approval->setProperty ("previousSha", previous); + // A usability acknowledgement only. PowerShell verifies the + // published release, both installer hashes and process locks. + return approvalFile.replaceWithText ( + juce::JSON::toString (juce::var (approval.get()), false)); + }); + } void launchSmartUpdater (bool applyStaged) { // Windows per-user installation only: independent updater process. @@ -7309,6 +7502,10 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer #if defined(_WIN32) HANDLE updateRunningMutex_ = nullptr; HANDLE installerShutdownEvent_ = nullptr; + int updatePromptTicks_ = 0; + std::unique_ptr updateNotice_; + juce::uint32 updateProbeCompleteTick_ = 0; + juce::String lastUpdatePromptedSha_; #endif std::unique_ptr splash_; std::unique_ptr window_; diff --git a/tests/approved_native_wire_gain_smoke.py b/tests/approved_native_wire_gain_smoke.py index 3bd2071bb..40fb13200 100644 --- a/tests/approved_native_wire_gain_smoke.py +++ b/tests/approved_native_wire_gain_smoke.py @@ -287,7 +287,12 @@ def main(): page.wait_for_function("()=>window.__nativeIntents.length===2") assert page.evaluate("()=>window.__heldWireInput===document.querySelector('#tracks .strip[data-id=\"2\"] .wire-gain')"), "ACK detached held gain control" latest = page.evaluate("()=>window.__nativeIntents.at(-1)") - assert abs(latest["payload"]["gainLinear"] - .001) < 1e-8 + # Native SOF/WIRE policy defines the bottom -60 dB + # detent as -infinity/silence (linear zero), not 0.001. + # The exact SEND EdgeId is retained; this is a scalar + # mute-level gain, NEVER a graph REMOVE/disconnect. + assert latest["payload"]["gainLinear"] == 0, latest + assert latest["payload"]["edgeId"] == SEND, latest state["graph"]["edges"][1]["gainLinear"] = latest["payload"]["gainLinear"] ack(page, state, latest) emit(page, "arMixConsoleSnapshot", state) diff --git a/tests/pages_v60_fader_wire_tactile_smoke.py b/tests/pages_v60_fader_wire_tactile_smoke.py index 757e2e758..20d4a6ad1 100644 --- a/tests/pages_v60_fader_wire_tactile_smoke.py +++ b/tests/pages_v60_fader_wire_tactile_smoke.py @@ -22,8 +22,22 @@ def source_contract(): for text in ("FADER_UNITY_CAPTURE_PX=7,FADER_UNITY_RELEASE_PX=12", "gesture.unityLatched=true", "if(!ev.altKey&&Math.abs", "handleField({target:g.input,type:'change'", - "WIRE_IMPACT_TRAVEL_MS=330,WIRE_IMPACT_SETTLE_MS=170", - "const distance=1-t; // distance travelled from IN toward OUT", + "WIRE_IMPACT_TRAVEL_MS=520,WIRE_IMPACT_SETTLE_MS=160", + "const WIRE_RETRACT_MS=330", + "const tipSwing=1.15*pose.catchUp", + "const recoil=amplitude*.13*catchUp", + "function wireRetractPose(x0,y0,rx,ry,elapsedMs)", + "function wireRetractWave(pose,t)", + "function wireRetractPathData(x0,y0,rx,ry,elapsedMs)", + "const endWave=wireRetractWave(pose,1)", + "plug.setAttribute('cy',shape.pose.tipY.toFixed(1))", + "const passed=pose.front-t;", + "svg.style.clipPath='none'", + "const width=.65-.29*longMix", + "const length01=Math.max(0,Math.min(1,(chord-95)/300))", + "function startWireRetraction(sourceId,releasePoint)", + "if(replugRequest)kickWireSpring(replugRequest.sourceId,replugRequest.destId)", + "const distance=1-t,passed=front-distance;", "const wave=passed>0?", "const accepted=ops.filter(op=>['CONNECT','ROUTE_ONLY','RETARGET'].includes(op.type)).at(-1)", "wire-drag-line is-wire-selected", @@ -177,9 +191,13 @@ def test_wire(page): samples=page.evaluate("window.__v60WireSamples") # Deterministic physical direction: first visible UP kick near IN, # OUT remains quiet initially; then the decayed crest reaches near OUT. - physics=page.evaluate("""()=>{ - const g=wireMotionGeometry.get('1-3'); - if(!g)return null; + # Canonical Pages GUI intentionally encapsulates its lexical graph. + # Probe the exact checked-in motion function without exposing a runtime + # debug global or duplicating the production renderer. + motion=HTML[HTML.index("const WIRE_IMPACT_TRAVEL_MS="): + HTML.index("function kickWireSpring(")] + physics=page.evaluate("()=>{\n"+motion+"""\n + const g=[0,0,500,0,72]; // approved long wire with anchored plugs const [x0,y0,x1,y1,limit]=g; const span=Math.abs(x1-x0),ceiling=Math.max(12,Math.min(100,Number(limit)||72)); const sag=Math.max(10,Math.min(ceiling,Math.min(ceiling-5,28+Math.sqrt(span)*1.55))); @@ -188,20 +206,44 @@ def test_wire(page): const v=1-t; return v*v*v*y0+3*v*v*t*(y0+c)+3*v*t*t*(y1+c)+t*t*t*y1; }; + // Same production physics for short and long spans; measure the + // maximum deformation against the natural slack cable at each length. + const peak=span=>{ + const geom=[0,0,span,0,72]; + const sag=Math.max(10,Math.min(72,Math.min(67,28+Math.sqrt(span)*1.55))); + const ctrl=sag*4/3; + let max=0; + for(const ms of [45,85,150,230,300,390,460,520]){ + const pts=wireImpactPathData(...geom,ms).match(/-?\\d+(?:\\.\\d+)?/g).map(Number); + for(let i=1;i<64;i++){ + const t=i/64,v=1-t; + const y=3*v*v*t*ctrl+3*v*t*t*ctrl; + max=Math.max(max,Math.abs(pts[2*i+1]-y)); + } + } + return max; + }; const displaced=(ms,i)=>{ const points=wireImpactPathData(...g,ms).match(/-?\\d+(?:\\.\\d+)?/g).map(Number); return points[2*i+1]-baseline(i/64); }; return { nearInEarly:displaced(45,60),nearOutEarly:displaced(45,10), - nearOutLate:displaced(270,10), - pluggedOut:displaced(0,0),pluggedIn:displaced(45,64) + nearOutLate:displaced(420,10), + pluggedOut:displaced(0,0),pluggedIn:displaced(45,64), + tinyPeak:peak(70),shortPeak:peak(170),longPeak:peak(500) }; }""") assert physics and physics["nearInEarly"]< -2.5,("no upward jerk at receiving IN",physics) assert abs(physics["nearOutEarly"])<.5,("wrong direction: OUT moves first",physics) - assert physics["nearOutLate"]< -1.2,("wave stops before OUT",physics) + assert physics["nearOutLate"]< -1.1,("wave stops before OUT",physics) + assert abs(physics["nearOutLate"])=5,("no finite spring movement",len(samples)) assert any(" L " in x["d"] for x in samples),("no cable impact",len(samples)) settled=cable.get_attribute("d") @@ -219,7 +261,7 @@ def test_wire(page): hit=page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-3"]') assert hit.count()==1 # The newly plugged edge is selected immediately, before the user clicks it. - assert page.locator('#wireLayer path.wire-outgoing-line[data-from="1"][data-to="3"].is-wire-selected').count()==1 + assert page.locator('#wireLayer path.wire-outgoing-line[data-from="1"][data-to="3"].is-wire-selected,#wireLayer path.wire-incoming-line[data-from="1"][data-to="3"].is-wire-selected').count()==1 initial_edge=hit.get_attribute("data-edge-id") mid=point_at_midpoint(hit) page.mouse.click(mid["x"],mid["y"]) @@ -262,6 +304,142 @@ def test_wire(page): page.evaluate("window.__v60Observer.disconnect()") + +def test_replug_and_retract(page): + # All actions are real pointer gestures on the preview mixer. Neither the + # retract overlay nor a wave can create a second graph EdgeId. + src=page.locator('#tracks .strip[data-id="1"] .wire-node-out') + old=page.locator('#tracks .strip[data-id="4"] .wire-node-in') + dst=page.locator('#tracks .strip[data-id="5"] .wire-node-in') + assert src.count()==old.count()==dst.count()==1,"need visible channels in wide bank" + old_edge=page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-4"]') + original_id=old_edge.get_attribute("data-edge-id") + assert original_id + page.evaluate("""()=>{ + window.__v62Relink=[]; + const wire=document.querySelector('#wireLayer'); + window.__v62Obs=new MutationObserver(records=>{ + for(const rec of records){ + const el=rec.target; + if(el.matches?.('path.wire-outgoing-line[data-cable-key="1-5"],path.wire-incoming-line[data-cable-key="1-5"]')) + window.__v62Relink.push(el.getAttribute('d')); + } + }); + window.__v62Obs.observe(wire,{subtree:true,attributes:true,attributeFilter:['d']}); + }""") + a=old.bounding_box() + b=dst.bounding_box() + cx=lambda q:q["x"]+q["width"]/2 + cy=lambda q:q["y"]+q["height"]/2 + page.mouse.move(cx(a),cy(a));page.mouse.down() + page.mouse.move(cx(b),cy(b),steps=12);page.mouse.up() + new_edge=page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-5"]') + assert new_edge.count()==1 and new_edge.get_attribute("data-edge-id")==original_id,\ + "Retarget must preserve the exact selected committed EdgeId" + assert page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-4"]').count()==0 + page.wait_for_timeout(850) + waves=page.evaluate("window.__v62Relink") + assert len(waves)>=5 and any(" L " in d for d in waves),\ + ("replug did not trigger newly rendered WIRE wavy",waves[:2]) + new_jacket=page.locator('#wireLayer path.wire-outgoing-line[data-cable-key="1-5"],#wireLayer path.wire-incoming-line[data-cable-key="1-5"]').first + assert " C " in new_jacket.get_attribute("d"),"replug must settle to canonical cubic" + + # Observe the actual detached SVG during an accepted pointer unplug. + # A 330ms reel MUST be measured with RAF/DOM evidence, not a sequence + # of slow locator reads that might miss a fast short-lived animation. + page.evaluate("""()=>{ + window.__v66ReelFrames=[]; + window.__v66ReelObserver=new MutationObserver(()=>{ + const layer=document.querySelector('#wireRetractLayer'); + const plug=layer?.querySelector('[data-wire-retract-plug]'); + const jacket=layer?.querySelector('[data-wire-retract-jacket]'); + if(!plug||!jacket)return; + const x=Number(plug.getAttribute('cx')),y=Number(plug.getAttribute('cy')); + if(Number.isFinite(x)&&Number.isFinite(y)) + window.__v66ReelFrames.push({x,y,r:Number(plug.getAttribute('r')), + phase:layer.dataset.wirePhase, + d:jacket.getAttribute('d')}); + }); + window.__v66ReelObserver.observe(document.getElementById('viewport'), + {childList:true,subtree:true,attributes:true,attributeFilter:['cx','cy','d']}); + }""") + other=page.locator('#tracks .strip[data-id="4"] .wire-node-in') + t=dst.bounding_box();q=other.bounding_box() + blank_x=(cx(t)+cx(q))/2 + blank_y=cy(t) + page.mouse.move(cx(t),cy(t));page.mouse.down() + page.mouse.move(blank_x,blank_y,steps=12);page.mouse.up() + assert page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-5"]').count()==0, \ + "unplug must REMOVE the graph edge immediately" + page.wait_for_timeout(450) + frames=page.evaluate("window.__v66ReelFrames") + source_x=cx(src.bounding_box()) + assert len(frames)>=6,("fast plug-out never animated in real browser",frames[:2]) + distances=[abs(item["x"]-source_x) for item in frames] + assert distances[0]>max(25,distances[-1]*2.5), \ + ("free plug did not reel briskly toward OUT",distances) + delta=max(item["y"] for item in frames)-min(item["y"] for item in frames) + assert delta>12,("plug dot did not visibly swing with the WIRE",delta) + assert frames[-1]["r"]{\n"+model+"""\n + const chord=400; + const deviation=(ms,i)=>{ + const {d,pose}=wireRetractPathData(0,0,chord,0,ms); + const ys=d.match(/-?\d+(?:\.\d+)?/g).map(Number); + const t=i/64; + return ys[2*i+1]-pose.sag*Math.sin(Math.PI*t); + }; + const early=wireRetractPathData(0,0,chord,0,50); + const middle=wireRetractPathData(0,0,chord,0,120); + const crest=wireRetractPathData(0,0,chord,0,135); + const finished=wireRetractPathData(0,0,chord,0,WIRE_RETRACT_MS); + const shortPose=wireRetractPose(0,0,80,0,95); + const longPose=wireRetractPose(0,0,chord,0,95); + const tip=ms=>wireRetractPathData(0,0,chord,0,ms).pose.tipY; + const svgTip=crest.d.match(/-?\d+(?:\.\d+)?/g).map(Number).slice(-2); + return { + nearOut:deviation(20,8),farEarly:deviation(20,51), + middleSwing:deviation(60,32),farSwing:deviation(80,48), + tipFirst:tip(100),tipRebound:tip(135), + sourceAnchor:deviation(135,0),earlyX:early.pose.x, + middleX:middle.pose.x,tipX:crest.pose.tipX, + tipY:crest.pose.tipY,svgTip, + completeX:finished.pose.tipX,completeY:finished.pose.tipY, + shortAmplitude:shortPose.amplitude,longAmplitude:longPose.amplitude, + startPhase:early.pose.phase,finishAmplitude:finished.pose.amplitude + }; + }""") + assert abs(physics["nearOut"])>3 and abs(physics["farEarly"])<.4, \ + ("impulse must start at OUT, not at the free plug",physics) + assert abs(physics["middleSwing"])>7 and abs(physics["farSwing"])>9, \ + ("wave fails to excite the entire shortening cable",physics) + assert abs(physics["tipFirst"])>10 and abs(physics["tipRebound"])>17, \ + ("dot/loose plug does not swing enough",physics) + assert physics["tipFirst"]*physics["tipRebound"]<0, \ + ("free dot must whip back in the opposite direction",physics) + assert abs(physics["sourceAnchor"])<.25,"source OUT socket cannot move" + assert 0 None: assert "6.5" in knob.get_attribute("value") or knob.input_value() == "6.5" # Double-click must use the same gain parameter path and restore unity. first.locator(".gain-dial").dblclick() - assert "+0.0 dB" in first.locator(".gain-readout").inner_text() + # The public formatter reserves '+' for strictly + # positive values; gain unity is displayed as 0.0 dB. + assert first.locator(".gain-readout").inner_text().strip() == "0.0 dB" assert knob.input_value() == "0" knob.evaluate("""el => { el.value = '6.5'; @@ -117,7 +119,20 @@ def run() -> None: # Rename the selected BUS in the native-style identity card. # SOF selection must follow its ID, not jump back to Bus A. - page.locator("#viewFilter").select_option("bus") + # VIEW & SELECTION was deliberately moved under the + # compact More menu. Exercise its visible operator path; + # do not force a hidden