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

Diagnose official SheetJS 0.20.3 test regressions with source-safe hashed failing-test metadata

davoodmehraban89 committed Oct 18, 2026 at 14:27 UTC ba3cc25e0be0773dec86a5520cf475d187497f1c
1 file changed +26 -1
.github/workflows/v6-patched-sheetjs-security-once.yml
+26 -1
@@ -67,7 +67,32 @@ jobs:
67 run: |
68 set -euo pipefail
69 cd "$TF_ROOT"
70 - npm test -- --reporter=dot > "$RUNNER_TEMP/private-tests-patched.log" 2>&1 || { echo 'PATCHED_XLSX_UNIT_TESTS_FAILED'; exit 1; }
70 + npm test -- --reporter=json "--outputFile=$RUNNER_TEMP/private-tests-patched.json" > "$RUNNER_TEMP/private-tests-patched.log" 2>&1 || true
71 + test -s "$RUNNER_TEMP/private-tests-patched.json" || { echo 'PATCHED_XLSX_TEST_JSON_ABSENT'; exit 1; }
72 + cat > "$RUNNER_TEMP/sanitized-failures.mjs" <<'NODE'
73 + import fs from 'node:fs';
74 + import crypto from 'node:crypto';
75 + const x=JSON.parse(fs.readFileSync(process.argv[2],'utf8'));
76 + console.log('PATCHED_UNIT_TOTAL='+Number(x.numTotalTests||0));
77 + console.log('PATCHED_UNIT_PASS='+Number(x.numPassedTests||0));
78 + console.log('PATCHED_UNIT_FAIL='+Number(x.numFailedTests||0));
79 + console.log('PATCHED_UNIT_PENDING='+Number(x.numPendingTests||0));
80 + const files=(x.testResults||[]);
81 + let count=0;
82 + for(const t of files)for(const a of t.assertionResults||[])if(a.status==='failed'){
83 + count++;
84 + const marker=crypto.createHash('sha256').update(String(a.fullName||a.title)).digest('hex').slice(0,10);
85 + const words=String(a.fullName||a.title).toLowerCase()+' '+(a.failureMessages||[]).join(' ').toLowerCase();
86 + const known=['xlsx','excel','import','export','workbook','worksheet','csv','file','schema','sql','mayan','security','read','write','buffer','json','parse','transform'];
87 + console.log('PATCHED_FAIL_'+count+'_HASH='+marker);
88 + console.log('PATCHED_FAIL_'+count+'_TOPIC='+known.filter(k=>words.includes(k)).join(','));
89 + const classes=['AssertionError','TypeError','ReferenceError','SyntaxError','RangeError','TimeoutError','ModuleNotFoundError'];
90 + console.log('PATCHED_FAIL_'+count+'_CLASS='+(classes.find(c=>(a.failureMessages||[]).join(' ').includes(c))||'OTHER'));
91 + if(count>=8)break;
92 + }
93 + NODE
94 + node "$RUNNER_TEMP/sanitized-failures.mjs" "$RUNNER_TEMP/private-tests-patched.json"
95 + node -e 'let x=require(process.argv[1]);if(x.numFailedTests||!x.numPassedTests)process.exit(3)' "$RUNNER_TEMP/private-tests-patched.json" || { echo 'PATCHED_XLSX_UNIT_TESTS_FAILED_SANITIZED'; exit 1; }
96 echo 'GATE_PASS_SHEETJS_PATCHED_UNIT_TESTS'
97 npm run typecheck > "$RUNNER_TEMP/private-typecheck-patched.log" 2>&1 || { echo 'PATCHED_XLSX_TYPECHECK_FAILED'; exit 1; }
98 echo 'GATE_PASS_SHEETJS_PATCHED_TYPECHECK'