سامانه صدور فاکتور و حسابداری

test(stage2.2): diagnose membership rollback after real login; label harness separately

davoodmehraban89 committed Oct 18, 2026 at 06:34 UTC 9bd84ba736e72242b9efbb3f39cc22cf6a3423a7
2 files changed +18 -1
.github/workflows/stage22-local.yml
+9
@@ -50,6 +50,15 @@ jobs:
50 run: |
51 set -o pipefail
52 node scripts/stage22-client-compat-gate.mjs stage22-evidence.json 2>&1 | tee stage22-compat.log
53 + - name: Annotate HARNESS job type explicitly
54 + if: always()
55 + run: |
56 + {
57 + echo '### Stage 2.2 HARNESS (NOT real-stack)'
58 + echo 'Runs original journal UI JavaScript in Chromium and tests local PostgreSQL through a restricted psql test bridge.'
59 + echo 'Does NOT verify GoTrue password login, a real bearer JWT, gateway/PostgREST, or browser-to-backend HTTP.'
60 + echo 'The separate stage22-real-stack job is mandatory before claiming full integration.'
61 + } >> "$GITHUB_STEP_SUMMARY"
62 - name: Upload mode/browser database evidence
63 if: always()
64 uses: actions/upload-artifact@v4
scripts/stage22-real-stack.mjs
+9 -1
@@ -86,6 +86,8 @@ try{
86 await page.waitForFunction(()=>document.getElementById('auth-screen')?.style.display==='none'&&!!window.currentUser?.organizationId,null,{timeout:50000});
87 }catch(error){
88 const stage=await page.evaluate(async()=>({
89 + membershipLock:!!document.getElementById('finora-membership-lock'),
90 + pendingStages:typeof finoraPendingLoginStages==='function'?finoraPendingLoginStages():[],
91 authFormReady:window.FinoraStartupStatus?.authFormReady,
92 assetsReady:window.FinoraStartupStatus?.extensionsReady,
93 failedAssets:window.FinoraStartupStatus?.failedExtensionCount,
@@ -96,7 +98,13 @@ try{
98 authSession:!!(await sb.auth.getSession()).data.session,
99 orgContextReady:!!window.FinoraOrganizationContextReady
100 }));
99 - console.error('REAL_LOGIN_DIAGNOSTIC '+JSON.stringify({stage,errors:errors.slice(0,5),responses:responseCodes.slice(-28)}));
101 + const orgCheck=await page.evaluate(async()=>{
102 + try{
103 + const {data,error}=await sb.from('organization_members').select('organization_id,status').eq('user_id',(await sb.auth.getUser()).data.user.id).eq('status','active');
104 + return {count:(data||[]).length,hasError:!!error};
105 + }catch{return {error:true}}
106 + });
107 + console.error('REAL_LOGIN_DIAGNOSTIC '+JSON.stringify({stage,orgCheck,errors:errors.slice(0,5),responses:responseCodes.slice(-28)}));
108 throw error;
109 }
110 const login=await page.evaluate(async()=>({org:currentUser.organizationId,uid:currentUser.id,hasJWT:!!(await sb.auth.getSession()).data.session?.access_token,api:SUPABASE_URL}));