Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(web): correct mobile Home feedback and Inbox opening (#957)
Generd455a1e44bee
diff --git a/src/web/src/components/community/shell/rail-indicator.test.ts b/src/web/src/components/community/shell/rail-indicator.test.tsindex 1051b7b3b..bdae99206 100644--- a/src/web/src/components/community/shell/rail-indicator.test.ts+++ b/src/web/src/components/community/shell/rail-indicator.test.ts@@ -25,7 +25,7 @@ describe("RailIndicator", () => {expect(html).toContain('data-slot="community-server-rail-indicator"')if (!props.active) {expect(html).toContain("group-hover:h-5")- expect(html).toContain("group-focus-within:h-5")+ expect(html).toContain("group-has-[:focus-visible]:h-5")} else {expect(html).not.toContain("group-hover:h-5")}@@ -50,7 +50,7 @@ describe("RailIndicator", () => {expect(html).toContain('data-testid="community-server-add"')expect(html).toContain("h-0")expect(html).toContain("group-hover:h-5")- expect(html).toContain("group-focus-within:h-5")+ expect(html).toContain("group-has-[:focus-visible]:h-5")expect(html).not.toContain("h-8")})})diff --git a/src/web/src/components/community/shell/rail-indicator.tsx b/src/web/src/components/community/shell/rail-indicator.tsxindex e181c640c..bd4e6ea12 100644--- a/src/web/src/components/community/shell/rail-indicator.tsx+++ b/src/web/src/components/community/shell/rail-indicator.tsx@@ -21,7 +21,7 @@ export function RailIndicator({"absolute left-0 top-1/2 w-1 -translate-y-1/2 rounded-r-full bg-foreground transition-all duration-150",presentation.active? "h-8"- : `${presentation.showDot ? "h-2.5" : "h-0"} group-hover:h-5 group-focus-within:h-5`,+ : `${presentation.showDot ? "h-2.5" : "h-0"} group-hover:h-5 group-has-[:focus-visible]:h-5`,].join(" ")}/>)diff --git a/src/web/src/components/community/shell/server-rail.pending.dom.test.ts b/src/web/src/components/community/shell/server-rail.pending.dom.test.tsindex 005323dfd..163e24c67 100644--- a/src/web/src/components/community/shell/server-rail.pending.dom.test.ts+++ b/src/web/src/components/community/shell/server-rail.pending.dom.test.ts@@ -219,7 +219,7 @@ describe("ServerRail one-in-flight structural guard", () => {.previousElementSibling as HTMLElementexpect(homeIndicator()).toHaveAttribute("data-slot", "community-server-rail-indicator")- expect(homeIndicator()).toHaveClass("h-0", "group-hover:h-5", "group-focus-within:h-5")+ expect(homeIndicator()).toHaveClass("h-0", "group-hover:h-5", "group-has-[:focus-visible]:h-5")renderer.rerender(createElement(ServerRail, {servers,@@ -228,7 +228,7 @@ describe("ServerRail one-in-flight structural guard", () => {onHome: vi.fn(),}))expect(homeIndicator()).toHaveClass("h-8")- expect(homeIndicator()).not.toHaveClass("group-hover:h-5", "group-focus-within:h-5")+ expect(homeIndicator()).not.toHaveClass("group-hover:h-5", "group-has-[:focus-visible]:h-5")})it("does not reconcile again for equivalent canonical projection references", () => {diff --git a/src/web/src/components/community/shell/shell-frame-view.dom.test.ts b/src/web/src/components/community/shell/shell-frame-view.dom.test.tsindex c141f402a..2a88fa130 100644--- a/src/web/src/components/community/shell/shell-frame-view.dom.test.ts+++ b/src/web/src/components/community/shell/shell-frame-view.dom.test.ts@@ -207,6 +207,7 @@ const inbox = {onOpenChange: vi.fn(),} as neverconst extensionProps = {+ inboxOpening: false,userBarExtension: { active: "none", update: null },daemonUpdate: { update: null, eligibleMachines: [], request: vi.fn() },onUserBarInboxOpenChange: vi.fn(),diff --git a/src/web/src/components/community/shell/shell-frame-view.tsx b/src/web/src/components/community/shell/shell-frame-view.tsxindex a673c6d29..b5118b037 100644--- a/src/web/src/components/community/shell/shell-frame-view.tsx+++ b/src/web/src/components/community/shell/shell-frame-view.tsx@@ -28,6 +28,7 @@ type Props = Pick<ShellFrameProps, "sidebar" | "children" | "extraDialogs"> & {rail: ReturnType<typeof useShellRailController>profile: ReturnType<typeof useShellProfileController>inbox: ReturnType<typeof useShellInboxController>+ inboxOpening: booleanuserBarExtension: UserBarExtensionStatedaemonUpdate: ReturnType<typeof useShellDaemonUpdateController>onUserBarInboxOpenChange: (open: boolean) => void@@ -45,6 +46,7 @@ export function ShellFrameView({rail,profile,inbox,+ inboxOpening,userBarExtension,daemonUpdate,onUserBarInboxOpenChange,@@ -128,6 +130,7 @@ export function ShellFrameView({unreadCount={inbox.unreadCount}unreadCountPartial={inbox.unreadCountPartial}inboxOpen={userBarExtension.active === "inbox"}+ inboxOpening={inboxOpening}onInboxOpenChange={onUserBarInboxOpenChange}extension={{active: userBarExtension.active,diff --git a/src/web/src/components/community/shell/shell-frame.dom.test.ts b/src/web/src/components/community/shell/shell-frame.dom.test.tsindex 4646631d0..0666cfe78 100644--- a/src/web/src/components/community/shell/shell-frame.dom.test.ts+++ b/src/web/src/components/community/shell/shell-frame.dom.test.ts@@ -10,6 +10,7 @@ import { useInboxAutoCollapse } from "@/hooks/community/use-inbox-auto-collapse"import { CommunityShellLayout } from "./community-shell-layout"import { UserBarExtensionSlot } from "./user-bar-extension-slot"import { useCommunityRouteFrame } from "./community-route-context"+import { normalizeCommunityHref } from "@/lib/community/community-route"import { tid } from "@/lib/community/testids"import type { ShellFrameView } from "./shell-frame-view"import type { useShellInboxController } from "./use-shell-inbox-controller"@@ -175,7 +176,8 @@ vi.mock("./shell-frame-view", () => ({createElement("button", {"data-testid": tid.inboxTrigger,"aria-expanded": view.userBarExtension.active === "inbox",- onClick: () => view.onUserBarInboxOpenChange(view.userBarExtension.active !== "inbox"),+ "aria-busy": view.inboxOpening || undefined,+ onClick: () => view.onUserBarInboxOpenChange(view.userBarExtension.active !== "inbox" && !view.inboxOpening),}, "Inbox trigger"),),})@@ -201,7 +203,7 @@ function renderInboxLifecycle(href = "/c/messages/unavailable", breakpoint = "momocks.lifecycle = truemocks.breakpoint.current = breakpointmocks.currentHref.current = href- let frameHref = href+ let frameHref = normalizeCommunityHref(href).pathnamelet context!: ReturnType<typeof useCommunityRouteFrame>function Action() {const current = useCommunityRouteFrame()@@ -510,6 +512,126 @@ describe("ShellFrame orchestration", () => {expect(mocks.railOptions).toHaveBeenLastCalledWith(expect.objectContaining({ breakpoint: "mobile" }))})+ describe("user-bar Inbox during list navigation", () => {+ const destination = "/c/channels/s1?from=inbox"++ it.each(["frame-first", "publication-first"])("opens once after the current complete destination, %s", (order) => {+ const shell = renderInboxLifecycle("/c/channels/s1/c1")+ act(() => shell.context.navigation.push(destination))+ const trigger = screen.getByTestId(tid.inboxTrigger)+ expect(trigger.closest("[data-slot='community-user-bar-overlay']")).not.toHaveAttribute("inert")+ fireEvent.click(trigger)+ expect(trigger).toHaveAttribute("aria-busy", "true")+ expect(trigger).toHaveAttribute("aria-expanded", "false")+ expect(mocks.push).toHaveBeenCalledExactlyOnceWith(destination)+ if (order === "frame-first") shell.update({ frameHref: "/c/channels/s1" })+ else shell.update({ publishedHref: destination })+ expect(mocks.openChanges).not.toHaveBeenCalledWith(true)+ shell.update({ frameHref: "/c/channels/s1", publishedHref: destination })+ expectVisibleInbox()+ expect(trigger).not.toHaveAttribute("aria-busy")+ expect(mocks.openChanges).toHaveBeenCalledExactlyOnceWith(true)+ shell.update()+ expect(mocks.openChanges).toHaveBeenCalledTimes(1)+ fireEvent.click(trigger)+ expect(trigger).toHaveAttribute("aria-expanded", "false")+ expect(mocks.openChanges.mock.calls).toEqual([[true], [false]])+ })++ it("waits for the known full query URL, then keeps normal navigation auto-collapse", () => {+ const shell = renderInboxLifecycle("/c/channels/s1/c1")+ act(() => shell.context.navigation.push(destination))+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ shell.update({ frameHref: "/c/channels/s1", publishedHref: "/c/channels/s1" })+ expect(mocks.openChanges).not.toHaveBeenCalledWith(true)+ shell.update({ publishedHref: destination })+ expectVisibleInbox()+ shell.update({ publishedHref: "/c/channels/s1?from=other" })+ expect(screen.getByTestId(tid.inboxTrigger)).toHaveAttribute("aria-expanded", "false")+ })++ it("opens directly on a settled query list and defers a query-only pending commit", () => {+ const shell = renderInboxLifecycle(destination)+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ expectVisibleInbox()+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ const next = "/c/channels/s1?from=next"+ act(() => shell.context.navigation.push(next))+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ expect(screen.getByTestId(tid.inboxTrigger)).toHaveAttribute("aria-busy", "true")+ shell.update({ publishedHref: next })+ expectVisibleInbox()+ expect(mocks.push).toHaveBeenCalledExactlyOnceWith(next)+ })++ it("waits for publication if the structural frame arrives without a local pending target", () => {+ const shell = renderInboxLifecycle("/c/channels/s1/c1")+ shell.update({ frameHref: "/c/channels/s1" })+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ expect(mocks.openChanges).not.toHaveBeenCalledWith(true)+ shell.update({ publishedHref: destination })+ expectVisibleInbox()+ expect(mocks.push).not.toHaveBeenCalled()+ })++ it("cancels on the second click without cancelling navigation or reviving at the same URL", () => {+ const shell = renderInboxLifecycle("/c/channels/s1/c1")+ act(() => shell.context.navigation.push(destination))+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ expect(shell.context.navigation.pendingHref).toBe(destination)+ shell.update({ frameHref: "/c/channels/s1", publishedHref: destination })+ shell.update({ frameHref: "/c/me", publishedHref: "/c/me" })+ shell.update({ frameHref: "/c/channels/s1", publishedHref: destination })+ expect(mocks.openChanges).not.toHaveBeenCalledWith(true)+ expect(screen.queryByTestId(tid.userBarExtension)).toBeNull()+ })++ it.each(["push", "pushImmediate", "replace", "resolver", "cancel", "Back"])(+ "discards a user-bar request on %s before a later identical destination", async (entry) => {+ const shell = renderInboxLifecycle("/c/channels/s1/c1")+ act(() => shell.context.navigation.push(destination))+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ await act(async () => {+ const nav = shell.context.navigation+ if (entry === "push") nav.push("/c/me")+ if (entry === "pushImmediate") nav.pushImmediate("/c/me")+ if (entry === "replace") nav.replace("/c/me")+ if (entry === "resolver") await nav.resolveAndPush(async () => "/c/me")+ if (entry === "cancel") nav.cancelPendingNavigation()+ if (entry === "Back") window.dispatchEvent(new Event("popstate"))+ })+ shell.update({ frameHref: "/c/me", publishedHref: "/c/me" })+ shell.update({ frameHref: "/c/channels/s1", publishedHref: destination })+ expect(mocks.openChanges).not.toHaveBeenCalledWith(true)+ },+ )++ it.each(["profile", "update", "dismiss"])("cancels pending opening before the %s extension action", (action) => {+ const shell = renderInboxLifecycle("/c/channels/s1/c1")+ act(() => shell.context.navigation.push(destination))+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ act(() => {+ const view = mocks.viewProps.current as Parameters<typeof ShellFrameView>[0]+ if (action === "profile") view.onUserBarOpenProfile("Viewer")+ if (action === "update") view.onUserBarOpenUpdate()+ if (action === "dismiss") view.dismissUserBarExtension()+ })+ shell.update({ frameHref: "/c/channels/s1", publishedHref: destination })+ expect(mocks.openChanges).not.toHaveBeenCalledWith(true)+ })++ it("discards a pending user-bar request on account change", () => {+ const shell = renderInboxLifecycle("/c/channels/s1/c1")+ act(() => shell.context.navigation.push(destination))+ fireEvent.click(screen.getByTestId(tid.inboxTrigger))+ shell.update({ viewerId: "other" })+ shell.update({ viewerId: "viewer" })+ shell.update({ frameHref: "/c/channels/s1", publishedHref: destination })+ expect(mocks.openChanges).not.toHaveBeenCalledWith(true)+ })+ })+describe("shared Open Inbox commit handoff", () => {it("opens once after exact frame, publication and auto-collapse, then keeps outside action before dismiss", () => {const shell = renderInboxLifecycle()diff --git a/src/web/src/components/community/shell/shell-frame.tsx b/src/web/src/components/community/shell/shell-frame.tsxindex 18646e8ee..03f87af7d 100644--- a/src/web/src/components/community/shell/shell-frame.tsx+++ b/src/web/src/components/community/shell/shell-frame.tsx@@ -11,6 +11,7 @@ import { useBreakpoint } from "@/hooks/use-mobile"import { useCommunityOnboarding } from "@/lib/community-onboarding"import {advanceCommunityCommittedFrame,+ isPublishedNonStructuralCommit,normalizeCommunityHref,resolveCommunityCheckpointPlan,resolveCommunityModulePlan,@@ -173,7 +174,7 @@ const [committedFrame, setCommittedFrame] = useAtom(useCreateAtom(initialCommittextensionState: userBarExtension,dispatch: dispatchUserBarExtension,})- const onUserBarInboxOpenChange = useCallback((open: boolean) => {+ const applyInboxOpenChange = useCallback((open: boolean) => {if (!open) {inbox.onOpenChange(false)dispatchUserBarExtension({ type: "extension.close", extension: "inbox" })@@ -186,34 +187,70 @@ const [committedFrame, setCommittedFrame] = useAtom(useCreateAtom(initialCommitt}, [daemonUpdate, dispatchUserBarExtension, inbox, profile, userBarExtension.active])const [inboxOpenRequest, setInboxOpenRequest] = useAtom(useCreateAtom<{viewerId: string+ href: string+ currentFrameOnly?: booleanisCurrent: () => boolean} | null>(null))- const openInbox = useCallback(() => {+ const requestInboxOpen = useCallback((fromUserBar: boolean) => {setInboxOpenRequest(null)- if (breakpoint !== "mobile" || (committedFrame.surface !== "detail" && checkpoint.surface !== "detail")) {- onUserBarInboxOpenChange(true)+ const published = normalizeCommunityHref(navigation.publishedHref)+ const currentFrameOnly = navigation.pendingHref === null && published.leafKey !== committedFrame.leafKey+ const target = normalizeCommunityHref(navigation.pendingHref+ ?? (currentFrameOnly ? committedFrame.href : navigation.publishedHref))+ const eligible = breakpoint !== "mobile" || resolveCommunityModulePlan(target.href).surface === "list"+ const externalDetail = !fromUserBar && breakpoint === "mobile"+ && (committedFrame.surface === "detail" || checkpoint.surface === "detail")+ if (eligible && !externalDetail) {+ if (navigation.pendingHref !== null+ || !isPublishedNonStructuralCommit(committedFrame, navigation.publishedHref, target.href)) {+ setInboxOpenRequest({+ viewerId: currentUser.id,+ href: target.href,+ currentFrameOnly,+ isCurrent: navigation.pendingHref !== null+ ? navigation.captureIntent({ pendingCommitHref: target.href })+ : navigation.captureIntent(),+ })+ return+ }+ applyInboxOpenChange(true)return}const request = {viewerId: currentUser.id,+ href: "/c/me",isCurrent: navigation.captureIntent({ nextCommitHref: "/c/me" }),}navigation.push("/c/me")setInboxOpenRequest(request)- }, [breakpoint, checkpoint.surface, committedFrame.surface, currentUser.id, navigation, onUserBarInboxOpenChange, setInboxOpenRequest])+ }, [applyInboxOpenChange, breakpoint, checkpoint.surface, committedFrame, currentUser.id, navigation, setInboxOpenRequest])+ const openInbox = useCallback(() => requestInboxOpen(false), [requestInboxOpen])+ const onUserBarInboxOpenChange = useCallback((open: boolean) => {+ if (open) {+ requestInboxOpen(true)+ return+ }+ setInboxOpenRequest(null)+ applyInboxOpenChange(false)+ }, [applyInboxOpenChange, requestInboxOpen, setInboxOpenRequest])useEffect(() => {if (!inboxOpenRequest) returnif (inboxOpenRequest.viewerId !== currentUser.id || !inboxOpenRequest.isCurrent()) {setInboxOpenRequest(null)return}+ const published = normalizeCommunityHref(navigation.publishedHref)+ const target = normalizeCommunityHref(inboxOpenRequest.href)+ const publicationMatches = inboxOpenRequest.currentFrameOnly+ ? committedFrame.leafKey === target.leafKey && published.leafKey === target.leafKey+ : isPublishedNonStructuralCommit(committedFrame, navigation.publishedHref, target.href)if (navigation.navigationPending || navigation.pendingHref !== null- || navigation.publishedHref !== "/c/me" || committedFrame.href !== "/c/me"- || checkpoint.surface !== "list") return+ || !publicationMatches+ || (breakpoint === "mobile" && checkpoint.surface !== "list")) returnsetInboxOpenRequest(null)- onUserBarInboxOpenChange(true)- }, [checkpoint.surface, committedFrame.href, currentUser.id, inboxOpenRequest, navigation.navigationPending,- navigation.pendingHref, navigation.publishedHref, onUserBarInboxOpenChange, setInboxOpenRequest])+ applyInboxOpenChange(true)+ }, [applyInboxOpenChange, breakpoint, checkpoint.surface, committedFrame, currentUser.id, inboxOpenRequest,+ navigation.navigationPending, navigation.pendingHref, navigation.publishedHref, setInboxOpenRequest])useNativeSystemNotifications(currentUser.id, committedFrame, navigation, notificationConsumer)const onUserBarOpenProfile = useCallback<ReturnType<typeof useShellProfileController>["openProfile"]>((name,@@ -221,6 +258,7 @@ const [committedFrame, setCommittedFrame] = useAtom(useCreateAtom(initialCommittdiscriminator,targetUserId,) => {+ setInboxOpenRequest(null)if (userBarExtension.active === "profile") {profile.closeProfile()dispatchUserBarExtension({ type: "extension.close", extension: "profile" })@@ -230,13 +268,15 @@ const [committedFrame, setCommittedFrame] = useAtom(useCreateAtom(initialCommittif (userBarExtension.active === "update") daemonUpdate.collapse()profile.openProfile(name, event, discriminator, targetUserId)dispatchUserBarExtension({ type: "extension.open", extension: "profile" })- }, [daemonUpdate, dispatchUserBarExtension, inbox, profile, userBarExtension.active])+ }, [daemonUpdate, dispatchUserBarExtension, inbox, profile, setInboxOpenRequest, userBarExtension.active])const onUserBarOpenUpdate = useCallback(() => {+ setInboxOpenRequest(null)if (userBarExtension.active === "inbox") inbox.onOpenChange(false)if (userBarExtension.active === "profile") profile.closeProfile()daemonUpdate.open()- }, [daemonUpdate, inbox, profile, userBarExtension.active])+ }, [daemonUpdate, inbox, profile, setInboxOpenRequest, userBarExtension.active])const dismissUserBarExtension = useCallback(() => {+ setInboxOpenRequest(null)if (userBarExtension.active === "inbox") inbox.onOpenChange(false)if (userBarExtension.active === "profile") profile.closeProfile()if (userBarExtension.active === "update") daemonUpdate.collapse()@@ -244,7 +284,7 @@ const [committedFrame, setCommittedFrame] = useAtom(useCreateAtom(initialCommitttype: "extension.close",extension: userBarExtension.active,})- }, [daemonUpdate, dispatchUserBarExtension, inbox, profile, userBarExtension.active])+ }, [daemonUpdate, dispatchUserBarExtension, inbox, profile, setInboxOpenRequest, userBarExtension.active])useEffect(() => {if (breakpoint !== "mobile" || checkpoint.surface !== "detail" || userBarExtension.active === "none") returndismissUserBarExtension()@@ -311,6 +351,7 @@ const [committedFrame, setCommittedFrame] = useAtom(useCreateAtom(initialCommittrail={rail}profile={profile}inbox={inbox}+ inboxOpening={inboxOpenRequest !== null}userBarExtension={userBarExtension}daemonUpdate={daemonUpdate}onUserBarInboxOpenChange={onUserBarInboxOpenChange}diff --git a/src/web/src/components/community/shell/shell.navigation-intent.dom.test.ts b/src/web/src/components/community/shell/shell.navigation-intent.dom.test.tsindex fc3b7a81d..86aa5f5f8 100644--- a/src/web/src/components/community/shell/shell.navigation-intent.dom.test.ts+++ b/src/web/src/components/community/shell/shell.navigation-intent.dom.test.ts@@ -19,6 +19,7 @@ import ServerLayout from "@/app/c/channels/layout"const mocks = vi.hoisted(() => ({pathname: "/c/channels/s1/a",+ search: "",push: vi.fn(),replace: vi.fn(),}))@@ -26,7 +27,7 @@ const mocks = vi.hoisted(() => ({vi.mock("next/navigation", () => ({usePathname: () => mocks.pathname,useSelectedLayoutSegments: () => mocks.pathname.split("/").slice(3),- useSearchParams: () => new URLSearchParams(),+ useSearchParams: () => new URLSearchParams(mocks.search),useRouter: () => ({ push: mocks.push, replace: mocks.replace, prefetch: vi.fn() }),}))vi.mock("react-resizable-panels", () => ({@@ -87,6 +88,12 @@ function frame(href: string, revision: number): CommunityCommittedFrame {return { ...normalizeCommunityHref(href), revision }}+function publishHref(href: string) {+ const url = new URL(href, "https://alook.test")+ mocks.pathname = url.pathname+ mocks.search = url.search+}+function renderShell(breakpoint: "mobile" | "desktop" = "mobile", queryClient = new QueryClient()) {let navigation!: Navigationlet committedFrame = frame(mocks.pathname, 0)@@ -101,6 +108,7 @@ function renderShell(breakpoint: "mobile" | "desktop" = "mobile", queryClient =})const props = {breakpoint,+ inboxOpening: false,checkpoint,sidebar: () => createElement("span", null, "Sidebar"),rail: { railProps: { onHome: () => navigation.push(nextTarget) } } as never,@@ -127,12 +135,12 @@ function renderShell(breakpoint: "mobile" | "desktop" = "mobile", queryClient =queryClient,get navigation() { return navigation },commit(href: string, revision: number, publish = true) {- if (publish) mocks.pathname = href- committedFrame = frame(href, revision)+ if (publish) publishHref(href)+ committedFrame = frame(normalizeCommunityHref(href).pathname, revision)renderer.rerender(createElement(QueryClientProvider, { client: queryClient }, createElement(Capture)))},publish(href: string) {- mocks.pathname = href+ publishHref(href)renderer.rerender(createElement(QueryClientProvider, { client: queryClient }, createElement(Capture)))},unmount: renderer.unmount,@@ -166,6 +174,7 @@ function expectPendingProof(shell: ReturnType<typeof renderShell>, epoch: numberbeforeEach(() => {mocks.pathname = "/c/channels/s1/a"+ mocks.search = ""mocks.push.mockReset()mocks.replace.mockReset()vi.stubGlobal("matchMedia", vi.fn(() => ({ matches: false })))@@ -281,6 +290,77 @@ describe("Shell input and explicit navigation ownership", () => {expect(mocks.replace).not.toHaveBeenCalled()})+ describe("current pending-commit qualification", () => {+ it.each(["frame-first", "publication-first"])("retains the structural target with a complete query URL, %s", (order) => {+ const shell = renderShell("desktop")+ const href = "/c/channels/s1?from=inbox"+ act(() => shell.navigation.push(href))+ const current = shell.navigation.captureIntent({ pendingCommitHref: href })+ expect(current()).toBe(true)+ if (order === "frame-first") shell.commit(href, 1, false)+ else shell.publish(href)+ expect(current()).toBe(true)+ shell.commit(href, 1)+ expect(shell.navigation.pendingHref).toBeNull()+ expect(shell.navigation.publishedHref).toBe(href)+ expect(current()).toBe(true)+ expect(mocks.push).toHaveBeenCalledExactlyOnceWith(href)+ })++ it("qualifies a query-only commit without inventing a frame revision", () => {+ const shell = renderShell("desktop")+ const href = "/c/channels/s1/a?msg=m1"+ act(() => shell.navigation.push(href))+ const current = shell.navigation.captureIntent({ pendingCommitHref: href })+ shell.publish(href)+ expect(shell.navigation.pendingHref).toBeNull()+ expect(current()).toBe(true)+ act(() => shell.navigation.push("/c/channels/s1/a?msg=m2"))+ shell.publish("/c/channels/s1/a?msg=m2")+ expect(current()).toBe(false)+ shell.publish(href)+ expect(current()).toBe(false)+ })++ it.each(["push", "pushImmediate", "replace", "resolver", "cancel", "Back"])(+ "retires on %s and rejects the old same URL", async (entry) => {+ const shell = renderShell("desktop")+ act(() => shell.navigation.push(target))+ const current = shell.navigation.captureIntent({ pendingCommitHref: target })+ await act(async () => {+ if (entry === "push") shell.navigation.push(nextTarget)+ if (entry === "pushImmediate") shell.navigation.pushImmediate(nextTarget)+ if (entry === "replace") shell.navigation.replace(nextTarget)+ if (entry === "resolver") await shell.navigation.resolveAndPush(async () => nextTarget)+ if (entry === "cancel") shell.navigation.cancelPendingNavigation()+ if (entry === "Back") window.dispatchEvent(new Event("popstate"))+ })+ expect(current()).toBe(false)+ shell.commit(nextTarget, 1)+ act(() => shell.navigation.push(target))+ shell.commit(target, 2)+ expect(current()).toBe(false)+ },+ )++ it("retires on an unrelated frame, same-URL no-op and unmount", () => {+ const shell = renderShell("desktop")+ act(() => shell.navigation.push(target))+ const unrelated = shell.navigation.captureIntent({ pendingCommitHref: target })+ shell.commit(nextTarget, 1)+ expect(unrelated()).toBe(false)+ act(() => shell.navigation.push(target))+ const settled = shell.navigation.captureIntent({ pendingCommitHref: target })+ shell.commit(target, 2)+ expect(settled()).toBe(true)+ act(() => shell.navigation.push(target))+ expect(settled()).toBe(false)+ const unmounted = shell.navigation.captureIntent({ pendingCommitHref: target })+ shell.unmount()+ expect(unmounted()).toBe(false)+ })+ })+describe("optional exact next-commit qualification", () => {it("retains only its own exact commit while default capture still retires", () => {const shell = renderShell("desktop")diff --git a/src/web/src/components/community/shell/use-community-navigation-controller.ts b/src/web/src/components/community/shell/use-community-navigation-controller.tsindex 479fb0c39..a0df5ae54 100644--- a/src/web/src/components/community/shell/use-community-navigation-controller.ts+++ b/src/web/src/components/community/shell/use-community-navigation-controller.ts@@ -46,11 +46,14 @@ export function useCommunityNavigationController(href: string} | null>(null)const captureIntent = useCallback<CommunityNavigationController["captureIntent"]>((options) => {- const revision = gateRef.current.revision + (options ? 1 : 0)+ const pendingCommit = options !== undefined && "pendingCommitHref" in options+ const revision = gateRef.current.revision + (options && "nextCommitHref" in options ? 1 : 0)const frameRevision = committedFrameRef.current.revision- const targetHref = options ? normalizeCommunityHref(options.nextCommitHref).href : null- const targetRevision = frameRevision + (targetHref !== null- && normalizeCommunityHref(targetHref).leafKey !== committedFrameRef.current.leafKey ? 1 : 0)+ const target = options ? normalizeCommunityHref("pendingCommitHref" in options+ ? options.pendingCommitHref : options.nextCommitHref) : null+ const targetHref = target?.href ?? null+ const targetRevision = frameRevision + (target !== null+ && target.leafKey !== committedFrameRef.current.leafKey ? 1 : 0)return () => {if (!mountedRef.current) return falseif (revision === gateRef.current.revision && frameRevision === committedFrameRef.current.revision) return true@@ -59,7 +62,10 @@ export function useCommunityNavigationController(&& settled.revision === revision && gateRef.current.revision === revision + 1&& settled.frameRevision === targetRevision&& settled.frameRevision === committedFrameRef.current.revision- && settled.href === targetHref && committedFrameRef.current.href === targetHref+ && settled.href === targetHref+ && (pendingCommit+ ? committedFrameRef.current.leafKey === target?.leafKey+ : committedFrameRef.current.href === targetHref)}}, [])const pendingBaselineRevisionRef = useRef(committedFrame.revision)diff --git a/src/web/src/components/community/shell/user-bar.interaction.dom.test.ts b/src/web/src/components/community/shell/user-bar.interaction.dom.test.tsindex 0db926ef2..83878acb2 100644--- a/src/web/src/components/community/shell/user-bar.interaction.dom.test.ts+++ b/src/web/src/components/community/shell/user-bar.interaction.dom.test.ts@@ -28,6 +28,32 @@ function renderBar() {}describe("UserBar Inbox switching", () => {+ it.each(["mobile", "desktop"] as const)("cancels the pending %s opening on the second actual trigger click", async (breakpoint) => {+ const changes = vi.fn()+ function Harness() {+ const [opening, setOpening] = useState(false)+ return createElement(UserBar, {+ breakpoint,+ user: { id: "u1", name: "User", avatar: "U" },+ inbox: createElement("span", null, "Inbox content"),+ hasUnread: false,+ inboxOpen: false,+ inboxOpening: opening,+ onInboxOpenChange: (open) => { changes(open); setOpening(open) },+ })+ }+ const user = setupUser()+ render(createElement(Harness))+ const trigger = screen.getByTestId(tid.inboxTrigger)+ await user.click(trigger)+ expect(trigger).toHaveAttribute("aria-busy", "true")+ expect(trigger).toHaveAttribute("aria-expanded", "false")+ await user.click(trigger)+ expect(trigger).not.toHaveAttribute("aria-busy")+ expect(changes.mock.calls).toEqual([[true], [false]])+ expect(screen.queryByRole("dialog", { name: "Inbox" })).not.toBeInTheDocument()+ })+it.each(["mobile", "desktop"] as const)("renders the real %s extension through its intended motion surface", (breakpoint) => {const inbox = createElement("button", null, "Inbox item")const renderer = render(createElement(UserBar, {diff --git a/src/web/src/components/community/shell/user-bar.tsx b/src/web/src/components/community/shell/user-bar.tsxindex 1d7bbb86b..f165eda62 100644--- a/src/web/src/components/community/shell/user-bar.tsx+++ b/src/web/src/components/community/shell/user-bar.tsx@@ -39,7 +39,7 @@ type UserBarExtension = {onDismiss: () => void}-export function UserBar({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnread, unreadCount, unreadCountPartial, inboxOpen, onInboxOpenChange, extension }: {+export function UserBar({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnread, unreadCount, unreadCountPartial, inboxOpen, inboxOpening = false, onInboxOpenChange, extension }: {breakpoint: Breakpointuser: { id: string; name: string; avatar: string; presence?: Presence; runningBotCount?: number }onOpenProfile?: OpenProfile@@ -49,6 +49,7 @@ export function UserBar({ breakpoint, user, onOpenProfile, onEditProfile, inbox,unreadCount?: numberunreadCountPartial?: booleaninboxOpen?: boolean+ inboxOpening?: booleanonInboxOpenChange?: (open: boolean) => voidextension?: UserBarExtension}) {@@ -65,7 +66,7 @@ export function UserBar({ breakpoint, user, onOpenProfile, onEditProfile, inbox,|| Boolean(extension && extension.active !== "none"))const closeInboxForAction = () => {- if (inboxOpen) onInboxOpenChange?.(false)+ if (inboxOpen || inboxOpening) onInboxOpenChange?.(false)}const dismissExtensionWithFocus = () => {if (!extension || extension.active === "none") return@@ -141,6 +142,7 @@ export function UserBar({ breakpoint, user, onOpenProfile, onEditProfile, inbox,unreadCount={unreadCount}unreadCountPartial={unreadCountPartial}inboxOpen={inboxOpen}+ inboxOpening={inboxOpening}onInboxOpenChange={onInboxOpenChange}closeInboxForAction={closeInboxForAction}profileTriggerRef={profileTriggerRef}@@ -177,7 +179,7 @@ export function UserBarSkeleton() {)}-function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnread, unreadCount, unreadCountPartial, inboxOpen, onInboxOpenChange, closeInboxForAction, profileTriggerRef, profileNameTriggerRef, lastProfileTriggerRef, inboxTriggerRef, updateBadgeRef, onRequestExtensionFocus, extension }: {+function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnread, unreadCount, unreadCountPartial, inboxOpen, inboxOpening, onInboxOpenChange, closeInboxForAction, profileTriggerRef, profileNameTriggerRef, lastProfileTriggerRef, inboxTriggerRef, updateBadgeRef, onRequestExtensionFocus, extension }: {breakpoint: Breakpointuser: { id: string; name: string; avatar: string; presence?: Presence; runningBotCount?: number }onOpenProfile?: OpenProfile@@ -187,6 +189,7 @@ function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnreaunreadCount?: numberunreadCountPartial?: booleaninboxOpen?: boolean+ inboxOpening: booleanonInboxOpenChange?: (open: boolean) => voidcloseInboxForAction: () => voidprofileTriggerRef: RefObject<HTMLButtonElement | null>@@ -283,14 +286,16 @@ function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnrea? "hover:text-foreground active:text-foreground": "hover:bg-accent hover:text-foreground",)}- aria-label={mobile ? (inboxOpen ? "Close Inbox" : "Open Inbox") : "Inbox"}+ aria-label={mobile ? (inboxOpen || inboxOpening ? "Close Inbox" : "Open Inbox") : "Inbox"}+ aria-busy={inboxOpening || undefined}aria-describedby={inboxDescriptionId}aria-expanded={inboxOpen}aria-pressed={mobile ? inboxOpen : undefined}aria-controls={inboxOpen && extension ? "community-user-bar-extension" : undefined}onClick={() => {- if (!inboxOpen) onRequestExtensionFocus("inbox")- onInboxOpenChange?.(!inboxOpen)+ if (!inboxOpen && !inboxOpening) onRequestExtensionFocus("inbox")+ if (inboxOpening) onRequestExtensionFocus("none")+ onInboxOpenChange?.(!inboxOpen && !inboxOpening)}}><InboxUnreadIndicatordiff --git a/src/web/src/contexts/community/route-frame.tsx b/src/web/src/contexts/community/route-frame.tsxindex 64d54e946..5a35b9a98 100644--- a/src/web/src/contexts/community/route-frame.tsx+++ b/src/web/src/contexts/community/route-frame.tsx@@ -7,7 +7,7 @@ import type { CommunityCommittedFrame } from "@/lib/community/community-route"import type { OwnerServerDeleteRouteToken } from "@/lib/community/eject-server"export type CommunityNavigationController = {- captureIntent: (options?: { nextCommitHref: string }) => () => boolean+ captureIntent: (options?: { nextCommitHref: string } | { pendingCommitHref: string }) => () => booleanpublishedHref: stringnavigationPending: booleanpendingHref: string | nulldiff --git a/src/web/src/test/e2e-ui/40-server-rail-unread.spec.ts b/src/web/src/test/e2e-ui/40-server-rail-unread.spec.tsindex 8bc0f89b9..67404debf 100644--- a/src/web/src/test/e2e-ui/40-server-rail-unread.spec.ts+++ b/src/web/src/test/e2e-ui/40-server-rail-unread.spec.ts@@ -179,3 +179,39 @@ test("server unread owns exact rail geometry, folder aggregation, read clear, anconst body = await seed.json() as { servers: Array<{ id: string; unread: boolean }> }expect(body.servers.find((server) => server.id === backgroundServer)?.unread).toBe(true)})+++test("Home retains touch focus without an inactive bar and keeps keyboard feedback", async ({ caseActors }) => {+ test.setTimeout(150_000)+ const actors = await caseActors(["alice", "bob"])+ const serverId = await actors.seed.seedServer("alice", `Touch focus ${Date.now()}`)+ const otherServerId = await actors.seed.seedServer("alice", `Touch target ${Date.now()}`)+ await actors.seed.seedJoinServer("alice", "bob", serverId)+ await actors.seed.seedJoinServer("alice", "bob", otherServerId)+ const { page } = await actors.asUser("bob", {+ viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true,+ })+ await gotoAfterUserWsAuth(page, `/c/channels/${serverId}`)+ const home = page.getByTestId(tid.homeButton)+ const server = page.getByTestId(tid.serverIcon(serverId))+ const homeIndicator = home.locator("xpath=preceding-sibling::*[@data-slot='community-server-rail-indicator']")+ await home.tap()+ await expect(page).toHaveURL(/\/c\/me$/)+ await expect(home).toHaveAttribute("aria-current", "page")+ await expectIndicatorHeight(homeIndicator, 32)+ await server.tap()+ await expect(page).toHaveURL(new RegExp(`/c/channels/${serverId}$`))+ await expect(server).toHaveAttribute("aria-current", "page")+ await expect(home).not.toHaveAttribute("aria-current", "page")+ await expectIndicatorHeight(page.getByTestId(tid.serverRailIndicator(serverId)), 32)+ await home.focus()+ expect(await home.evaluate((element) => element.matches(":focus-visible"))).toBe(false)+ await expectIndicatorHeight(homeIndicator, 0)+ await page.keyboard.press("Tab")+ await home.focus()+ expect(await home.evaluate((element) => element.matches(":focus-visible"))).toBe(true)+ await expectIndicatorHeight(homeIndicator, 20)+ await page.keyboard.press("Enter")+ await expect(page).toHaveURL(/\/c\/me$/)+ await expectIndicatorHeight(homeIndicator, 32)+})diff --git a/src/web/src/test/e2e-ui/53-mobile-inbox-surface.spec.ts b/src/web/src/test/e2e-ui/53-mobile-inbox-surface.spec.tsindex eae6da9d0..10d457d76 100644--- a/src/web/src/test/e2e-ui/53-mobile-inbox-surface.spec.ts+++ b/src/web/src/test/e2e-ui/53-mobile-inbox-surface.spec.ts@@ -1,4 +1,4 @@-import type { Page, Request } from "@playwright/test"+import type { Page, Request, Route } from "@playwright/test"import { expect, test, type CaseActors } from "./_fixtures/case-fixture"import { GEOMETRY_EPSILON, composerEditable, gotoAfterUserWsAuth, ignoreNextDevToolsPointerCapture, waitForElementMotion } from "./_fixtures/actions"import { communityFrameEvents, proxyCommunityWebSockets } from "./_fixtures/community-ws-proxy"@@ -157,6 +157,67 @@ function observeWrites(page: Page) {test.describe("mobile Inbox interactive user-bar base", () => {test.setTimeout(180_000)+ for (const cancelBeforeCommit of [false, true]) {+ test(`keeps the first pending list Inbox command, cancel before commit=${cancelBeforeCommit}`, async ({ caseActors, caseResources }) => {+ const actors = await caseActors(["alice", "bob"])+ const stamp = Date.now()+ const serverId = await actors.seed.seedServer("alice", `Pending Inbox ${stamp}`)+ const channelName = `pending-inbox-${stamp}`+ const channelId = await actors.seed.seedChannel("alice", serverId, channelName)+ await actors.seed.seedJoinServer("alice", "bob", serverId)+ const { page } = await actors.asUser("bob", {+ viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true,+ })+ await gotoAfterUserWsAuth(page, `/c/channels/${serverId}/${channelId}`)+ await ignoreNextDevToolsPointerCapture(page)+ await expect(page.getByRole("banner").getByText(channelName, { exact: true })).toBeVisible()+ let release!: () => void+ const gate = new Promise<void>((resolve) => { release = resolve })+ caseResources.own(release, async (captured) => { captured() })+ let held = 0+ const root = `/c/channels/${serverId}`+ const pattern = (url: URL) => url.pathname === root+ const handler = async (route: Route) => {+ held += 1+ await gate+ await route.continue()+ }+ await page.route(pattern, handler)+ try {+ await page.getByRole("banner").getByRole("button", { name: "Back" }).tap({ noWaitAfter: true })+ await expect.poll(() => held).toBeGreaterThan(0)+ const trigger = page.getByTestId(tid.inboxTrigger)+ await expect(trigger).toBeVisible()+ await trigger.tap()+ await expect(trigger).toHaveAttribute("aria-busy", "true")+ await expect(trigger).toHaveAttribute("aria-expanded", "false")+ await expect(page.getByRole("dialog", { name: "Inbox", exact: true })).toHaveCount(0)+ if (cancelBeforeCommit) {+ await trigger.tap()+ await expect(trigger).not.toHaveAttribute("aria-busy")+ }+ release()+ await expect(page).toHaveURL(new RegExp(`${root}$`))+ await expect(page.getByRole("banner").getByText(channelName, { exact: true })).toHaveCount(0)+ await expect(trigger).not.toHaveAttribute("aria-busy")+ if (cancelBeforeCommit) {+ await expect(trigger).toHaveAttribute("aria-expanded", "false")+ await expect(page.getByRole("dialog", { name: "Inbox", exact: true })).toHaveCount(0)+ } else {+ await expect(trigger).toHaveAttribute("aria-expanded", "true")+ await expect(page.getByRole("dialog", { name: "Inbox", exact: true })).toBeVisible()+ await expect(page.getByTestId(tid.userBarExtension)).toHaveCount(1)+ await trigger.tap()+ await expect(trigger).toHaveAttribute("aria-expanded", "false")+ await expect(page.getByRole("dialog", { name: "Inbox", exact: true })).toHaveCount(0)+ }+ } finally {+ release()+ await page.unroute(pattern, handler)+ }+ })+ }+test("paints the retained Inbox digits after hidden messages and repeated detail returns", async ({ caseActors }, testInfo) => {const actors = await caseActors(["alice", "bob"])const { asUser } = actors