Spaces:
Sleeping
Sleeping
Commit History
-
Global code-quality polish: DRY + named constants + leak cleanup
Yuchen Yuan +1: Claude Opus 4.7 (1M context)Targeted refactor pass based on a structured audit. Pure maintainability wins; no behaviour changes. Frontend: collapse 8 popovers into one hook 8 components (AuthButton, ThemeSwitcher, MoreMenu, PapersPopover, SupportPopover, DevelopersPopover, BlockPicker, PresetPicker) each carried an identical 16-line "close on mousedown + Escape" effect block. Extracted to lib/useDismissOn.ts; ~150 lines deleted, one hook to audit instead of eight. useDismissOn(open, rootRef, useCallback(() => setOpen(false), [])) Behaviour is intentionally identical to the inlined block so older git-blame on the call sites stays coherent. Backend: consolidate effective-user-id resolution routes/plugins.py and routes/workflow.py each carried a subtly different implementation of "session cookie wins over query_user_id, anon hf_ prefix is reserved". Pulled into auth_service.resolve_effective_user_id(request, query, *, required). - required=True path raises ValueError → routes/plugins maps to 400 - required=…57f0b3e -
Fix popover clipping + IBM-chip transparency bleed-through
Yuchen Yuan +1: Claude Opus 4.7 (1M context)User report: two visible glitches on the screenshots — (1) on a desktop browser, the icons in the TopBar's right cluster appeared to be visually stacked behind/inside the "ibm: n/a" chip on the left cluster; (2) on iPhone Safari, opening the Theme dropdown made the menu slide off the left edge of the screen. Root cause (1) — opacity-70 on the IBM chip When the server has no IBM token, the chip was rendered with class `opacity-70`. That made the WHOLE element 70% translucent, including its background. At narrower viewports where the right- cluster icons (Lab/Papers/Developers/Theme/Tour/Support/Auth) flex- squeeze closer to the chip, anything sitting under or behind it became visible through the alpha. Fixed by replacing opacity-70 with `!bg-canvas` (solid surface color) + the existing `text-mute` for the dimmed-disabled look. Identical visual intent, no alpha transparency. Root cause (2) — 3 popovers lacked the mobile-safe anchor pattern PapersPopover, Support…db325d1 -
Mobile + a11y + defense-in-depth fixes from broader audit
Yuchen Yuan +1: Claude Opus 4.7 (1M context)Mobile + keyboard access to palette tiles (CRITICAL) Previously the only way to add a block to the canvas was HTML5 drag- and-drop, which doesn't fire on touch devices and has no keyboard analogue. Tiles were <div draggable> with no role, no tabIndex, and no click handler — so mobile users could only use the BlockPicker dropdown, and keyboard users had no path at all. - PaletteTile is now a <button type="button"> with onClick → addBlocksToCanvas([kind]) plus a Space override (Enter is handled by the native button semantics). - Drag-and-drop still works for mouse users on top of this — the button element preserves draggable + onDragStart so drag-to- insert keeps working. - focus-visible:ring-2 ring-accent makes the focused tile obvious to keyboard users. - aria-label per tile now reads "Add Gate Counter block to canvas. Tally gate types in the current circuit." (label + tagline) rather than relying on title-attr-only. Touch-friendly delete X (IMPORTANT) Both the palett…524287c
-
Drag-to-insert + plugin lifecycle UX fixes
Yuchen Yuan +1: Claude Opus 4.7 (1M context)Drag-to-insert (new feature) When the user drags a block from the palette and the cursor passes within ~60 flow-units of an existing edge, that edge lights up with an accent-coloured dashed animation. Dropping the block onto a lit edge splices it in: the old edge is removed and replaced by two new edges (upstream → new node, new node → downstream). Implementation: - New _findClosestEdge_ helper does line-segment-distance hit testing against every edge's source-right-center → target-left-center approximation. Threshold is in flow coordinates so it scales with zoom. Falls back to default 200x56 node footprint when React Flow hasn't measured yet. - _onDragOver_ checks for the palette's `application/reactflow` data type and computes the closest edge each frame, setting dropTargetEdgeId. - _onDragLeave_ clears the target so the dashed highlight doesn't linger if the user abandons the drag outside the canvas. - _onDrop_ captures dropTargetEdgeId, clears it, then either splices…dca3016 -
Full audit pass: leak fixes, sign-in clarity, functional bugs
Yuchen Yuan +1: Claude Opus 4.7 (1M context)Triggered by user request "全方位的检查、测试" covering visualization, user comprehension, page logic, ease-of-use, science, info leakage, and security. Three parallel audits ran (info-leak, sign-in clarity, visual/a11y, functional/scientific); fixes batched below. Critical functional bugs - workflow_service.run_pipeline + run_pipeline_stream now call plugin_service.hydrate_from_dataset_if_needed before dispatch. Without this, a logged-in user running a pipeline on a fresh container (or on the mirror Space) would see "plugin not found" even though it sits safely in their HF Datasets backing store. - plugin_runner._scrub_scalars / _scrub_value drop NaN and ±Inf instead of passing them through. Standard JSON has no representation for either; model_dump_json emits NaN/Infinity which the browser's JSON.parse refuses, so any plugin returning a numerically degenerate scalar used to make the entire /run response fail to parse client- side. NaN → dropped from scalars dict; Inf → nul…4c566b4 -
Multi-user: HF OAuth login + per-user plugin persistence
Yuchen Yuan +1: Claude Opus 4.7 (1M context)What this lets users do - Anyone can click "Sign in" in the top bar and authenticate with their Hugging Face account (OpenID Connect via the HF OAuth flow). No account creation, no password management on our side. - Each signed-in user gets their own private namespace for uploaded plugins. Other users (and other browsers from the same person) cannot see them. - Plugins uploaded while signed in are mirrored to a private HF Dataset repo (qudastudio/quda-user-data) so they survive container restarts and follow the user across devices. - Guest (anonymous) mode is fully preserved: visitors can still drop a .zip without signing in; those plugins continue to live in /tmp and are per-browser, exactly as before. Architecture Browser ──cookie──▶ FastAPI ──HfApi──▶ HF Dataset (private) │ └──▶ /tmp (volatile cache) Identity = session cookie's hf_<username> (when signed in) ∥ anon UUID query par…b6faf15