Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

Diagnose protected V6 integrations GUI routing and fix asynchronous Windows NSIS uninstall verification

davoodmehraban89 committed Oct 18, 2026 at 06:32 UTC 7f80b49684fa1042c5edb017749ff3ee64d68db7
1 file changed +31 -4
.github/workflows/windows-v6-rebuilt-installed-gui-lab-once.yml
+31 -4
@@ -166,10 +166,30 @@ jobs:
166 const pages=async()=>{const r=await fetch('http://127.0.0.1:'+port+'/json/list',{signal:AbortSignal.timeout(1500)});return r.ok?r.json():[]};
167 const first=await wait(async()=>{const x=await pages();return x.find(y=>y.type==='page'&&y.url?.startsWith(base)&&y.webSocketDebuggerUrl)});
168 conn=await wsConnect(first.webSocketDebuggerUrl);
169 + report.stage='LOCAL_ENTRY';
170 + const initial=await conn.evalJs("({path:location.pathname,entry:[...document.querySelectorAll('a[href]')].some(a=>a.getAttribute('href')==='/dashboard')})").catch(()=>null);
171 + report.entryInitialLogin=initial?.path==='/login';
172 + report.entryLinkPresent=!!initial?.entry;
173 + if(initial?.path==='/login'&&initial.entry){
174 + await conn.evalJs("(()=>{const a=[...document.querySelectorAll('a[href]')].find(a=>a.getAttribute('href')==='/dashboard');if(a){a.click();return true}return false})()").catch(()=>null);
175 + await sleep(1500);
176 + }
177 report.stage='SQL_PAGE';
178 + const http=await fetch(base+'/integrations',{signal:AbortSignal.timeout(10000)}).catch(()=>null);
179 + report.sqlHttpStatus=http?.status||0;
180 await conn.call('Page.navigate',{url:base+'/integrations'}).catch(()=>null);
181 let last='';
172 - await wait(async()=>{const x=await pages();const p=x.find(z=>z.type==='page'&&z.url?.startsWith(base+'/integrations')&&z.webSocketDebuggerUrl);if(!p)return false;if(p.webSocketDebuggerUrl!==last){try{conn.ws.close()}catch{}conn=await wsConnect(p.webSocketDebuggerUrl);last=p.webSocketDebuggerUrl}return conn.evalJs("location.pathname==='/integrations'&&!!document.querySelector('textarea')&&document.body?.innerText.includes('اتصال به دیتابیس')")});
182 + await wait(async()=>{
183 + const x=await pages();
184 + if(x.some(z=>z.type==='page'&&z.url?.startsWith(base+'/login')))report.loginTargetSeen=true;
185 + const p=x.find(z=>z.type==='page'&&z.url?.startsWith(base+'/integrations')&&z.webSocketDebuggerUrl);
186 + if(p)report.integrationsTargetSeen=true;
187 + if(!p)return false;
188 + if(p.webSocketDebuggerUrl!==last){try{conn.ws.close()}catch{}conn=await wsConnect(p.webSocketDebuggerUrl);last=p.webSocketDebuggerUrl}
189 + const state=await conn.evalJs("({path:location.pathname,hasTextarea:!!document.querySelector('textarea')})");
190 + if(state?.path==='/integrations')report.integrationsDomSeen=true;
191 + return state?.path==='/integrations'&&state?.hasTextarea;
192 + });
193 report.integrations=true;
194 report.stage='EDITOR';
195 const state=await conn.evalJs("(()=>{const f=document.querySelector('textarea');f.focus();f.select();return {ro:f.readOnly,disabled:f.disabled,buttons:[...document.querySelectorAll('button')].map(b=>b.textContent?.trim())}})()");
@@ -198,9 +218,10 @@ jobs:
218 New-Item -ItemType Directory -Force -Path $reportDir | Out-Null
219 node $probe $env:TF_INSTALLED_V6_EXE $reportDir *> (Join-Path $env:RUNNER_TEMP 'private-gui-output.log')
220 $result=Get-Content (Join-Path $reportDir 'private-gui-report.json') -Raw | ConvertFrom-Json
201 - foreach($key in @('integrations','writable','select','copyButton','osClipboard','bankDisabled')){
221 + foreach($key in @('integrations','writable','select','copyButton','osClipboard','bankDisabled','entryInitialLogin','entryLinkPresent','loginTargetSeen','integrationsTargetSeen','integrationsDomSeen')){
222 Write-Host ("GUI_"+$key+"="+[bool]$result.$key)
223 }
224 + Write-Host ("GUI_SQL_HTTP_STATUS="+[int]$result.sqlHttpStatus)
225 if($LASTEXITCODE -ne 0 -or $result.status -ne 'PASS'){throw ('INSTALLED_GUI_'+[string]$result.stage+'_FAILED')}
226 Write-Host 'GATE_PASS_ACTUAL_WINDOWS_OS_CLIPBOARD'
227 - name: Silent uninstall of actual private V6 Setup
@@ -209,11 +230,17 @@ jobs:
230 $ErrorActionPreference='Stop'
231 $uninstaller=@(Get-ChildItem $env:TF_V6_INSTALL_DIR -Recurse -File -ErrorAction SilentlyContinue | Where-Object {$_.Name -match '^uninstall.*\.exe$'})
232 if($uninstaller.Count -ne 1){throw 'V6_NSIS_UNINSTALLER_NOT_FOUND'}
233 + @(Get-Process -Name 'TreasuryFlow' -ErrorAction SilentlyContinue) | ForEach-Object { try{Stop-Process -Id $_.Id -Force -ErrorAction Stop}catch{} }
234 $proc=Start-Process -FilePath $uninstaller[0].FullName -ArgumentList '/S' -PassThru
235 if(!$proc.WaitForExit(90000)){try{$proc.Kill()}catch{};throw 'V6_UNINSTALL_TIMEOUT'}
236 if($proc.ExitCode -ne 0){throw 'V6_UNINSTALL_NONZERO'}
215 - $remaining=@(Get-ChildItem $env:TF_V6_INSTALL_DIR -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
216 - if($remaining.Count -ne 0){throw 'V6_UNINSTALL_LEFT_EXECUTABLE'}
237 + $removed=$false
238 + for($i=0;$i -lt 90;$i++){
239 + $remaining=@(Get-ChildItem $env:TF_V6_INSTALL_DIR -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
240 + if($remaining.Count -eq 0){$removed=$true;break}
241 + Start-Sleep -Seconds 1
242 + }
243 + if(!$removed){throw 'V6_UNINSTALL_LEFT_EXECUTABLE_AFTER_90_SECONDS'}
244 Write-Host 'GATE_PASS_REAL_V6_NSIS_UNINSTALL'
245 - name: Strictly bound scope of this validation
246 if: always()