فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(test): restore Persian native labels and cover encoding regressions
Davood Mehraban committed
Nov 24, 2026 at 17:10 UTC
fdee1685c73864c74dbee39c9158886e4de3024c
3 files changed
+52
-8
PROJECT_STATUS.md
+5
-4
@@ -7,14 +7,15 @@
7
- baseline_commit: 93bec56498e115c653da153e00a19f02efc57159; clean local and remote state verified before this change. Current implementation SHA is the Git commit containing this packet.
8
- last_completed_action: reproduced the invalid workflow with actionlint 1.7.7; repaired the malformed UTF-8 prefix before the name key; added checksum-pinned Actions validation to normal PR quality and the memory preflight; made the browser regression discoverable by npm test.
9
- failure_ledger: runs 45343458191 and 45343858906 failed before any jobs. The key was corrupted to a nonstandard name by an encoding conversion. They are workflow-definition failures, not Windows installation failures or a product memory-leak result. Two occurrences; resolved locally by parser validation, remote verification still pending.
10
+- additional_failure: native run 45405204319 reached the installed application but a corrupted Persian setup label rejected its fresh-login screen. Git comparison to successful harness 369ba0b proved the same Windows UTF-8/CP1256 conversion also damaged the administrator name, synthetic Persian labels and offline error detection. Restored only those four lines; two failing local behavioral regressions now pass. No application change or new installer is required.
11
- change_scope: CI/harness tests and execution status only. No application, schema, Holoo, native binary or package dependency changes.
12
- test_policy: pushes run preflight then the ten-cycle installed smoke using the existing NSIS. Endurance requires workflow_dispatch with run_endurance=true; default false. Separate timeout budgets are 25 and 160 minutes. A short pass never means 120-minute acceptance.
12
-- verification: Linux npm test 488/488 pass, 0 failed/skipped; Vite build pass (existing large-chunk advisory); production dependency audit 0 advisories; actionlint across workflows pass; five browser-harness positive/negative tests pass. These are local results, not a claim of native Windows success for this revision.
13
+- verification: Linux npm test 491/491 pass, 0 failed/skipped; Vite build pass (existing large-chunk advisory); production dependency audit 0 advisories; actionlint across workflows pass; eight browser/bootstrap/error-guard positive/negative tests pass; the two encoding regressions were first observed failing against the corrupted source. These are local results, not a claim of native Windows success for this revision.
14
- prior_installed_evidence: https://github.com/davoodmehraban89/Factor-easyPro/actions/runs/45248855137 succeeded at 369ba0b with 10 cycles and actual Windows process-tree metrics. Post-GC renderer heap was 4,094,320 B in cycle 1 and 4,153,060 B in cycle 10. This is one short sample, not a leak verdict or long-duration acceptance.
15
- artifact_source: existing successful native run 45243530762, product source 25faa1548536572d4a2199fe9c11fea9c1029b6f, candidate 2.0.4. Harness revisions are recorded separately; do not rebuild NSIS merely for these QA edits.
15
-- delivery_state: local changes under validation; commit/push and current CI not yet claimed.
16
-- interrupted_action: none; unpublished_work: this recovery patch until pushed.
17
-- next_action: run the five harness tests on Aram, commit/push the focused patch on #202, then inspect its quality and targeted Windows runs. Update this packet and PR body with the actual outcome; do not rerun while an equivalent run is active.
16
+- delivery_state: first recovery commit c61c4ffee816a966a04046c4b5bf6d9b91c4cd8d pushed. Quality 45405217972 and Q01 45405217963 passed; targeted native 45405204319 failed at Persian setup detection. A second, locally verified encoding repair is pending publication.
17
+- interrupted_action: none; unpublished_work: restore four misdecoded Persian lines in the native runner and add bootstrap/offline-error regressions. The original endurance behavior is preserved.
18
+- next_action: run the eight harness regressions on Aram, commit/push the encoding repair on #202, then inspect the new targeted Windows run. Update this packet and PR body with the actual outcome; do not rerun while an equivalent run is active.
19
- blockers / limits: the memory workflow is absent from main as checked on 2026-11-24, so workflow_dispatch activation still requires a separately authorized workflow integration. The 120-minute test and >=3 independent runner samples required by #201 remain unverified. Physical QA and release gates remain separate.
20
- approvals: safe branch edits, tests, commit/push and Draft PR maintenance are authorized. No new merge, release, production installation or SQL write authorization. Historical approval for #200 does not authorize #202/#199 merge.
21
- do_not_repeat: no rerun of the two malformed workflow revisions; no NSIS rebuild for harness-only changes; no automatic two-hour workload per push; no reinterpretation of short smoke as endurance; no retry of historical A08 fixed-date failures.
tests/windows-vm-installed-tauri-cdp.cjs
+4
-4
@@ -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);
tests/windows-vm-native-memory-stability-contract.test.mjs
+43
@@ -61,3 +61,46 @@ test('native stability fails at the actual incorrect middle page', async () => {
61
test('native stability rejects record-count changes after navigation', async () => {
62
await assert.rejects(harness({ mutateAfterRead: true }).run(), /Synthetic record counts changed/);
63
});
64
+
65
+const nativeRunner = readFileSync(new URL('./windows-vm-installed-tauri-cdp.cjs', import.meta.url), 'utf8');
66
+// Execute the real injected setup/login block without launching an installer.
67
+// Escaped expected labels remain stable if a Windows editor misdecodes UTF-8.
68
+const setupLabel = '\u062a\u0639\u06cc\u06cc\u0646 \u0631\u0645\u0632';
69
+const adminLabel = '\u0645\u062f\u06cc\u0631';
70
+const setupStart = nativeRunner.indexOf(' const setup = ready.initialMode.includes(');
71
+const setupEnd = nativeRunner.indexOf(' await eventually(', setupStart);
72
+assert.ok(setupStart >= 0 && setupEnd > setupStart, 'Native setup/login block missing');
73
+const setupBlock = nativeRunner.slice(setupStart, setupEnd);
74
+
75
+test('real native bootstrap recognizes Persian setup and submits the correct administrator name', async () => {
76
+ const fields = { faUser: {}, faPass: {}, faPass2: { style: { display: '' } },
77
+ faSubmit: { click: () => { fields.clicked = true; } } };
78
+ const document = { getElementById: id => fields[id] };
79
+ await vm.runInNewContext('(async () => {' + setupBlock + '})()', {
80
+ assert, ready: { initialMode: setupLabel }, mode: 'stability', PASSWORD: 'Synthetic-test-only',
81
+ cdp: { evaluate: script => vm.runInNewContext(script, { document }) }
82
+ });
83
+ assert.equal(fields.faUser.value, adminLabel);
84
+ assert.equal(fields.faPass.value, fields.faPass2.value);
85
+ assert.equal(fields.clicked, true);
86
+});
87
+
88
+test('real native bootstrap rejects an existing-login screen for a fresh stability profile', async () => {
89
+ await assert.rejects(vm.runInNewContext('(async () => {' + setupBlock + '})()', {
90
+ assert, ready: { initialMode: 'existing-login' }, mode: 'stability'
91
+ }), /a new native profile must prompt/);
92
+});
93
+
94
+test('real offline navigation guard rejects the Persian page-load error', () => {
95
+ const start = nativeRunner.indexOf('if (FINORA.Router.current() !== route');
96
+ const end = nativeRunner.indexOf('timings.push(', start);
97
+ assert.ok(start >= 0 && end > start, 'Native offline navigation guard missing');
98
+ const guard = nativeRunner.slice(start, end);
99
+ const context = {
100
+ FINORA: { Router: { current: () => 'reports' } }, route: 'reports',
101
+ document: { querySelector: () => null, getElementById: () => null },
102
+ body: '\u062e\u0637\u0627 \u062f\u0631 \u0628\u0627\u0631\u06af\u0630\u0627\u0631\u06cc \u0635\u0641\u062d\u0647'
103
+ };
104
+ assert.throws(() => vm.runInNewContext(guard, context), /Installed app route failed/);
105
+ assert.doesNotThrow(() => vm.runInNewContext(guard, { ...context, body: 'Rendered report content' }));
106
+});