mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-25 20:15:37 +02:00
Addresses Elon's review on PR #3832 plus a separate report that the "Or tap here to open in Lark" link in the install dialog had no standard right-click affordances on the desktop app. Backend (must-fix from review) The PR's stated 'safety net for users who pick the wrong CTA' only worked one direction: a Feishu-first begin already swapped to Lark on tenant_brand=lark, but the new Lark-first begin (added by this same PR) had no reverse path — a user who picked 'Bind to Lark' but actually authorized with a Feishu account would carry RegionLark all the way through finishSuccess and either fail at GetBotInfo or commit a wrong-region row. - PollResult now carries SwitchedDomain AND SwitchedRegion in lockstep, so the caller never has to re-derive region from the domain string. - Poll() detects tenant_brand=feishu while polling against a non-Feishu host symmetrically with the existing tenant_brand=lark check, gated on the current host so we don't loop on a brand we already match. - runPolling reads region from res.SwitchedRegion instead of the hardcoded RegionLark — the SwitchedDomain branch now flips both feishu→lark and lark→feishu cleanly. - Tests: updated the existing TestRegistrationClient_Poll_DomainSwitchOnLarkTenant to assert SwitchedRegion, added TestRegistrationClient_Poll_DomainSwitchOnFeishuTenant for the reverse, and TestRegistrationClient_Poll_NoSwitchWhenAlreadyOnMatchingHost (table-driven, both directions) to pin that the gate doesn't loop. Backend (nit from review) Handler comment on /lark/install/begin claimed unknown region defaults to Feishu downstream, but the handler already returns 400 on unknown values. Updated the comment to match the actual behavior and document why we 400 rather than silently normalize (so a frontend typo can't land users on the wrong cloud without telling them). Frontend (nit from review) The Agent inspector's Connected badge was hardcoded 'Connected to Lark' / 'Manage in Lark' (en) and 'Connected to Feishu' / 'Manage in Feishu' (zh-Hans) — both wrong half the time now that the install flow can land on either cloud per agent. Made the badge text and Manage tooltip read from installation.region: - agent_bot_connected_label_{feishu,lark} - agent_bot_manage_link_{feishu,lark} - agent_bot_manage_tooltip_{feishu,lark} across en / zh-Hans / ja / ko. Legacy single-region keys retained for safety. Existing badge tests updated: fixtures without 'region' now expect the Feishu copy; the region: 'lark' test was promoted to also assert the Lark badge text and link target. 21/21 lark-tab tests pass. Desktop (separate report) Right-clicking an <a> in the renderer surfaced only Copy / Cut / Paste / Select All — no 'Open Link in Browser' or 'Copy Link Address'. The renderer's <a target="_blank"> click path already routes through setWindowOpenHandler → openExternalSafely, but discoverability via the context menu was missing. context-menu.ts now appends two link-specific items when params.linkURL is an http(s) URL. Open Link routes through openExternalSafely (reuses the existing scheme allowlist); Copy Link Address writes to Electron's clipboard. Labels are localized to the OS preferred language for the four locales the renderer ships (en / zh-Hans / ja / ko); zh-* variants all route to zh-Hans, anything else falls back to English. New context-menu.test.ts pins five cases: link items show for http(s), not for javascript:/mailto:/etc., not when no link is under the cursor, zh-CN gets Chinese, fr-FR falls back to English. 198/198 desktop tests pass. MUL-3083 Co-authored-by: multica-agent <github@multica.ai>