Spaces:
Running
Running
Commit History
Today
-
fix(pinned-dispatcher+health+honest-proofs): Node autoSelectFamily dual-contract lookup — BYOK lane, /test and the whole dynamic cascade unbroken
Z User- pinnedLookup now answers BOTH net contracts: array form under all:true (autoSelectFamily destructures addresses[0] — the old single-object form made EVERY pinned dial throw in ms: BYOK chat lane, BYOK /test oracle and the platform dynamic cascade silently fell back since the pinning change) - health: unified isOverallHealthy critical set (db+migrations only, shared by cached+fresh paths — kills the recurring public 503 windows) + 4s deadline & one retry on the db ping (was: unbounded hang) - maskApiKey: ••••last4 only (write-only contract, no key-prefix leak) - live proofs: pipefail + guarded retries (the tee-pipeline always reported success — vacuous green), origin-probe base + x-forwarded-host (edge challenge immune), probe session for the login-gated chat lanes, explicit ENV-SKIP instead of silent pass - tests: pinnedLookup dual-contract + all:true array form, health-critical semantics (7), mask last4; 1480/1480 green, tsc clean, build OK - DEPLOYMENT.md §13 docu…dac06da -
proof(live): BYOK lifecycle live proof + dispatch-only chatbot matrix workflow
Z User- scripts/byok-lifecycle-live-proof.ts: key-icon contract B1-B5 — save (write-only, masked last4), decrypt->real provider call (fake key gets the localized 401/403 verdict), kill-switch toggle, delete - .github/workflows/live-quality-proof.yml: workflow_dispatch ONLY (zero scheduled minutes — budget rule) runs the T1-T7 chatbot feature matrix + the BYOK lifecycle on the live production site0eb3910
Yesterday
-
test(live-proof): classify edge bot-challenge as env-skip, not product failure
ahmdelbaz28-ux6277759 -
test(live-proof): first-load numerals probe, batched tRPC format, sw.js serve proof
ahmdelbaz28-uxRun-1 findings on the dispatch runner: the post-click reload re-rolled the Cloudflare managed challenge (empty DOM — no counters) and the single-call tRPC input format answered 400 (real client uses batch=1). The numerals check now runs on the FIRST load (language=en pre-set in the init script — no reload), the contact check uses the exact batched URL the site's own httpBatchLink sends (3 retries + diagnostics), and a new check proves the self-heal chain is actually served: /sw.js 200 + no-cache + cleanupOutdatedCaches.687021d -
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(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 -
ops(diag): real write probe via huggingface_hub + proper variable delete (script file)
platform-review-bot390b466
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 -
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
3 days ago
-
fix(probe): S8476 regression — probeUrl must return absolute URL for Node fetch
Z UserThe SSRF guard refactor returned a relative path (url.pathname + search), but Node fetch rejects relative URLs, crashing the live deploy/cache probe before any check ran. Return the absolute URL rebuilt from BASE_URL; the scheme + same-host guards still run first, so the SSRF protection is unchanged. Verified: probe 26/26 PASS against production.e74a653 -
fix(sonar): S9383 — handle the fire-and-forget SSE-reader promise
Z UserThe lint round inlined the streamDone binding into a bare async IIFE, which left the promise unhandled (SonarCloud S9383, new-code reliability gate C). The trailing .catch is unreachable — the reader loop swallows every error itself — but it satisfies the rule with zero behavior change. Quality gate on new code: reliability 3(C) -> target 1(A) once re-analyzed.e1c2cf7 -
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
4 days ago
-
fix(sonar): wave 13 — extract stubPaymentProc from stubGateProc (S3776)
ahmdelbaz28-uxThe last open SonarCloud finding: the payment-funnel stub cases pushed stubGateProc to cognitive complexity 22. The four payment procedures move into their own stubPaymentProc router (same dispatch order, same behavior). Verified: syntax check, payment-funnel + subscribe-gate E2E green.9ad78c6 -
fix(sonar): wave 12 — readiness follow-ups + E2E flake root fix
ahmdelbaz28-uxFollow-up wave from the 2026-11-30 production-audit re-scan: - api/boot.ts (S3776): extract runBootMigrations(), stopBackgroundWorkers() and createShutdownHandler() to module scope — start() back under the cognitive-complexity bar, behavior identical. - api/health-router.ts (S3776): extract gatherChecks() — the /health route now only decides cache-vs-fresh, overall status and the payload. - scripts/ui-test-server.mjs (S3776): extract readTrpcPostBody() — the tRPC stub router loses its nested stream-callback complexity. - deploy.sh (S7689): drop shell-style backticks inside the staging banner. - tests/e2e/features/payment-funnel.spec.ts (S5906): toHaveLength(1) instead of a generic equality assertion. - tests/e2e/features/desktop-recovery.spec.ts (FLAKE ROOT FIX): loadCount() raced the recovery-flow reload — a destroyed execution context failed the whole expect.poll cycle (~1-in-3..6 repeats, proven pre-existing on HEAD: 2/6 failures without any wave-12 change). Context…78d1cd7 -
fix(readiness): production-audit wave 2026-11-30 — launch-readiness repairs
ahmdelbaz28-uxRoot-cause fixes from the e2e-testing + production-audit tour: 1. db-init.ts (v19 destructive migration): refuse DROP TABLE quizQuestions when a runtime COUNT(*) shows rows — the old drop trusted an authoring-time 'verified empty' claim and would have silently destroyed student quiz data on future schema drift. Migration outcome is now tracked (getMigrationOutcome) and failures reset migrationDone so boot retries are real retries. 2. boot.ts: migration retry loop (3 attempts, backoff) + completed graceful shutdown — stop Telegram poller / YouTube watcher / email-drip scheduler, bounded close (4s keep-alive eviction, 8s forced exit), drain both MySQL pools. SIGTERM teardown no longer hangs until the platform kill timeout. 3. health-router.ts: new checks.migrations — a failed boot migration is now VISIBLE (unhealthy -> 503 -> orchestrator restart) instead of a silent warn. 4. payment-router.ts: (a) production refuses Paymob intents while a *_test_* secret k…5cc2c97 -
fix(sonar): wave 10 - last 3 findings (S6582 console?.debug, S8786 documented NOSONAR on the bounded scrubber regexes)
Z User780e694 -
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 6 - operator tooling + infra, 477 findings (scripts/, infra/, tests/, cache/, public/, .agents/, .github/, Dockerfile)
Z UserSECURITY (real fixes at root): - S2083 BLOCKER: lh_static_server path traversal -> canonical resolve + root-prefix check + 403 - S5144 SSRF: prod_reverse_proxy -> fixed upstream + allowlist + origin-form - S5443 x22: probe artifacts moved from /tmp to project-local .cache dirs - S2245 x5: credential material -> node:crypto randomBytes - S8689: log redaction helper for token/secret material - S5145 x4: log injection sanitized; S8476: CSRF URL allowlist - S4036 x3: absolute executable paths instead of PATH lookup - S9383 BUG: cache-nuke promise handled; S3923 x3 + S1244 x2 + S5797 real bugs collapsed / math.isclose SMELLS: python S1192 literals hoisted (53), S3776 refactored (32) with differential fuzz equivalence on parsers, S1481/S1186/S1172/S1854/S8513... ; js/ts scripts S9382/S6582/S3358/S7780/S7785/S4624...; infra worker S3776 28->extracted; page objects; cache/ TS files; GitHub Actions snake_case; Dockerfile RUN arg order; shell [[ conditionals. Verified: node --check all edi…23a1787
7 days ago
-
fix(ci): refs live-proof retries transient chatbot blips in-place
ahmdelbaz28-uxThe 2026-11-26 16:45 green run needed its job-level retry: attempt 1 failed on a transient chatbot blip and only attempt 2 passed. Retrying INSIDE the proof (429/500/502/503/504/529, network drops, and 200-empty reply — the kilo-auto empty-content failure mode — x3, 20s/40s backoff) keeps the deploy gate honest about real contract breaks while one bad second can no longer redden the run. Non-transient results and content contracts are unchanged; the outer 2-attempt pattern stays as the net.1132e0b -
fix(owner-contact): correct owner email handle everywhere — ahmedelbaz28 → ahmdelbaz28
The admin-approval alert fallback (api/lib/approval.ts adminAlertEmail()), the live-e2e/log-proof probe docs, the perf probe BASE URL (dead host ahmedelbaz28-ahmdrtap.hf.space → ahmdelbaz28-ahmdrtap.hf.space) and the DEPLOYMENT.md owner handle all carried a one-letter typo ('e' after 'ahmd'). The Space secret ADMIN_ALERT_EMAIL was overwritten with the correct inbox in the same round (values live outside the repo by policy).621f56a -
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
8 days ago
-
ci(live-proof): authenticate the chatbot refs proof (owner directive — chatbot is login-only)
ahmdelbaz28-uxThe post-deploy live probe called /api/chatbot anonymously and got 401 from the new session gate, failing the deploy job. The proof now logs in as a dedicated approved probe account (PROBE_USER/PROBE_PASSWORD repo secrets, bootstrapped once via admin approval on production) and rides its HttpOnly-cookie session through every contract call. The ad-hoc saudi-gate-live-proof tool gains the same login step.8fdfd23
9 days ago
-
test(approval-gate): live admin dashboard tour — full approve/reject state machine verified on production (owner directive 2026-11-25)
ahmdelbaz28-ux- admin login (via the ADMIN_RECOVERY lever, restored after the tour), pendingApprovals queue, approveUser -> approved probe CAN sign in (httpOnly-cookie session, no token in the web body), rejectUser -> APPROVAL_REJECTED, reject of an APPROVED account -> the LIVE session dies instantly (auth.me 401, tokenVersion bump), reopenApproval -> APPROVAL_PENDING, final cleanup rejects. - Run results: part1 8/8 product contracts held (operator cookie-jar bug caused the 403s, fixed with separate jars in part2), part2 18/18 PASS. - Owner alert emails + resendApprovalEmail accepted by Resend during the tour (log-proven pipeline).7d18891 -
test(approval-gate): live production E2E probes for the registration approval gate + owner email alert (owner directive 2026-11-25)
ahmdelbaz28-ux- scripts/approval-gate-live-e2e.ts: register->pending(no session), login blocked (APPROVAL_PENDING sentinel), duplicate-register CONFLICT, email-action-link armor (tampered/malformed/empty-signature -> inert 400), logs scan. - scripts/alert-email-log-proof.ts: attaches to the HF runtime log SSE stream, triggers a probe registration, and captures '[Approval] alert email sent' live — proves Resend accepted the alert to the owner inbox. - Verified green on production (probe users 268/269, alert email accepted 16:50:47Z).57ad5dd -
fix(chatbot-gating): citation-stamp side honors the shared loading predicate — no Elsewedy stamp on suppressed Saudi-DPS answers (v3.9.2 follow-up)
ahmdelbaz28-uxLive E2E finding on the deployed v3.9.2: a Saudi-DPS load question got '[Elsewedy Electric — Power Cables Catalogue, Table 3, p16]' appended — enforceCablesCitations resolved citations from the query WITHOUT knowing the cables KB had been cross-suppressed (citation without source, stamped server-side on both the chatbot.ts success path and the chatbot-router.ts stream seam). Root cure: cablesBlockLoads(query, refsRouteActive) is now the SINGLE source of truth — the builder (prompt side) and the enforcement (stamp side) share it; the enforcement recomputes the cross-flag deterministically from the query (hasRefsIntent && routeRefsQuery(...).docs.length>0), which fixes both call sites with zero signature churn. One-way import cables→refs (no cycle; verified refs never imports cables). - Regression test: suppressed Saudi answer stays stamp-free; genuine cables question still gets its mandatory stamp. Full suite: 1301 passing.c43d59e -
fix(chatbot-gating): cross-domain suppression — Saudi-DPS/catalogue questions never drag the Elsewedy/EgyCode KB (v3.9.2)
ahmdelbaz28-uxOwner discipline 'no unimportant file reads' (2026-11-24 audit): generic load words («محركات», «إنارة», «معامل الطلب») in hasCablesIntent made a Saudi-DPS load calculation pull the Elsewedy catalogue + Egyptian-Code guiding volume (~4.6k chars of off-target tokens from the wrong source). - Cross-gating is now symmetric: refs already received cablesIntentActive (excludes elsewedy/egycode corpora); cables now receives refsRouteActive (hasRefsIntent && routeRefsQuery(...).docs.length>0, computed in chatbot.ts) and stays EMPTY unless the query names an explicit cable noun (CABLE_NOUN_RE: كابل/مقطع/السويدي/أمبيراسية/مم²/xlpe/نحاس…). - Integration preserved: 'Saudi load calc + choose cable cross-section' loads BOTH cores; suppression fires only on bare load words. - Backward compatible: calls without the flag keep the legacy behavior. - PROMPT_VERSION 3.9.2 + changelog; new contract test in chatbot-cables.test.ts; permanent audit script scripts/routing-integration-audit.ts (66…ea73420 -
test(docgen-gate): permanent live E2E for the EXPLICIT-REQUEST-ONLY gate — verified green on production
ahmdelbaz28-uxFour-scenario production probe (scripts/docgen-gate-live-e2e.ts, same pattern as skills-live-e2e): long/tabular answer without a file request → prose only, no docgen fence, no suggestion/offer; format mention in a question → prose only; explicit request → docgen fence in the FIRST reply with format+filename+title. Run green against the live HF Space at cc06b18: ALL GATE CONTRACTS HOLD (production).3ea5f56 -
fix(chatbot): agent-architecture audit (layers 3/6/10) — routing noise, refs ownership, block coherence, rendering contract E2E, post-deploy live probe
ahmdelbaz28-uxSkills applied: agent-architecture-audit + e2e-testing + systematic-debugging (+ the ci-cd gates pattern), per the owner's token-burn minimization mandate. AUDIT FINDINGS → FIXES (evidence-backed, code-first): 1. Layer 6 (routing discipline) — keyword hygiene: single generic words fired whole domain cores on unrelated questions ('قاطع' lit saudi+schneider on a generic breaker-vs-disconnector question; 'قصر' lit the Saadat pack on a cables question; 'كود' lit cables on a SAUDI-code question; 'kva' lit ABB on any load question; 'توليد/نقل/توزيع' lit Gilany on anything). Removed the generic tokens from the keyword lists — the specific PHRASES keep every intended contract (all skillnet tests green untouched). 2. Layer 6 (coherence) — forced co-selection: a dynamic RAG block can never ride without its protocol block anymore (getSystemPrompt force-includes saadat/cables/the exact refs skills when their context block is present). 3. Layer 3 (context routing) — refs ow…0916f03 -
fix(chatbot-refs): chassis/fixture parts must never win device selection — NON_DEVICE_RE guard + live-proof script for the references layer
ahmdelbaz28-uxLive E2E finding: the cheapest '1600A 3P' item was ENW116C3MC00H — a CHASSIS ALONE part (91,303 EGP), not a breaker. Device-kind selection now excludes chassis/chaasis/fixture/interlocking/set-of/adaptation lines (accessory kind keeps them). 44 tests green.ce629f4 -
feat(chatbot-refs): technical-references expert core — Saudi DPS-01 + ABB transformers + Schneider Egypt price list 2026 + full page index of all 7 documents
ahmdelbaz28-uxUser requirement: the bot OWNS the reference documents in its knowledge base, answers with proof from the file, picks the right catalogue ITEM (Product ID + full data + price) and routes every question through an index so tokens are never burned on wrong files. NOTHING is omitted from any document. New knowledge bases (GENERATED, cell-verified by scripts/extract_refs_kb.py): - chatbot-saudi-kb.ts — SEC DPS-01 (46p): area tables 3-6 (84/90/62/75 rows, CB bands via the +1-boundary rule verified against printed anchors), density tables 7-10, demand factors (29), coincidence factors CF(1..99), types C1-C29, 21 curated rules, printed §-index. - chatbot-abb-kb.ts — ABB catalogue (51p): 61 small + 36 medium oil designs, 6 large typical datas, 112 dry VCC/RESIBLOC loss rows, 40 IP00 dimension rows, tank glyph decode (L=▲ hermetic, G=● conservator), suspected print errors kept verbatim + flagged. - chatbot-schneider-kb.ts — price list 2026 (319p, 8 TOC parts): 3264 priced items p…14cbffb -
fix(chatbot-cables): strict type-check compliance (ultracheck) — quoted csaLabel emission, CablesHit.citationEn, widened Code data records
ahmdelbaz28-ux- generator: fmt_num now emits string values via json.dumps (csaLabel: "4" instead of bare 4 / accidental division expression for reduced-neutral labels like 25 RM / 16 RM) - CablesHit gains citationEn (EN citation prefills + enforcement) - CableAmpacityRow → Record cast via unknown (TS2352 under strict) - EgyCodeSection.data widened to admit per-key load-capacity records - test cleanups (non-null ground assert, drop stray __internal probe)25ec22e -
feat(chatbot): cables & Egyptian-Code expert core — Elsewedy KB + deterministic sizing engine + citation contract
ahmdelbaz28-uxSources saved as retrievable, citable knowledge (user requirement: the bot must reference and CITE the Egyptian Code and the Elsewedy catalogue, and size cable sections from its own verified calculations): - chatbot-cables-kb.ts (AUTO-GENERATED from Power Cables.pdf via scripts/extract_cables_kb.py + scripts/gen_cables_kb_ts.py): 20 LV/MV ampacity tables (291 rows, page-cited), short-circuit tables 14-17, voltage-drop 18-19, derating 3-13, AWG/Cu-Al conversions, the catalogue's own formulas + selection guidance. Suspect catalogue misprints preserved verbatim + flagged (sc_cu_pvc 10mm² air-touched '9', Table 11 '0.98'). - chatbot-egycode-kb.ts: 18 clause-cited sections from the Egyptian Code design volume (Ch1 loads, Ch2 lighting eq 2-1, Ch8 cable routes/trenches/ conduit fill 40%+10%/trays 50%/inspection rooms, Ch9 power factor). - chatbot-cables.ts (expert layer, Saadat pattern): bilingual intent gate, BM25 over the combined corpus (keywords-only index + Arabic prefix…51ac820
11 days ago
-
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 -
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 -
fix(sonar): harden ops scripts — header allowlist in proxy (S5146/S6109/S5144), argv-only secrets (S5443), log-injection sanitizers (S5145), flat ternary map (S3358)
ahmdelbaz28-ux3b1d754 -
test(ops): email-chain + uptime-robot + lighthouse-proxy + button-probe consent fix — 29/29 live, 41/41 e2e, 1125/1125 unit
ahmdelbaz28-uxee184e3 -
fix(lint): no-useless-escape in saadat citation regex + ops tooling (resend/uptimerobot diagnostics)
ahmdelbaz28-ux63fed05 -
perf(cls): skeleton geometry mirrors the real course grid — /courses CLS 0.165 → ~0
ahmdelbaz28-uxMeasured live (Lighthouse-style, real Chrome): the 0.165 layout shift on /courses came from the FOOTER jumping when the course grid hydrated. Two drifts stacked: skeleton showed 6 cards (2 rows) while a page holds 12 (4 rows), and the skeleton thumbnail used aspect-video (216px at 3-col width) vs the real card's h-48 (192px). Skeleton now renders PAGE_SIZE placeholders with the exact h-48 thumbnail height. Field: vitest 1125/1125, tsc clean, eslint clean. perf_metrics_prod.mjs added for repeatable live web-vitals measurement.7a728a2 -
test(probe): live button-by-button wiring probe — 20/20 PASS on production
ahmdelbaz28-uxClicks every primary control on the published site: home mount, language toggle (both ways), chatbot FAB auth gate (guest → /login), navbar → courses, course card → course page, lesson/gate surface, login POST (401 on wrong creds = backend wired), register form, dashboard guard, admin guard, ErrorBoundary clean after EVERY step, zero page errors.46ff5c0 -
test(probe): serve an empty sw instead of 404 — probe artifact was polluting the console-error check (11/11 PASS live)
ahmdelbaz28-ux4bed9c5 -
fix(cache): root-cure the stale-shell class — SW never serves the HTML shell again
ahmdelbaz28-uxOwner reports (2026-11-22): 'المتصفح الآخر يفتح نسخة قديمة' + desktop infinite loading. Hard evidence found in the generated sw.js: 1. vite-plugin-pwa DEFAULTS navigateFallback to index.html -> NavigationRoute(createHandlerBoundToURL) served the PRECACHED shell cache-first on every navigation. A profile with an old SW opened a one-deploy-behind app forever. index.html is now excluded from globPatterns AND navigateFallback: undefined (explicit Object.assign override) — NavigationRoute is GONE from the emitted sw.js; every navigation revalidates the shell (no-cache + cache-nuke token). 2. cache-nuke.js: the 2-nuke-per-session cap permanently disarmed long-lived tabs. A proven-healthy load (token == buildId == stored) now restores the full budget, so the NEXT deploy can heal again. +2 regression tests (12/12). 3. Worker edge proxy: HTML shell CDN-Cache-Control 30s -> no-store. A pre-deploy shell served from an edge PoP referenced DELETED hashed assets (…97b6407
13 days ago
-
fix(chatbot): Saadat v1.1.1 — deterministic citation compliance (live E2E finding)
Z UserLive E2E on production (POST /api/chatbot, 6 real book problems in Egyptian student phrasing): v1.0.0 answered P 11.1 with the book's own numbers (801.2 MJ / 8.5 MJ-s/rad, methodology correct) but OMITTED the [Saadat, ...] tag in 1 of 5 book-mode answers — the directive specified the format but not the position nor a ready-made string, so compliance was probabilistic. Fix (fully dynamic — static prompt bytes unchanged, PROMPT_VERSION stays 3.8.0): - buildSaadatContextBlock now appends a PREFILLED verbatim citation line for the pinned problem: '📌 سطر الاستشهاد الإلزامي — انسخه حرفيًا في نهاية الرد: [Saadat, Solutions Manual, Ch.X, P X.Y, pp.N]' — the model copies instead of deriving. - CONTEXT_RULES (ar+en) made positional: the citation line must be the LAST line of the reply. - Anti-attribution guard: concept queries (no problem-id hit) get NO prefilled line — the book is never cited for a problem the student didn't request. - Citation size is reserved up-front in the budge…96a9b23 -
fix(chatbot): Saadat real-case hardening v1.1.0 — 5 defects found by live student-phrasing tests
Ahmed Elbaz PlatformReal-case harness (scripts/saadat-realcases.ts, 13 scenarios) ran the exact production path against real problems and real Egyptian-student phrasing: baseline 1/13 PASS → 13/13 PASS after this fix. 189/189 vitest green. 1. excerpt truncation (critical): the 1200+400 window cut the book's own solution data in 98/181 problems — P 6.9's answer Ybus matrix was lost entirely, breaking the ±0.5% grounding contract. Thinking lane now sends 2400+700; instant stays compact (1200+400). 2. 'رقم' between anchor and number ('حل المسألة رقم 2.7') never resolved — replaced the single regex with an anchor-window scanner (resolveProblemIds). 3. Arabic-Indic digits ٠-٩/۰-۹ + Arabic decimal ٫ + thousands ٬ now normalize. 4. parentheses 'مسألة (6.9)' + multi-problem messages ('المسألتين 6.9 و 10.3') pin ALL requested problems (up to 4) at the top of retrieval. 5. missing intent keywords: 'مسالتين/مسالتان' now fire the academic layer. New regression suite locked in chatbot-saadat.test.ts (…10d431a -
feat(chatbot): Saadat academic core v1.0.0 — prompt v3.8.0
ahmdelbaz28-uxTextbook-mastery layer per the owner's requirement: the bot must OWN the Power System Analysis specialty, UNDERSTAND the Solutions Manual's method and EXECUTE solutions the way the book does. - chatbot-saadat-kb.ts (auto-generated): 181 verbatim problem excerpts (head+tail, copyright-safe) from the 285-page manual + bilingual TOC derived from verified problem content - chatbot-saadat.ts: solution-methodology protocol (classify → book's method → step-by-step → verify ±0.5% → cite), academic-intent gate, dependency-free BM25 retriever with deterministic problem-ID resolution, verifyAgainstBook() numeric verification against the book's own values - skillnet: saadat-academic-core registered in SKILL_REGISTRY (both modes) - prompts: getSystemPrompt(..., saadatContext?) appends the SAADAT-KB RAG block (empty for non-academic queries → byte-identical prompt) - chatbot/chatbot-stream: block built from the routing signal on the main, streaming and vision pass-2 lanes (handwritten…04707c4