T7.2 — חוזה Approval וסמכות לפי מצב עבודה

v1.0 Implementation Report · 11 באוגוסט 2026 · BAROUCH SHALIT

מטרה: איחוד בדיקות הסמכות כך שכל נתיבי manual, semi_auto ו-full_auto מתכנסים לאכיפה משותפת. פתרון 3 פערי P1 מ-T7.1.

3/3 פערי P1 מ-T7.1 נפתרו ✅

GAP-001 (סף 9.5 configurable) + GAP-004 (actor_type/logical_role/session_id) + GAP-005 (re-auth חלופי) — כולם מומשו. חוזה ה-Approval המאוחד מופעל בכל שלושת מצבי העבודה.

חלק א׳ — פתרון 3 פערי P1 מ-T7.1
GAP-001P1

סף 9.5 מוקשה בקוד → הפך ל-configurable

נפתר ✅

לפני: decisionObject.ts line 128: confidence >= 9.5 hardcoded constant

אחרי: SystemSettings.semi_auto_high_confidence_threshold (default 9.5) + decisionObject.ts uses data.semi_auto_high_confidence_threshold ?? 9.5

קבצים ששונו:
base44/entities/SystemSettings.jsonc (added field)base44/shared/decisionObject.ts (updated determineApprovalRequired)
GAP-004P1

חסרים actor_type / logical_role / session_id → נוספו

נפתר ✅

לפני: AuditEvent.actor (string) בלבד; קוד משתמש ב-user.email

אחרי: AuditEvent: actor_type (enum: user/agent/system/scheduler) + logical_role (string) נוספו. session_id כבר היה קיים. auditEventLogger.ts מאכלס את השדות החדשות.

קבצים ששונו:
base44/entities/AuditEvent.jsonc (added actor_type + logical_role)base44/shared/auditEventLogger.ts (updated AuditEventInput + create)
GAP-005P1

אין מנגנון Re-auth → נוצר חלופי

נפתר ✅ (חלופה — לאישור Security Admin)

לפני: §7.7/§7.12 דורש re-auth ל-3 פעולות קריטיות; Base44 auth לא תומך ב-step-up auth

אחרי: reauthGuard.ts: חלופת confirmation + reason + audit. requireReauth() בודק שיש reason + confirmed, ולוג ל-AuditEvent עם actor_type + logical_role.

קבצים ששונו:
base44/shared/reauthGuard.ts (new module)reauthGuard exports: requireReauth, requiresReauth, isFullAutoTransition, isFreezeCancel
חלק ב׳ — כלל Re-auth מאוחד (§7.7 + §7.12)

כלל מאוחד מחליף את הסתירה בין §7.7 ו-§7.12. מומש ב-reauthGuard.ts.

פעולהדרישהסיבהמימוש בקוד
מעבר ל-full_autoאימות מחדש (re-auth)סיכון קריטי — ביצוע אוטומטי ללא אישור פרטניreauthGuard.ts: TRANSITION_TO_FULL_AUTO
ביטול Global Freezeאימות מחדש (re-auth)סיכון קריטי — שחרור עמדות לקנייהreauthGuard.ts: CANCEL_GLOBAL_FREEZE
שינוי הרשאות מהותי (Break-Glass, PermissionMatrix)אימות מחדש (re-auth)סיכון אבטחה — שינוי מפת סמכויותreauthGuard.ts: PERMISSION_CHANGE
הפעלת Global Freezeמיידי, ללא אימותפעולת הגנה P0 אינה ממתינהtradeExecution.ts checkFreeze (immediate)
מעבר manual ↔ semi_autoAudit בלבדשינוי תפעולי שגרתי, שערי הגנה זהיםSettings page (mode change + AuditEvent)
מעבר מ-full_auto למצב אחרAudit בלבדהקטנת סיכון — אינה מעלה סיכוןSettings page (mode change + AuditEvent)
חלק ג׳ — חוזה Approval לפי מצב עבודה
manual

אישור נדרש: תמיד — כל עסקה דורשת אישור מפורש

ביצוע אוטומטי: אף פעולה

שערים: Freeze → Explain → Decision Active → Risk Gate → Approval → Validity → market_open

מיקום בקוד: executeTrade entry.ts: manual approve path

semi_auto

אישור נדרש: confidence < 9.5 (configurable) → דרוש אישור; ≥ 9.5 → auto-approve

ביצוע אוטומטי: SELL/Reduction/Exit (P0 protection) + confidence ≥ 9.5 (auto-approve)

שערים: Freeze → Explain → Decision Active → Risk Gate → Approval (if < 9.5) → Validity → market_open

מיקום בקוד: decisionObject.ts: determineApprovalRequired + refreshPortfolioPrices EXECUTION

full_auto

אישור נדרש: confidence < 8.5 → דרוש אישור; ≥ 8.5 → auto-execute

ביצוע אוטומטי: BUY/SELL עם confidence ≥ 8.5 (בכפוף לכל השערים)

שערים: Freeze → Explain → Decision Active → Risk Gate → Approval (if < 8.5) → Validity → market_open

מיקום בקוד: decisionObject.ts: determineApprovalRequired + refreshPortfolioPrices EXECUTION

חלק ד׳ — שערים מאוחדים (כל המצבים)

כל השערים מאוחדים — אין מצב שבו מצב עבודה כלשהו מדלג על שער. אפס עקיפות (למעט legacy:true ל-Decision Gate בלבד).

שעראכיפהמיקום בקודמאוחד
Global FreezecheckFreeze() — blocks BUY only; SELL/Reduction/Exit passtradeExecution.ts line 82
Explain Before ExecuteassertExplainBeforeExecute() — reasoning + authority ref mandatorytradeExecution.ts line 89
Emergency LiquidationisEmergencyLiquidation + verifyEmergencyAuthorized — BreakGlassEvent requiredtradeExecution.ts line 92-98
Decision ActiveassertDecisionActive() — ACTIVE + not expired + snapshot frozentradeExecution.ts line 102 + executeTrade entry.ts line 326
Risk GatecheckRiskGatePassed() — RiskVerdict=PASS requiredtradeExecution.ts line 106 + refreshPortfolioPrices line 474
Approval GatecheckApprovalValid() when approval_required=truetradeExecution.ts line 110 + refreshPortfolioPrices line 481
Proposal TTLproposal_expires_at checked at executeTrade entryexecuteTrade entry.ts line 114
Approval TTLapproval_expires_at checked in refreshPortfolioPricesrefreshPortfolioPrices line 440
Price Drift ValiditydriftPct > threshold (auto=3%, semi=5%) → expiredexecuteTrade entry.ts line 212 + refreshPortfolioPrices line 191
market_openisMarketOpen() — BUY parked if closed; sells skip if closedexecuteTrade entry.ts line 154 + refreshPortfolioPrices line 438
Order Fill GuardshouldFillBuy() — limit/stop conditionsexecuteTrade entry.ts line 265 + refreshPortfolioPrices line 458
חלק ה׳ — קריטריוני קבלה ל-T7.2
manual אינו מבצע ללא פעולה מפורשת: כל עסקה דורשת approve ידני — מאומת.
semi_auto דורש אישור תקף: confidence < 9.5 (configurable) → דרוש אישור; ≥ 9.5 → auto-approve — מאומת.
full_auto אינו עוקף שער: confidence ≥ 8.5 → auto-exec עם כל השערים — מאומת.
אישור שפג נחסם: TTL + Validity נבדקים בשני נתיבי הביצוע — מאומת.
Re-auth מאוחד: 3 מקרים דורשים re-auth (full_auto, Freeze cancel, permission change); 3 פטורים — מאומת ב-reauthGuard.ts.

המלצת מעבר ל-T7.3

T7.2 השלים את חוזה ה-Approval המאוחד ופתר את כל 3 פערי ה-P1 מ-T7.1. ניתן לעבור ל-T7.3 (Override, Freeze ופעולות חירום) — מיפוי ואימות מטריצת Override/Freeze/Emergency.

InvestIQ · CH7 T7.2 · v1.0 Implementation Report · 11 באוגוסט 2026 · BAROUCH SHALIT