فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
feat(holoo): load verified read-only audit from Aram lab
Davood Mehraban committed
Nov 22, 2026 at 21:42 UTC
e1fcf71443bd5b32f3a6853a15f012aa2988460a
2 files changed
+30
src/holoo-audit-loader.cjs
new
+16
@@ -0,0 +1,16 @@
1
+'use strict';
2
+const { spawnSync } = require('node:child_process');
3
+const { resolve } = require('node:path');
4
+const AUDIT_SCRIPT = resolve(__dirname, '..', 'scripts', 'holoo-schema-audit.ps1');
5
+function loadApprovedHolooAudit() {
6
+ if (process.platform !== 'win32') throw new Error('Aram Windows lab audit is required');
7
+ const result = spawnSync('powershell.exe', ['-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-File',AUDIT_SCRIPT,'-Json'], {
8
+ encoding: 'utf8', timeout: 30000, maxBuffer: 1024 * 1024, windowsHide: true
9
+ });
10
+ if (result.error || result.status !== 0 || !result.stdout) throw new Error('Approved Holoo lab audit failed');
11
+ let audit;
12
+ try { audit = JSON.parse(result.stdout); } catch { throw new Error('Invalid Holoo audit JSON'); }
13
+ if (audit?.database !== 'HolooBackup_050808_LAB_20261110' || audit?.complete !== true || audit?.readOnlyAudit !== true || audit?.productionWriteGate?.status !== 'NO-GO' || audit?.productionWriteGate?.productionWritesAuthorized !== false) throw new Error('Untrusted Holoo audit result');
14
+ return audit;
15
+}
16
+module.exports = { loadApprovedHolooAudit };
tests/holoo-audit-loader.test.mjs
new
+14
@@ -0,0 +1,14 @@
1
+import test from 'node:test';
2
+import assert from 'node:assert/strict';
3
+import { createRequire } from 'node:module';
4
+const require = createRequire(import.meta.url);
5
+const { loadApprovedHolooAudit } = require('../src/holoo-audit-loader.cjs');
6
+test('audit loader refuses non-Windows host', { skip: process.platform === 'win32' }, () => {
7
+ assert.throws(loadApprovedHolooAudit, /Windows/);
8
+});
9
+test('audit loader executes approved script and returns read-only NO-GO evidence', { skip: process.platform !== 'win32' || process.env.HOLOO_SQL_INTEGRATION !== '1' }, () => {
10
+ const audit = loadApprovedHolooAudit();
11
+ assert.equal(audit.database, 'HolooBackup_050808_LAB_20261110');
12
+ assert.equal(audit.readOnlyAudit, true);
13
+ assert.equal(audit.productionWriteGate.productionWritesAuthorized, false);
14
+});