فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

Add bounded 120-minute installed A08 endurance with checkpoints

Davood Mehraban committed Nov 24, 2026 at 10:20 UTC 6c009dce7b1750bfc346e79a7fd539093fe788c7
3 files changed +52 -11
.github/workflows/a08-installed-memory-stability.yml
+15 -3
@@ -1,4 +1,4 @@
1 -name: A08 installed Windows memory stability (reuse NSIS)
1 +ï»؟name: A08 installed Windows memory stability (reuse NSIS)
2 on:
3 pull_request:
4 paths:
@@ -27,7 +27,7 @@ jobs:
27 targeted-native-a08:
28 if: github.event_name == 'workflow_dispatch' || github.head_ref == 'work/a08-memory-stability-20261123'
29 runs-on: windows-latest
30 - timeout-minutes: 35
30 + timeout-minutes: 160
31 steps:
32 # Checkout the separately reviewed QA harness; verify the immutable
33 # binary-producing source SHA independently against its successful run.
@@ -72,11 +72,23 @@ jobs:
72 $files=@(Get-ChildItem test-installer -Recurse -Filter '*x64-setup.exe')
73 if ($files.Count -ne 1) { throw 'Expected exactly one reused NSIS installer' }
74 ./scripts/windows-vm-targeted-a08.ps1 -Installer $files[0].FullName -ExpectedVersion $env:EXPECTED_VERSION -Mode stability
75 + - name: Run 120-minute installed endurance after short smoke
76 + shell: pwsh
77 + env:
78 + A08_ENDURANCE: '1'
79 + EXPECTED_VERSION: ${{ inputs.expected_version || '2.0.4' }}
80 + run: |
81 + $lab=Join-Path $env:RUNNER_TEMP 'factor-a08-targeted-native'
82 + Move-Item $lab "$lab-smoke"
83 + $files=@(Get-ChildItem test-installer -Recurse -Filter '*x64-setup.exe')
84 + ./scripts/windows-vm-targeted-a08.ps1 -Installer $files[0].FullName -ExpectedVersion $env:EXPECTED_VERSION -Mode stability
85 - name: Upload targeted native A08 evidence
86 if: always()
87 uses: actions/upload-artifact@v4
88 with:
89 name: a08-installed-memory-stability-evidence
80 - path: ${{ runner.temp }}/factor-a08-targeted-native/reports/*.json
90 + path: |
91 + ${{ runner.temp }}/factor-a08-targeted-native/reports/*.json
92 + ${{ runner.temp }}/factor-a08-targeted-native-smoke/reports/*.json
93 retention-days: 14
94 if-no-files-found: warn
scripts/windows-vm-targeted-a08.ps1
+1 -1
@@ -29,7 +29,7 @@ if ($exe.Count -ne 1 -or $exe[0].Length -lt 300000) { throw 'Installed native ex
29 if ($LASTEXITCODE -ne 0) { throw 'Installed WebView2 A08 benchmark failed' }
30 $result=Get-Content $report -Raw | ConvertFrom-Json
31 if ($Mode -eq 'stability' -and ($result.nativeMemoryStability.status -ne 'PASSED' -or
32 - $result.nativeMemoryStability.cycles.Count -ne 10)) { throw 'Stability cycle acceptance incomplete' }
32 + $result.nativeMemoryStability.cycles.Count -ne $(if ($env:A08_ENDURANCE -eq '1') { 240 } else { 10 }))) { throw 'Stability cycle acceptance incomplete' }
33 if ($result.status -ne 'PASSED' -or $result.installedNativeTauri -ne $true -or
34 $result.nativePerformance.products -ne 10000 -or
35 $result.nativePerformance.invoices -ne 50000 -or
tests/windows-vm-installed-tauri-cdp.cjs
+36 -7
@@ -162,14 +162,14 @@ async function connect(url) {
162 } else {
163 assert.equal(ready.version, expectedVersion, 'candidate build runtime version mismatch');
164 }
165 - const setup = ready.initialMode.includes('تعیین رمز');
165 + const setup = ready.initialMode.includes('طھط¹غŒغŒظ† ط±ظ…ط²');
166 if (mode === 'seed' || mode === 'fresh' || mode === 'benchmark' || mode === 'stability' || mode === 'crash-arm') {
167 assert.equal(setup, true, 'a new native profile must prompt to set the administrator password');
168 } else {
169 assert.equal(setup, false, 'upgrade/reopen should preserve existing administrator credentials');
170 }
171 await cdp.evaluate('(() => {' +
172 - 'document.getElementById("faUser").value="مدیر";' +
172 + 'document.getElementById("faUser").value="ظ…ط¯غŒط±";' +
173 'document.getElementById("faPass").value=' + JSON.stringify(PASSWORD) + ';' +
174 'if(document.getElementById("faPass2").style.display!=="none") document.getElementById("faPass2").value=' + JSON.stringify(PASSWORD) + ';' +
175 'document.getElementById("faSubmit").click();return "submitted"})()');
@@ -374,7 +374,7 @@ async function connect(url) {
374 if (mode === 'fresh') {
375 // Drive synthetic records, complete snapshot replay and every SPA route
376 // inside the actually installed Tauri WebView2, not Vite preview.
377 - const ui = await cdp.evaluate("(async () => {\n const ensure = (pass, message) => { if (!pass) throw Error(message); };\n ensure(!document.getElementById('finoraAuthOverlay'), 'Cannot test UI before login');\n const person = await window.ContactController.create({\n name: 'شخص آزمایشی ماشین مجازی', role: 'both'\n });\n const product = await window.ProductController.createProduct({\n name: 'کالای آزمایشی ماشین مجازی', code: 'WINDOWS-VM-LAB',\n buyPrice: 150, sellPrice: 250, trackInventory: true\n });\n const db = window.FINORA.Storage;\n const before = {\n contacts: (await db.getAll('contacts')).length,\n products: (await db.getAll('products')).length\n };\n ensure((await db.get('contacts',person.id))?.name === 'شخص آزمایشی ماشین مجازی',\n 'Contact did not persist in the native app');\n ensure((await db.get('products',product.id))?.sellPrice === 250,\n 'Product did not persist in the native app');\n const snapshot = await db.exportAll();\n ensure(snapshot.version === 7 && snapshot.app === 'Factor-easyPro',\n 'Native snapshot identity/version mismatch');\n ensure(snapshot.data.users.every(u => !u.pwHash && !u.pwSalt && !u.pass),\n 'Credential hash leaked into plain export');\n ensure(snapshot.data.contacts.some(c => c.id === person.id) &&\n snapshot.data.products.some(p => p.id === product.id),\n 'Native snapshot missing committed master data');\n ensure(await db.importAll(snapshot) === true,\n 'Native full snapshot replay did not succeed');\n const after = {\n contacts: (await db.getAll('contacts')).length,\n products: (await db.getAll('products')).length\n };\n ensure(before.contacts === after.contacts && before.products === after.products,\n 'Snapshot replay duplicated a contact or product');\n const routes = [\n 'dashboard', 'invoices', 'products', 'contacts', 'treasury',\n 'cheques', 'expenses', 'reports', 'accounting', 'settings'\n ];\n const pages = [];\n for (const route of routes) {\n await FINORA.Router.go(route);\n const view = document.getElementById('pageContent');\n const text = (view?.textContent || '').trim();\n ensure(FINORA.Router.current() === route, 'Unexpected route: ' + route);\n ensure(text.length > 10, 'Empty page: ' + route);\n ensure(!text.includes('خطا در بارگذاری صفحه'),\n 'Router reported a page rendering error: ' + route);\n ensure(!document.querySelector('.toast-error'),\n 'Error toast while navigating to: ' + route);\n pages.push({route, renderedCharacters: text.length});\n }\n await FINORA.Router.go('dashboard');\n ensure(!document.getElementById('finoraAuthOverlay'),\n 'Navigation unexpectedly returned to authentication overlay');\n return {masterData:before, backup:'plain-no-credentials-replay-idempotent',\n routes:pages, visibleVersion:FINORA.version};\n})()", 45000);
377 + const ui = await cdp.evaluate("(async () => {\n const ensure = (pass, message) => { if (!pass) throw Error(message); };\n ensure(!document.getElementById('finoraAuthOverlay'), 'Cannot test UI before login');\n const person = await window.ContactController.create({\n name: 'ط´ط®طµ ط¢ط²ظ…ط§غŒط´غŒ ظ…ط§ط´غŒظ† ظ…ط¬ط§ط²غŒ', role: 'both'\n });\n const product = await window.ProductController.createProduct({\n name: 'ع©ط§ظ„ط§غŒ ط¢ط²ظ…ط§غŒط´غŒ ظ…ط§ط´غŒظ† ظ…ط¬ط§ط²غŒ', code: 'WINDOWS-VM-LAB',\n buyPrice: 150, sellPrice: 250, trackInventory: true\n });\n const db = window.FINORA.Storage;\n const before = {\n contacts: (await db.getAll('contacts')).length,\n products: (await db.getAll('products')).length\n };\n ensure((await db.get('contacts',person.id))?.name === 'ط´ط®طµ ط¢ط²ظ…ط§غŒط´غŒ ظ…ط§ط´غŒظ† ظ…ط¬ط§ط²غŒ',\n 'Contact did not persist in the native app');\n ensure((await db.get('products',product.id))?.sellPrice === 250,\n 'Product did not persist in the native app');\n const snapshot = await db.exportAll();\n ensure(snapshot.version === 7 && snapshot.app === 'Factor-easyPro',\n 'Native snapshot identity/version mismatch');\n ensure(snapshot.data.users.every(u => !u.pwHash && !u.pwSalt && !u.pass),\n 'Credential hash leaked into plain export');\n ensure(snapshot.data.contacts.some(c => c.id === person.id) &&\n snapshot.data.products.some(p => p.id === product.id),\n 'Native snapshot missing committed master data');\n ensure(await db.importAll(snapshot) === true,\n 'Native full snapshot replay did not succeed');\n const after = {\n contacts: (await db.getAll('contacts')).length,\n products: (await db.getAll('products')).length\n };\n ensure(before.contacts === after.contacts && before.products === after.products,\n 'Snapshot replay duplicated a contact or product');\n const routes = [\n 'dashboard', 'invoices', 'products', 'contacts', 'treasury',\n 'cheques', 'expenses', 'reports', 'accounting', 'settings'\n ];\n const pages = [];\n for (const route of routes) {\n await FINORA.Router.go(route);\n const view = document.getElementById('pageContent');\n const text = (view?.textContent || '').trim();\n ensure(FINORA.Router.current() === route, 'Unexpected route: ' + route);\n ensure(text.length > 10, 'Empty page: ' + route);\n ensure(!text.includes('ط®ط·ط§ ط¯ط± ط¨ط§ط±ع¯ط°ط§ط±غŒ طµظپط­ظ‡'),\n 'Router reported a page rendering error: ' + route);\n ensure(!document.querySelector('.toast-error'),\n 'Error toast while navigating to: ' + route);\n pages.push({route, renderedCharacters: text.length});\n }\n await FINORA.Router.go('dashboard');\n ensure(!document.getElementById('finoraAuthOverlay'),\n 'Navigation unexpectedly returned to authentication overlay');\n return {masterData:before, backup:'plain-no-credentials-replay-idempotent',\n routes:pages, visibleVersion:FINORA.version};\n})()", 45000);
378 assert.equal(ui.routes.length, 10);
379 assert.equal(ui.visibleVersion, expectedVersion);
380 report.nativeUI = ui;
@@ -568,7 +568,7 @@ async function connect(url) {
568 await FINORA.Router.go(route);
569 const body = (document.getElementById('pageContent')?.textContent || '').trim();
570 if (FINORA.Router.current() !== route || body.length <= 10 ||
571 - body.includes('خطا در بارگذاری صفحه') ||
571 + body.includes('ط®ط·ط§ ط¯ط± ط¨ط§ط±ع¯ط°ط§ط±غŒ طµظپط­ظ‡') ||
572 document.querySelector('.toast-error') ||
573 document.getElementById('finoraAuthOverlay')) {
574 throw Error('Installed app route failed while offline: ' + route);
@@ -684,7 +684,24 @@ async function connect(url) {
684 await collect();
685 const baseline = await heap();
686 const processBaseline = windowsProcessMemory();
687 - for (let i = 0; i < 10; i++) {
687 + const endurance = process.env.A08_ENDURANCE === '1';
688 + const count = endurance ? 240 : 10;
689 + const intervalMs = endurance ? 30000 : 0;
690 + const started = performance.now();
691 + const checkpoint = () => {
692 + if (!reportPath) return;
693 + const target = path.join(path.dirname(reportPath), 'stability-checkpoint.json');
694 + fs.writeFileSync(target + '.tmp', JSON.stringify(report, null, 2));
695 + fs.renameSync(target + '.tmp', target);
696 + };
697 + report.nativeMemoryStability = {
698 + status: 'RUNNING', synthetic: true, cycles, baseline, processBaseline,
699 + gcSupported, count, intervalMs, endurance
700 + };
701 + checkpoint();
702 + for (let i = 0; i < count; i++) {
703 + if (endurance) await wait(Math.max(0, started + i * intervalMs - performance.now()));
704 + const elapsedMs = performance.now() - started;
705 const result = await cdp.evaluate(cycleCode, 120000);
706 assert.equal(result.products, 10000);
707 assert.equal(result.invoices, 50000);
@@ -693,15 +710,27 @@ async function connect(url) {
710 const raw = await heap();
711 if (gcSupported) await collect();
712 const postGc = gcSupported ? await heap() : null;
696 - cycles.push({ cycle: i + 1, durationMs: result.rounds[0].durationMs,
697 - raw, postGc, windowsProcessTree: windowsProcessMemory() });
713 + const windowsProcessTree = windowsProcessMemory();
714 + cycles.push({ cycle: i + 1, elapsedMs, durationMs: result.rounds[0].durationMs,
715 + raw, postGc, windowsProcessTree });
716 + report.nativeMemoryStability.gcSupported = gcSupported;
717 + checkpoint();
718 + if (endurance) {
719 + assert.ok(gcSupported && !windowsProcessTree.unavailable && !processBaseline.unavailable,
720 + 'Endurance memory evidence unavailable');
721 + assert.ok(performance.now() - started <= (i + 1) * intervalMs,
722 + 'Endurance sample exceeded its scheduled interval');
723 + }
724 }
725 + if (endurance) await wait(Math.max(0, started + count * intervalMs - performance.now()));
726 report.nativeMemoryStability = {
727 + count, intervalMs, endurance, elapsedMs: performance.now() - started,
728 status: 'PASSED', synthetic: true, cycles, baseline, processBaseline,
729 gcSupported, heapScope: 'renderer-js-heap-not-Windows-working-set',
730 windowsProcessScope: 'installed-Tauri-parent-and-descendant-processes',
731 note: 'Diagnostic series only; no leak verdict or SLA implied'
732 };
733 + checkpoint();
734 }
735
736 }