Spaces:
Running
Running
Commit History
Today
-
quality(sonar): S3776 paymob side-effects extraction + remaining BUG fixes
Z User- paymob webhook: refund-revocation + promo reconciliation extracted verbatim into reconcileSideEffectsAfterTransition (applyWebhookStatusTransition now far below the 15 ceiling) - CourseDetail: validatePromo().catch, isCourseCompleted && Boolean(course?.id) (S6439 leaked value), navigate NOSONAR markers (framework void|Promise) - Admin: navigate NOSONAR marker Tests 1472/1472, tsc clean, build OK.26533fc -
quality(sonar): complexity under limit + React19 SyntheticEvent migration
Z User- paymob webhook: guard chain + status transition extracted (S3776 22->low) - boot: security posture check extracted from start() (S3776 16->low) - FormEvent -> SyntheticEvent across 7 files (React 19 types: the alias is deprecated because it never matched a real DOM event class) Tests 1472/1472, tsc app+server clean, build OK.f57f434 -
security(cfskill-run3): deep audit fixes + SonarCloud quality pass
Z UserAudit (cloudflare/security-audit-skill, 7 coverage units, 5 hunter waves): - cache: Redis delPattern prefix->glob — settings/approval-gate invalidation was a silent no-op under Redis (stale contact info + delayed gate close) - jwt/approval: remove hardcoded dev APP_SECRET fallback (public repo secret) - boot: production fatal log when EDGE_HOST_ENFORCE unset (fail-loud) - yt-sync: GET /state now bound to x-sync-ts window (eternal replay lane gone) - paymob webhook: signed currency actually passed to verifyPaymobAmount; promo quota released on terminal FAILED events (+ idempotent re-consume when a later event completes the same order) - push: endpoint rows can no longer be re-bound/cross-deleted between users - sessions: bounded device-metadata strings (column widths) - notification links: protocol-relative URLs rejected; noopener unified; Paymob redirect pinned to accept.paymob.com - deploy.sh: secret gate covers re_/gsk_/nvapi-/modal-/mysql:// families SonarCloud (194 open ->…700d33c
Yesterday
-
fix(pwa+numerals): stuck-device SW cure — build-signed SW URL; device-locale-proof digits
ahmdelbaz28-uxOWNER REPORTS (2026-12-03): 1) SAME deploy: footer Facebook tap fixed on one phone, still dead on the original phone. 2) Home counters rendered Arabic-Indic digits while the UI was English. ROOT CAUSES: 1) PRE-2026-11-26 shells served /sw.js with NO Cache-Control (serve-static default), so old phones kept a heuristic-fresh ancient sw.js in HTTP cache; SW update checks consulted it, the ancient precached-shell worker (navigateFallback era, no in-shell self-heal) was never replaced — the device ran the pre-fix bundle forever. Fresh devices fetched everything new — hence the two-phone divergence. 2) Bare .toLocaleString() followed the DEVICE locale, not the site language: ar-EG devices got Arabic-Indic digits inside the English UI. FIXES: - main.tsx v4: SW registered at /sw.js?v=<buildId> (token from the shell's cache-nuke tag) + updateViaCache:'none' — every deploy presents a NEW script URL no cached sw.js can answer; new worker installs (skipWaiting+clientsC…c7ed040 -
fix(contact+pwa): social taps always land + post-login install suggestion
ahmdelbaz28-uxMEASURED ROOT CAUSES (live production, 2026-12-03): 1) Contact save persistence WORKS: the owner's facebook share URL and gmail address are stored in siteSettings AND served by the live footer. The reported 'save reverts' predated the current deployment state. 2) Footer icon activation WORKS in normal browsers (proved via same-tab navigation: the share link lands on the owner's real Facebook page). The genuinely dead case: IN-APP WEBVIEWS (Facebook/Instagram/TikTok/ WhatsApp browsers) silently drop target=_blank activations — the user taps and nothing happens. That is what 'the icon does not navigate' felt like on a phone. FIXES: - external-links.ts: openExternal reroutes http(s) taps to the SAME tab inside in-app webviews (UA detection superset incl. TikTok/Bytedance), leaving native target=_blank untouched everywhere else; mailto:/tel: always keep OS handling. Unit-tested (18 cases). - Footer social anchors wired through openExternal. - siteSettings contac…ec94e17 -
fix(courses): remove subscribe gate — instant playback, auto-scroll, dead-lesson self-heal
ahmdelbaz28-uxOWNER CONTRACT (2026-12-03): the subscribe-to-the-channel gate is GONE. Why: users clicking a course video hit the subscribe wall; the subscribe button did not open YouTube; most playlist videos answered 'video not available'. Root causes addressed end-to-end: SERVER - course-watching.ts: lessonVideo no longer requires a signed unlock ticket; completeSubscribeUnlock procedure deleted; SUBSCRIBE_REQUIRED cannot occur anymore. Login-first (2026-11-22) unchanged. - settings-router.ts: 'subscribeGate' dropped from the public section allowlist (deny-by-default; legacy rows stay server-side). - playlist-sync.ts: deadYouTube self-heal lane — YouTube-linked lessons whose video LEFT the playlist (broken 'الفيديو غير متاح' embeds and legacy placeholder rows) are purged automatically on trusted full-mirror syncs (gh-relay ingest / admin-manual). Throttled watcher ticks never delete. R2/manual lessons are never touched. CLIENT - CourseDetail.tsx: gate screen, settings query, unloc…889e7bd -
fix(mobile+load): full platform review — phone cropping, boot race, hung-provider stalls
Z UserMOBILE (owner report 2026-12-02: admin Users tab clipped on phone): - Users tab approvals rows: min-w-0 + flex-1 on the text block and break-all on the email line — a long unbreakable email token pushed the row past the card edge and the card's overflow-hidden CLIPPED it (reproduced at 320px, row painted 122px off-screen; now wraps inside the row) - Global safety net: html/body overflow-x clip (clip, not hidden — sticky keeps working) so one unbreakable token can never widen the page again - Grid auto-track blowout: 34 grids across 9 files declared cols only at sm/lg (grid gap-4 lg:grid-cols-N) — the implicit auto track sized to max-content, so nowrap content inflated tracks to 715px on a 320px screen (dashboard Recent Activity). Base grid-cols-1 added everywhere - Dialog/AlertDialog primitives: grid-cols-1 on the content grid — the bare shadcn `grid` sized its implicit track to max-content, so dialogs hosting truncate/nowrap rows (lessons manager) scrolled their whol…8054c5d -
feat(mobile): SidebarX-style drawer — floating 20px card, gradient-glow active cell, bottom collapse chevron
ahmdelbaz28-uxPort of Frezyx/sidebarx visual language to the site's mobile drawer: - Floating panel: 10px inset on all anchored edges + safe-area env() calc, borderRadius 20 (theme.decoration), deep shadow — like the SidebarX card - Items: 10px-radius bordered cells; selected = accent gradient fill + 40% border + glow boxShadow (selectedItemDecoration port), replaces old dot - SidebarX signature bottom collapse chevron (aria-labelled, testid mobile-menu-toggle), arrow points to the anchored edge = collapse direction - Icons 20px (SidebarX iconTheme size), light-theme glow override added Zero logic changes: focus trap, Escape, body scroll lock, drag-to-close, drag guard, route-change close, NotificationCenter bell all untouched. Verified: tsc clean, vite build ok, 1465/1465 tests green.5484b55
2 days ago
-
feat(admin): signature triple-bell chime + unmissable bold checkbox marks
Z UserOwner directives 2026-12-01: 1. "عاوز صوت الاشعارات يكون صوت مميز غير الموجود وصوت واضح لكن احترافي" — the two-tone beep is now a signature A-major bell arpeggio (A5→C♯6→E6): each voice layers a soft 2nd/3rd harmonic (glass-bell spectrum), a quiet A4 gives body, a faint A6 sparkle closes the phrase. 8-12ms attacks, exponential decays, peaks ≤0.18, ~1.2s total — clear at phone volume, never harsh. Same API; verified through the REAL poller-bridge path (15 partials recorded: 440/880/1108.73/1318.51/1760 + harmonics). 2. "المربع بينور اصفر بس مش بداخله علامة صح" — the checkmark was a stroke-width-2 hairline at 14px: easy to lose in a bright amber fill on high-DPI phones. The base Checkbox now strokes at 3 (bold, unmissable) and the tri-state is honest: partial select-all shows a MINUS, not a lying full check. Verified on real-touch (pointer:coarse) emulation: 16px compact box, bold dark check on amber, minus on indeterminate. 3. ui-test-server: approvals-q…9f54f8d -
feat(admin): professional glowing approval-gate toggle + fixed multi-select
Z UserOwner report 2026-12-01 (with phone screenshots): 1. ROOT FIX — the mobile 44px touch-target rule inflated role=checkbox and role=switch buttons into ~44px squares: giant ugly checkboxes, distorted rows, an unrecognizable gate 'switch blob'. Form controls now keep their TRUE visual size and get a transparent ::before hit-pad (44px reach) instead — Apple-HIG pattern, applied globally. 2. Multi-select was unreliable because the first selection inserted the inline toolbar (~50px) and shifted the list under the finger mid-tap. The bulk toolbar is now a viewport-fixed floating bar portaled to <body> (Gmail-style): zero layout shift, thumb-reachable approve/reject/clear with safe-area inset. 3. Approval-gate control redesigned: pulsing live status dot, amber glow on the card + switch while enforcing, plain gray when off — state is readable at one glance. Switch thumb now slides correctly in RTL. 4. Checkboxes restyled proportionate to the text (16px, rounded, am…0d73662 -
fix(sonar): final three — real button toast card, lookup-map action verbs, awaited stream consumer
Z User- S6819/S6847/S6845: the actionable toast is now a REAL <button> card (native keyboard activation — no ARIA role, no double-fire Enter handler); announcements keep role=alert; dismiss is an absolutely-positioned sibling so no interactive element nests inside another - S3776: actionLabelFor complexity — verbs moved to a lookup map - S7785: the log-stream consumer is captured and top-level-awaited (raced with a bounded drain) instead of a discarded void call9a1fb7a -
fix(sonar): clean the 9 findings the deep-link commit surfaced on new code
Z User- S3776 (critical): NotificationPollerBridge event assembly split into flat helpers (announceApprovalRequest / actionLabelFor / toastDurationFor) - S3358: duration nested ternary extracted - S4624: push-sw link builder via concatenation (no nested templates) - S6594: RegExp.exec instead of String.match (notification-link + push-sw) - S7785: named async fn + void detach (no async IIFE) - S6847/S6845: actionable toast card gets role=button (interactive element may carry mouse/keyboard listeners + tabIndex); announcements keep alert - S6582: optional chain in the NOTIFICATION_CLICKED handlere70a195 -
feat(notifications): one-tap deep links — every actionable notification opens its action screen
Z UserOwner directive 2026-12-01: clicking a notification must OPEN the place its action happens on (e.g. a join request lands straight on the accept/reject queue), not just flip a read flag. Root fixes: - server: approval fan-out url /admin?tab=users (renders the DASHBOARD tab under path-based routing) -> /admin/users?approvals=1; email dashboardUrl fixed the same way; approval-accepted notice /login -> /dashboard - client: src/lib/notification-link.ts — one resolver for every event (scheme safety + legacy ?tab= normalization + structured-payload fallbacks so a join request can NEVER render link-less), fully unit-tested - toast: the CARD body is clickable now (onOpen + keyboard support), join requests get a 'مراجعة الطلب' action button and 12s dwell - bell rows normalize legacy persisted urls before opening; 'افتح' affordance - push-sw: notificationclick posts the SPA path form (absolute URLs were silently dropped by the page handler) + legacy url normalization - /admin/users?a…6da4d8e -
feat(admin): one-shot bulk approve/reject + professional acceptance notification for approved users
Z UserBULK DECISIONS (owner directive 2026-12-01): the approval queue gains checkbox-per-row + select-all (up to the whole 200-row queue) and two confirm-guarded one-shot buttons. Both procedures route EVERY row through the SAME decideApproval state machine (no duplicated security logic): approve only lifts pending rows, reject skips protected admins, one bad row degrades to a skip entry instead of aborting the batch, duplicates collapse, and the batch is capped at 200 (aligned with the queue page). ACCEPTANCE NOTICE (owner directive 2026-12-01): when a user is approved they now receive a professional notification through BOTH channels that can actually reach them: 1. a dedicated bilingual acceptance email (verdict banner + one sign-in CTA, built from buildAccountApprovedEmail) riding the email_delivery_log ledger as 'approval-accepted' with one transient retry, and 2. an in-app stream event greeting them the moment they sign in. The notice rides decideApproval itself — d…264507b -
feat(admin): in-dashboard back navigation + approval-gate owner switch + AI panel icon fixes
ahmdelbaz28-uxOwner report 2026-12-01, three asks, all root-cured: 1) BACK NAVIGATION (phone back exited the whole site): Root cause: admin tabs were pure React state — the URL never changed, so tab switches pushed NO history entries and the browser back button left /admin entirely (or closed the tab when it was the landing page). Fix: tabs are now URL-synced (/admin + /admin/:tabId route). Every tab switch is a real history entry; phone back walks back through visited tabs and out to the previous page; tabs are deep-linkable (/admin/users...). New one-tap back arrow in the mobile top bar uses history when the SPA has entries and lands on the dashboard otherwise. 2) APPROVAL-GATE OWNER SWITCH (new capability, default ON): The owner can now enable/disable the whole gate from the Users tab. ON (default — the 2026-11-24 contract): registrations land pending and wait for approval. OFF: registrations approve themselves (decidedAt stamped), already-pending accounts en…0d070f3 -
fix(admin-ui): root-cure mobile horizontal overflow — every tab edge-to-edge clean
ahmdelbaz28-uxOwner report 2026-12-01: admin dashboard on mobile showed content cut off at the right edge (screenshots of /admin Users tab). Root cause chain: 1. <main> is a flex item without min-w-0 — its automatic min-width (min-content of the widest child) stretched the WHOLE column beyond the phone viewport, so every tab looked clipped, not just tables. 2. The 3 data tables (users / payments / promos) sat in overflow-hidden cards with no scroll lane and no min-width. 3. Long unbreakable strings (emails, phone+reference, playlist URL, audit procedure, chatbot Q/A, article slugs) widened table cells. Repairs (all 18 tabs benefit from #1): - main: min-w-0 so the column can shrink to the real viewport. - users table: overflow-x-auto wrapper + min-w-[720px]/sm:min-w-[880px] + 'Joined' column hidden below sm + break-words on the email cell. - payments table: overflow-x-auto + min-w-[840px] + break-all on the phone/reference sub-line. - promos table: overflow-x-auto + min-w-[600px]. - …03e79dd
3 days ago
-
fix(lint): lint-all round — zero eslint warnings repo-wide
Z User- local-auth-router: cleaned verification results built explicitly (no throwaway destructured diagnostics vars); behavior identical — the non-admin response carries only success + message on both sites - Profile.tsx: session-scoped emailChangePending read via a lazy useState initializer instead of setState-in-effect (no cascading render on mount) - scripts: dropped unused bindings (streamDone IIFE inlined, t0, label param, size fn, before35ThinkingAr) - profile-email-flow regression guard tracks the equivalent cleaned return literal eslint: 11 warnings -> 0. tsc -b + ultracheck + biome stay clean.d28fca5 -
fix(security): security-audit wave 2026-11-30 — 6 root-cause repairs
security-auditCloudflare security-audit-skill full review (4 hunter units: auth/sessions, access-control, injection/SSRF, client+config). Confirmed findings fixed: - google-only-account-500 (low): NULL passwordHash rows surfaced a distinct, delay-free, unthrottled HTTP 500 that confirmed 'username exists with no local password'. Now routed through the dummy-hash lane -> uniform 401 + per-account throttle. - platform-cascade-dns-pinning (medium): the platform provider cascade (chat stream/non-stream + /models discovery + admin test) validated the baseUrl string only — a rebinding hostname could aim the key-bearing POST at an internal target. All three dials now go through pinnedPublicFetch (same DNS-pinned egress the BYOK lane already uses). - gis-nonce-binding (low): GIS ID tokens were accepted without a nonce, so a captured token could be replayed within its 1h validity. Login/Register now generate a CSPRNG nonce at google.accounts.id.initialize time, echo it in the POST, and t…2c0a4c0
4 days ago
-
fix(sonar): wave 9 - resolve the last 6 stubborn findings
Z User- S2486 cache-nuke: catch now USES the exception (console.debug) instead of a bare comment - definitively compliant - css:S7924 x2: explicit background-color base (#0a0e17) under the translucent gradients so the contrast analyzer composites against the real dark theme (cyan-400 vs dark = ~10.6:1) instead of falling back to white - python:S5843: HEAD_RE_PARTS[0] split under the complexity budget (any() over parts unchanged) - S8786 x2: redact regex rebuilt with fully disjoint character classes (no whitespace adjacency = no backtracking ambiguity, linear scan) Verified: tsc clean, vitest 1394/1394, py_compile clean, node --check.f8a3341 -
fix(sonar): wave 8 - final sweep, all 21 remaining live findings
Z User- S8689/S5144: documented sanitizer/authority invariants (redact() contract, fixed-hostname + origin-form) - taint-model blind spots, NOSONAR justified - S3776 x3: extract collectNormalizedMessages, verifyRightsAndSweep, ReviewsHeader (16 -> <=15 each) - S8786/S5843: extract_refs_kb trailing-number + kW token validators (differential-fuzz equivalent: 0 mismatches / 200k cases), redact() regex linearized in both probe scripts, HEAD_RE_PARTS regrouped (0/60k) - css:S7924 x2: cyan-500 -> cyan-400 at the flagged rules (4.5:1 cleared) - S7503/S3626 write-strategies, S6582 worker, S4323 cables aliases, S7786 TypeError, S2486 comment style Verified: tsc clean, eslint clean, vitest 1394/1394, py_compile clean.5632e3b -
fix(sonar): wave 7 - cleanup round from live scan (93 findings across 65 files)
Z User- 34 in-scope follow-ups exposed by the 17:59 scan (refactor residuals: S3776 helper splits, S4323 type aliases, S6759 readonly on extracted components, S8786 bounded-regex justifications, S6551 scrub patterns, S9440/S7924 CSS at new positions) - python leftovers: 29x S1481 positional _, S8786 regex canonicalization (fuzz-verified), S3776 task24 step-fn hoisting, S1192 dialog/content-type consts - operator tooling: S9382 documented NOSONARs for deliberate poll/throttle loops + Promise.all for independent probes, S8689 second log site routed through redact(), S5144 second fetch site behind UPSTREAM_HOST_ALLOWLIST Verified: tsc clean, vitest 1394/1394, node --check + py_compile on touched scripts.6780540 -
fix(sonar): wave 5 - final in-scope sweep, 92 findings across 67 files (complete: 994/994 in-scope)
Z User- 23 two-count files + 44 one-count files: S6582/S7503/S7755/S7773/ S7780/S8786/S9382/S3776/S6759/S6819/S5906/S5976/S3863/S7763/S7785/ S8782/S4138/S7744/S6606/S4624/S7778/S7754 - google-auth-router 47->11, shield 39->6, security middleware 24->8, ForgotPassword 34->4, VerifyEmail 22->5, Courses 28->13 (DOM identical) - S9382 NOSONAR only for: Redis connection retry backoff, migration ledger order - both documented sequential necessities - contract tests re-pinned: issueSessionResponse centralization (both session paths categorize), isHostGateExempt approval-action exemption Verified: tsc clean, eslint 0 errors, vitest 1394/1394.6165987 -
fix(sonar): wave 4 - resolve 114 findings (payment-router, sld render/repair, chatbot-prompts, cache, Register, ArticleDetail, chat-format, user-ai-provider, image-quota, email, chatbot-errors, push-state, Footer, notes-router, local-auth, think-filter, settings/maintenance/paymob routers, youtube-watcher, referral, env)
Z User- S3776 extractions (getSystemPrompt via SystemPromptArgs, chatbot-prompts 51->15, email OTP verify flow, local-auth register/login/updateProfile) - S9382: NOSONAR only for documented sequential necessities (Redis SCAN pagination, bulkUpsert pool cap, ordered SQL dump, oEmbed concurrency pool) - S8786: credential regex de-duplicated quantifiers, email validator split, UA WebView regex preserved via differential corpus test - S6551: describeCause/JSON diagnostics; S6759 readonly props; S5906 in tests - contract tests re-pinned to helper-based equivalents (2FA helper call site, finalizeEmailVerification pendingEmail flow, changeEmailWithVerification rate-limit-inside-branch) - all runtime invariants unchanged Verified: tsc clean, eslint 0 errors, vitest 1394/1394.da57150 -
fix(sonar): wave 3 - resolve 100 findings (medium files: health-router, seo-meta, chatbot-stream, CourseDetail, docgen spec/md/font, AiProvidersPanel, SubscribeGate, spa-handler, Articles, AdminNotificationPanel, Documents, NotificationCenter, playlist-sync, approval, chatbot-feedback, chatbot-byok, boot)
Z User- S3776 extractions across components and lib (NotificationCenter push flow 55->11, Articles 41->6, AdminNotificationPanel 22->1, playlist-sync 34->7) - S3358 nested ternaries -> module helpers/sub-components - S9382: Promise.all for independent writes; NOSONAR only for the notify-cap throttle in playlist-sync - S8786: trailing-slash regexes -> shared stripTrailingSlashes loop - S6551: JSON diagnostics; S4782/S6564/S6660/S7737/S7773/S7503/S7737 - approval contract test adapted to Promise.all admin fan-out (same pins) Verified: tsc clean, eslint 0 errors, vitest full suite green.caa8f36 -
fix(sonar): wave 2 - resolve 112 findings (CourseReviews, telegram-bot, saudi-kb, chatbot, shape, css, refs.test)
Z User- CourseReviews: S3776 40->14 via label helpers, S3358, S6759 readonly props - telegram-bot: S3776 extractions (splitForTelegram, handlePrivateMessage, pollLoop, supervisorBody), S9382 throttle NOSONARs, S7503 de-async, S4782, S6582; retry_after sleep removed from loop - chatbot-saudi-kb: S7780 String.raw x12 - chatbot.ts: S3776 cascade/sweep extractions, S107 bundle, S4123 sync validators, S6551 JSON.stringify diagnostics - docgen/shape.ts: bidiRuns decomposed (95->~2), S3358/S4323/S7755, docgen output pinned by existing tests - index.css + elite-animations.css: S9440 consolidated prefers-reduced-motion blocks, S9449 explicit transition properties, S4666 merged duplicate selectors, S9450, S7924 contrast fixes - chatbot-refs.test.ts: S5906 toHaveLength assertions Verified: tsc clean, eslint 0 errors, biome clean, vitest 1394/1394.c2dde89 -
fix(sonar): wave 1 - resolve 511 in-scope findings across 15 app files
Z UserRoot-cause refactors per SonarCloud rules (behavior-preserving): - S3776 cognitive complexity: extracted cohesive helpers in ai-router, chatbot-router, chatbot-refs, chatbot-cables, Admin, ChatBot, skillnet, saadat, pdf, db-init, chat-render, Profile - S3358 nested ternaries -> Record lookups / if-chains / bilingual helper - S7780 String.raw for regex-source literals; S7781 replaceAll - S6594 match->exec / matchAll; S6557 startsWith/endsWith; S7755 .at() - S8786 backtracking: split overlapping-quantifier regexes (citation, refusal, promise/delivery detectors), linear rewrites, documented bounded-pattern NOSONARs where grammar is provably linear - S9382: Promise.all for independent DB upserts; documented NOSONAR for order-dependent/throttled loops only - S3923 real bug: identical-branch ternary in chatbot-cables depthFactor - S6551: honest typed rows instead of String(object) in db-init/sld fence - Source-contract tests re-pinned to the refactored equivalents (admission-gate…9ce5991
7 days ago
-
fix(approval-loop): email Accept/Reject now executes — challenge-free links + honest db_error page
ROOT CAUSE (owner report 'قبول/رفض الإيميل مش بينفذ'): the email buttons linked to the canonical domain, whose Cloudflare managed challenge never passes for mail-app webviews/non-JS clients (measured: real-browser navigation stuck on 'Just a moment…', curl 403 cf-mitigated) — clicks carrying the owner's signed authority died at the edge and the approval circle never closed. - approval.ts: approvalActionBaseUrl() — APPROVAL_ACTION_BASE_URL (Space var, set to the raw hf.space origin) routes the buttons straight to the app; falls back to FRONTEND_URL. Signed HMAC token remains the sole authority. - shield.ts: exempt /api/approval/action from the host gate (same precedent as the paymob/yt-sync HMAC-verified paths) — clicks work from ANY host. - approval-action-route.ts: db_error is now an honest 503 retry page — it can no longer masquerade as 'تم البت في هذا الطلب مسبقاً' while nothing was written. - env.ts/.env.example: APPROVAL_ACTION_BASE_URL documented. - contract tests (45 to…263459d -
fix(lint): biome-ignore for the intentional-deps referral useMemo in Register
Z UserBiome does not honor eslint-disable comments — the intentional re-read trigger dep (refCodeFromUrl) on the storedRefCode useMemo needed its own biome-ignore. Zero behavior change; run-3 verification suite re-confirmed green: tsc -b clean, eslint 0 errors, biome 0 errors, vitest 1391/1391, vite build OK (precache 1501.01 KiB).bfd9645 -
perf(frontend): react-best-practices pass — 16 files, zero behavior change
Security Audit Run 3Applied the vercel-labs react-best-practices catalog (ECC/vercel skills) across src/. Every fix is behavior-preserving; verified with tsc -b clean, biome 0 errors, eslint 0 errors (1 pre-existing warning, was 2), vitest 1391/1391, vite build OK (precache 1510.06 -> 1500.62 KiB). Code-reviewed per the requesting-code-review skill (read-only reviewer over 12a144f..HEAD); the single Important finding (cv-auto wrapper div would break grid equal-height stretch) is fixed via the repo's own cvClass-prop pattern, and the Register referral snapshot edge is handled with an intentional-deps useMemo. Waterfalls (async-*): - NotificationCenter: VAPID public-key fetch no longer serialized behind an up-to-8s serviceWorker.ready wait on first visits (independent lane, own try/catch — error semantics unchanged) - CertificateView share-image: logo (network) + QR (data-URI) loads start concurrently and are awaited inside their original guarded blocks Re-render (rerender-*): - ui/motion TiltCard +…02797da -
feat(email): delivery verdicts surface in the dashboard — silent alert failures impossible
Z UserOwner report: 'the registration-approval email never reached my inbox and nothing ever told me.' Root cause: sends are best-effort and the outcome lived only in server logs the owner cannot read. - migration v22: bounded email_delivery_log ledger (class, masked recipient, ok, provider status, safe reason; 14-day prune) - email.ts: every send outcome recorded best-effort (config/network/4xx/5xx classes); network errors now a classified, ledgered failure instead of an unhandled rejection - approval.ts: alert email sends FIRST with ONE transient retry (network / 5xx only), then the in-app admin notification carries the real verdict — 'sent to your inbox' or the exact provider reason + approve-from-dashboard guidance - admin-users.ts: emailDeliveryLog query (last 10 outcomes, last approval alert, from address) — degrades to empty pre-migration - Admin.tsx: approval card shows a green/red verdict banner with the provider reason + one-click re-send, plus a mini delivery ledg…37e6657 -
security(audit-run-3): comprehensive security audit fixes (cloudflare security-audit-skill)
Security Audit Run 3Confirmed vulnerabilities fixed: - paymob-webhook: bind SIGNED obj.order.id to stored paymobOrderId (unsigned merchant_order_id was the only correlation key — replay-with-swap class); verify the callback's own signed currency (EGP pin now two-sided); preserve the original charge reference on refund/void events - promo quota release is now transaction-atomic with the refund/reject that compensates it (webhook tx + admin reject tx) - referral reward coupon is granted at ADMIN APPROVAL instead of registration (self-referral coupon farming closed); single decision path in decideApproval - wishlist add/list leak of unpublished (draft) course metadata — existence + isPublished validation on add/toggle, publish predicate on the list join - vision image-quota reservation leak on the per-user daily-cap 429 path (refund exactly once invariant restored); vision lanes re-keyed to the AUTHENTICATED account (u<id>) instead of spoofable client headers - forgotPassword: per-RECIPIENT s…ec34781 -
feat(ui): implement review suggestions #2-#5 — motion discipline, signature completion, proof system, certificate share asset
Z UserSuggestion #2 — one motion per screen (Brand Kit §6): hero is now visually silent except the primary CTA: static Zap badge, static ambient glow, static image frame, static floating cards, static scroll indicator; the ONLY continuous motion is the new .brand-cta-glow pulse (opacity-only pseudo-element, reduced-motion safe). Background icon layer cut 25→5 icons sharing ONE slow 40s transform drift. Suggestion #3 — signature completion: .brand-signature-line now under every Home section title (removed the clashing section-header-glow divider), .brand-signature-hover floors on the AI-section + CTA-banner primary buttons (new optional wrapperClassName on ArcFlashButton — backward compatible). Headline keyword gradient-text switched to the official orange→cyan signature. Suggestion #4 — unified proof system (truthful by construction): green check chip "شهادة موثقة" on course cards, "طالب موثق" badge on every published review (reviews are enrollment-gated server-side…d42fc97 -
feat(brand+seo): signature gradient system + Brand Kit law + noscript SEO fallback
Z UserUI review implementation (safe scope — outside the security agent's files): Suggestion #3 — electric signature (orange→cyan, 3px) now repeats at: - scroll-progress bar pinned page-top (new SignatureProgressBar, rAF, transform-only, reduced-motion safe, RTL origin) mounted in App - boot splash loading bar (was cyan→blue, now the official signature) - course-card top edge reveal on hover (.brand-signature-card in CourseCard) - opt-in utilities .brand-signature-line (section titles) and .brand-signature-hover (primary CTAs) ready for the Home round that follows the security agent's UI rework Suggestion #1 — Brand Kit law: docs/BRAND-KIT.md pins the 60/30/10 color rule, exact token values from index.css, radius/shadow scale, the icon-beside-label button standard, motion rules and the proof system. SEO (review gap #4, minimal fix): <noscript> block in index.html with an Arabic summary + 5 internal links so JS-less crawlers get real text. Verified: tsc clean, biome cl…d4d279d -
feat(home): replace fake testimonials with AI assistant capability cards
Z UserOwner request: the seeded testimonials section on the landing page is gone. In its place — a promotional section showcasing what the platform's AI assistant can actually do (all verified in code, not invented): 1. Reads Images & Diagrams — vision lane (attach photo of a handwritten problem / circuit diagram / software screenshot) 2. Live Screen Sharing — getDisplayMedia lane, the bot follows the user's ETAP/SKM session in real time 3. Deep Thinking Mode — thinking vs instant modes 4. Bring Your Own Key — BYOK lane (OpenAI / Gemini / Groq / OpenRouter), replies route through the user's provider without platform quotas 5. Conversation Memory — last 50 rounds + rolling summary persisted to the account 6. Live Streaming, Full Control — streamed replies with stop / copy / clear Section style mirrors the existing Saadat AI section: SectionHeader + BentoCard grid + AnimatedIcon (orbit/pulse/morph/glow/float/tilt), fully bilingual with automatic RTL. Testimonial type, course.test…101b372 -
fix(ui): icon beside label on every button + WCAG AA button contrast
Z UserRoot cause (icon stacked ABOVE label): ArcFlashButton — the shared CTA used by the landing hero and AI-assistant section — had gap-2 but NO flex display; Tailwind preflight makes <svg> display:block, so the icon rendered as a block ABOVE the text node. Fix at the component root: inline-flex items-center justify-center — every usage inherits the correct icon-beside-name layout. All 39 raw button sites audited via scanner + manual review; shadcn Button, navLinkBase, admin-sidebar-item and btn-primary already carried flex and were healthy. Contrast (computed WCAG 2.1, brand hues preserved): - .btn-primary white-on-accent 2.80:1 -> 6.89:1 (dark text, bg unchanged; light theme 3.68 -> 5.24). Navbar avatar initials fallback same. - cyan-500->blue-600 + white 2.43:1 -> 5.36:1: gradient start deepened to cyan-700 (Faq support CTA, References buttons/badge, ChatBot send/FAB). - emerald buttons keep their bg, text flipped to near-black #04121c: 2.54/3.77:1 -> 7.47/5.03:1 (Quiz finish, Adm…dec24b8
8 days ago
-
chore(biome): eliminate the organizeImports class repo-wide + close every remaining biome error
Z UserThe three organizeImports errors documented on the avatar feature (review- router, CourseReviews, ChatBot) were one instance of a repo-wide class: 17 assist/source/organizeImports diagnostics across 15 files, all on untouched import blocks. biome check --write applied the safe mechanical reorder (no side-effect-only imports moved — verified against the full diff; the 1391-test suite + tsc + build all pass unchanged). Also closed so `npx biome check .` now exits clean: - email-templates.ts useTemplate: concat → template literal - chatbot-cables-kb.ts noApproximativeNumericConstant ×2: biome-ignore with justification — ac 1.442 Ω/km is measured IEC cable data, NOT the log2(e) constant the rule suspects; auto-fix would have corrupted the table - admin-learning.ts usePlaywrightValidDescribeCallback ×3: biome-ignore — `describe` there is the local error formatter (line 238) for the DB canary diagnostics, not a test-runner describe18afd52 -
fix(approval-gate): verified ≠ approved — the admin dashboard now shows the REAL entry state everywhere
Z UserOwner report (2026-11-26): "a user complains that despite being logged in and his email confirmed by the admin, every visit asks him to log in again — the platform does not remember him." ROOT CAUSE (code + live server logs): The admin approval gate (owner directive 2026-11-24, "لا يدخل أحد للمنصة بدون تأكيد الإيميل من الأدمن") fail-closes EVERY session issuance on users.approvalStatus === 'approved' — local login, Google OAuth callback, AND every live request (context.ts loadUserFromDb). "Email confirmation" (emailVerifiedAt — the self-service link/OTP flow) is a fully independent milestone that NEVER touches approvalStatus. The live log captured the exact victim: [GoogleAuth/OAuth] "Sign-in refused by approval gate — userId 5, gate: pending" minutes after the last deploy. The account was verified but never admin-approved → every login attempt bounces → "asks me to log in every time". The session pipeline itself (30-day sliding cookies, grace-window renewal, flag-cookie self-heal) wa…d28c7f4 -
feat(avatar): profile photo now surfaces in chat bubbles and course reviews
Z UserOwner request (2026-11-26): the photo uploaded from the profile page (31baaf4) should follow the user across every social surface — chat messages and course reviews — not just the profile/navbar. Server: - review-router.listByCourse now projects userAvatar (users.avatar) with each published review; the sibling lesson-comments router already returned it, so the review list was the odd one out. Client: - CourseReviews.tsx: reviewer avatar circle renders the real photo when set (lazy/async, cover-cropped), initials circle stays the fallback for reviewers without a photo — identical geometry, no layout shift. - ChatBot.tsx: MessageBubble gains a stable userAvatar prop (memo-safe — changes only when the user actually changes their photo); user bubbles wear the real photo in place of the generic User icon chip, icon chip remains the fallback. Assistant bubbles keep the site logo. Admin moderation tables intentionally keep compact initials (moderation rows…2e6a64d -
feat(profile): uploadable user avatar — photo replaces the initials box, name under it
Z UserOwner request (2026-11-26): the user dashboard's avatar box showed only the first letter of the name. It now renders the user's actual profile photo (with the name displayed UNDER the photo per the layout requirement) and the user can upload/replace/remove it themselves. Why storage lives in the DB: the HF Space disk is EPHEMERAL (rebuilt on every deploy) — an uploaded file would vanish at the next push. users.avatar (MEDIUMTEXT) persists in the external MySQL and already existed for Google OAuth picture URLs; self-uploads ride the same column as small data URLs. Server: - migration v20 (db-init.ts): users.avatar TEXT→MEDIUMTEXT, idempotent INFORMATION_SCHEMA probe (re-ALTERs only while still plain TEXT) - SafeUser + AuthMeOutput widened with avatar; explicit projection updated — auth.me + session.me now deliver it to the UI (30s SafeUser cache evicted on change via evictUserAuthCache) - auth.updateAvatar mutation (local-auth-router.ts): authed-only, writes ONLY…31baaf4 -
fix(chatbot): Android back button closes the fullscreen chat instead of leaving the site
Z UserOwner report (2026-11-26): on mobile the chat opens fullscreen (desired), so users press the hardware back button to leave the chat — and the SPA interpreted it as site exit, dropping them out of the platform entirely. Root cause: nothing intercepted the back gesture for the overlay. Android back fired a history pop that react-router honored as real navigation (previous route / site exit) while the fullscreen chat stayed stacked above it visually. Cure — pin-one-entry gate (ChatBot.tsx): - while the fullscreen chat is open on mobile, ONE extra history entry is pinned (same URL, flagged state, router idx preserved) — a same-URL popstate the router reads as a no-op - first back press pops that entry: popstate handler closes the chat only; the site never navigates - the X button and the minimize button consume the pinned entry via history.back() (suppressed pop) so the stack never grows stale entries — the NEXT back press after closing leaves the site normally …ef2f7a3 -
fix(notifications): compact mobile toast cards — YouTube bursts no longer wall off the screen
Z UserOwner report (2026-11-26): the YouTube new-episode toast shown on platform entry rendered a very tall card on phones; a multi-event burst stacked up to four of them and covered the entire screen. Root cause (measured): two independent inflators — 1. the broadcast copy carried a ~200-char marketing tail, so one card rendered ~7 text lines ≈ 220px tall 2. the card was a fixed 320px-wide, unclamped box and the stack allowed 4 toasts on every viewport; on a phone that is 800px+ of glass Fix — client (NotificationToast.tsx): - card is fluid-width on mobile (full width minus 32px margins), p-3, 28px icon, message line-clamp-2, title line-clamp-1; ≥sm unchanged (320px, p-4, message line-clamp-3) - responsive stack cap via matchMedia (jsdom-safe fallback): max 2 toasts on mobile, 4 on desktop; displaced events stay in the bell history — a toast is not an inbox - container gains left+right margins on mobile (no overflow on narrow screens) and pointer-ev…2c2b16c -
fix(remember-device): boot auth verification never destroys a session the server did not reject
ahmdelbaz28-uxRoot cause (measured live 2026-11-25/26): the reported 'exits the site -> the app forgets I was logged in despite Remember this device' was NOT a cookie/session death. The 30-day cookie pair, 7d JWT + 30-day grace renewal and tokenVersion revocation are all sound. What broke the remember-device promise was the BOOT VERIFICATION RACE on infrastructure outside the auth pipeline: - the canonical domain (qzz.io) rides an external Cloudflare edge that answers /api/* with 403 cf-mitigated:challenge ('Just a moment…') — live-captured on /api/health and auth.sessionProbe; an XHR can never solve an interactive challenge, so during any challenge window every tRPC call dies - the HF Space container restarts on every deploy (frequent pushes) and can briefly 5xx during cold starts / healthcheck restarts auth.me ran with retry:false, so the FIRST such failure flipped isAuthenticated to false and ProtectedRoute navigated to /login while the user's valid 30-day cookie was sti…2435544
9 days ago
-
fix(chatbot-docgen): EXPLICIT-REQUEST-ONLY hard gate — no unsolicited file generation, no suggestions (v3.9.1)
ahmdelbaz28-uxOwner directive (2026-11-24, absolute): the permanent file-generation capability stays, but it must NEVER fire without an explicit user request, and the bot must NEVER suggest or offer file generation. - docgenSkillAr/En: removed the auto-trigger clause («يستحق ملفاً» / 'long/tabular enough to deserve one') — long or tabular answers now stay plain prose with no docgen board; added THE FUNDAMENTAL CONDITION block (explicit request = the only key, no self-initiated generation, no suggestion/offer/hint ever, format-name-only mention → prose answer, format follows the user's request verbatim with pdf as the only default when a file IS explicitly requested but no format is named). - Removed the post-delivery offer-to-convert clause («اعرض تحويلها» / 'offer the other on request') — one file per reply, never offer another format; the user asks for it themselves. - docgenQuickAr/En (instant lane): same hard gate in condensed form. - ChatBot.tsx welcome messages (EN+AR): remove…cc06b18 -
feat(chatbot-docgen): permanent in-chat document generation — PDF/DOCX/MD (v3.9.0)
ahmdelbaz28-uxOwner directive (2026-11-24): the bot must ALWAYS be able to build real files for the user inside the chat — no external skill loading, ever. - docgen skill 'docgen-file-export' in SKILL_REGISTRY (category export, thinking+instant): routed on file/export intent, emits a ```docgen DocSpec fence with the immediate-execution contract (file in the FIRST reply, verified numbers only, mandatory citations). - api/lib/docgen/: dependency-free deterministic renderers — PDF written from scratch (Type0/Identity-H CID fonts, two embedded GNU FreeFont subsets, full Arabic presentation-form shaping + simplified UAX#9 bidi with N0 bracket-pair + N1/N2 neutral resolution, RTL tables, page footers), DOCX as stored-ZIP OOXML (bidiVisual RTL tables, w:bidi paragraphs, Word-native shaping), and GFM Markdown. - POST /api/docs/gen: public, stateless, size-capped (60k content chars), typed 422 diagnostics — the /api/diagrams/sld contract. - Chat UI: renderDocgenFence download card (format …aea6c23 -
feat(approval): reopenApproval — owner authority reaches pre-gate accounts (root fix)
ahmdelbaz28-uxOwner report (2026-11-24): he signed in with ahmedelbaz28@gmail.com and the gate never stopped him. DB truth: that email maps to the pre-gate account @AHMEDBAZ (id=5, created 2026-05-03) — the v17 migration grandfathered every existing account as 'approved' by design, so the gate (which fires at session issuance for pending/rejected rows only) correctly never applied to it. New registrations ARE gated (22/22 live). ROOT FIX — reopenApproval (admin mutation + users-table button): - any NON-admin account can be put back into the pending queue at any time: approvalStatus=pending, decision columns cleared; - live session KILLED in the same write (tokenVersion bump + auth-cache eviction) — pending means no access, not just no NEW sessions; - admin rows stay untouchable (no self lock-out); already-pending rows error instead of double-writing; - the owner alert fan-out fires (in-app stream + email with fresh signed Approve/Reject links) so the decision can happen from the inbox. Con…175408e -
feat(approval): admin gate on registration — owner approves/rejects every join before login
ahmdelbaz28-uxOwner directive (2026-11-24): 'أنا كأدمن لازم أقبل أو أرفض أي حد يسجل في المنصة قبل ما يدخل — وعندي سلطة إلغاء دخول أي حد في أي وقت.' SERVER (enforced at EVERY session-issuance path): - users.approvalStatus (pending|approved|rejected) + decision columns, v17 idempotent migration — DEFAULT 'approved' grandfathers all pre-gate accounts with zero backfill; registration writes 'pending'. - register: creates the account pending, issues NO token/cookie, responds pendingApproval:true — the login gate enforces the rest. - login: gate AFTER credential+2FA verify, BEFORE session issuance — correct credentials are not enough. Stable APPROVAL_PENDING / APPROVAL_REJECTED sentinels drive the localized panels; pending retries never burn the per-account failure throttle. - Google OAuth callback + GIS: all paths gated; new Google sign-ups insert pending and receive NO session (redirect marker / 403 codes). - decideApproval: reject flips status AND bumps tokenVersion in ONE UPDATE (live…a7cb154
11 days ago
-
fix(byok): owner-review UX fixes — delete confirm guard + toggle state-mirror sync
ahmdelbaz28-uxUser-journey review findings (2026-11-23): 1. DELETE had no confirmation — one misclick permanently erased the encrypted key (irreversible: the plaintext never leaves the server, so there is no way to re-derive it). Now asks for explicit confirm with a bilingual message explaining the consequence, same convention as every other destructive action in the app. 2. TOGGLE left the checkbox stale — the checkbox renders config.enabled while handleToggle only flipped the separate state mirror, so after a toggle the checkbox still showed the OLD value; a user re-clicking it silently re-enabled (or re-disabled) the model. Both mirrors now flip optimistically, roll back together on failure, and the server's authoritative config row is adopted on success. Feedback toast states which cascade is now in charge (user model first / platform models).1035617 -
feat(gate): login required for ALL content — no video, article body, or file download for logged-out visitors
ahmdelbaz28-uxOwner contract 2026-11-22: visitors may browse catalog surfaces, but ANY actual content opens only after signing in. Server boundary (the real enforcement): - course.previewVideo REMOVED entirely — the anonymous playback path no longer exists in the codebase; logged-in free-lesson playback stays on course.lessonVideo (authed + subscribe-ticket gated) - course.completeSubscribeUnlock: publicMutation → authMutation, the deviceId branch deleted — tickets are always ACCOUNT-bound; guests get 401 UNAUTHORIZED instead of a ticket - articles.getBySlug: publicQuery → authedQuery — the article BODY is platform content; list/categories stay public (metadata only) - references.getDownloadUrl: publicMutation → authMutation — file downloads require a session; anonymous callers get UNAUTHORIZED Frontend (login-first UX, matching the boundary): - /articles/:slug wrapped in ProtectedRoute → guests redirect to /login - CourseDetail: guests clicking ANY lesson now get the LOGIN wall panel …1635daf -
feat(auth): reset/verification emails now speak the user's language + spam guidance in every email
ahmdelbaz28-ux- email-templates: bilingual contract EmailLang (ar|en|both) — reset and verification emails render in the user's stored preferredLanguage (ar→Arabic RTL, en→English LTR, unknown→bilingual AR+EN sections) - every template carries the spam-folder guidance line ('check Spam, mark as Not spam so we reach your inbox next time') in the SAME language — the owner-reported 'code never arrives' case is a Gmail spam-folder landing, so the guidance must live inside the email itself - ForgotPassword: localized success toast (was server English), title now says code (not link), duplicate deliveryWarning block removed, step-1 guidance extended with the mark-not-spam instruction - tests: 18 template tests incl. per-variant language + guidance checksecca573 -
fix(auth): root-cure owner report 'reset code never arrives' — explicit case-insensitive email contract + spam-folder guidance
ahmdelbaz28-uxLive forensics (Resend API) proved the full chain healthy: the owner's account (id=5, email stored UPPERCASE since 2026-05-03) DID receive 4 reset codes + 2 verification codes today, all last_event=delivered — the emails land in gmail's Spam folder, and the ci collation already folds case on every lookup. Cures shipped: - initiatePasswordReset normalizes the lookup email (explicit ci contract, survives any future collation change) — the mixed-case stored row keeps matching - pendingEmail arms normalized to lowercase: confirmed email changes land lowercase going forward (regression guard updated in profile-email-flow) - register stores emails lowercase (no new mixed-case rows) - ForgotPassword 'sent' screen now tells the truth: check the Spam folder, look for the 6-digit code, enter it below or use the link buttone82ae2c