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

ci: harden runtime configuration and branch verification

Davood Mehraban committed Oct 5, 2026 at 17:19 UTC c8f1c266d220ce35bc12140e46bcad54f34aebbb
3 files changed +11 -2
.github/workflows/ci.yml
+8 -2
@@ -1,7 +1,7 @@
1 -name: TreasuryFlow CI
1 +name: TreasuryFlow CI
2 on:
3 push:
4 - branches: [main, phase-2-treasury-core]
4 + branches: ['main', 'phase-*', 'release-*']
5 pull_request:
6 branches: [main]
7 jobs:
@@ -18,4 +18,10 @@ jobs:
18 - run: npm run typecheck
19 - run: npm test -- --reporter=dot
20 - run: npx eslint src --no-cache
21 + - name: Verify production schema contract
22 + run: npm test -- --run src/platform/persistence/schema-contract.test.ts
23 + - name: Reject committed secret files
24 + shell: bash
25 + run: |
26 + if git ls-files | grep -E '(^|/)\.env($|\.)' | grep -v '\.env\.production\.example$'; then exit 1; fi
27 - run: npm run build
src/platform/runtime-config.test.ts new
+2
@@ -0,0 +1,2 @@
1 +import {describe,expect,it} from 'vitest';import {validateRuntimeConfig} from './runtime-config';
2 +describe('runtime config',()=>{it('accepts safe disabled-bank production config',()=>expect(validateRuntimeConfig({NODE_ENV:'production',APP_BASE_URL:'https://treasury.example',BANK_ADAPTER_MODE:'disabled'})).toEqual([]));it('blocks unsafe live bank activation and insecure url',()=>{expect(validateRuntimeConfig({NODE_ENV:'production',APP_BASE_URL:'http://x',BANK_ADAPTER_MODE:'live'})).toEqual(['https-required','live-bank-not-authorized'])})});
src/platform/runtime-config.ts new
+1
@@ -0,0 +1 @@
1 +export function validateRuntimeConfig(e:Record<string,string|undefined>){const errors:string[]=[];if(e.NODE_ENV==='production'&&!e.APP_BASE_URL?.startsWith('https://'))errors.push('https-required');if(e.BANK_ADAPTER_MODE==='live')errors.push('live-bank-not-authorized');return errors}