From 40fae6701616ef8b8bcd7308bb8bf06cc9da2662 Mon Sep 17 00:00:00 2001 From: yannickmonney Date: Thu, 8 Oct 2026 01:19:36 +0200 Subject: [PATCH 1/7] fix(platform): open every rail section on its overview A rail or tab-bar tile now always lands on its section's first page, from another section and from inside it: Home a fresh chat, Knowledge Documents, Automations the list, Settings its landing. The remembered automation, project and Knowledge tab are gone with their modules, history state and self-heal redirects; the rail's logo and a desktop visit to /home open a fresh chat too. Each rail tile sets aria-current from the rule that places the pill, so a screen reader hears the current section on every Knowledge tab and Home page, not only where the URL starts with the tile's link. --- design/docs/app.md | 4 + docs/de/get-started/members.md | 2 +- docs/de/platform/chat/basics.md | 2 +- docs/de/platform/index.md | 4 +- docs/de/platform/member/overview.md | 2 +- docs/en/get-started/members.md | 2 +- docs/en/platform/chat/basics.md | 2 +- docs/en/platform/index.md | 4 +- docs/en/platform/member/overview.md | 2 +- docs/fr/get-started/members.md | 2 +- docs/fr/platform/chat/basics.md | 2 +- docs/fr/platform/index.md | 4 +- docs/fr/platform/member/overview.md | 2 +- .../layout/app-sidebar/app-sidebar.test.tsx | 20 +- .../layout/app-sidebar/sidebar-header.tsx | 1 + .../app-sidebar/sidebar-nav.browser.test.tsx | 184 +++++++++++++++ .../layout/app-sidebar/sidebar-nav.test.tsx | 95 ++++---- .../layout/app-sidebar/sidebar-nav.tsx | 20 +- .../layout/mobile-bottom-nav.test.tsx | 33 ++- .../components/layout/mobile-bottom-nav.tsx | 8 +- .../automation-detail-shell.test.tsx | 123 +--------- .../components/automation-detail-shell.tsx | 40 +--- .../automations/lib/detail-memory.test.ts | 62 ----- .../features/automations/lib/detail-memory.ts | 59 ----- .../features/home/lib/project-memory.test.ts | 86 ------- .../app/features/home/lib/project-memory.ts | 69 ------ .../components/knowledge-navigation.tsx | 9 +- .../lib/knowledge-tab-memory.test.ts | 43 ---- .../knowledge/lib/knowledge-tab-memory.ts | 48 ---- .../app/hooks/use-navigation-items.test.ts | 189 ++++++--------- .../app/hooks/use-navigation-items.ts | 220 +++++++----------- services/platform/app/router.tsx | 5 - .../app/routes/dashboard/$id/_knowledge.tsx | 29 +-- .../app/routes/dashboard/$id/home.test.tsx | 22 +- .../app/routes/dashboard/$id/home.tsx | 5 +- .../$id/projects/$projectId.test.tsx | 104 +-------- .../dashboard/$id/projects/$projectId.tsx | 50 ---- .../tests/e2e/specs/navigation.spec.ts | 11 +- .../tests/manual/reference/automation.md | 11 +- .../platform/tests/manual/reference/pins.md | 4 +- .../tests/manual/suites/automations.md | 4 +- .../tests/manual/suites/navigation.md | 43 ++-- .../tests/manual/suites/responsive.md | 6 +- 43 files changed, 553 insertions(+), 1084 deletions(-) create mode 100644 services/platform/app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx delete mode 100644 services/platform/app/features/automations/lib/detail-memory.test.ts delete mode 100644 services/platform/app/features/automations/lib/detail-memory.ts delete mode 100644 services/platform/app/features/home/lib/project-memory.test.ts delete mode 100644 services/platform/app/features/home/lib/project-memory.ts delete mode 100644 services/platform/app/features/knowledge/lib/knowledge-tab-memory.test.ts delete mode 100644 services/platform/app/features/knowledge/lib/knowledge-tab-memory.ts diff --git a/design/docs/app.md b/design/docs/app.md index 9f5d843633..a66c82322f 100644 --- a/design/docs/app.md +++ b/design/docs/app.md @@ -29,6 +29,10 @@ what is there, and the page shows the one thing you opened. active section sits on one pill that glides from tile to tile (never two fills blinking); inactive tiles are muted; each shows a no-arrow tooltip to its right. Built from `@tale/ui` primitives, not a bespoke layout. A phone shows the same sections, from the same list, inside a floating, fully rounded bottom capsule. Its lightly translucent surface contains both icons and labels; one selected background glides between destinations. Scroll content continues behind it, with end clearance for the last item. Composers and page-action docks sit above it. The capsule is 60px tall with 20px icons and 11px labels. Downward scrolling reduces it to a 52px icon-only capsule, at most 280px wide and 4px lower; upward scrolling restores it. Both states keep 44px touch targets, accessible names and stable content clearance. The capsule hides while the software keyboard is open and returns when it closes. + A tile always opens its section's overview — Home a new chat (on a phone, the Home list), + Knowledge its first tab, Automations the list, Settings its landing page — never the place you + left, also when you are already in that section. The page's section decides the lit tile and its + `aria-current="page"`. - **Section panels** — a section with navigation of its own opens it in a panel beside the page, one frame for all of them: `SubPanel width="list"` (280px by default, full height, right border), a `SubPanelHeader` naming the section in the same `h-13` row as a page header (border included, so diff --git a/docs/de/get-started/members.md b/docs/de/get-started/members.md index 08712c2d7d..a582bce13e 100644 --- a/docs/de/get-started/members.md +++ b/docs/de/get-started/members.md @@ -48,7 +48,7 @@ Wähle im Bereich **Start** unter **Projekte** ein Projekt, auf das du zugreifen ## Zur Arbeit zurückkehren -Jeder Bereich öffnet seine eigene erste Seite – egal, was du dort zuletzt getan hast. Am Computer ist **Start** die Ausnahme: Dort öffnet sich der Chat, den du zuletzt gelesen hast, und wählst du **Start** erneut, beginnt ein neuer Chat. Die [Navigationsanleitung](/de/platform#navigation) erklärt die Bedienelemente am Computer und auf dem Smartphone. +Jeder Bereich öffnet seine eigene erste Seite – egal, was du dort zuletzt getan hast. Am Computer öffnet **Start** einen neuen Chat. Die [Navigationsanleitung](/de/platform#navigation) erklärt die Bedienelemente am Computer und auf dem Smartphone. **Start** zeigt deine Chats zusammen mit den offenen Aufgaben, die dir zugewiesen sind oder auf dein Review warten. Mit **Chats** oder **Aufgaben** über der Liste siehst du nur eine der beiden Arten. Ist die Seitenleiste ausgeblendet, holt **Seitenleiste einblenden** am Anfang der Kopfzeile sie zurück. Beginne für ein neues Thema einen neuen Chat und teile Projektgespräche bewusst, wenn andere sie benötigen. diff --git a/docs/de/platform/chat/basics.md b/docs/de/platform/chat/basics.md index 878bbdc4f7..7d655dc545 100644 --- a/docs/de/platform/chat/basics.md +++ b/docs/de/platform/chat/basics.md @@ -13,7 +13,7 @@ Nutze den Chat, um Fragen zu stellen, ein Dokument zu verstehen oder Information ## Die erste Nachricht senden -Öffne **Start**. Am Computer öffnet sich dabei der Chat, den du zuletzt gelesen hast, falls es einen gibt. Für ein neues Thema wählst du **Neuer Chat** oben in der Liste von **Start** oder klickst am Computer erneut auf **Start**, während der Bereich aktiv ist. Schreibe in das Nachrichtenfeld. Mit **Enter** sendest du, mit **Shift+Enter** fügst du einen Zeilenumbruch ein. Ein vorgeschlagener Gesprächseinstieg funktioniert wie eine eigene erste Frage. Ergänze Quelle, Thema und die Art der Antwort, die du brauchst. +Öffne **Start**. Am Computer öffnet sich ein neuer Chat, und die Seitenleiste von **Start** daneben listet deine bisherigen Chats; auf dem Smartphone wählst du **Chats** und dann **Neuer Chat**. Für ein weiteres Thema wählst du später erneut **Start** oder **Neuer Chat** oben in der Liste von **Start**. Schreibe in das Nachrichtenfeld. Mit **Enter** sendest du, mit **Shift+Enter** fügst du einen Zeilenumbruch ein. Ein vorgeschlagener Gesprächseinstieg funktioniert wie eine eigene erste Frage. Ergänze Quelle, Thema und die Art der Antwort, die du brauchst. Zum Beispiel: „Finde die Onboarding-Rückmeldungen und fasse die drei häufigsten Probleme zusammen. Nenne die Dokumente als Quellen und trenne gemeldete Probleme von deinen Vorschlägen.“ diff --git a/docs/de/platform/index.md b/docs/de/platform/index.md index f7b1c3e60a..128463a2c3 100644 --- a/docs/de/platform/index.md +++ b/docs/de/platform/index.md @@ -14,14 +14,14 @@ Auf dem Smartphone schwebt die Navigation als abgerundete Leiste über der Seite Beim Scrollen nach unten wird die Leiste kleiner, rückt etwas nach unten und zeigt nur noch die Symbole. Scrollst du nach oben, erscheinen die Leiste in voller Größe und die Beschriftungen wieder. Alle Bereiche bleiben in beiden Größen erreichbar. -Ein Bereich öffnet immer seine eigene erste Seite – egal, was du dort zuletzt getan hast. Dieselbe Auswahl führt dich also jedes Mal an dieselbe Stelle. Ein Beispiel: Öffne in einer Automatisierung den Tab **Läufe**, wechsle zu **Start** und wähle dann **Automatisierungen**. Du landest in der Liste der Automatisierungen, nicht auf dem Tab, den du verlassen hast. Am Computer macht nur **Start** dort weiter, wo du aufgehört hast, und öffnet den Chat, den du zuletzt gelesen hast – oder einen neuen Chat, falls es noch keinen gibt. Wählst du **Start** erneut, während du schon dort bist, beginnt ein neuer Chat. Dasselbe erreichst du mit **⌥⌘N** auf dem Mac oder **Alt+Ctrl+N** unter Windows und Linux. +Ein Bereich öffnet immer seine eigene erste Seite – egal, was du dort zuletzt getan hast. Dieselbe Auswahl führt dich also jedes Mal an dieselbe Stelle: **Start** öffnet einen neuen Chat, **Wissen** die **Dokumente** und **Automatisierungen** die Liste der Automatisierungen. Das gilt auch, wenn du den Bereich wählst, in dem du gerade bist. Ein Beispiel: Öffne in einer Automatisierung den Tab **Läufe**, wechsle zu **Wissen** und wähle dann **Automatisierungen**. Du landest in der Liste der Automatisierungen, nicht auf dem Tab, den du verlassen hast. Auf dem Smartphone öffnet **Start** statt eines neuen Chats die Liste von **Start**. Einen neuen Chat beginnst du auch mit **⌥⌘N** auf dem Mac oder **Alt+Ctrl+N** unter Windows und Linux. Die **Einstellungen** führen ihre Seiten in einer Seitenleiste neben der Seite auf, und die Kopfzeile nennt die geöffnete Seite; auf dem Smartphone beginnen sie mit einer Liste ihrer Seiten. **Wissen** zeigt seine Seiten als Tabs unter der Kopfzeile. | Du möchtest … | So gehst du vor | | --- | --- | | Einen anderen Bereich öffnen | Wähle den Bereich in der Navigationsleiste oder auf dem Smartphone in der Tab-Leiste. | -| Einen neuen Chat beginnen | Am Computer wählst du **Neuer Chat** im Bereich **Start** oder wählst **Start** erneut, während du bereits dort bist. Auf dem Smartphone öffnest du **Start**, wählst **Chats** und dann **Neuer Chat**. | +| Einen neuen Chat beginnen | Am Computer wählst du **Start** oder **Neuer Chat** im Bereich **Start**. Auf dem Smartphone öffnest du **Start**, wählst **Chats** und dann **Neuer Chat**. | | Ein Projekt öffnen | Am Computer wählst du das Projekt im Bereich **Start** unter **Projekte**. Auf dem Smartphone wählst du das Projekt und dann **Projekt öffnen**. | | Zur Projektliste zurückkehren | Wähle **Alle Projekte** im Bereich **Start** oder klicke oben im Projekt auf den Navigationspfad **Projekte**. | | Zur Dokumentenliste zurückkehren | Wähle **Wissen**. | diff --git a/docs/de/platform/member/overview.md b/docs/de/platform/member/overview.md index 64c72f733e..54f30c430d 100644 --- a/docs/de/platform/member/overview.md +++ b/docs/de/platform/member/overview.md @@ -35,7 +35,7 @@ Bearbeite dein Profil, prüfe deine Nutzungslimits und verstehe gespeicherte Ein -Wechsle über die [Hauptnavigation](/de/platform#navigation) zwischen deinen Tätigkeiten. Jeder Bereich öffnet seine eigene erste Seite; am Computer öffnet **Start** stattdessen den Chat, den du zuletzt gelesen hast, und wählst du **Start** erneut, beginnt ein neuer Chat. [Start](/de/platform#home) zeigt außerdem deine Projekte, die offenen Aufgaben, die dir zugewiesen sind oder auf dein Review warten, und die Inbox, sofern deine Organisation eine hat. +Wechsle über die [Hauptnavigation](/de/platform#navigation) zwischen deinen Tätigkeiten. Jeder Bereich öffnet seine eigene erste Seite; am Computer öffnet **Start** einen neuen Chat. [Start](/de/platform#home) zeigt außerdem deine Projekte, die offenen Aufgaben, die dir zugewiesen sind oder auf dein Review warten, und die Inbox, sofern deine Organisation eine hat. ## Arbeit an einen Projektagenten übergeben diff --git a/docs/en/get-started/members.md b/docs/en/get-started/members.md index 9b6918eaac..8d3d2b4591 100644 --- a/docs/en/get-started/members.md +++ b/docs/en/get-started/members.md @@ -48,7 +48,7 @@ Open a task to read its description, assignee, and discussion. You can create ta ## Return to your work -Every section opens on its own first page, whatever you did there last. On a computer, **Home** is the exception: it reopens the chat you last read, and choosing it again starts a new chat. The [navigation guide](/platform#navigation) explains the desktop and phone controls. +Every section opens on its own first page, whatever you did there last. On a computer, **Home** opens a new chat. The [navigation guide](/platform#navigation) explains the desktop and phone controls. Home lists your chats together with the open tasks assigned to you or waiting for your review; choose **Chats** or **Tasks** above the list to see one kind only. If the Home panel is hidden, **Show sidebar** at the start of the header brings it back. Use a new chat for a new subject and share a project conversation deliberately when teammates need it. diff --git a/docs/en/platform/chat/basics.md b/docs/en/platform/chat/basics.md index 57634f3e8a..f0aa6ff7d7 100644 --- a/docs/en/platform/chat/basics.md +++ b/docs/en/platform/chat/basics.md @@ -13,7 +13,7 @@ Use chat to ask questions, understand a document, or investigate information in ## Send your first message -Open **Home**. On a computer, it reopens the chat you last read, if there is one. To begin a new subject, choose **New chat** at the top of the Home list or, on a computer, choose **Home** again while it is active. Type in the message field. Press **Enter** to send or **Shift+Enter** for a new line. A starter prompt fills the same role as your own first question; edit your request to include the source, subject, and kind of answer you need. +Open **Home**. On a computer, a new chat opens, and the Home panel beside it lists your earlier chats; on a phone, choose **Chats**, then **New chat**. To begin another subject later, choose **Home** again or **New chat** at the top of the Home list. Type in the message field. Press **Enter** to send or **Shift+Enter** for a new line. A starter prompt fills the same role as your own first question; edit your request to include the source, subject, and kind of answer you need. For example: “Find the onboarding feedback and summarize the three most common problems. Cite the documents and separate reported problems from your suggestions.” diff --git a/docs/en/platform/index.md b/docs/en/platform/index.md index 54f5b22d7c..81ecd754c5 100644 --- a/docs/en/platform/index.md +++ b/docs/en/platform/index.md @@ -14,14 +14,14 @@ On a phone, navigation sits in a rounded capsule floating above the page. Conten As you scroll down, the navigation becomes smaller and moves slightly lower, showing just the icons. Scroll up to bring back the full bar and labels. Every destination stays available in both sizes. -A section always opens on its own first page, whatever you did there last, so the same choice leads to the same place every time. For example, open an automation's **Runs** tab, switch to **Home**, then choose **Automations**: the automation list opens, not the tab you left. On a computer, Home is the one section that picks up where you were: it reopens the chat you last read, or a new chat if you have none, and choosing **Home** again while you are there starts a new chat. The shortcut **⌥⌘N** on a Mac, or **Alt+Ctrl+N** on Windows or Linux, also starts a new chat. +A section always opens on its own first page, whatever you did there last, so the same choice leads to the same place every time: **Home** opens a new chat, **Knowledge** opens **Documents**, and **Automations** opens the automation list. Choosing the section you are already in does the same. For example, open an automation's **Runs** tab, switch to **Knowledge**, then choose **Automations**: the automation list opens, not the tab you left. On a phone, **Home** opens the Home list instead of a new chat. The shortcut **⌥⌘N** on a Mac, or **Alt+Ctrl+N** on Windows or Linux, also starts a new chat. **Settings** lists its pages in a panel beside the page, and the page header names the page you opened; on a phone, Settings starts from a list of its pages. **Knowledge** shows its pages as tabs under its header. | You want to… | Do this | | --- | --- | | Open another section | Choose that section in the rail or, on a phone, in the tab bar. | -| Start a new chat | On a computer, choose **New chat** in Home, or choose **Home** while you are already there. On a phone, open **Home**, choose **Chats**, then **New chat**. | +| Start a new chat | On a computer, choose **Home**, or **New chat** in Home. On a phone, open **Home**, choose **Chats**, then **New chat**. | | Open a project | On a computer, choose the project under **Projects** in Home. On a phone, choose the project, or choose **Open project** from its menu. | | Return to the project list | Choose **All projects** in Home, or use the **Projects** breadcrumb above the project. | | Return to the Documents list | Choose **Knowledge**. | diff --git a/docs/en/platform/member/overview.md b/docs/en/platform/member/overview.md index 9aff2eb550..43303514d4 100644 --- a/docs/en/platform/member/overview.md +++ b/docs/en/platform/member/overview.md @@ -35,7 +35,7 @@ Edit your profile, check your usage limits, and understand saved preferences and -Move between your daily work with the [main navigation](/platform#navigation). Each section opens on its own first page; on a computer, **Home** reopens the chat you last read instead, and choosing it again starts a new chat. [Home](/platform#home) also lists your projects, the open tasks assigned to you or waiting for your review, and the inbox when your organization has one. +Move between your daily work with the [main navigation](/platform#navigation). Each section opens on its own first page; on a computer, **Home** opens a new chat. [Home](/platform#home) also lists your projects, the open tasks assigned to you or waiting for your review, and the inbox when your organization has one. ## Hand work to a project agent diff --git a/docs/fr/get-started/members.md b/docs/fr/get-started/members.md index 78723e78cb..6a254b8afa 100644 --- a/docs/fr/get-started/members.md +++ b/docs/fr/get-started/members.md @@ -48,7 +48,7 @@ Ouvre une tâche pour lire sa description, son attribution et la discussion. Dan ## Reprendre ton travail -Chaque section s’ouvre sur sa première page, quoi que tu y aies fait auparavant. Sur ordinateur, **Accueil** fait exception : il rouvre le chat que tu as lu en dernier, et le choisir à nouveau démarre un nouveau chat. Le [guide de navigation](/fr/platform#navigation) décrit les commandes sur ordinateur et téléphone. +Chaque section s’ouvre sur sa première page, quoi que tu y aies fait auparavant. Sur ordinateur, **Accueil** ouvre un nouveau chat. Le [guide de navigation](/fr/platform#navigation) décrit les commandes sur ordinateur et téléphone. **Accueil** affiche tes chats avec les tâches ouvertes qui te sont attribuées ou qui attendent ta relecture ; choisis **Chats** ou **Tâches** au-dessus de la liste pour n’afficher que tes chats ou que tes tâches. Si le panneau latéral est masqué, **Afficher le panneau latéral**, au début de l’en-tête, le fait revenir. Commence un nouveau chat pour un nouveau sujet et partage volontairement une conversation de projet lorsque tes collègues en ont besoin. diff --git a/docs/fr/platform/chat/basics.md b/docs/fr/platform/chat/basics.md index ae1dddb47a..46c81dc21e 100644 --- a/docs/fr/platform/chat/basics.md +++ b/docs/fr/platform/chat/basics.md @@ -13,7 +13,7 @@ Utilise le chat pour poser une question, comprendre un document ou rechercher un ## Envoyer un premier message -Ouvre **Accueil**. Sur ordinateur, le chat que tu as lu en dernier se rouvre, s’il y en a un. Pour aborder un nouveau sujet, choisis **Nouveau chat** en haut de la liste d’**Accueil** ou, sur ordinateur, sélectionne à nouveau **Accueil** alors que cette section est active. Écris dans le champ de message. Appuie sur **Entrée** pour envoyer ou sur **Maj+Entrée** pour aller à la ligne. Une suggestion de départ joue le même rôle que ta propre question : précise la source, le sujet et le type de réponse attendu. +Ouvre **Accueil**. Sur ordinateur, un nouveau chat s’ouvre, et le panneau latéral d’**Accueil**, à côté, liste tes chats précédents ; sur téléphone, choisis **Chats**, puis **Nouveau chat**. Pour aborder un autre sujet plus tard, choisis à nouveau **Accueil** ou **Nouveau chat** en haut de la liste d’**Accueil**. Écris dans le champ de message. Appuie sur **Entrée** pour envoyer ou sur **Maj+Entrée** pour aller à la ligne. Une suggestion de départ joue le même rôle que ta propre question : précise la source, le sujet et le type de réponse attendu. Par exemple : « Retrouve les retours d’onboarding et résume les trois problèmes les plus fréquents. Cite les documents et sépare les problèmes signalés de tes suggestions. » diff --git a/docs/fr/platform/index.md b/docs/fr/platform/index.md index 00ff12b98c..31ba0e26f6 100644 --- a/docs/fr/platform/index.md +++ b/docs/fr/platform/index.md @@ -14,14 +14,14 @@ Sur téléphone, la navigation flotte au-dessus de la page dans une barre arrond Quand tu fais défiler la page vers le bas, la barre devient plus petite, descend légèrement et n’affiche plus que les icônes. Remonte dans la page pour retrouver la barre complète et ses libellés. Toutes les destinations restent accessibles dans les deux formats. -Une section s’ouvre toujours sur sa première page, quoi que tu y aies fait auparavant : le même choix te mène donc chaque fois au même endroit. Par exemple, ouvre l’onglet **Exécutions** d’une automatisation, passe dans **Accueil**, puis choisis **Automatisations** : la liste des automatisations s’ouvre, et non l’onglet que tu as quitté. Sur ordinateur, seul **Accueil** reprend où tu en étais : il rouvre le chat que tu as lu en dernier, ou un nouveau chat si tu n’en as aucun. Choisir **Accueil** alors que tu y es déjà démarre un nouveau chat, tout comme le raccourci **⌥⌘N** sur Mac ou **Alt+Ctrl+N** sous Windows et Linux. +Une section s’ouvre toujours sur sa première page, quoi que tu y aies fait auparavant : le même choix te mène donc chaque fois au même endroit. **Accueil** ouvre un nouveau chat, **Connaissances** ouvre **Documents** et **Automatisations** ouvre la liste des automatisations. C’est aussi le cas quand tu choisis la section où tu te trouves déjà. Par exemple, ouvre l’onglet **Exécutions** d’une automatisation, passe dans **Connaissances**, puis choisis **Automatisations** : la liste des automatisations s’ouvre, et non l’onglet que tu as quitté. Sur téléphone, **Accueil** ouvre la liste d’**Accueil** plutôt qu’un nouveau chat. Le raccourci **⌥⌘N** sur Mac ou **Alt+Ctrl+N** sous Windows et Linux démarre aussi un nouveau chat. **Paramètres** liste ses pages dans un panneau latéral, à côté de la page, et l’en-tête indique la page ouverte ; sur téléphone, Paramètres commence par la liste de ses pages. **Connaissances** présente ses pages sous forme d’onglets sous son en-tête. | Tu souhaites… | Marche à suivre | | --- | --- | | Ouvrir une autre section | Choisis cette section dans la barre de navigation ou, sur téléphone, dans la barre d’onglets. | -| Démarrer un nouveau chat | Sur ordinateur, choisis **Nouveau chat** dans **Accueil**, ou choisis **Accueil** alors que tu y es déjà. Sur téléphone, ouvre **Accueil**, choisis **Chats**, puis **Nouveau chat**. | +| Démarrer un nouveau chat | Sur ordinateur, choisis **Accueil**, ou **Nouveau chat** dans **Accueil**. Sur téléphone, ouvre **Accueil**, choisis **Chats**, puis **Nouveau chat**. | | Ouvrir un projet | Sur ordinateur, choisis le projet sous **Projets** dans **Accueil**. Sur téléphone, choisis le projet, puis **Ouvrir le projet**. | | Revenir à la liste des projets | Choisis **Tous les projets** dans **Accueil**, ou clique sur **Projets** dans le fil d’Ariane au-dessus du projet. | | Revenir à la liste des documents | Choisis **Connaissances**. | diff --git a/docs/fr/platform/member/overview.md b/docs/fr/platform/member/overview.md index e107ffdc78..d7c2f525ee 100644 --- a/docs/fr/platform/member/overview.md +++ b/docs/fr/platform/member/overview.md @@ -35,7 +35,7 @@ Modifie ton profil, consulte tes limites d’utilisation et comprends les préf -Passe d’une activité à l’autre avec la [navigation principale](/fr/platform#navigation). Chaque section s’ouvre sur sa première page ; sur ordinateur, **Accueil** rouvre plutôt le chat que tu as lu en dernier, et le choisir à nouveau démarre un nouveau chat. [Accueil](/fr/platform#home) liste aussi tes projets, les tâches ouvertes qui te sont attribuées ou qui attendent ta relecture, et la boîte de réception si ton organisation en a une. +Passe d’une activité à l’autre avec la [navigation principale](/fr/platform#navigation). Chaque section s’ouvre sur sa première page ; sur ordinateur, **Accueil** ouvre un nouveau chat. [Accueil](/fr/platform#home) liste aussi tes projets, les tâches ouvertes qui te sont attribuées ou qui attendent ta relecture, et la boîte de réception si ton organisation en a une. ## Confier du travail à un agent de projet diff --git a/services/platform/app/components/layout/app-sidebar/app-sidebar.test.tsx b/services/platform/app/components/layout/app-sidebar/app-sidebar.test.tsx index 5cb504e2a7..a888500897 100644 --- a/services/platform/app/components/layout/app-sidebar/app-sidebar.test.tsx +++ b/services/platform/app/components/layout/app-sidebar/app-sidebar.test.tsx @@ -22,15 +22,23 @@ type MockLinkProps = React.ComponentProps<'a'> & { to?: string; params?: Record; preload?: string; + search?: Record; }; vi.mock('@tanstack/react-router', () => ({ + // `search` is a router prop, not a DOM attribute — surfaced as data-* so a + // test can assert what a link navigates with. Link: React.forwardRef(function Link( - { to, params: _params, preload: _preload, children, ...rest }, + { to, params: _params, preload: _preload, search, children, ...rest }, ref, ) { return ( - + {children} ); @@ -100,6 +108,14 @@ describe('AppSidebar', () => { ); }); + it('opens a fresh chat from the logo, never the last one', () => { + render(); + + const logo = screen.getByRole('link', { name: 'Tale' }); + expect(logo).toHaveAttribute('href', '/dashboard/$id/chat'); + expect(logo).toHaveAttribute('data-search', '{"new":true}'); + }); + describe('accessibility', () => { it('passes axe audit', async () => { const { container } = render(); diff --git a/services/platform/app/components/layout/app-sidebar/sidebar-header.tsx b/services/platform/app/components/layout/app-sidebar/sidebar-header.tsx index 63242924bf..ed24618db3 100644 --- a/services/platform/app/components/layout/app-sidebar/sidebar-header.tsx +++ b/services/platform/app/components/layout/app-sidebar/sidebar-header.tsx @@ -22,6 +22,7 @@ export function SidebarHeader({ organizationId }: SidebarHeaderProps) { diff --git a/services/platform/app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx b/services/platform/app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx new file mode 100644 index 0000000000..aec40d312b --- /dev/null +++ b/services/platform/app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx @@ -0,0 +1,184 @@ +import '@testing-library/jest-dom/vitest'; +import { + Outlet, + RouterProvider, + createMemoryHistory, + createRootRoute, + createRoute, + createRouter, +} from '@tanstack/react-router'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + +import { defineAbilityFor } from '@/lib/permissions/ability'; +import { cleanup, render, screen, waitFor } from '@/tests/utils/render'; + +import { SidebarFooter } from './sidebar-footer'; +import { SidebarNav } from './sidebar-nav'; + +import '@/app/globals.css'; + +/** + * The rail under a real router, in Chromium: what each tile opens and which + * tile names the page as current. The unit tests mock `Link`, so they cannot + * see TanStack's own `aria-current` stamp beside the rail's — only this run + * proves the two never name different tiles, and that a click lands on the + * section's overview whatever was open there before. + */ + +vi.mock('@/app/features/conversations/hooks/use-inbox-availability', () => ({ + useInboxAvailability: () => ({ showInbox: false }), +})); + +vi.mock('@/app/features/conversations/hooks/queries', () => ({ + useUnreadConversationCount: () => ({ data: undefined }), +})); + +vi.mock('@/app/hooks/use-ability', () => ({ + useAbility: () => defineAbilityFor('owner'), +})); + +vi.mock('@/app/components/branding/branding-provider', () => ({ + useBrandingContext: () => ({ accentColor: null, logoUrl: null }), +})); + +vi.mock('@/app/components/user-button', () => ({ + UserButton: () => null, +})); + +vi.mock('@/app/features/notifications/components/notification-bell', () => ({ + NotificationBell: () => null, +})); + +afterEach(cleanup); + +const ORG = '/dashboard/org-1'; + +function Rail() { + return ( + <> + +
+ +
+ + ); +} + +function renderRail(initialPath: string) { + const rootRoute = createRootRoute({ component: Rail }); + const chatRoute = createRoute({ + getParentRoute: () => rootRoute, + path: '/dashboard/$id/chat', + validateSearch: (search: Record) => + search.new === true ? { new: true } : {}, + component: () =>

Chat page

, + }); + const pages = [ + '/dashboard/$id/documents', + '/dashboard/$id/websites', + '/dashboard/$id/automations', + '/dashboard/$id/automations/$automationSlug/runs', + '/dashboard/$id/projects/$projectId/tasks/board', + '/dashboard/$id/projects/$projectId/automations', + '/dashboard/$id/settings', + '/dashboard/$id/settings/teams', + ].map((path) => + createRoute({ + getParentRoute: () => rootRoute, + path, + component: () =>

{path}

, + }), + ); + const router = createRouter({ + routeTree: rootRoute.addChildren([chatRoute, ...pages]), + history: createMemoryHistory({ initialEntries: [initialPath] }), + }); + /** Moves to `path` the way an address or another link would. */ + async function go(path: string) { + router.history.push(path); + await waitFor(() => expect(router.state.location.pathname).toBe(path)); + } + return { router, go, ...render() }; +} + +const tile = (name: string) => + screen.findByRole('link', { name: new RegExp(`^${name}`) }); + +/** Every rail link naming the page as current, by its accessible name. */ +function currentTiles(): string[] { + return screen + .getAllByRole('link') + .filter((link) => link.getAttribute('aria-current') === 'page') + .map((link) => link.getAttribute('aria-label') ?? ''); +} + +describe('the rail in Chromium', () => { + it("opens each section's overview, never the place left there", async () => { + const { user, router, go } = renderRail(`${ORG}/automations/intake/runs`); + const location = () => router.state.location; + + await user.click(await tile('Knowledge')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/documents`)); + + // Another Knowledge tab, then away and back: Documents again. + await go(`${ORG}/websites`); + await user.click(await tile('Home')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/chat`)); + expect(location().search).toEqual({ new: true }); + + await user.click(await tile('Automations')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/automations`)); + + await user.click(await tile('Knowledge')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/documents`)); + + await user.click(await tile('Settings')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/settings`)); + + // From inside the section, too. + await go(`${ORG}/settings/teams`); + await user.click(await tile('Settings')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/settings`)); + + await go(`${ORG}/projects/p-1/tasks/board`); + await user.click(await tile('Home')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/chat`)); + expect(location().search).toEqual({ new: true }); + }); + + it('names exactly one tile as the current page, the one the pill marks', async () => { + const { go } = renderRail(`${ORG}/chat`); + + for (const [path, section] of [ + [`${ORG}/chat`, 'Home'], + [`${ORG}/websites`, 'Knowledge'], + [`${ORG}/automations/intake/runs`, 'Automations'], + [`${ORG}/projects/p-1/tasks/board`, 'Home'], + [`${ORG}/projects/p-1/automations`, 'Home'], + [`${ORG}/settings/teams`, 'Settings'], + ] as const) { + await go(path); + await waitFor(() => expect(currentTiles(), path).toEqual([section])); + expect( + screen + .getByRole('link', { name: new RegExp(`^${section}`) }) + .querySelector('[data-active="true"]'), + path, + ).not.toBeNull(); + } + }); + + it('opens a section from the keyboard', async () => { + const { user, router } = renderRail(`${ORG}/automations/intake/runs`); + + (await tile('Automations')).focus(); + await user.keyboard('{Enter}'); + + await waitFor(() => + expect(router.state.location.pathname).toBe(`${ORG}/automations`), + ); + }); +}); diff --git a/services/platform/app/components/layout/app-sidebar/sidebar-nav.test.tsx b/services/platform/app/components/layout/app-sidebar/sidebar-nav.test.tsx index fdf2409d77..4362daa53a 100644 --- a/services/platform/app/components/layout/app-sidebar/sidebar-nav.test.tsx +++ b/services/platform/app/components/layout/app-sidebar/sidebar-nav.test.tsx @@ -40,34 +40,22 @@ type MockLinkProps = React.ComponentProps<'a'> & { params?: Record; preload?: string; search?: Record; - state?: Record; }; vi.mock('@tanstack/react-router', () => ({ // Router-only props (`to`, `params`, `preload`) are stripped so that only real // DOM attributes — crucially `aria-label` — reach the rendered anchor. Link: React.forwardRef(function Link( - { - to, - params: _params, - preload: _preload, - search, - state, - children, - ...rest - }, + { to, params: _params, preload: _preload, search, children, ...rest }, ref, ) { - // `search`/`state` are router props, not DOM attributes — surface them as - // data-* so a test can assert what the rail decided to navigate with. - // `data-history-state`, not `data-state`: Radix's Tooltip trigger already - // clones a `data-state` (open/closed) onto this element via `{...rest}`. + // `search` is a router prop, not a DOM attribute — surfaced as data-* so + // a test can assert what the rail decided to navigate with. return ( {children} @@ -116,7 +104,7 @@ vi.mock('@/app/hooks/use-navigation-items', () => ({ // A shortcut item: its accessible name must stay the plain label, with // the shortcut chip living only in the sighted-hover tooltip. shortcut: '⌥ ⌘ N', - reentrySearch: { new: true }, + search: { new: true }, }, { label: primaryLabels[1], @@ -124,11 +112,6 @@ vi.mock('@/app/hooks/use-navigation-items', () => ({ params: { id: 'test-org' }, href: '/dashboard/test-org/automations', icon: LayoutGrid, - // As `useNavigationItems` would set it when `to` resolves to a - // remembered deep link — marks the arrival so the landing route can - // self-heal (unrelated to this fixture's own `to`, kept at the - // section root so the existing destination tests stay valid). - state: { navRestore: true }, }, { label: primaryLabels[2], @@ -231,6 +214,35 @@ describe('SidebarNav', () => { ).toBeInTheDocument(); }); + // The rail names the section the page belongs to, by the same rule that + // places the pill — not only where the URL starts with a tile's own `to`. + it('marks only the active section as the current page', () => { + mockLocation.pathname = + '/dashboard/test-org/automations/qa__layout-check/runs'; + + render(); + + const current = screen + .getAllByRole('link') + .filter((link) => link.getAttribute('aria-current') === 'page'); + expect(current).toEqual([ + screen.getByRole('link', { name: primaryLabels[1] }), + ]); + }); + + it('moves the current page with the section', () => { + mockLocation.pathname = '/dashboard/test-org/projects'; + + render(); + + const current = screen + .getAllByRole('link') + .filter((link) => link.getAttribute('aria-current') === 'page'); + expect(current).toEqual([ + screen.getByRole('link', { name: primaryLabels[2] }), + ]); + }); + it('passes an axe link-name audit', async () => { const { container } = render(); await checkAccessibility(container); @@ -240,14 +252,11 @@ describe('SidebarNav', () => { // ------------------------------------------------------------------------- // A rail click is a request for the SECTION — this tile only renders what // `useNavigationItems` (mocked above) already decided the destination is, - // it never computes one of its own. That hook resolves most items to the - // section's own entry point, but for Home/Knowledge/Automations resolves - // to a remembered deep link when one exists and the tile isn't already - // active (its own tests own that behavior); this tile's only job is to - // pass `to`/`params`/`state` through untouched. + // its section's overview, and never computes one of its own: the same + // `to`, `params` and `search` from another section and from inside it. // ------------------------------------------------------------------------- describe('destination', () => { - it('opens whatever entry point the item carries, not a deeper page inside it', () => { + it('opens the entry point, not a deeper page inside it', () => { mockLocation.pathname = '/dashboard/test-org/automations/qa__layout-check/runs'; @@ -266,23 +275,18 @@ describe('SidebarNav', () => { ).toHaveAttribute('href', '/dashboard/$id/projects'); }); - it('threads the item’s history state through, for a remembered deep link', () => { + it('opens a fresh composer when re-entering chat', () => { render(); expect( - screen.getByRole('link', { name: primaryLabels[1] }), - ).toHaveAttribute('data-history-state', '{"navRestore":true}'); + screen.getByRole('link', { name: primaryLabels[0] }), + ).toHaveAttribute('data-search', '{"new":true}'); }); - it('leaves an item with no state alone', () => { - render(); - - expect( - screen.getByRole('link', { name: primaryLabels[2] }), - ).not.toHaveAttribute('data-history-state'); - }); + it('opens a fresh composer from another section too', () => { + // Never the last chat: the tile lands on the same page from anywhere. + mockLocation.pathname = '/dashboard/test-org/projects'; - it('opens a fresh composer when re-entering chat', () => { render(); expect( @@ -290,25 +294,12 @@ describe('SidebarNav', () => { ).toHaveAttribute('data-search', '{"new":true}'); }); - it('does not apply the re-entry search to a section left alone', () => { + it('carries no search on a tile without one', () => { render(); expect( screen.getByRole('link', { name: primaryLabels[2] }), ).not.toHaveAttribute('data-search'); }); - - it('resumes rather than starting fresh when entering chat from elsewhere', () => { - // The re-entry search belongs to the ACTIVE tile only. Leaking it to an - // inactive chat tile would replace "reopen my last chat" with a blank - // composer on every arrival from another section. - mockLocation.pathname = '/dashboard/test-org/projects'; - - render(); - - expect( - screen.getByRole('link', { name: primaryLabels[0] }), - ).not.toHaveAttribute('data-search'); - }); }); }); diff --git a/services/platform/app/components/layout/app-sidebar/sidebar-nav.tsx b/services/platform/app/components/layout/app-sidebar/sidebar-nav.tsx index 8d756d8eb9..5051db521f 100644 --- a/services/platform/app/components/layout/app-sidebar/sidebar-nav.tsx +++ b/services/platform/app/components/layout/app-sidebar/sidebar-nav.tsx @@ -50,18 +50,14 @@ export function SidebarNavItem({ return null; } - // Where this tile goes: the section's own landing page by default — a rail - // click from outside the section resets to its entry point, not the last - // place inside it. Home, Knowledge and Automations are the exceptions: - // `item.to`/`item.state` already resolve to a remembered deep link when - // one exists (see `useNavigationItems`), so this stays a plain pass-through. + // Where this tile goes: the section's overview, every time — from another + // section and from inside this one. A rail click is a request for the + // section, never a replay of a place in it, so it always lands on the same + // page: Home a fresh composer, a tabbed section its first tab. const linkProps = { to: item.to, params: item.params, - ...(isActive && item.reentrySearch !== undefined - ? { search: item.reentrySearch } - : {}), - ...(item.state !== undefined ? { state: item.state } : {}), + ...(item.search !== undefined ? { search: item.search } : {}), preload: 'render', } as const; @@ -146,6 +142,12 @@ export function SidebarNavItem({ {...linkProps} data-indicator-key={item.href} aria-label={accessibleName} + // The section the page belongs to, by the same rule that places the + // pill. TanStack only stamps `aria-current` itself when the URL starts + // with the tile's own `to`, which misses Knowledge's other tabs and + // every Home page but the composer; its own stamp never names a tile + // this rule leaves out, so the two cannot disagree. + aria-current={isActive ? 'page' : undefined} className={linkClassName} > {rowContent} diff --git a/services/platform/app/components/layout/mobile-bottom-nav.test.tsx b/services/platform/app/components/layout/mobile-bottom-nav.test.tsx index a24a5c1109..69c8f22dac 100644 --- a/services/platform/app/components/layout/mobile-bottom-nav.test.tsx +++ b/services/platform/app/components/layout/mobile-bottom-nav.test.tsx @@ -36,8 +36,10 @@ vi.mock('@/lib/i18n/client', () => ({ const navigate = vi.fn(); let automationSlug: string | undefined; +// Where the phone is — set before rendering to move the page. +const currentLocation = { pathname: '/dashboard/org-1/chat' }; vi.mock('@tanstack/react-router', () => ({ - useLocation: () => ({ pathname: '/dashboard/org-1/chat' }), + useLocation: () => currentLocation, useNavigate: () => navigate, useMatches: ({ select, @@ -78,6 +80,7 @@ vi.mock('@/app/hooks/use-display-mode', () => ({ beforeEach(() => { viewer.role = 'owner'; automationSlug = undefined; + currentLocation.pathname = '/dashboard/org-1/chat'; inbox.hasInbox = true; unread.data = undefined; unreadCalls.length = 0; @@ -134,6 +137,34 @@ describe('the mobile tab bar', () => { params: { id: 'org-1' }, }); }); + + // A tab always lands on its section's first page, also from inside that + // section: never the tab or the automation that was open there. Strict + // equality, so a stray history state fails the case too. + it('opens Knowledge on Documents from any of its tabs', async () => { + currentLocation.pathname = '/dashboard/org-1/websites'; + const { user } = render(); + expect(screen.getByRole('button', { name: /^knowledge/ })).toHaveAttribute( + 'aria-current', + 'page', + ); + await user.click(screen.getByRole('button', { name: /^knowledge/ })); + expect(navigate.mock.lastCall?.[0]).toStrictEqual({ + to: '/dashboard/$id/documents', + params: { id: 'org-1' }, + }); + }); + + it('opens the automations list from inside an automation', async () => { + currentLocation.pathname = '/dashboard/org-1/automations/intake/runs'; + automationSlug = 'intake'; + const { user } = render(); + await user.click(screen.getByRole('button', { name: /^automations/ })); + expect(navigate.mock.lastCall?.[0]).toStrictEqual({ + to: '/dashboard/$id/automations', + params: { id: 'org-1' }, + }); + }); }); /** The phone's Home tab carries the same unread chip as the desktop rail — diff --git a/services/platform/app/components/layout/mobile-bottom-nav.tsx b/services/platform/app/components/layout/mobile-bottom-nav.tsx index 56055f3250..e8781b883a 100644 --- a/services/platform/app/components/layout/mobile-bottom-nav.tsx +++ b/services/platform/app/components/layout/mobile-bottom-nav.tsx @@ -105,13 +105,7 @@ export function MobileBottomNav({ organizationId }: MobileBottomNavProps) { to: '/dashboard/$id/home', params: { id: organizationId }, } - : { - to: item.to, - params: item.params, - ...(item.state !== undefined - ? { state: item.state } - : {}), - }, + : { to: item.to, params: item.params }, ); }, }; diff --git a/services/platform/app/features/automations/components/automation-detail-shell.test.tsx b/services/platform/app/features/automations/components/automation-detail-shell.test.tsx index 498787959a..3e09f799cf 100644 --- a/services/platform/app/features/automations/components/automation-detail-shell.test.tsx +++ b/services/platform/app/features/automations/components/automation-detail-shell.test.tsx @@ -4,7 +4,7 @@ import type { ReactNode } from 'react'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { checkAccessibility } from '@/tests/utils/a11y'; -import { render, screen, waitFor, within } from '@/tests/utils/render'; +import { render, screen, within } from '@/tests/utils/render'; import { AutomationDetailShell } from './automation-detail-shell'; @@ -21,21 +21,16 @@ const fixtures = vi.hoisted(() => ({ error: undefined as unknown, dirtyKeys: undefined as ReadonlySet | undefined, pathname: '/dashboard/org-1/automations/sync-emails', - state: {} as Record, })); -const mockNavigate = vi.hoisted(() => vi.fn()); - -// The shell reads the location to tell a RESTORED arrival (the rail reopening -// a remembered automation) from a deliberate one, so a deleted automation falls -// back to the list instead of dead-ending. No router is mounted here. +// The shell reads the location to know which tab is open. No router is +// mounted here. vi.mock('@tanstack/react-router', () => ({ useLocation: () => ({ pathname: fixtures.pathname, search: {}, - state: fixtures.state, + state: {}, }), - useNavigate: () => mockNavigate, Link: ({ children, to }: { children: ReactNode; to: string }) => ( {children} ), @@ -158,9 +153,6 @@ beforeEach(() => { fixtures.error = undefined; fixtures.dirtyKeys = undefined; fixtures.pathname = '/dashboard/org-1/automations/sync-emails'; - fixtures.state = {}; - mockNavigate.mockClear(); - window.localStorage.clear(); }); describe('AutomationDetailShell', () => { @@ -285,88 +277,12 @@ describe('AutomationDetailShell', () => { ).not.toBeInTheDocument(); }); - // A remembered automation (the Automations rail tile reopening it, see - // `use-navigation-items.ts`) can be gone by the time the rail click lands. - // That arrival is marked with `state.navRestore`, and only THAT arrival - // redirects: a shared link to the same dead automation keeps explaining - // rather than bouncing away. - it('drops the stale memory and redirects to the list on a restored arrival', () => { - fixtures.automation = null; - fixtures.state = { navRestore: true }; - renderShell(); - - expect(mockNavigate).toHaveBeenCalledWith({ - to: '/dashboard/$id/automations', - params: { id: 'org-1' }, - replace: true, - }); - }); - - it('does not redirect a restored arrival scoped to a project', () => { - // Project-scoped automation routes belong to that project's own memory - // (`features/home/lib/project-memory.ts`), not the org Automations list. - fixtures.automation = null; - fixtures.state = { navRestore: true }; - renderShell({ projectId: 'proj-1' }); - - expect(mockNavigate).not.toHaveBeenCalled(); - }); - it('passes an axe audit', async () => { const { container } = renderShell(); await checkAccessibility(container); }); }); -// A navigation AWAY updates `pathname` (and re-runs the write effect) on the -// render just before this component unmounts, so `pathname` no longer -// matches the automation this shell is FOR. Regression for a bug where the -// unguarded effect persisted wherever the user navigated TO — e.g. clicking -// Automations landed on Knowledge or Home, because that's what the shell -// last wrote under its own key on its way out. -describe('AutomationDetailShell — remembering only its own path', () => { - const OWN_PATH = '/dashboard/org-1/automations/billing__dunning/editor'; - - it('persists its own path while genuinely on it', async () => { - fixtures.pathname = OWN_PATH; - renderShell(); - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.automations.org-1.lastPath'), - ).toBe(JSON.stringify(OWN_PATH)), - ); - }); - - it('does not overwrite the memory with a pathname that no longer belongs to this automation', async () => { - fixtures.pathname = OWN_PATH; - const { rerender } = renderShell(); - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.automations.org-1.lastPath'), - ).toBe(JSON.stringify(OWN_PATH)), - ); - - // Simulate the render right before this shell unmounts on the way to - // Knowledge: `pathname` has already moved, this component hasn't yet. - fixtures.pathname = '/dashboard/org-1/documents'; - rerender( - -
- , - ); - - // The last GOOD path survives untouched — never Knowledge's path. - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.automations.org-1.lastPath'), - ).toBe(JSON.stringify(OWN_PATH)), - ); - }); -}); - /** * A deleted automation keeps its runs until retention removes them, but the * shell read the 404 as "not found" and a run link opened a blank page @@ -418,37 +334,6 @@ describe('AutomationDetailShell — a deleted automation', () => { ); }); - // Deleted from the list, an automation stays remembered as the rail's - // place; reopening it there must land on the list, not on its banner. - it('drops the stale memory and redirects to the list on a restored arrival', () => { - fixtures.pathname = '/dashboard/org-1/automations/billing__dunning/editor'; - fixtures.state = { navRestore: true }; - window.localStorage.setItem( - 'tale.platform.automations.org-1.lastPath', - JSON.stringify(fixtures.pathname), - ); - renderShell(); - - expect(mockNavigate).toHaveBeenCalledExactlyOnceWith({ - to: '/dashboard/$id/automations', - params: { id: 'org-1' }, - replace: true, - }); - expect( - window.localStorage.getItem('tale.platform.automations.org-1.lastPath'), - ).toBeNull(); - }); - - it('keeps explaining the deletion to a deliberate arrival', () => { - // A shared link or a run link opens the deleted automation on purpose. - fixtures.pathname = - '/dashboard/org-1/automations/billing__dunning/runs/run-1'; - renderShell(); - - expect(mockNavigate).not.toHaveBeenCalled(); - expect(screen.getByRole('alert')).toBeVisible(); - }); - it('keeps plain not-found for a name that was never saved', () => { fixtures.error = { data: { code: 'automation not found' } }; fixtures.pathname = diff --git a/services/platform/app/features/automations/components/automation-detail-shell.tsx b/services/platform/app/features/automations/components/automation-detail-shell.tsx index 52284cefc2..b94bc2a109 100644 --- a/services/platform/app/features/automations/components/automation-detail-shell.tsx +++ b/services/platform/app/features/automations/components/automation-detail-shell.tsx @@ -12,9 +12,9 @@ import { EmptyState } from '@tale/ui/empty-state'; import { PageLayout } from '@tale/ui/page-layout'; import { Skeletonize } from '@tale/ui/skeleton-context'; import { useFormatDate } from '@tale/ui/use-format-date'; -import { Link, useLocation, useNavigate } from '@tanstack/react-router'; +import { Link, useLocation } from '@tanstack/react-router'; import { SearchX, Trash2 } from 'lucide-react'; -import { useEffect, useMemo, useState, type ReactNode } from 'react'; +import { useMemo, useState, type ReactNode } from 'react'; import { TabNavigation, @@ -24,10 +24,6 @@ import { automationSlugToParam } from '@/lib/automations/slug'; import { useT } from '@/lib/i18n/client'; import { useAutomation } from '../hooks/queries'; -import { - clearAutomationMemory, - persistAutomationMemory, -} from '../lib/detail-memory'; import { automationDetailPathname } from '../lib/detail-paths'; import { DOCUMENT_DIRTY_KEY, @@ -92,8 +88,7 @@ function AutomationDetailFrame({ const { t } = useT('automations'); const { t: tCommon } = useT('common'); const { formatDate } = useFormatDate(); - const { pathname, state } = useLocation(); - const navigate = useNavigate(); + const { pathname } = useLocation(); const [versionPickerTarget, setVersionPickerTarget] = useState(null); const automationQuery = useAutomation(organizationId, automationSlug); @@ -114,35 +109,6 @@ function AutomationDetailFrame({ const onRuns = pathname === `${root}/runs` || pathname.startsWith(`${root}/runs/`); - // Remember this automation's detail page, org-scoped only — a - // project-scoped route (`projectId` set) belongs to that project's own - // memory instead (`features/home/lib/project-memory.ts`). Guarded on - // `pathname` still being under `root`: a route change updates `pathname` - // (and re-runs this effect) on the render just before this component - // unmounts, so an unguarded write would persist wherever the user - // navigated TO, under the automation's OWN key. - useEffect(() => { - if (projectId !== undefined || isMissing) return; - if (pathname !== root && !pathname.startsWith(`${root}/`)) return; - persistAutomationMemory(organizationId, pathname); - }, [projectId, isMissing, organizationId, pathname, root]); - - // A remembered automation can be deleted between visits. When the rail - // RESTORED us here, forget the stale place and fall back to the list - // rather than leaving the user on a not-found, or on a deleted - // automation's banner, they never asked for. - const wasRestored = state.navRestore === true; - const isGone = isMissing || deletedAt !== undefined; - useEffect(() => { - if (!isGone || !wasRestored || projectId !== undefined) return; - clearAutomationMemory(organizationId); - void navigate({ - to: '/dashboard/$id/automations', - params: { id: organizationId }, - replace: true, - }); - }, [isGone, wasRestored, projectId, organizationId, navigate]); - const tabs = useMemo(() => { const deleted = deletedAt !== undefined; return [ diff --git a/services/platform/app/features/automations/lib/detail-memory.test.ts b/services/platform/app/features/automations/lib/detail-memory.test.ts deleted file mode 100644 index 08e6dfa00c..0000000000 --- a/services/platform/app/features/automations/lib/detail-memory.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -// @vitest-environment jsdom -import { beforeEach, describe, expect, it } from 'vitest'; - -import { - clearAutomationMemory, - persistAutomationMemory, - readAutomationMemory, -} from './detail-memory'; - -beforeEach(() => { - window.localStorage.clear(); -}); - -describe('automation detail memory', () => { - it('has nothing to read before anything is persisted', () => { - expect(readAutomationMemory('org-1')).toBeUndefined(); - }); - - it('round-trips a persisted path', () => { - persistAutomationMemory( - 'org-1', - '/dashboard/org-1/automations/billing__dunning/runs', - ); - expect(readAutomationMemory('org-1')).toBe( - '/dashboard/org-1/automations/billing__dunning/runs', - ); - }); - - it('scopes the memory per organization', () => { - persistAutomationMemory('org-1', '/dashboard/org-1/automations/x/runs'); - expect(readAutomationMemory('org-2')).toBeUndefined(); - }); - - it('drops the memory on clear', () => { - persistAutomationMemory('org-1', '/dashboard/org-1/automations/x/runs'); - clearAutomationMemory('org-1'); - expect(readAutomationMemory('org-1')).toBeUndefined(); - }); - - it('ignores corrupted storage rather than throwing', () => { - window.localStorage.setItem( - 'tale.platform.automations.org-1.lastPath', - '{not json', - ); - expect(readAutomationMemory('org-1')).toBeUndefined(); - }); - - // Regression: a past write-side bug could persist a pathname belonging to - // a DIFFERENT section (e.g. Knowledge's `/documents`) under this key. The - // read side must reject it rather than trust whatever is stored, and clean - // up so a later read doesn't keep re-validating the same bad value. - it('rejects and clears a stored path that does not belong to this organization’s automations', () => { - window.localStorage.setItem( - 'tale.platform.automations.org-1.lastPath', - JSON.stringify('/dashboard/org-1/documents'), - ); - expect(readAutomationMemory('org-1')).toBeUndefined(); - expect( - window.localStorage.getItem('tale.platform.automations.org-1.lastPath'), - ).toBeNull(); - }); -}); diff --git a/services/platform/app/features/automations/lib/detail-memory.ts b/services/platform/app/features/automations/lib/detail-memory.ts deleted file mode 100644 index 806b3927d8..0000000000 --- a/services/platform/app/features/automations/lib/detail-memory.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * The last org-scoped automation detail page visited — read by - * `useNavigationItems` to send the Automations rail tile straight back to it, - * written by `AutomationDetailShell` as the tab/automation changes. Org-scoped - * only: a project-scoped automation route belongs to the project it's bound - * to (see `features/home/lib/project-memory.ts`), not to this section. - */ - -function storageKey(organizationId: string): string { - return `tale.platform.automations.${organizationId}.lastPath`; -} - -export function readAutomationMemory( - organizationId: string, -): string | undefined { - if (typeof window === 'undefined') return undefined; - try { - const key = storageKey(organizationId); - const raw = window.localStorage.getItem(key); - if (!raw) return undefined; - const parsed: unknown = JSON.parse(raw); - const root = `/dashboard/${organizationId}/automations/`; - // Defends against a value a past bug could have written under this key - // that doesn't actually point at an automation (self-heals by clearing - // it, so a future read isn't stuck re-validating the same bad value). - if (typeof parsed !== 'string' || !parsed.startsWith(root)) { - window.localStorage.removeItem(key); - return undefined; - } - return parsed; - } catch (error) { - console.warn('[automations] failed to read remembered path', error); - return undefined; - } -} - -export function persistAutomationMemory( - organizationId: string, - pathname: string, -): void { - if (typeof window === 'undefined') return; - try { - window.localStorage.setItem( - storageKey(organizationId), - JSON.stringify(pathname), - ); - } catch (error) { - console.warn('[automations] failed to persist remembered path', error); - } -} - -export function clearAutomationMemory(organizationId: string): void { - if (typeof window === 'undefined') return; - try { - window.localStorage.removeItem(storageKey(organizationId)); - } catch (error) { - console.warn('[automations] failed to clear remembered path', error); - } -} diff --git a/services/platform/app/features/home/lib/project-memory.test.ts b/services/platform/app/features/home/lib/project-memory.test.ts deleted file mode 100644 index c768d06c16..0000000000 --- a/services/platform/app/features/home/lib/project-memory.test.ts +++ /dev/null @@ -1,86 +0,0 @@ -// @vitest-environment jsdom -import { beforeEach, describe, expect, it } from 'vitest'; - -import { - clearProjectMemory, - isProjectAutomationsPath, - persistProjectMemory, - readProjectMemory, -} from './project-memory'; - -beforeEach(() => { - window.localStorage.clear(); -}); - -describe('home project memory', () => { - it('has nothing to read before anything is persisted', () => { - expect(readProjectMemory('org-1')).toBeUndefined(); - }); - - it('round-trips a persisted path', () => { - persistProjectMemory( - 'org-1', - '/dashboard/org-1/projects/proj-1/tasks/board', - ); - expect(readProjectMemory('org-1')).toBe( - '/dashboard/org-1/projects/proj-1/tasks/board', - ); - }); - - it('scopes the memory per organization', () => { - persistProjectMemory('org-1', '/dashboard/org-1/projects/proj-1/files'); - expect(readProjectMemory('org-2')).toBeUndefined(); - }); - - it('drops the memory on clear', () => { - persistProjectMemory('org-1', '/dashboard/org-1/projects/proj-1/files'); - clearProjectMemory('org-1'); - expect(readProjectMemory('org-1')).toBeUndefined(); - }); - - it('ignores corrupted storage rather than throwing', () => { - window.localStorage.setItem( - 'tale.platform.home.org-1.lastProjectPath', - '{not json', - ); - expect(readProjectMemory('org-1')).toBeUndefined(); - }); - - // Regression: a past write-side bug could persist a pathname belonging to - // a DIFFERENT section (e.g. Automations' list) under this key. The read - // side must reject it rather than trust whatever is stored, and clean up - // so a later read doesn't keep re-validating the same bad value. - it('rejects and clears a stored path that does not belong to this organization’s projects', () => { - window.localStorage.setItem( - 'tale.platform.home.org-1.lastProjectPath', - JSON.stringify('/dashboard/org-1/automations'), - ); - expect(readProjectMemory('org-1')).toBeUndefined(); - expect( - window.localStorage.getItem('tale.platform.home.org-1.lastProjectPath'), - ).toBeNull(); - }); -}); - -describe('isProjectAutomationsPath', () => { - it('matches the Automations tab and every page under it', () => { - for (const path of [ - '/dashboard/org-1/projects/proj-1/automations', - '/dashboard/org-1/projects/proj-1/automations/mail-sync', - '/dashboard/org-1/projects/proj-1/automations/mail-sync/runs/run-1', - ]) { - expect(isProjectAutomationsPath(path), path).toBe(true); - } - }); - - it('leaves the other project pages alone', () => { - for (const path of [ - '/dashboard/org-1/projects/proj-1', - '/dashboard/org-1/projects/proj-1/tasks/board', - '/dashboard/org-1/projects/proj-1/files', - '/dashboard/org-1/projects/proj-1/automations-archive', - ]) { - expect(isProjectAutomationsPath(path), path).toBe(false); - } - }); -}); diff --git a/services/platform/app/features/home/lib/project-memory.ts b/services/platform/app/features/home/lib/project-memory.ts deleted file mode 100644 index 5809c9abb8..0000000000 --- a/services/platform/app/features/home/lib/project-memory.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * The last project detail page visited from Home — read by - * `useNavigationItems` to send the Home rail tile straight back to it (only - * when Home isn't already active, so Chat/Tasks/Inbox's own behavior is - * untouched), written by `projects/$projectId.tsx` as the tab/project - * changes. Covers every project sub-route, including a bound automation's - * workbench under `.../automations/$automationSlug` — for those who may use - * Automations, see {@link isProjectAutomationsPath}. - */ - -function storageKey(organizationId: string): string { - return `tale.platform.home.${organizationId}.lastProjectPath`; -} - -/** - * Whether a project path is one of its automation pages (the Automations tab - * or anything under it). Only Owners, Admins and Developers may open them, so - * the Home tile must neither remember one for anyone else nor send them back - * to one it remembered before their role changed. - */ -export function isProjectAutomationsPath(pathname: string): boolean { - return /\/projects\/[^/]+\/automations(?:\/|$)/.test(pathname); -} - -export function readProjectMemory(organizationId: string): string | undefined { - if (typeof window === 'undefined') return undefined; - try { - const key = storageKey(organizationId); - const raw = window.localStorage.getItem(key); - if (!raw) return undefined; - const parsed: unknown = JSON.parse(raw); - const root = `/dashboard/${organizationId}/projects/`; - // Defends against a value a past bug could have written under this key - // that doesn't actually point at a project (self-heals by clearing it, - // so a future read isn't stuck re-validating the same bad value). - if (typeof parsed !== 'string' || !parsed.startsWith(root)) { - window.localStorage.removeItem(key); - return undefined; - } - return parsed; - } catch (error) { - console.warn('[home] failed to read remembered project path', error); - return undefined; - } -} - -export function persistProjectMemory( - organizationId: string, - pathname: string, -): void { - if (typeof window === 'undefined') return; - try { - window.localStorage.setItem( - storageKey(organizationId), - JSON.stringify(pathname), - ); - } catch (error) { - console.warn('[home] failed to persist remembered project path', error); - } -} - -export function clearProjectMemory(organizationId: string): void { - if (typeof window === 'undefined') return; - try { - window.localStorage.removeItem(storageKey(organizationId)); - } catch (error) { - console.warn('[home] failed to clear remembered project path', error); - } -} diff --git a/services/platform/app/features/knowledge/components/knowledge-navigation.tsx b/services/platform/app/features/knowledge/components/knowledge-navigation.tsx index 56cca6841e..7c1a072dc1 100644 --- a/services/platform/app/features/knowledge/components/knowledge-navigation.tsx +++ b/services/platform/app/features/knowledge/components/knowledge-navigation.tsx @@ -17,16 +17,13 @@ type KnowledgeLabelKey = | 'products' | 'contacts'; -export interface KnowledgePage { +interface KnowledgePage { readonly labelKey: KnowledgeLabelKey; readonly path: string; } -/** Knowledge's pages, in reading order. Exported so the rail's remembered-tab - * resolution (`use-navigation-items.ts`) and its persistence - * (`lib/knowledge-tab-memory.ts`) share this one list instead of each - * duplicating the 5-tab enum. */ -export const KNOWLEDGE_PAGES: readonly KnowledgePage[] = [ +/** Knowledge's pages, in reading order. */ +const KNOWLEDGE_PAGES: readonly KnowledgePage[] = [ { labelKey: 'documents', path: 'documents' }, { labelKey: 'knowledgeEntries', path: 'knowledge-entries' }, { labelKey: 'websites', path: 'websites' }, diff --git a/services/platform/app/features/knowledge/lib/knowledge-tab-memory.test.ts b/services/platform/app/features/knowledge/lib/knowledge-tab-memory.test.ts deleted file mode 100644 index 4c508c7099..0000000000 --- a/services/platform/app/features/knowledge/lib/knowledge-tab-memory.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -// @vitest-environment jsdom -import { beforeEach, describe, expect, it } from 'vitest'; - -import { - persistKnowledgeTabMemory, - readKnowledgeTabMemory, -} from './knowledge-tab-memory'; - -beforeEach(() => { - window.localStorage.clear(); -}); - -describe('knowledge tab memory', () => { - it('has nothing to read before anything is persisted', () => { - expect(readKnowledgeTabMemory('org-1')).toBeUndefined(); - }); - - it('round-trips a persisted tab', () => { - persistKnowledgeTabMemory('org-1', 'websites'); - expect(readKnowledgeTabMemory('org-1')).toBe('websites'); - }); - - it('scopes the memory per organization', () => { - persistKnowledgeTabMemory('org-1', 'websites'); - expect(readKnowledgeTabMemory('org-2')).toBeUndefined(); - }); - - it('ignores a tab that is not one of the 5 known pages', () => { - window.localStorage.setItem( - 'tale.platform.knowledge.org-1.lastTab', - JSON.stringify('not-a-real-tab'), - ); - expect(readKnowledgeTabMemory('org-1')).toBeUndefined(); - }); - - it('ignores corrupted storage rather than throwing', () => { - window.localStorage.setItem( - 'tale.platform.knowledge.org-1.lastTab', - '{not json', - ); - expect(readKnowledgeTabMemory('org-1')).toBeUndefined(); - }); -}); diff --git a/services/platform/app/features/knowledge/lib/knowledge-tab-memory.ts b/services/platform/app/features/knowledge/lib/knowledge-tab-memory.ts deleted file mode 100644 index 3605825978..0000000000 --- a/services/platform/app/features/knowledge/lib/knowledge-tab-memory.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { KNOWLEDGE_PAGES } from '../components/knowledge-navigation'; - -/** - * Which of Knowledge's 5 tabs the rail should reopen. Read by - * `useNavigationItems`, written by `_knowledge.tsx` as the tab changes — so - * the Knowledge rail tile lands back on the last tab visited instead of - * always Documents. - */ - -function storageKey(organizationId: string): string { - return `tale.platform.knowledge.${organizationId}.lastTab`; -} - -const KNOWLEDGE_TAB_PATHS: ReadonlySet = new Set( - KNOWLEDGE_PAGES.map((page) => page.path), -); - -export function readKnowledgeTabMemory( - organizationId: string, -): string | undefined { - if (typeof window === 'undefined') return undefined; - try { - const raw = window.localStorage.getItem(storageKey(organizationId)); - if (!raw) return undefined; - const parsed: unknown = JSON.parse(raw); - return typeof parsed === 'string' && KNOWLEDGE_TAB_PATHS.has(parsed) - ? parsed - : undefined; - } catch (error) { - console.warn('[knowledge] failed to read remembered tab', error); - return undefined; - } -} - -export function persistKnowledgeTabMemory( - organizationId: string, - path: string, -): void { - if (typeof window === 'undefined') return; - try { - window.localStorage.setItem( - storageKey(organizationId), - JSON.stringify(path), - ); - } catch (error) { - console.warn('[knowledge] failed to persist remembered tab', error); - } -} diff --git a/services/platform/app/hooks/use-navigation-items.test.ts b/services/platform/app/hooks/use-navigation-items.test.ts index b3f741bb03..e9a0e86039 100644 --- a/services/platform/app/hooks/use-navigation-items.test.ts +++ b/services/platform/app/hooks/use-navigation-items.test.ts @@ -1,8 +1,5 @@ import { describe, expect, it, vi, beforeEach } from 'vitest'; -import { persistAutomationMemory } from '@/app/features/automations/lib/detail-memory'; -import { persistProjectMemory } from '@/app/features/home/lib/project-memory'; -import { persistKnowledgeTabMemory } from '@/app/features/knowledge/lib/knowledge-tab-memory'; import { defineAbilityFor } from '@/lib/permissions/ability'; import { renderHook } from '@/tests/utils/render'; @@ -57,15 +54,8 @@ vi.mock('@/lib/i18n/client', () => ({ vi.mock('@tale/ui/use-is-mac', () => ({ useIsMac: () => false })); -// The rail resolves a remembered target off the CURRENT location — mutate -// this between assertions to move "where the user is" without a real router. -const mockLocation = { pathname: '/dashboard/org-1/chat' }; - -vi.mock('@tanstack/react-router', () => ({ - useLocation: () => mockLocation, -})); - -const { useNavigationItems } = await import('./use-navigation-items'); +const { isItemActive, useNavigationItems } = + await import('./use-navigation-items'); function items() { const { result } = renderHook(() => useNavigationItems('org-1')); @@ -89,7 +79,6 @@ beforeEach(() => { inbox.hasInbox = true; unread.data = undefined; unreadCalls.length = 0; - mockLocation.pathname = '/dashboard/org-1/chat'; window.localStorage.clear(); }); @@ -103,6 +92,63 @@ describe('the rail', () => { ]); expect(pinned.map((item) => item.label)).toEqual(['userSettings']); }); + + // A tile is a request for the section, never a replay of a place in it — + // the same page every time, whatever was open there before. The places an + // earlier build remembered are planted in storage, where browsers still + // keep them: no tile may read them. + it("opens every section's first page", () => { + window.localStorage.setItem( + 'tale.platform.automations.org-1.lastPath', + '/dashboard/org-1/automations/billing__dunning/runs', + ); + window.localStorage.setItem( + 'tale.platform.home.org-1.lastProjectPath', + '/dashboard/org-1/projects/proj-1/files', + ); + window.localStorage.setItem( + 'tale.platform.knowledge.org-1.lastTab', + 'websites', + ); + + const { primary, pinned } = items(); + expect( + [...primary, ...pinned].map(({ label, to, params, search }) => ({ + label, + to, + params, + search, + })), + ).toEqual([ + { + label: 'home', + to: '/dashboard/$id/chat', + params: { id: 'org-1' }, + search: { new: true }, + }, + { + label: 'knowledge', + to: '/dashboard/$id/documents', + params: { id: 'org-1' }, + search: undefined, + }, + { + label: 'automations', + to: '/dashboard/$id/automations', + params: { id: 'org-1' }, + search: undefined, + }, + { + label: 'userSettings', + to: '/dashboard/$id/settings', + params: { id: 'org-1' }, + search: undefined, + }, + ]); + for (const item of [...primary, ...pinned]) { + expect(item, item.label).not.toHaveProperty('state'); + } + }); }); describe('the Automations entry', () => { @@ -144,8 +190,10 @@ describe('the Home nav entry', () => { } }); - it('starts a fresh chat when clicked while already in Home', () => { - expect(homeItem()?.reentrySearch).toEqual({ new: true }); + it('always opens a fresh chat, never the last one', () => { + const item = homeItem(); + expect(item?.to).toBe('/dashboard/$id/chat'); + expect(item?.search).toEqual({ new: true }); }); it('carries the unread inbox count as its badge', () => { @@ -179,108 +227,25 @@ describe('the Home nav entry', () => { }); }); -describe('the Home nav entry — reopening a project', () => { - it('resolves to the last project visited, arriving from outside Home', () => { - mockLocation.pathname = '/dashboard/org-1/documents'; - persistProjectMemory('org-1', '/dashboard/org-1/projects/proj-1/files'); - - const item = homeItem(); - expect(item?.to).toBe('/dashboard/org-1/projects/proj-1/files'); - expect(item?.state).toEqual({ navRestore: true }); - }); - - it('leaves chat as the target while already inside Home', () => { - mockLocation.pathname = '/dashboard/org-1/chat'; - persistProjectMemory('org-1', '/dashboard/org-1/projects/proj-1/files'); - - const item = homeItem(); - expect(item?.to).toBe('/dashboard/$id/chat'); - expect(item?.state).toBeUndefined(); - }); - - it('falls back to chat when no project was ever visited', () => { - mockLocation.pathname = '/dashboard/org-1/documents'; - - const item = homeItem(); - expect(item?.to).toBe('/dashboard/$id/chat'); - expect(item?.state).toBeUndefined(); - }); - - it('reopens a project automation page for a developer', () => { - mockLocation.pathname = '/dashboard/org-1/documents'; - persistProjectMemory( - 'org-1', - '/dashboard/org-1/projects/proj-1/automations/mail-sync', - ); - - expect(homeItem()?.to).toBe( - '/dashboard/org-1/projects/proj-1/automations/mail-sync', - ); - }); - - // Remembered while the viewer was still a Developer: after the role - // changed, Home would otherwise keep reopening the access denial. - it.each(['editor', 'member'])( - 'does not reopen a project automation page for the %s role', - (role) => { - viewer.role = role; - mockLocation.pathname = '/dashboard/org-1/documents'; - persistProjectMemory( - 'org-1', - '/dashboard/org-1/projects/proj-1/automations/mail-sync', - ); - - const item = homeItem(); - expect(item?.to).toBe('/dashboard/$id/chat'); - expect(item?.state).toBeUndefined(); - }, - ); -}); - describe('the Knowledge nav entry', () => { - it('opens Documents by default', () => { - expect(knowledgeItem()?.to).toBe('/dashboard/$id/documents'); - }); - - it('reopens the last tab visited, arriving from outside Knowledge', () => { - persistKnowledgeTabMemory('org-1', 'websites'); - expect(knowledgeItem()?.to).toBe('/dashboard/$id/websites'); - }); - - it('stays on Documents while already inside Knowledge', () => { - mockLocation.pathname = '/dashboard/org-1/websites'; - persistKnowledgeTabMemory('org-1', 'products'); - - expect(knowledgeItem()?.to).toBe('/dashboard/$id/documents'); + it('opens Documents and lights up on every Knowledge tab', () => { + const item = knowledgeItem(); + expect(item?.to).toBe('/dashboard/$id/documents'); + for (const path of [ + '/dashboard/org-1/documents', + '/dashboard/org-1/knowledge-entries', + '/dashboard/org-1/websites', + '/dashboard/org-1/products', + '/dashboard/org-1/contacts', + ]) { + expect(item && isItemActive(item, path), path).toBe(true); + } + expect(item && isItemActive(item, '/dashboard/org-1/chat')).toBe(false); }); }); describe('the Automations nav entry', () => { - it('opens the list by default', () => { + it('opens the list', () => { expect(automationsItem()?.to).toBe('/dashboard/$id/automations'); }); - - it('reopens the last automation page visited, arriving from outside Automations', () => { - persistAutomationMemory( - 'org-1', - '/dashboard/org-1/automations/billing__dunning/runs', - ); - - const item = automationsItem(); - expect(item?.to).toBe('/dashboard/org-1/automations/billing__dunning/runs'); - expect(item?.state).toEqual({ navRestore: true }); - }); - - it('stays on the list while already inside Automations', () => { - mockLocation.pathname = - '/dashboard/org-1/automations/billing__dunning/runs'; - persistAutomationMemory( - 'org-1', - '/dashboard/org-1/automations/billing__dunning/runs', - ); - - const item = automationsItem(); - expect(item?.to).toBe('/dashboard/$id/automations'); - expect(item?.state).toBeUndefined(); - }); }); diff --git a/services/platform/app/hooks/use-navigation-items.ts b/services/platform/app/hooks/use-navigation-items.ts index 214ea8171a..a8c238a096 100644 --- a/services/platform/app/hooks/use-navigation-items.ts +++ b/services/platform/app/hooks/use-navigation-items.ts @@ -1,7 +1,6 @@ 'use client'; import { useIsMac } from '@tale/ui/use-is-mac'; -import { useLocation } from '@tanstack/react-router'; import { BrainIcon, House, @@ -12,15 +11,9 @@ import { import { useMemo } from 'react'; import { useCanUseAutomations } from '@/app/features/automations/hooks/use-can-use-automations'; -import { readAutomationMemory } from '@/app/features/automations/lib/detail-memory'; import { useUnreadConversationCount } from '@/app/features/conversations/hooks/queries'; import { useInboxAvailability } from '@/app/features/conversations/hooks/use-inbox-availability'; import { isHomePath } from '@/app/features/home/lib/home-paths'; -import { - isProjectAutomationsPath, - readProjectMemory, -} from '@/app/features/home/lib/project-memory'; -import { readKnowledgeTabMemory } from '@/app/features/knowledge/lib/knowledge-tab-memory'; import { useT } from '@/lib/i18n/client'; import { type AppAction, type AppSubject } from '@/lib/permissions/ability'; @@ -57,18 +50,11 @@ export interface NavItem { */ isActivePath?: (pathname: string) => boolean; /** - * Search to apply when the tile is clicked while ALREADY active — the - * "take me back to this section's default" gesture. Only chat needs one: - * re-entering chat opens a fresh composer rather than resuming a thread. - */ - reentrySearch?: Record; - /** - * History state to apply when clicked. Set only when `to` has been - * resolved to a remembered deep link (Automations, Home → a project), so - * the landing route can tell a restored arrival from a deliberate one and - * self-heal (fall back to its list) if that target is gone. + * Search the tile always navigates with. Only Home carries one: + * `{ new: true }`, so the tile opens a fresh composer from any section and + * from Home itself, never the last chat. */ - state?: Record; + search?: Record; } export interface NavigationItems { @@ -114,119 +100,83 @@ export function useNavigationItems(businessId: string): NavigationItems { // get the entry, whatever the organization runs. const showAutomations = useCanUseAutomations(); - const { pathname } = useLocation(); - return useMemo((): NavigationItems => { - const homeItem: NavItem = { - // Home holds everything you work on — chats, projects with their - // tasks, and the inbox — behind one panel. The tile opens the - // caller's last chat (or a blank composer when there is none); - // clicking it while already in Home starts a fresh chat, the same - // navigation the ⌥⌘N shortcut performs. - label: tNav('home'), - to: '/dashboard/$id/chat', - params: { id: businessId }, - href: `/dashboard/${businessId}/chat`, - icon: House, - shortcut: newChatShortcut, - reentrySearch: { new: true }, - isActivePath: (path) => isHomePath(path, businessId), - badge: unreadConversations ?? 0, - badgeLabel: tNav('aria.unreadConversations', { - count: unreadConversations ?? 0, - }), - }; - // Arriving from outside Home (Knowledge, Automations, Settings): if a - // specific project was last open, reopen it instead of resuming chat. - // Already-in-Home (including the fresh-chat reentry gesture above) and - // "no project ever visited" both fall through untouched, and so does a - // project automation page remembered before the viewer's role changed. - if (!isItemActive(homeItem, pathname)) { - const rememberedProjectPath = readProjectMemory(businessId); - if ( - rememberedProjectPath !== undefined && - (showAutomations || !isProjectAutomationsPath(rememberedProjectPath)) - ) { - homeItem.to = rememberedProjectPath; - homeItem.params = {}; - homeItem.state = { navRestore: true }; - } - } - - const knowledgeItem: NavItem = { - label: tNav('knowledge'), - to: '/dashboard/$id/documents', - params: { id: businessId }, - href: `/dashboard/${businessId}/documents`, - icon: BrainIcon, - // Mirrors KnowledgeNavigation's tab strip exactly: the rail's - // active state is computed from these, so a tab missing here would - // fail to highlight while the user is on it. - subItems: [ - { - label: tKnowledge('documents'), - to: '/dashboard/$id/documents', - params: { id: businessId }, - href: `/dashboard/${businessId}/documents`, - }, - { - label: tKnowledge('knowledgeEntries'), - to: '/dashboard/$id/knowledge-entries', - params: { id: businessId }, - href: `/dashboard/${businessId}/knowledge-entries`, - }, - { - label: tKnowledge('websites'), - to: '/dashboard/$id/websites', - params: { id: businessId }, - href: `/dashboard/${businessId}/websites`, - }, + // Every tile opens its section's overview — the same page every time, + // whatever was open in that section before and also from inside it: a + // tile is a request for the section, never a replay of a place in it. + return useMemo( + (): NavigationItems => ({ + primary: [ { - label: tKnowledge('products'), - to: '/dashboard/$id/products', + // Home holds everything you work on — chats, projects with their + // tasks, and the inbox — behind one panel. The tile always opens a + // fresh composer, the same navigation the ⌥⌘N shortcut performs; + // the earlier chats stay one row away in the Home panel. + label: tNav('home'), + to: '/dashboard/$id/chat', params: { id: businessId }, - href: `/dashboard/${businessId}/products`, + href: `/dashboard/${businessId}/chat`, + icon: House, + shortcut: newChatShortcut, + search: { new: true }, + isActivePath: (path) => isHomePath(path, businessId), + badge: unreadConversations ?? 0, + badgeLabel: tNav('aria.unreadConversations', { + count: unreadConversations ?? 0, + }), }, { - label: tKnowledge('contacts'), - to: '/dashboard/$id/contacts', + label: tNav('knowledge'), + to: '/dashboard/$id/documents', params: { id: businessId }, - href: `/dashboard/${businessId}/contacts`, + href: `/dashboard/${businessId}/documents`, + icon: BrainIcon, + // Mirrors KnowledgeNavigation's tab strip exactly: the rail's + // active state is computed from these, so a tab missing here would + // fail to highlight while the user is on it. + subItems: [ + { + label: tKnowledge('documents'), + to: '/dashboard/$id/documents', + params: { id: businessId }, + href: `/dashboard/${businessId}/documents`, + }, + { + label: tKnowledge('knowledgeEntries'), + to: '/dashboard/$id/knowledge-entries', + params: { id: businessId }, + href: `/dashboard/${businessId}/knowledge-entries`, + }, + { + label: tKnowledge('websites'), + to: '/dashboard/$id/websites', + params: { id: businessId }, + href: `/dashboard/${businessId}/websites`, + }, + { + label: tKnowledge('products'), + to: '/dashboard/$id/products', + params: { id: businessId }, + href: `/dashboard/${businessId}/products`, + }, + { + label: tKnowledge('contacts'), + to: '/dashboard/$id/contacts', + params: { id: businessId }, + href: `/dashboard/${businessId}/contacts`, + }, + ], }, - ], - }; - // Which of the 5 sibling tabs was last open — never anything deeper, - // there isn't anything deeper here. - if (!isItemActive(knowledgeItem, pathname)) { - const rememberedTab = readKnowledgeTabMemory(businessId); - if (rememberedTab !== undefined) { - knowledgeItem.to = `/dashboard/$id/${rememberedTab}`; - knowledgeItem.params = { id: businessId }; - } - } - - const automationsItem: NavItem = { - label: tNav('automations'), - to: '/dashboard/$id/automations', - params: { id: businessId }, - href: `/dashboard/${businessId}/automations`, - icon: Workflow, - }; - // The exact sub-path under a specific automation — org-scoped only - // (see `features/automations/lib/detail-memory.ts`). - if (!isItemActive(automationsItem, pathname)) { - const rememberedPath = readAutomationMemory(businessId); - if (rememberedPath !== undefined) { - automationsItem.to = rememberedPath; - automationsItem.params = {}; - automationsItem.state = { navRestore: true }; - } - } - - return { - primary: [ - homeItem, - knowledgeItem, - ...(showAutomations ? [automationsItem] : []), + ...(showAutomations + ? [ + { + label: tNav('automations'), + to: '/dashboard/$id/automations', + params: { id: businessId }, + href: `/dashboard/${businessId}/automations`, + icon: Workflow, + }, + ] + : []), ], pinned: [ { @@ -243,14 +193,14 @@ export function useNavigationItems(businessId: string): NavigationItems { icon: SettingsIcon, }, ], - }; - }, [ - businessId, - tNav, - tKnowledge, - unreadConversations, - newChatShortcut, - pathname, - showAutomations, - ]); + }), + [ + businessId, + tNav, + tKnowledge, + unreadConversations, + newChatShortcut, + showAutomations, + ], + ); } diff --git a/services/platform/app/router.tsx b/services/platform/app/router.tsx index 6c3461a447..4750dc50a4 100644 --- a/services/platform/app/router.tsx +++ b/services/platform/app/router.tsx @@ -135,10 +135,5 @@ declare module '@tanstack/react-router' { /** How many `?task=` sheet entries the tasks board pushed above the bare * board (see `features/tasks/lib/view.ts`). */ taskSheetDepth?: number; - /** Set on a rail click that resolved to a remembered deep link (see - * `use-navigation-items.ts`). Lets the landing route tell a restored - * arrival from a deliberate one, so a since-deleted automation or - * project falls back to its list instead of dead-ending. */ - navRestore?: boolean; } } diff --git a/services/platform/app/routes/dashboard/$id/_knowledge.tsx b/services/platform/app/routes/dashboard/$id/_knowledge.tsx index 47ecc68108..d537d42779 100644 --- a/services/platform/app/routes/dashboard/$id/_knowledge.tsx +++ b/services/platform/app/routes/dashboard/$id/_knowledge.tsx @@ -5,22 +5,13 @@ import { import { ContentArea } from '@tale/ui/content-area'; import { PageLayout } from '@tale/ui/page-layout'; import { createFileRoute, Outlet, useLocation } from '@tanstack/react-router'; -import { useEffect } from 'react'; import { AccessDenied } from '@/app/components/layout/access-denied'; -import { - KNOWLEDGE_PAGES, - KnowledgeNavigation, -} from '@/app/features/knowledge/components/knowledge-navigation'; -import { persistKnowledgeTabMemory } from '@/app/features/knowledge/lib/knowledge-tab-memory'; +import { KnowledgeNavigation } from '@/app/features/knowledge/components/knowledge-navigation'; import { useAbility, useAbilityLoading } from '@/app/hooks/use-ability'; import { useT } from '@/lib/i18n/client'; import { seo } from '@/lib/utils/seo'; -const KNOWLEDGE_TAB_PATHS: ReadonlySet = new Set( - KNOWLEDGE_PAGES.map((page) => page.path), -); - export const Route = createFileRoute('/dashboard/$id/_knowledge')({ head: () => ({ meta: seo('knowledge'), @@ -37,24 +28,6 @@ function KnowledgeLayout() { const ability = useAbility(); const abilityLoading = useAbilityLoading(); - // Remember which tab this is, so the Knowledge rail tile can reopen it - // instead of always resetting to Documents (see `use-navigation-items.ts`). - // Matched against the FULL path, not just the last segment: a route change - // updates `pathname` (and re-runs this effect) on the render just before - // this component unmounts, and a bare segment match would otherwise - // mistake an unrelated page ending in the same word for a Knowledge tab. - useEffect(() => { - const segment = pathname.split('/').pop(); - if ( - segment === undefined || - !KNOWLEDGE_TAB_PATHS.has(segment) || - pathname !== `/dashboard/${organizationId}/${segment}` - ) { - return; - } - persistKnowledgeTabMemory(organizationId, segment); - }, [pathname, organizationId]); - // Access is only knowable once the ability has loaded. Until then render the // SAME chrome (header title + knowledge nav, neither of which depends on the // ability) so it never pops in — only the content area is held empty. The diff --git a/services/platform/app/routes/dashboard/$id/home.test.tsx b/services/platform/app/routes/dashboard/$id/home.test.tsx index 9605fea33a..8b7b193ec4 100644 --- a/services/platform/app/routes/dashboard/$id/home.test.tsx +++ b/services/platform/app/routes/dashboard/$id/home.test.tsx @@ -7,7 +7,7 @@ import { render, screen } from '@/tests/utils/render'; // --------------------------------------------------------------------------- // Home on a phone creates nothing: its header holds the title and search, and // a new chat starts from the Chats view of the list below. On a desktop the -// route sends you to the chat, where the Home panel already stands. +// route sends you to a fresh chat, where the Home panel already stands. // --------------------------------------------------------------------------- const { mobile } = vi.hoisted(() => ({ mobile: { current: true } })); @@ -17,8 +17,18 @@ vi.mock('@tanstack/react-router', () => ({ useParams: () => ({ id: 'org-1' }), ...config, }), - Navigate: ({ to }: { to: string }) => ( -
+ Navigate: ({ + to, + search, + }: { + to: string; + search?: Record; + }) => ( +
), Link: ({ children, to }: { children: React.ReactNode; to: string }) => ( {children} @@ -104,13 +114,17 @@ describe('Home route', () => { ); }); - it('sends a desktop visit to the chat', () => { + it('sends a desktop visit to a fresh chat, the page the rail opens', () => { mobile.current = false; render(); expect(screen.getByTestId('navigate')).toHaveAttribute( 'data-to', '/dashboard/$id/chat', ); + expect(screen.getByTestId('navigate')).toHaveAttribute( + 'data-search', + '{"new":true}', + ); expect(screen.queryByTestId('navigator')).not.toBeInTheDocument(); }); }); diff --git a/services/platform/app/routes/dashboard/$id/home.tsx b/services/platform/app/routes/dashboard/$id/home.tsx index 06b8699fd3..113004fee9 100644 --- a/services/platform/app/routes/dashboard/$id/home.tsx +++ b/services/platform/app/routes/dashboard/$id/home.tsx @@ -14,8 +14,8 @@ import { seo } from '@/lib/utils/seo'; /** * Home on a phone: the list of everything you work on — chats, your tasks, * the inbox — as the screen itself, where a desktop shows it as the panel - * beside the page. A desktop visit lands on the chat instead, the page the - * rail's Home opens, so a link to Home works on either. The header holds only + * beside the page. A desktop visit lands on a fresh chat instead, the page + * the rail's Home opens, so a link to Home works on either. The header holds only * search: Home creates nothing, and a new chat starts from the Chats view. */ export const Route = createFileRoute('/dashboard/$id/home')({ @@ -35,6 +35,7 @@ function HomeScreen() { ); diff --git a/services/platform/app/routes/dashboard/$id/projects/$projectId.test.tsx b/services/platform/app/routes/dashboard/$id/projects/$projectId.test.tsx index f39fc741dd..25508184d4 100644 --- a/services/platform/app/routes/dashboard/$id/projects/$projectId.test.tsx +++ b/services/platform/app/routes/dashboard/$id/projects/$projectId.test.tsx @@ -21,7 +21,6 @@ const { mockUseAutomations, mockUseProject, mockLocation, mockNavigate } = mockLocation: { pathname: '/dashboard/org-1/projects/proj-1', search: {} as Record, - state: {} as Record, }, mockNavigate: vi.fn(), })); @@ -164,7 +163,6 @@ afterEach(() => { viewer.role = 'developer'; mockLocation.pathname = '/dashboard/org-1/projects/proj-1'; mockLocation.search = {}; - mockLocation.state = {}; window.localStorage.clear(); }); @@ -369,28 +367,11 @@ describe('project shell — a project that is gone', () => { screen.getByRole('link', { name: 'projects.title' }), ).toHaveAttribute('href', '/dashboard/org-1/projects'); }); - - // A remembered project (the Home rail tile reopening it, see - // `use-navigation-items.ts`) can be gone by the time the rail click lands — - // deleted, or a membership change. That arrival is marked with - // `state.navRestore`, and only THAT arrival redirects: a shared link to the - // same dead project keeps explaining rather than bouncing away. - it('drops the stale memory and redirects to the list on a restored arrival', () => { - mockLocation.state = { navRestore: true }; - setupMissing(); - - expect(mockNavigate).toHaveBeenCalledWith({ - to: '/dashboard/$id/projects', - params: { id: 'org-1' }, - replace: true, - }); - }); }); // --------------------------------------------------------------------------- // #3885: a project read that FAILED is not a project that is gone. The shell -// read both as "We couldn't find that project. It may have been deleted." — -// and on a restored arrival dropped the memory and left for the list. It +// read both as "We couldn't find that project. It may have been deleted." It // stays, says the read failed and tries it again; no tab renders without its // project (Files and Agents would show nothing). // --------------------------------------------------------------------------- @@ -449,14 +430,6 @@ describe('project shell — a project read that failed', () => { expect(screen.queryByTestId('outlet')).not.toBeInTheDocument(); }); - it('keeps the memory and the place on a restored arrival', () => { - mockLocation.state = { navRestore: true }; - setupFailed(); - - expect(mockNavigate).not.toHaveBeenCalled(); - expect(screen.getByRole('alert')).toBeInTheDocument(); - }); - it('opens the tab, and hands it the focus, when Try again worked', async () => { const { rerender } = setupFailed(); tryAgain().focus(); @@ -475,81 +448,6 @@ describe('project shell — a project read that failed', () => { }); }); -// A navigation AWAY updates `location.pathname` (and re-runs the write -// effect) on the render just before this component unmounts, so the pathname -// no longer belongs to THIS project. Regression for a bug where the -// unguarded effect persisted wherever the user navigated TO — e.g. clicking -// Home landed on Automations or Knowledge, because that's what the shell -// last wrote under its own key on its way out. -describe('project shell — remembering only its own path', () => { - it('persists its own path while genuinely on it', async () => { - const { unmount } = setup([]); - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.home.org-1.lastProjectPath'), - ).toBe('"/dashboard/org-1/projects/proj-1"'), - ); - unmount(); - }); - - it('does not overwrite the memory with a pathname that no longer belongs to this project', async () => { - const { rerender, unmount } = setup([]); - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.home.org-1.lastProjectPath'), - ).toBe('"/dashboard/org-1/projects/proj-1"'), - ); - - // Simulate the render right before this shell unmounts on the way to - // Automations: `pathname` has already moved, this component hasn't yet. - mockLocation.pathname = '/dashboard/org-1/automations'; - rerender(); - - // The last GOOD path survives untouched — never Automations' path. - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.home.org-1.lastProjectPath'), - ).toBe('"/dashboard/org-1/projects/proj-1"'), - ); - unmount(); - }); - - it('remembers a project automation page for a developer', async () => { - mockLocation.pathname = - '/dashboard/org-1/projects/proj-1/automations/mail-sync'; - const { unmount } = setup([{ name: 'mail-sync' }]); - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.home.org-1.lastProjectPath'), - ).toBe('"/dashboard/org-1/projects/proj-1/automations/mail-sync"'), - ); - unmount(); - }); - - // A Member who opens a project automation URL only sees the denial; if - // Home remembered that page, the tile would keep reopening it. - it('never remembers a project automation page for a member', async () => { - viewer.role = 'member'; - const { rerender, unmount } = setup([{ name: 'mail-sync' }]); - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.home.org-1.lastProjectPath'), - ).toBe('"/dashboard/org-1/projects/proj-1"'), - ); - - mockLocation.pathname = - '/dashboard/org-1/projects/proj-1/automations/mail-sync'; - rerender(); - - await waitFor(() => - expect( - window.localStorage.getItem('tale.platform.home.org-1.lastProjectPath'), - ).toBe('"/dashboard/org-1/projects/proj-1"'), - ); - unmount(); - }); -}); - // --------------------------------------------------------------------------- // The Home panel folds away from a project's page as it does from a chat's or // a task's: the header's first control is the panel toggle. It renders only diff --git a/services/platform/app/routes/dashboard/$id/projects/$projectId.tsx b/services/platform/app/routes/dashboard/$id/projects/$projectId.tsx index 3201d6a740..46930aae67 100644 --- a/services/platform/app/routes/dashboard/$id/projects/$projectId.tsx +++ b/services/platform/app/routes/dashboard/$id/projects/$projectId.tsx @@ -32,11 +32,6 @@ import { import { useAutomations } from '@/app/features/automations/hooks/queries'; import { useCanUseAutomations } from '@/app/features/automations/hooks/use-can-use-automations'; import { HomePanelToggle } from '@/app/features/home/components/home-panel-toggle'; -import { - clearProjectMemory, - isProjectAutomationsPath, - persistProjectMemory, -} from '@/app/features/home/lib/project-memory'; import { ProjectArchivedBadge } from '@/app/features/projects/components/project-archived-badge'; import { isProjectTasksPath, @@ -114,52 +109,7 @@ function ProjectDetailLayout() { const contentRef = useRef(null); const focusContent = useCallback(() => contentRef.current?.focus(), []); - // Remember this project's detail page, so the Home rail tile can reopen it - // instead of always resuming the last chat thread (see - // `use-navigation-items.ts`). Guarded on the pathname still being under - // this project's own root: a route change updates `location.pathname` (and - // re-runs this effect) on the render just before this component unmounts, - // so an unguarded write would persist wherever the user navigated TO, - // under THIS project's key. An automation page this viewer may not open - // is never remembered: Home would keep reopening the denial. - const projectRoot = `/dashboard/${organizationId}/projects/${projectId}`; const canUseAutomations = useCanUseAutomations(); - useEffect(() => { - if (isMissing) return; - if ( - location.pathname !== projectRoot && - !location.pathname.startsWith(`${projectRoot}/`) - ) { - return; - } - if (!canUseAutomations && isProjectAutomationsPath(location.pathname)) { - return; - } - persistProjectMemory(organizationId, location.pathname); - }, [ - isMissing, - organizationId, - location.pathname, - projectRoot, - canUseAutomations, - ]); - - // A remembered project can be deleted, or left behind by a membership - // change, between one visit and the next. When the rail RESTORED us here, - // drop the stale memory and fall back to the list: the user asked for - // Home, so give them Home's own place rather than a dead end they never - // chose. A link someone shared keeps the explanatory not-found message - // below instead of bouncing away. - const wasRestored = location.state.navRestore === true; - useEffect(() => { - if (!isMissing || !wasRestored) return; - clearProjectMemory(organizationId); - void navigate({ - to: '/dashboard/$id/projects', - params: { id: organizationId }, - replace: true, - }); - }, [isMissing, wasRestored, organizationId, navigate]); // The Automations tab is conditional: a project with nothing bound gets no // tab rather than one that opens an empty list. `listAutomations` scoped to diff --git a/services/platform/tests/e2e/specs/navigation.spec.ts b/services/platform/tests/e2e/specs/navigation.spec.ts index 5b96a70983..7946418d7a 100644 --- a/services/platform/tests/e2e/specs/navigation.spec.ts +++ b/services/platform/tests/e2e/specs/navigation.spec.ts @@ -130,12 +130,13 @@ test.describe('navigation: primary side-nav rail', () => { await expect(primaryNav(page)).toBeVisible(); } - // The Home tile (shares its href with the logo) returns to chat, with the - // Home panel beside it. - await navLinkByHref(page, `/dashboard/${organizationId}/chat`) - .first() + // The Home tile opens a fresh chat, with the Home panel beside it. Its + // href carries `?new=true`, so it is found by its name (the unread chip + // may follow the label). + await primaryNav(page) + .getByRole('link', { name: new RegExp(`^${t('navigation.home')}`) }) .click(); - await page.waitForURL(/\/chat(?:[/?#]|$)/, { timeout: TIMEOUT.NAV }); + await page.waitForURL(/\/chat\?new=true/, { timeout: TIMEOUT.NAV }); await expect(chatSurfaceAnchor(page)).toBeVisible({ timeout: TIMEOUT.VISIBLE, }); diff --git a/services/platform/tests/manual/reference/automation.md b/services/platform/tests/manual/reference/automation.md index d10b8ff609..acd0dd45f3 100644 --- a/services/platform/tests/manual/reference/automation.md +++ b/services/platform/tests/manual/reference/automation.md @@ -677,8 +677,9 @@ Legend: ✅ fully automated · 🔶 partially automated · ⛔ manual-only (no s | [metrics](../suites/metrics.md) | `MET-B1`, `MET-A1`–`MET-A2`, `MET-P1`–`MET-P2` | ⛔ manual-only | — | | [navigation](../suites/navigation.md) | `NAV-F2`, `NAV-F3`, `NAV-F7` | ✅ automated | `navigation.spec.ts` | | [navigation](../suites/navigation.md) | `NAV-F42` (the header line): a bordered page header is the `h-13` box with its divider inside, so it ends on the line a section panel's header ends on | 🔶 browser | `packages/ui/src/components/layout/adaptive-header.browser.test.tsx` (real Chromium, `SubPanelHeader` beside a bordered `AdaptiveHeaderRoot`); each section's page stays manual | -| [navigation](../suites/navigation.md) | `NAV-F1` | 🔶 automated + component | `navigation.spec.ts` (each rail tile commits its section — Knowledge, Automations, Settings from the rail's foot — and Home returns to the chat with the Home panel beside it) + `app/hooks/use-navigation-items.test.ts` (the three working sections with Settings pinned to the foot; Home opens the chat and lights on every Home route) + `app/components/layout/app-sidebar/sidebar-nav.test.tsx` (tile names, section entry points); the gliding pill and the active styling stay manual | -| [navigation](../suites/navigation.md) | `NAV-F17`, `NAV-F18`, `NAV-F23` (the Home tile's half): re-entering Home starts a fresh chat, entering from elsewhere resumes; the tile carries the unread inbox count scoped to the active organization, rests bare while it loads or at zero, skips the read without an inbox, and puts the count's meaning in its accessible name | 🔶 component | `app/hooks/use-navigation-items.test.ts`, `app/components/layout/app-sidebar/sidebar-nav.test.tsx`; the last-READ chat, the live drop after reading and the per-viewer scope (`NAV-F24`) stay manual | +| [navigation](../suites/navigation.md) | `NAV-F1` | 🔶 automated + component | `navigation.spec.ts` (each rail tile commits its section — Knowledge, Automations, Settings from the rail's foot — and Home opens a fresh chat with the Home panel beside it) + `app/hooks/use-navigation-items.test.ts` (the three working sections with Settings pinned to the foot; every tile opens its section's first page, Home a fresh chat; Home lights on every Home route) + `app/components/layout/app-sidebar/sidebar-nav.test.tsx` (tile names, section entry points) + `app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx` (the clicks in a real router); the gliding pill and the active styling stay manual | +| [navigation](../suites/navigation.md) | `NAV-F17`, `NAV-F18`, `NAV-F23` (the Home tile's half): Home opens a fresh chat from anywhere, and so do the rail's logo and a desktop visit to `/home`; the tile carries the unread inbox count scoped to the active organization, rests bare while it loads or at zero, skips the read without an inbox, and puts the count's meaning in its accessible name | 🔶 component | `app/hooks/use-navigation-items.test.ts`, `app/components/layout/app-sidebar/sidebar-nav.test.tsx`, `app/components/layout/app-sidebar/app-sidebar.test.tsx`, `app/routes/dashboard/$id/home.test.tsx`; the organization's address resuming the last-READ chat, the live drop after reading and the per-viewer scope (`NAV-F24`) stay manual | +| [navigation](../suites/navigation.md) | `NAV-F16`, `NAV-A9`: every rail tile opens its section's overview from another section and from inside it — Documents from Websites, the automation list from a run, the Settings landing from Teams, a fresh chat from a project's board — and places an earlier build remembered are ignored; exactly one rail tile carries `aria-current="page"`, the one the pill marks, and Enter on a focused tile opens its section | 🔶 Chromium + component | `app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx`, `app/hooks/use-navigation-items.test.ts`, `app/components/layout/app-sidebar/sidebar-nav.test.tsx`, `app/components/layout/mobile-bottom-nav.test.tsx`; the screen-reader read-out, the focus ring and the tab bar on a device stay manual | | [navigation](../suites/navigation.md) / [projects](../suites/projects.md) | `NAV-F41`, `NAV-F26`, `PROJ-F28` (the e2e half): the Home panel stays beside a project opened from its **Projects** section, the project row turns current, **All projects** opens the list beside the panel; the view switcher's **Tasks** radio takes `aria-checked` | 🔶 automated | `navigation.spec.ts` (the Home panel); the panel's persistence across routes, **New project**, the collapse and the switcher's memory and arrow keys stay manual | | [navigation](../suites/navigation.md) / [conversations](../suites/conversations.md) | `NAV-F26`–`NAV-F30`, `NAV-A5`, `CONV-G1` (the component half): chats, tasks and conversations share one stream, newest first in day bands with pinned chats above them; each row's context line; the open item marked current; the view narrowed and remembered; the draft row while a fresh chat is written; the empty views and the way on from each (**New chat**, **All projects**); no Inbox view without an inbox; the panel's axe audit; which routes are Home, what the open item is, the compact ages per locale | 🔶 component | `app/features/home/components/home-panel.test.tsx`, `app/features/home/hooks/use-home-data.test.tsx` (All reads the OPEN conversations whatever the Inbox view shows, skips the read without an inbox, lists a task once when it is both assigned to you and waiting on your review, counts the switcher's dots), `app/features/home/lib/home-items.test.ts` (day bands on local midnight, across a daylight-saving change too), `app/features/home/lib/home-paths.test.ts` (which routes are Home and which of them carry the panel — not a project's automation workbench), `app/features/home/hooks/use-compact-age.test.tsx`; real layout and drops are `home-panel.browser.test.tsx`'s (see the `CHAT-B11` row); the glide, scrolling an open task or conversation into view, live ages and the menus' keyboard visibility stay manual | | [navigation](../suites/navigation.md) | `NAV-P3`, `NAV-F31` (the boot half): the pre-hydration script reserves the Home panel on every Home route, keeps a folded panel folded only on the pages that can unfold it (a chat, a task page, an open conversation, a project's page), reserves nothing outside Home or on a shared-chat snapshot, and keeps the composer stand-in to chat routes | 🔶 unit | `app/components/layout/boot-chat-script.test.ts`, `app/components/layout/boot-shell-render.test.tsx`; the real geometry on a throttled reload stays manual | @@ -746,8 +747,8 @@ Legend: ✅ fully automated · 🔶 partially automated · ⛔ manual-only (no s | [projects](../suites/projects.md) | `PROJ-B17` (the component half, #3885): a failed project read is named inside the project shell with **Try again**, never as `projects.errors.PROJECT_NOT_FOUND` and never as a blank tab: the header and the tab strip stay and `projects.loadFailed` takes the tab's place, so no tab renders without its project; a restored arrival neither redirects nor forgets the Home memory; the alert holds through a retry with its button busy, and a retry that works opens the tab and hands the focus to the content region; a read that answered with no project (404/403) keeps the not-found message, with no retry; the Overview on its own says the same through the real `useProject`, adapter row and four-attempt retry policy against a closed synthetic transport, and shows the project once the read answers; EN/DE/FR | 🔶 component | `app/features/projects/components/project-overview.read-failure.test.tsx`, `app/routes/dashboard/$id/projects/$projectId.test.tsx`; the blocked request in a real browser stays `PROJ-B17` | | [projects](../suites/projects.md) | Sharing on General while the organization's teams are still loading: the **Audience** row (`projects.settings.audience`) holds a loading status and never offers **No teams yet.** (`projects.sharing.noTeamsHint`) or **Create a team** (`projects.sharing.noTeamsCreateLink`) to an administrator of an org that has teams | ✅ component | `app/features/projects/components/project-sharing-section.test.tsx` | | [projects](../suites/projects.md) | REST chat after the 2026-09-15 round-i evaluation: `MessagePart` is a `type` discriminator with an explicit mapping over six named part schemas (`TextPart` … `ApprovalPart`), and the contract declares nullability with `nullable` only — no OpenAPI 3.1 type list anywhere in the document | ✅ automated | `scripts/openapi/spec.test.ts` | -| [responsive](../suites/responsive.md) | `RESP-F1` | ✅ automated | `responsive.spec.ts` (app-shell: rail hidden; the tab bar holds Home, Knowledge, Automations and Settings, no overflow sheet) + component `app/components/layout/mobile-bottom-nav.test.tsx` (the same sections as the rail, Settings included) | -| [responsive](../suites/responsive.md) | `RESP-F10` | 🔶 automated + component | `responsive.spec.ts` (the Home tab opens `/home` with the view switcher) + `app/components/layout/mobile-bottom-nav.test.tsx` (the Home tab opens the Home list; its unread chip and the chip's meaning in the tab's name); the list's layout, **New chat** and the desktop redirect to the chat stay manual | +| [responsive](../suites/responsive.md) | `RESP-F1` | ✅ automated | `responsive.spec.ts` (app-shell: rail hidden; the tab bar holds Home, Knowledge, Automations and Settings, no overflow sheet) + component `app/components/layout/mobile-bottom-nav.test.tsx` (the same sections as the rail, Settings included; a tab carries no remembered place: Knowledge from Websites opens Documents, Automations from a run opens the list) | +| [responsive](../suites/responsive.md) | `RESP-F10` | 🔶 automated + component | `responsive.spec.ts` (the Home tab opens `/home` with the view switcher) + `app/components/layout/mobile-bottom-nav.test.tsx` (the Home tab opens the Home list; its unread chip and the chip's meaning in the tab's name); the list's layout, **New chat** and the desktop redirect to a fresh chat stay manual | | [responsive](../suites/responsive.md) | `RESP-F3` | ✅ automated | `responsive.spec.ts` (floating Save dock: 1 visible Save, dirty→enabled, reload-discard) | | [responsive](../suites/responsive.md) | `RESP-F3` dock frame: one inset between the floating dock's border and its actions on every side, a dock whose actions wrap hugs its widest row, and the dock re-fits when its actions or the viewport change | ✅ automated | `packages/ui/src/components/layout/mobile-floating-actions.browser.test.tsx` (real Chromium at 390×844 and 430×932, one row and wrapped rows) | | [automations](../suites/automations.md) / [responsive](../suites/responsive.md) | `AUTO-F12`, `RESP-F15` (the canvas's fit): the graph refits whenever the canvas's box changes size — a window resized, the tab strip wrapping its verbs, an inspector opening — while the view is still where a fit left it and a fit can show every node; a view the reader zoomed or the page panned (a picked node brought into sight) stays put, and **reset view** hands it back to the fit | ✅ Chromium | `packages/ui/src/components/flow/flow-canvas.browser.test.tsx` (a 900×700 canvas shrunk to 600×420 still shows every node; a zoomed and a page-panned view survive a resize; a reset view follows the box again) | @@ -1066,4 +1067,4 @@ Scroll-responsive navigation is covered by `packages/ui/src/hooks/use-scroll-com | [tasks](../suites/tasks.md) / [automations](../suites/automations.md) | Attaching during terminal journal drain cannot re-arm the orphan deadline or end sibling-dependent leftovers; status becomes exited only after durable drain. A backward wall-clock step preserves the epoch start and produces nonnegative monotonic elapsed duration accepted by journal replay and canonical NDJSON consumers. | ✅ unit + real processes + replay parser | `services/sandbox-runtime/daemon/src/exec-completion.test.ts` (causal terminal-drain barrier, captured orphan callbacks, real detached survivor, backward producer clock, both protocol validators, journal replay and canonical client parser); live transport and provider teardown remain separate coverage | | [tasks](../suites/tasks.md) | A task's dialog and page read one actor directory for every comment, timeline line and markdown body (the list reads one where nothing provides it). The dialog's first frame renders its newest 20 comments and history lines; the rest follow in an interruptible background render. The **Blocked by**, **Blocks** and **Reviewer** pickers read and build nothing until first used, and a composer reads its mention candidates on first focus. The task's discussion, dependencies, reviewer and watch reads start with the task. A listing keeps its rows through a refetch of the same rows; live hints refresh each entity once per 50 ms window. The activity read and its lines quote a changed description; only comments that arrive after a task page opened slide in. | ✅ component + unit | `app/features/tasks/components/task-comments.directory.test.tsx`, `app/features/tasks/hooks/use-first-frame-slice.test.ts`, `app/features/tasks/components/task-dependencies.test.tsx`, `app/features/tasks/components/reviewer-picker.test.tsx`, `app/features/tasks/components/mention-textarea.test.tsx`, `app/features/tasks/hooks/use-prefetch-task-reads.test.tsx`, `app/hooks/use-cached-paginated-query.test.tsx`, `app/lib/backend/use-backend-hints.test.tsx`, `backend/domains/tasks/service.activity.test.ts`, `app/features/tasks/components/task-conversation.test.tsx`; timings on a production build remain `TASK-P6` | | [performance](../suites/performance.md) / [navigation](../suites/navigation.md) | An overlay modal (dialog, sheet, drawer, the search palette, image zoom) pins the app root to `pointer-events: auto` from its first style pass until the body is live again, so the page under it is not restyled while its backdrop still keeps every pointer from the page; menus, selects and popovers keep the inert page. The search palette has no backdrop blur. `useFormatDate` re-renders an instance for its locale only while that locale's data was still loading, and `formatDate` skips converting into the runtime's own zone. | ✅ unit + component + real Chromium | `packages/ui/src/components/overlays/page-pointer-pin.test.tsx`, `packages/ui/src/components/dialog/modal-isolation.browser.test.tsx`, `packages/ui/src/hooks/use-format-date.test.tsx`, `packages/ui/src/lib/date/format.test.ts`; keystroke paint time without a GPU remains `PERF-P11` | -| [projects](../suites/projects.md) / [chat](../suites/chat.md) / [knowledge](../suites/knowledge.md) / [automations](../suites/automations.md) | The component halves of `PROJ-F40`, `CHAT-F61`, `KNOW-F37` and `AUTO-F56`: a delete lands on its overview. A project deleted from one of its own pages replaces that page with the Projects list, while a delete from the list (or a refused one) moves nothing; the open chat deleted from its header or its row replaces its page with a fresh chat (`?new`), never plain `/chat`, whose resume could reopen the deleted chat, while deleting another chat or a refused delete moves nothing; a subfolder deleted from its row keeps the folder on screen instead of jumping to the Documents root; a folder trail the backend refuses (404 or 403) reads as no trail, which replaces the dead address with the Documents root and toasts `documents.folderNotFound`, while any other failure stays an error; the Automations rail reopening a deleted automation lands on the list and forgets it, while a deliberate arrival keeps the deletion banner | 🔶 component + adapter | `app/features/projects/components/project-delete-dialog.test.tsx`, `app/features/chat/components/thread-delete-dialog.test.tsx`, `app/features/documents/components/documents-table.folder-delete.test.tsx`, `app/features/documents/components/breadcrumb-navigation.test.tsx`, `app/lib/backend/documents.breadcrumb.test.ts`, `app/features/automations/components/automation-detail-shell.test.tsx`; the real router, browser history and toasts stay manual (the four boxes) | +| [projects](../suites/projects.md) / [chat](../suites/chat.md) / [knowledge](../suites/knowledge.md) / [automations](../suites/automations.md) | The component halves of `PROJ-F40`, `CHAT-F61`, `KNOW-F37` and `AUTO-F56`: a delete lands on its overview. A project deleted from one of its own pages replaces that page with the Projects list, while a delete from the list (or a refused one) moves nothing; the open chat deleted from its header or its row replaces its page with a fresh chat (`?new`), never plain `/chat`, whose resume could reopen the deleted chat, while deleting another chat or a refused delete moves nothing; a subfolder deleted from its row keeps the folder on screen instead of jumping to the Documents root; a folder trail the backend refuses (404 or 403) reads as no trail, which replaces the dead address with the Documents root and toasts `documents.folderNotFound`, while any other failure stays an error; a deleted automation's address keeps its deletion banner | 🔶 component + adapter | `app/features/projects/components/project-delete-dialog.test.tsx`, `app/features/chat/components/thread-delete-dialog.test.tsx`, `app/features/documents/components/documents-table.folder-delete.test.tsx`, `app/features/documents/components/breadcrumb-navigation.test.tsx`, `app/lib/backend/documents.breadcrumb.test.ts`, `app/features/automations/components/automation-detail-shell.test.tsx`; the real router, browser history and toasts stay manual (the four boxes) | diff --git a/services/platform/tests/manual/reference/pins.md b/services/platform/tests/manual/reference/pins.md index 23d6eef4cd..28fdeaa6b1 100644 --- a/services/platform/tests/manual/reference/pins.md +++ b/services/platform/tests/manual/reference/pins.md @@ -32,7 +32,9 @@ time you are tempted to shorten one. | `AUTH-F18` | Better Auth's browser fetch plugin already follows successful consent/continuation responses. A second navigation can race the callback's one-use state and code; `oauth-authorization.test.tsx` pins single redirect ownership, StrictMode continuation and both consent actions. | | `SET-A7` | The device label and revoked badge competed for one non-wrapping flex row, so a long label shrank the badge into an ellipsis. The group wraps and the status keeps its intrinsic width. This box holds visible EN/DE/FR status text at desktop and narrow widths; `webdav-settings.test.tsx` separately holds active/null and revoked action states. | -| `NAV-F1` | The rail's first tile is **Home** (`navigation.home`), not Chat, and there is no Projects or Inbox tile: chats, projects with their tasks, and the inbox fold into Home, whose tile opens the last chat and lights on every Home route through `isHomePath` rather than its own href. New chat is the panel header's action (and a click on Home from inside Home). A rail click always commits the section's default entry, whatever the user did there before — `sidebar-nav.test.tsx` and `use-navigation-items.test.ts` hold those rules, `navigation.spec.ts` drives the clicks; this box judges the labels, order, the gliding pill and the active styling. | +| `NAV-F1` | The rail's first tile is **Home** (`navigation.home`), not Chat, and there is no Projects or Inbox tile: chats, projects with their tasks, and the inbox fold into Home, whose tile opens a fresh chat and lights on every Home route through `isHomePath` rather than its own href. New chat is the panel header's action and the Home tile's, from anywhere. A rail click always commits the section's default entry, whatever the user did there before — `sidebar-nav.test.tsx` and `use-navigation-items.test.ts` hold those rules, `navigation.spec.ts` drives the clicks; this box judges the labels, order, the gliding pill and the active styling. | +| `NAV-F16` / `NAV-F18` | The rail's per-section memory shipped twice — a remembered section place, then (#3959) a remembered automation, project and Knowledge tab, with Home resuming the last-read chat — and was retired twice on the owner's call (2026-09-20, 2026-10-08): a tile always opens its section's overview, also from inside the section, and Home always a fresh chat. Places an earlier build stored stay in browsers and are never read. `use-navigation-items.test.ts` asserts that no item carries history state and that the stored places are ignored; `sidebar-nav.browser.test.tsx` drives the clicks in a real router. Do not reintroduce it. The organization's own address still resumes the last-read chat (the sign-in landing), which NAV-F18 keeps under manual watch. | +| `NAV-A9` | TanStack's `Link` stamps `aria-current="page"` only when the URL starts with the link's own `to`, so the rail named no current section on Knowledge's other tabs or on most Home pages, while the pill still marked one. The rail now sets `aria-current` from `isItemActive`, the pill's own rule; `sidebar-nav.browser.test.tsx` checks in a real router that exactly one tile is current and that it is the one the pill marks. | | `NAV-F31` | The panel folds only on a chat, a task page, an open conversation and a project's page, because only their headers carry the toggle that brings it back; the projects list or the inbox index has none, so a stored fold is ignored there on purpose — otherwise the panel could be hidden with no way to show it. A project's page joined on 2026-10-02: its header had no toggle, so the panel could not be hidden beside a board. The fold rule and the phone-header rule (RESP-F12) are separate: a project folds its panel but keeps the shell bar on a phone. The boot script applies the same rules before paint (`home-paths.test.ts` `isPanelCollapsible` / `hasOwnPhoneHeader`, `boot-chat-script.test.ts`). | | `NAV-F9` | The API page now links developer prose and raw OpenAPI separately. `app/routes/docs.test.tsx` holds link destinations and accessibility; the manual box judges readable and keyboard-reachable links at phone width. | | `NAV-F11` | The public docs moved to a separate origin. `app/components/user-button.test.tsx` pins the shared canonical constant and safe new-tab attributes; the box no longer expects the old marketing-site subpath. | diff --git a/services/platform/tests/manual/suites/automations.md b/services/platform/tests/manual/suites/automations.md index 625f18ffc1..fdbd4c0113 100644 --- a/services/platform/tests/manual/suites/automations.md +++ b/services/platform/tests/manual/suites/automations.md @@ -530,7 +530,7 @@ output: `automations.detail.deleted.title` with **Open the run history** (`automations.detail.deleted.openRuns`). A slug nobody ever saved still reads `automations.notFound.title`. -- [ ] `AUTO-F56` · **The rail forgets a deleted automation** — Open an +- [ ] `AUTO-F56` · **A deleted automation leaves the rail on the list** — Open an automation's **Editor**, go back to the list and delete it from its row (`automations.detail.delete.title`), switch to **Knowledge**, then click the **Automations** rail tile → You land on `/dashboard/{org}/automations` @@ -588,7 +588,7 @@ output: without **Open the full run** (`tasks.run.openFull`), and the automation's name in the timeline shows no **View automation** (`tasks.timeline.viewWorkflow`); choose **Home** in the rail after the - project URL → the project's own page or the chat opens, never the + project URL → a fresh chat opens (`/chat?new=true`), never the denial. An Owner, Admin or Developer gets every page, the tab and both links. - [ ] `AUTO-F54` · **An agent node creates an image into its output** — With diff --git a/services/platform/tests/manual/suites/navigation.md b/services/platform/tests/manual/suites/navigation.md index d2c614ec30..a412e3e642 100644 --- a/services/platform/tests/manual/suites/navigation.md +++ b/services/platform/tests/manual/suites/navigation.md @@ -1,6 +1,6 @@ # Navigation & shell -> **Prefix** `NAV-` · **Reset** none · **Cost** 68 boxes +> **Prefix** `NAV-` · **Reset** none · **Cost** 71 boxes Exercise cross-app navigation — the primary side-nav rail and the section panels beside the page (the Home panel with its projects and its one stream of @@ -21,7 +21,7 @@ live in [chat.md](chat.md), the Inbox view in | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Primary nav sections | `/dashboard/{org}/{chat\|documents\|automations\|settings}` — the rail's **Home**, **Knowledge**, **Automations** and (at its foot) **Settings** | | Home routes | `/dashboard/{org}/{chat\|projects\|conversations}/…` and `/dashboard/{org}/tasks/{taskId}` — the Home panel stands beside every one | -| Home list (phone) | `/dashboard/{org}/home` — a desktop visit redirects to `/dashboard/{org}/chat` | +| Home list (phone) | `/dashboard/{org}/home` — a desktop visit redirects to a fresh chat, `/dashboard/{org}/chat?new=true` | | Knowledge | `/dashboard/{org}/documents` (the "Knowledge" rail item) | | Settings landing | `/dashboard/{org}/settings` → redirects by role (`getDefaultSettingsRoute`): `…/settings/organization` (owner/admin), `…/settings/connectors` (developer), else `…/settings/account` | | Governance group | `/dashboard/{org}/settings/governance` → redirects to `…/governance/content-models` | @@ -58,8 +58,8 @@ loaded, and reads **No teams** for an account in none. (`navigation.userSettings`), which sits at the rail's foot with the **Notifications** bell (`navigation.notifications`) and the account menu (`auth.userButton.manageAccount`) → Each click commits that section's - DEFAULT entry: Home opens `/chat` (the chat you last read, else a blank - composer) with the Home panel (`home.aria.panel`) beside it; Knowledge + DEFAULT entry: Home opens a fresh composer (`/chat?new=true`) with the + Home panel (`home.aria.panel`) beside it; Knowledge `/documents` (its pages — Documents, Knowledge entries, Websites, Products and Contacts — sit as tabs under its header, NAV-F32); Automations `/automations`; Settings the role's @@ -177,23 +177,27 @@ loaded, and reads **No teams** for an account in none. again → You land on `/documents`, not Websites. Repeat for **Automations** (open one automation's **Runs** tab → `/automations`) and **Settings** (open **Teams** → the role's default landing): each opens the section's own first - page, never the tab or record you left. Only **Home** resumes, because its - entry point reopens the last chat you read (`NAV-F18`): open a project's - board with a task open (`?task=…`), click **Knowledge**, then **Home** → you - land on that chat, not on the board. + page, never the tab or record you left. **Home** too: open a project's + board with a task open (`?task=…`), click **Knowledge**, then **Home** → a + fresh composer (`/chat?new=true`), neither the board nor the chat you last + read (`NAV-F18`). And the reverse: open an automation from a project's + **Automations** tab, click **Knowledge**, then **Automations** → the + organization's list, not that automation. - [ ] `NAV-F17` · **Re-entry resets the section** — While sitting on a project's board (inside Home), click the **Home** tile you are already on → A fresh composer opens (`/chat?new=true`) and the Home panel's list gains the draft row **New chat** (`home.newChat`) at the top, marked current. Same gesture in **Knowledge** (from **Websites**) lands on `/documents`; in **Settings** on the role's default landing. -- [ ] `NAV-F18` · **Home resumes the last chat** — From **Knowledge**, click - **Home** → It opens the chat you last READ (not merely the one with the - newest activity: have a second account post into an older chat first, then - confirm the tile still reopens yours). Now click **Home** again while - already in Home — on a chat, a project, a task page or the inbox → A fresh - composer opens (`?new=true`), not a chat. ⌥⌘N (Alt+Ctrl+N off a Mac), shown - in the tile's tooltip, does the same from any page. +- [ ] `NAV-F18` · **Home always starts a new chat** — From **Knowledge**, + click **Home** → A fresh composer opens (`/chat?new=true`) with the Home + panel beside it, not the chat you last read. Click **Home** again while + already in Home — on a chat, a project, a task page or the inbox → The + same. ⌥⌘N (Alt+Ctrl+N off a Mac), shown in the tile's tooltip, and the + rail's logo do the same from any page. Opening the organization's own + address (`/dashboard/{org}`) still resumes the chat you last READ, not + merely the one with the newest activity: have a second account post into + an older chat first, then confirm that address reopens yours. - [ ] `NAV-F20` · **A pasted key stays in page memory** — Open `/docs`, click **Authorize**, paste an API key, run one request, then reload the page → The request went out authorized; after the reload the lock is open again @@ -653,6 +657,15 @@ loaded, and reads **No teams** for an account in none. (NAV-A5). - [ ] `NAV-A8` · **Keep pinch zoom available after focusing a compact field on iOS** → In Safari 10 or later, open a compact field such as an inline rename, focus it and dismiss the keyboard: focus does not enlarge the page automatically, and a manual pinch still enlarges and restores it. Repeat the manual pinch in an installed home-screen app and in another iOS browser or an embedded web view; those contexts retain their original viewport settings and may still zoom on focus. Repeat on Android: manual pinch remains available. +- [ ] `NAV-A9` · **The rail names the section you are in** → In the + accessibility tree (or with a screen reader) visit + `/dashboard/{org}/websites`, `/dashboard/{org}/automations/{slug}/runs`, a + project's board and `/dashboard/{org}/settings/teams` → Exactly one tile of + the rail carries `aria-current="page"`: **Knowledge**, **Automations**, + **Home**, and **Settings** at the rail's foot — always the tile the pill + sits on. Below 768 px the tab bar's buttons say the same. Tab to a tile and + press Enter → Its section's first page opens, and the tile keeps a visible + focus ring. ## Performance diff --git a/services/platform/tests/manual/suites/responsive.md b/services/platform/tests/manual/suites/responsive.md index 645e17a43f..78b48592a6 100644 --- a/services/platform/tests/manual/suites/responsive.md +++ b/services/platform/tests/manual/suites/responsive.md @@ -1,6 +1,6 @@ # Responsive (cross-cutting) -> **Prefix** `RESP-` · **Reset** none · **Cost** 34 boxes +> **Prefix** `RESP-` · **Reset** none · **Cost** 35 boxes Verify the app adapts across viewports — the mobile in-flow bottom tab bar, the phone's Home list and its way back, the mobile floating Save cluster, and @@ -78,7 +78,9 @@ if you want to keep a write. **Settings** (`navigation.userSettings`) — no **More** tab, no overflow sheet, no separate Projects or Inbox tab. **Home** is the active tab on the chat, and on a project, a task page and the inbox too; each other tab opens - its section's first page. + its section's first page, also from inside that section: **Knowledge** + opened from **Websites** lands on **Documents**, **Automations** opened from + an automation's **Runs** tab on the list. - [ ] `RESP-F2` · **~~More sheet~~ (retired)** → The **More** tab and its overflow sheet are gone: Knowledge, Automations and Settings are tabs of their own (`RESP-F1`). From 8af14b2a749f7db82ac6f8084d51dad22bb7983c Mon Sep 17 00:00:00 2001 From: yannickmonney Date: Thu, 8 Oct 2026 01:27:37 +0200 Subject: [PATCH 2/7] fix(platform): show a project automation's project and section An automation opened from a project's Automations tab now starts its trail at the project: / Automations / . The project's name returns to the project and Automations to the project's own Automations tab, which the phone's back arrow follows too; a project that cannot be read leaves a Projects crumb, and a long name truncates. The page belongs to the Automations section, so the rail and the tab bar light Automations there instead of Home (isProjectAutomationPage, which also replaces showsHomePanel), and switching organization from it lands on the other organization's Automations list. The project automation URLs are unchanged. --- design/docs/app.md | 6 +- docs/de/platform/automations/editor.md | 2 +- docs/de/platform/index.md | 2 + docs/en/platform/automations/editor.md | 2 +- docs/en/platform/index.md | 2 + docs/fr/platform/automations/editor.md | 2 +- docs/fr/platform/index.md | 2 + .../app-sidebar/sidebar-nav.browser.test.tsx | 23 +++ .../layout/mobile-bottom-nav.test.tsx | 13 ++ .../automation-breadcrumbs.browser.test.tsx | 183 ++++++++++++++++++ .../automation-breadcrumbs.test.tsx | 131 ++++++++++++- .../components/automation-breadcrumbs.tsx | 129 +++++++++--- .../components/automation-detail-shell.tsx | 5 +- .../app/features/home/lib/home-paths.test.ts | 41 ++-- .../app/features/home/lib/home-paths.ts | 38 ++-- .../app/hooks/use-navigation-items.test.ts | 29 +++ .../app/hooks/use-navigation-items.ts | 11 +- .../app/lib/org-switch-subpath.test.ts | 19 ++ .../platform/app/lib/org-switch-subpath.ts | 9 +- .../platform/app/routes/dashboard/$id.tsx | 6 +- .../dashboard/$id/projects/$projectId.tsx | 7 +- services/platform/index.html | 2 +- .../tests/manual/reference/automation.md | 4 +- .../platform/tests/manual/reference/pins.md | 3 +- .../tests/manual/suites/automations.md | 19 +- .../tests/manual/suites/navigation.md | 23 ++- 26 files changed, 617 insertions(+), 96 deletions(-) create mode 100644 services/platform/app/features/automations/components/automation-breadcrumbs.browser.test.tsx diff --git a/design/docs/app.md b/design/docs/app.md index a66c82322f..3558d52133 100644 --- a/design/docs/app.md +++ b/design/docs/app.md @@ -32,7 +32,7 @@ what is there, and the page shows the one thing you opened. A tile always opens its section's overview — Home a new chat (on a phone, the Home list), Knowledge its first tab, Automations the list, Settings its landing page — never the place you left, also when you are already in that section. The page's section decides the lit tile and its - `aria-current="page"`. + `aria-current="page"`: an automation opened inside a project belongs to Automations. - **Section panels** — a section with navigation of its own opens it in a panel beside the page, one frame for all of them: `SubPanel width="list"` (280px by default, full height, right border), a `SubPanelHeader` naming the section in the same `h-13` row as a page header (border included, so @@ -75,7 +75,9 @@ what is there, and the page shows the one thing you opened. verbs — Save/Discard and any entity actions — sit in the strip's trailing slot (`AdaptiveHeaderTabActionsSlot`), never in the title row's right half; the title row keeps only the name and its identity badges (archived, live). Run/sub-pages keep a plain leaf, keep the strip - with the parent tab lit, and link the entity name back up the trail. + with the parent tab lit, and link the entity name back up the trail. An automation opened inside a + project starts its trail with the project: ` / Automations / `, the crumbs leading + to the project and to its Automations tab. - **Right/secondary panels** (the Home panel, a task's details) slide in and **resize the main column** rather than overlay it; main content re-flows to the remaining width. - **Main column is centred and width-capped** — e.g. chat is 558px (new) / 768px (conversation). Don't diff --git a/docs/de/platform/automations/editor.md b/docs/de/platform/automations/editor.md index bd19238da9..fcef05b18f 100644 --- a/docs/de/platform/automations/editor.md +++ b/docs/de/platform/automations/editor.md @@ -5,7 +5,7 @@ description: Prüfe und ändere Knoten, gib Testdaten ein, speichere eine Versio Im Workflow-Editor änderst du den Ablauf einer Automatisierung und wählst die gespeicherte Version für Live-Läufe. Änderungen brauchen Entwickler-, Admin- oder Inhaberrechte. Speichern, Testen und Bereitstellen sind getrennte Schritte: Die Arbeit an einem Entwurf lässt die bereitgestellte Version bestehen. -Öffne **Automatisierungen** und wähle einen Eintrag. Er öffnet sich im Tab **Editor**. Für einen neuen Ablauf beginne mit [Automatisierungen erstellen oder importieren](/de/platform/automations/catalog). +Öffne **Automatisierungen** und wähle einen Eintrag. Er öffnet sich im Tab **Editor**. Öffnest du eine Automatisierung im Tab **Automatisierungen** eines Projekts, beginnt der Navigationspfad mit diesem Projekt: Wähle den Projektnamen, um zum Projekt zurückzukehren, oder **Automatisierungen**, um zu seinen Automatisierungen zurückzukehren. Die Navigationsleiste markiert in beiden Fällen **Automatisierungen**. Für einen neuen Ablauf beginne mit [Automatisierungen erstellen oder importieren](/de/platform/automations/catalog). | Tab | Wofür du ihn nutzt | | --- | --- | diff --git a/docs/de/platform/index.md b/docs/de/platform/index.md index 128463a2c3..853d74d6c6 100644 --- a/docs/de/platform/index.md +++ b/docs/de/platform/index.md @@ -16,6 +16,8 @@ Beim Scrollen nach unten wird die Leiste kleiner, rückt etwas nach unten und ze Ein Bereich öffnet immer seine eigene erste Seite – egal, was du dort zuletzt getan hast. Dieselbe Auswahl führt dich also jedes Mal an dieselbe Stelle: **Start** öffnet einen neuen Chat, **Wissen** die **Dokumente** und **Automatisierungen** die Liste der Automatisierungen. Das gilt auch, wenn du den Bereich wählst, in dem du gerade bist. Ein Beispiel: Öffne in einer Automatisierung den Tab **Läufe**, wechsle zu **Wissen** und wähle dann **Automatisierungen**. Du landest in der Liste der Automatisierungen, nicht auf dem Tab, den du verlassen hast. Auf dem Smartphone öffnet **Start** statt eines neuen Chats die Liste von **Start**. Einen neuen Chat beginnst du auch mit **⌥⌘N** auf dem Mac oder **Alt+Ctrl+N** unter Windows und Linux. +Eine Automatisierung, die du im Tab **Automatisierungen** eines Projekts öffnest, gehört zu **Automatisierungen**: Die Navigationsleiste markiert **Automatisierungen**, und der Navigationspfad über der Automatisierung beginnt mit dem Projekt. Wähle den Projektnamen, um zum Projekt zurückzukehren, oder **Automatisierungen**, um zu seinen Automatisierungen zurückzukehren. + Die **Einstellungen** führen ihre Seiten in einer Seitenleiste neben der Seite auf, und die Kopfzeile nennt die geöffnete Seite; auf dem Smartphone beginnen sie mit einer Liste ihrer Seiten. **Wissen** zeigt seine Seiten als Tabs unter der Kopfzeile. | Du möchtest … | So gehst du vor | diff --git a/docs/en/platform/automations/editor.md b/docs/en/platform/automations/editor.md index c9cd342182..103f21ecbf 100644 --- a/docs/en/platform/automations/editor.md +++ b/docs/en/platform/automations/editor.md @@ -5,7 +5,7 @@ description: Inspect and edit nodes, supply test input, save a version, and depl Use the workflow editor to change what an automation does and decide which saved version runs live. You need Developer, Admin, or Owner permissions to make changes. Saving, testing, and deployment are separate steps: editing a draft leaves the deployed version in place. -Open **Automations**, then select an automation. It opens on **Editor**. To create one first, use [Create or import an automation](/platform/automations/catalog). +Open **Automations**, then select an automation. It opens on **Editor**. An automation you open from a project's **Automations** tab shows that project at the start of the breadcrumb trail: choose the project's name to return to the project, or **Automations** to return to its automations. The rail marks **Automations** either way. To create one first, use [Create or import an automation](/platform/automations/catalog). | Tab | Use it to | | --- | --- | diff --git a/docs/en/platform/index.md b/docs/en/platform/index.md index 81ecd754c5..f396416cc6 100644 --- a/docs/en/platform/index.md +++ b/docs/en/platform/index.md @@ -16,6 +16,8 @@ As you scroll down, the navigation becomes smaller and moves slightly lower, sho A section always opens on its own first page, whatever you did there last, so the same choice leads to the same place every time: **Home** opens a new chat, **Knowledge** opens **Documents**, and **Automations** opens the automation list. Choosing the section you are already in does the same. For example, open an automation's **Runs** tab, switch to **Knowledge**, then choose **Automations**: the automation list opens, not the tab you left. On a phone, **Home** opens the Home list instead of a new chat. The shortcut **⌥⌘N** on a Mac, or **Alt+Ctrl+N** on Windows or Linux, also starts a new chat. +An automation you open from a project's **Automations** tab belongs to **Automations**: the rail marks **Automations**, and the breadcrumb trail above the automation starts with the project. Choose the project's name to return to the project, or **Automations** to return to its automations. + **Settings** lists its pages in a panel beside the page, and the page header names the page you opened; on a phone, Settings starts from a list of its pages. **Knowledge** shows its pages as tabs under its header. | You want to… | Do this | diff --git a/docs/fr/platform/automations/editor.md b/docs/fr/platform/automations/editor.md index ae28dbcd38..9bfb191454 100644 --- a/docs/fr/platform/automations/editor.md +++ b/docs/fr/platform/automations/editor.md @@ -5,7 +5,7 @@ description: Examine et modifie les nœuds, fournis les données de test, puis e L’éditeur de workflow permet de modifier le comportement d’une automatisation et de choisir sa version active. Il faut les droits Développeur, Admin ou Propriétaire pour apporter des changements. Enregistrer, tester et mettre en service sont des étapes distinctes : modifier un brouillon laisse la version déployée en place. -Ouvre **Automatisations**, puis sélectionne une automatisation. Elle s’ouvre dans l’onglet **Éditeur**. Pour en créer une, consulte [Créer ou importer une automatisation](/fr/platform/automations/catalog). +Ouvre **Automatisations**, puis sélectionne une automatisation. Elle s’ouvre dans l’onglet **Éditeur**. Une automatisation ouverte depuis l’onglet **Automatisations** d’un projet affiche ce projet au début du fil d’Ariane : choisis le nom du projet pour revenir au projet, ou **Automatisations** pour revenir à ses automatisations. Dans les deux cas, la barre de navigation met **Automatisations** en évidence. Pour en créer une, consulte [Créer ou importer une automatisation](/fr/platform/automations/catalog). | Onglet | Utilisation | | --- | --- | diff --git a/docs/fr/platform/index.md b/docs/fr/platform/index.md index 31ba0e26f6..2599c0776d 100644 --- a/docs/fr/platform/index.md +++ b/docs/fr/platform/index.md @@ -16,6 +16,8 @@ Quand tu fais défiler la page vers le bas, la barre devient plus petite, descen Une section s’ouvre toujours sur sa première page, quoi que tu y aies fait auparavant : le même choix te mène donc chaque fois au même endroit. **Accueil** ouvre un nouveau chat, **Connaissances** ouvre **Documents** et **Automatisations** ouvre la liste des automatisations. C’est aussi le cas quand tu choisis la section où tu te trouves déjà. Par exemple, ouvre l’onglet **Exécutions** d’une automatisation, passe dans **Connaissances**, puis choisis **Automatisations** : la liste des automatisations s’ouvre, et non l’onglet que tu as quitté. Sur téléphone, **Accueil** ouvre la liste d’**Accueil** plutôt qu’un nouveau chat. Le raccourci **⌥⌘N** sur Mac ou **Alt+Ctrl+N** sous Windows et Linux démarre aussi un nouveau chat. +Une automatisation que tu ouvres depuis l’onglet **Automatisations** d’un projet appartient à **Automatisations** : la barre de navigation met **Automatisations** en évidence, et le fil d’Ariane au-dessus de l’automatisation commence par le projet. Choisis le nom du projet pour revenir au projet, ou **Automatisations** pour revenir à ses automatisations. + **Paramètres** liste ses pages dans un panneau latéral, à côté de la page, et l’en-tête indique la page ouverte ; sur téléphone, Paramètres commence par la liste de ses pages. **Connaissances** présente ses pages sous forme d’onglets sous son en-tête. | Tu souhaites… | Marche à suivre | diff --git a/services/platform/app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx b/services/platform/app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx index aec40d312b..f8eedabef1 100644 --- a/services/platform/app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx +++ b/services/platform/app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx @@ -83,6 +83,7 @@ function renderRail(initialPath: string) { '/dashboard/$id/automations/$automationSlug/runs', '/dashboard/$id/projects/$projectId/tasks/board', '/dashboard/$id/projects/$projectId/automations', + '/dashboard/$id/projects/$projectId/automations/$automationSlug/editor', '/dashboard/$id/settings', '/dashboard/$id/settings/teams', ].map((path) => @@ -149,6 +150,27 @@ describe('the rail in Chromium', () => { expect(location().search).toEqual({ new: true }); }); + // The owner's report: an automation opened from a project's Automations + // tab left the rail on Home, and Automations later reopened it. + it('treats an automation opened in a project as Automations', async () => { + const { user, router, go } = renderRail( + `${ORG}/projects/p-1/automations/intake/editor`, + ); + const location = () => router.state.location; + + await waitFor(() => expect(currentTiles()).toEqual(['Automations'])); + + await user.click(await tile('Knowledge')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/documents`)); + await user.click(await tile('Automations')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/automations`)); + + // Clicked from the automation itself, too. + await go(`${ORG}/projects/p-1/automations/intake/editor`); + await user.click(await tile('Automations')); + await waitFor(() => expect(location().pathname).toBe(`${ORG}/automations`)); + }); + it('names exactly one tile as the current page, the one the pill marks', async () => { const { go } = renderRail(`${ORG}/chat`); @@ -158,6 +180,7 @@ describe('the rail in Chromium', () => { [`${ORG}/automations/intake/runs`, 'Automations'], [`${ORG}/projects/p-1/tasks/board`, 'Home'], [`${ORG}/projects/p-1/automations`, 'Home'], + [`${ORG}/projects/p-1/automations/intake/editor`, 'Automations'], [`${ORG}/settings/teams`, 'Settings'], ] as const) { await go(path); diff --git a/services/platform/app/components/layout/mobile-bottom-nav.test.tsx b/services/platform/app/components/layout/mobile-bottom-nav.test.tsx index 69c8f22dac..720a3c658e 100644 --- a/services/platform/app/components/layout/mobile-bottom-nav.test.tsx +++ b/services/platform/app/components/layout/mobile-bottom-nav.test.tsx @@ -155,6 +155,19 @@ describe('the mobile tab bar', () => { }); }); + it('lights Automations on an automation opened inside a project', () => { + currentLocation.pathname = + '/dashboard/org-1/projects/p-1/automations/intake/editor'; + automationSlug = 'intake'; + render(); + expect( + screen.getByRole('button', { name: /^automations/ }), + ).toHaveAttribute('aria-current', 'page'); + expect(screen.getByRole('button', { name: /^home/ })).not.toHaveAttribute( + 'aria-current', + ); + }); + it('opens the automations list from inside an automation', async () => { currentLocation.pathname = '/dashboard/org-1/automations/intake/runs'; automationSlug = 'intake'; diff --git a/services/platform/app/features/automations/components/automation-breadcrumbs.browser.test.tsx b/services/platform/app/features/automations/components/automation-breadcrumbs.browser.test.tsx new file mode 100644 index 0000000000..bcb8e3baa5 --- /dev/null +++ b/services/platform/app/features/automations/components/automation-breadcrumbs.browser.test.tsx @@ -0,0 +1,183 @@ +import '@testing-library/jest-dom/vitest'; +import { + Outlet, + RouterProvider, + createMemoryHistory, + createRootRoute, + createRoute, + createRouter, + useParams, +} from '@tanstack/react-router'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { page } from 'vitest/browser'; + +import { paramToAutomationSlug } from '@/lib/automations/slug'; +import { cleanup, render, screen, waitFor, within } from '@/tests/utils/render'; + +import { AutomationBreadcrumbs } from './automation-breadcrumbs'; + +import '@/app/globals.css'; + +/** + * The trail of an automation opened inside a project, under a real router in + * Chromium: where its crumbs lead, that only the leaf names the current page + * (the ancestors are prefixes of the URL, which TanStack would otherwise mark + * current too), the phone's back arrow, and a long project name that must + * not crowd the automation's own name out. + */ + +const fixtures = vi.hoisted(() => ({ + projectName: 'Apollo', +})); + +vi.mock('../hooks/queries', () => ({ + useAutomation: () => ({ + data: { presentation: { name: 'Intake' } }, + isPending: false, + }), + useAutomations: () => ({ data: [], isPending: false }), +})); + +vi.mock('@/app/features/projects/hooks/queries', () => ({ + useProject: () => ({ + project: { name: fixtures.projectName }, + isLoading: false, + }), +})); + +beforeEach(async () => { + fixtures.projectName = 'Apollo'; + await page.viewport(1280, 800); +}); + +afterEach(cleanup); + +function AutomationPage() { + const { id, automationSlug, projectId } = useParams({ strict: false }); + return ( +
+ +
+ ); +} + +function renderTrail(initialPath: string) { + const rootRoute = createRootRoute({ component: Outlet }); + const automationPages = [ + '/dashboard/$id/automations/$automationSlug/editor', + '/dashboard/$id/automations/$automationSlug/runs/$runId', + '/dashboard/$id/projects/$projectId/automations/$automationSlug/editor', + '/dashboard/$id/projects/$projectId/automations/$automationSlug/runs/$runId', + ].map((path) => + createRoute({ + getParentRoute: () => rootRoute, + path, + component: AutomationPage, + }), + ); + const otherPages = [ + '/dashboard/$id/automations', + '/dashboard/$id/projects', + '/dashboard/$id/projects/$projectId', + '/dashboard/$id/projects/$projectId/automations', + ].map((path) => + createRoute({ + getParentRoute: () => rootRoute, + path, + component: () =>

{path}

, + }), + ); + const router = createRouter({ + routeTree: rootRoute.addChildren([...automationPages, ...otherPages]), + history: createMemoryHistory({ initialEntries: [initialPath] }), + }); + return { router, ...render() }; +} + +const PROJECT_AUTOMATION = '/dashboard/org-1/projects/p-1/automations'; + +describe('the trail of an automation opened in a project, in Chromium', () => { + it('names only the leaf as the current page', async () => { + renderTrail(`${PROJECT_AUTOMATION}/intake/editor`); + + const trail = await screen.findByRole('navigation', { + name: 'Breadcrumb', + }); + const list = within(trail).getByRole('list'); + await within(list).findByRole('link', { name: 'Apollo' }); + for (const link of within(trail).getAllByRole('link')) { + expect(link, link.textContent ?? '').not.toHaveAttribute('aria-current'); + } + expect( + within(trail).getByRole('heading', { level: 1, name: 'Intake' }), + ).toHaveAttribute('aria-current', 'page'); + }); + + it("leads back to the project's Automations tab and to the project", async () => { + const { user, router } = renderTrail(`${PROJECT_AUTOMATION}/intake/editor`); + /** The desktop trail's crumb named `name`, once the trail renders. */ + const crumb = async (name: string) => + within( + within( + await screen.findByRole('navigation', { name: 'Breadcrumb' }), + ).getByRole('list'), + ).findByRole('link', { name }); + + await user.click(await crumb('Automations')); + await waitFor(() => + expect(router.state.location.pathname).toBe(PROJECT_AUTOMATION), + ); + + router.history.push(`${PROJECT_AUTOMATION}/intake/editor`); + await user.click(await crumb('Apollo')); + await waitFor(() => + expect(router.state.location.pathname).toBe( + '/dashboard/org-1/projects/p-1', + ), + ); + }); + + it("returns the phone's back arrow to the project's Automations tab", async () => { + await page.viewport(390, 800); + renderTrail(`${PROJECT_AUTOMATION}/intake/editor`); + + const back = await screen.findByRole('link', { name: 'Back' }); + expect(back).toBeVisible(); + expect(back).toHaveAttribute('href', PROJECT_AUTOMATION); + // The full trail is the desktop's; the phone keeps the arrow and the name. + expect( + screen.getByRole('link', { name: 'Apollo', hidden: true }), + ).not.toBeVisible(); + expect( + screen.getByRole('heading', { level: 1, name: 'Intake' }), + ).toBeVisible(); + }); + + it('truncates a long project name and keeps the automation readable', async () => { + fixtures.projectName = + `Quarterly regional operations ${'review '.repeat(13)}`.trim(); + renderTrail(`${PROJECT_AUTOMATION}/intake/runs/r-1`); + + const project = await screen.findByRole('link', { + name: fixtures.projectName, + }); + await waitFor(() => + expect(project.scrollWidth).toBeGreaterThan(project.clientWidth), + ); + // The crumb is capped, the name crumb and the leaf both still show. + expect(project.getBoundingClientRect().width).toBeLessThanOrEqual(192); + const automation = screen.getByRole('link', { name: 'Intake' }); + expect(automation).toBeVisible(); + expect(automation).toHaveAttribute( + 'href', + `${PROJECT_AUTOMATION}/intake/editor`, + ); + const leaf = screen.getByRole('heading', { level: 1, name: 'Run' }); + expect(leaf.getBoundingClientRect().width).toBeGreaterThan(0); + expect(leaf.getBoundingClientRect().right).toBeLessThanOrEqual(1280); + }); +}); diff --git a/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx b/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx index cc84ff21b6..af8aa24191 100644 --- a/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx +++ b/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx @@ -5,7 +5,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { asProjectId } from '@/app/features/projects/hooks/use-project-id-param'; import { checkAccessibility } from '@/tests/utils/a11y'; -import { render, screen } from '@/tests/utils/render'; +import { render, screen, within } from '@/tests/utils/render'; import { AutomationBreadcrumbs } from './automation-breadcrumbs'; @@ -14,6 +14,11 @@ const fixtures = vi.hoisted(() => ({ isPending: false, onRun: false, automations: [] as unknown[], + projectRead: { + project: { name: 'Apollo' } as { name: string } | null, + isLoading: false, + }, + projectReadArgs: [] as (string | undefined)[], })); const mockNavigate = vi.hoisted(() => vi.fn()); @@ -58,6 +63,14 @@ vi.mock('@tanstack/react-router', () => ({ }), })); +// The project the automation is opened in; the project shell already read it. +vi.mock('@/app/features/projects/hooks/queries', () => ({ + useProject: (projectId: string | undefined) => { + fixtures.projectReadArgs.push(projectId); + return fixtures.projectRead; + }, +})); + vi.mock('../hooks/queries', () => ({ useAutomation: () => ({ data: { @@ -83,8 +96,19 @@ describe('AutomationBreadcrumbs', () => { // Empty listing → the leaf renders the plain name, so the cases that // assert exact h1 names stay valid without knowing about the switcher. fixtures.automations = []; + fixtures.projectRead = { project: { name: 'Apollo' }, isLoading: false }; + fixtures.projectReadArgs = []; }); + /** The trail's ancestor links, in order — the desktop trail only, without + * the phone's back control. */ + function trailLinks() { + const trail = screen.getByRole('list'); + return within(trail) + .getAllByRole('link') + .map((link) => [link.textContent, link.getAttribute('href')]); + } + it('links Automations back to the org list and heads with the pack name', () => { fixtures.presentation = { name: 'Chase overdue invoices', @@ -127,11 +151,28 @@ describe('AutomationBreadcrumbs', () => { ).toBeVisible(); }); - it('always returns Automations to the org hub, even from a project-scoped page', () => { - fixtures.presentation = undefined; - fixtures.isPending = false; - fixtures.onRun = false; + it('starts the trail at the project an automation is opened in', () => { + render( + , + ); + // The project leads back to the project, Automations to the project's + // own Automations tab — where the automation was opened from. + expect(trailLinks()).toEqual([ + ['Apollo', '/dashboard/org-1/projects/proj-1'], + ['Automations', '/dashboard/org-1/projects/proj-1/automations'], + ]); + expect( + screen.getByRole('heading', { level: 1, name: 'Dunning' }), + ).toBeVisible(); + expect(fixtures.projectReadArgs).toContain('proj-1'); + }); + + it("returns the phone's back arrow to the project's Automations tab", () => { render( { />, ); - expect(screen.getByRole('link', { name: 'Automations' })).toHaveAttribute( + const back = screen.getByRole('link', { name: /back/i }); + expect(back).toHaveClass('md:hidden'); + expect(back).toHaveAttribute( 'href', - '/dashboard/org-1/automations', + '/dashboard/org-1/projects/proj-1/automations', ); }); + it('falls back to the project list when the project cannot be read', () => { + fixtures.projectRead = { project: null, isLoading: false }; + + render( + , + ); + + expect(trailLinks()).toEqual([ + ['Projects', '/dashboard/org-1/projects'], + ['Automations', '/dashboard/org-1/projects/proj-1/automations'], + ]); + }); + + it('holds the project crumb as a skeleton while the project loads', () => { + fixtures.projectRead = { project: null, isLoading: true }; + + render( + , + ); + + expect(trailLinks()).toEqual([ + ['Automations', '/dashboard/org-1/projects/proj-1/automations'], + ]); + expect(screen.queryByRole('link', { name: 'Projects' })).toBeNull(); + }); + + it('reads no project outside one', () => { + render( + , + ); + + expect(trailLinks()).toEqual([ + ['Automations', '/dashboard/org-1/automations'], + ]); + expect(fixtures.projectReadArgs).toEqual([]); + }); + it('on a run, links the automation name back to the automation page', () => { fixtures.presentation = { name: 'Chase overdue invoices' }; fixtures.isPending = false; @@ -188,9 +279,16 @@ describe('AutomationBreadcrumbs', () => { />, ); - expect( - screen.getByRole('link', { name: 'Chase overdue invoices' }), - ).toHaveAttribute( + expect(trailLinks()).toEqual([ + ['Apollo', '/dashboard/org-1/projects/proj-1'], + ['Automations', '/dashboard/org-1/projects/proj-1/automations'], + [ + 'Chase overdue invoices', + '/dashboard/org-1/projects/proj-1/automations/billing__dunning/editor', + ], + ]); + // Mobile back follows the immediate parent — the automation. + expect(screen.getByRole('link', { name: /back/i })).toHaveAttribute( 'href', '/dashboard/org-1/projects/proj-1/automations/billing__dunning/editor', ); @@ -278,4 +376,17 @@ describe('AutomationBreadcrumbs', () => { ); await checkAccessibility(container); }); + + it('passes an axe audit inside a project', async () => { + fixtures.presentation = { name: 'Chase overdue invoices' }; + + const { container } = render( + , + ); + await checkAccessibility(container); + }); }); diff --git a/services/platform/app/features/automations/components/automation-breadcrumbs.tsx b/services/platform/app/features/automations/components/automation-breadcrumbs.tsx index 5b18635984..0787e40809 100644 --- a/services/platform/app/features/automations/components/automation-breadcrumbs.tsx +++ b/services/platform/app/features/automations/components/automation-breadcrumbs.tsx @@ -4,15 +4,20 @@ * The adaptive-header trail for one automation (and its runs). * * On the automation page: `Automations / ` — the Automations crumb - * always returns to the org Automations hub (the project has no Automations - * tab; its `/automations` list sits under Projects chrome and reads as a - * detour), and the name leaf is the shared breadcrumb switcher over sibling - * automations, exactly like a project's name. On a run page: - * `Automations / / Run` — the name crumb returns to this automation - * (project-scoped when opened from a project) as a plain link, and the - * mobile back arrow follows that immediate parent. + * returns to the org Automations hub, and the name leaf is the shared + * breadcrumb switcher over sibling automations, exactly like a project's + * name. On a run page: `Automations / / Run` — the name crumb returns + * to this automation as a plain link, and the mobile back arrow follows that + * immediate parent. + * + * Opened inside a project, the trail starts at the project: + * ` / Automations / ` (and `… / Run`). The project's name + * returns to the project, and Automations to the project's own Automations + * tab, the list the automation was opened from — so the phone's back arrow + * leads there too. */ +import { cn } from '@tale/ui/cn'; import { HEADER_CRUMB_LINK_CLASS, HeaderBreadcrumbs, @@ -22,6 +27,8 @@ import { SkeletonBox } from '@tale/ui/skeleton'; import { Skeletonize } from '@tale/ui/skeleton-context'; import { Link, useMatch } from '@tanstack/react-router'; +import { useProject } from '@/app/features/projects/hooks/queries'; +import { asProjectId } from '@/app/features/projects/hooks/use-project-id-param'; import { automationSlugToParam } from '@/lib/automations/slug'; import { useT } from '@/lib/i18n/client'; import { automationDisplayName } from '@/lib/shared/schemas/automation_presentation'; @@ -36,7 +43,8 @@ export function AutomationBreadcrumbs({ }: { organizationId: string; automationSlug: string; - /** When set, the automation name crumb (on a run) stays on the project route. */ + /** When set, the trail starts at this project and every crumb stays on + * the project route. */ projectId?: string; }) { const { t } = useT('automations'); @@ -64,18 +72,30 @@ export function AutomationBreadcrumbs({ }) !== undefined; const onRun = onOrgRun || onProjectRun; - // Always the org hub — project-scoped `/automations` renders inside the - // project shell (Projects / …), which is not what this crumb names. - const listCrumb = ( - - {t('title')} - - ); + // The list the automation belongs to here: the org hub, or inside a + // project that project's own Automations tab. An ancestor of the current + // URL, so it matches exactly: TanStack would otherwise mark it as the + // current page beside the leaf. + const listCrumb = + projectId !== undefined ? ( + + {t('title')} + + ) : ( + + {t('title')} + + ); // The automation's default surface, exactly where a list row lands — the // bare entity URL would only forward there. @@ -128,15 +148,72 @@ export function AutomationBreadcrumbs({ return ( + ), + }, ] - : [{ key: 'automations', content: listCrumb }] - } + : []), + { key: 'automations', content: listCrumb }, + ...(onRun ? [{ key: 'automation', content: automationCrumb }] : []), + ]} leaf={onRun ? t('runs.breadcrumb') : nameLeaf} /> ); } + +/** + * The project an automation was opened in, leading back to it. The project + * shell's loader already read it, so the name is usually there on the first + * frame. Like the Automations crumb it is an ancestor of the current URL, so + * it matches exactly. A long name truncates, so the automation's own name + * keeps its room; the accessible name stays whole. A project that cannot be + * read leaves the way out its not-found page offers: the project list. + */ +function ProjectCrumb({ + organizationId, + projectId, +}: { + organizationId: string; + projectId: string; +}) { + const { t } = useT('projects'); + const { project, isLoading } = useProject(asProjectId(projectId)); + + if (isLoading) { + return ( + + + + + + ); + } + return project ? ( + + {project.name} + + ) : ( + + {t('title')} + + ); +} diff --git a/services/platform/app/features/automations/components/automation-detail-shell.tsx b/services/platform/app/features/automations/components/automation-detail-shell.tsx index b94bc2a109..9ada173dd4 100644 --- a/services/platform/app/features/automations/components/automation-detail-shell.tsx +++ b/services/platform/app/features/automations/components/automation-detail-shell.tsx @@ -53,8 +53,9 @@ interface AutomationDetailShellProps { /** * The chrome every automation detail page shares, on the org route AND the * project-scoped one: the `PageLayout` scroll shell, the - * `Automations / ` breadcrumb (the name doubling as the sibling - * switcher), and the tab strip — **Editor**, **General**, **Runs** — exactly the composition a project detail carries. The strip's + * `Automations / ` breadcrumb — ` / Automations / ` on + * the project-scoped route — with the name doubling as the sibling + * switcher, and the tab strip — **Editor**, **General**, **Runs** — exactly the composition a project detail carries. The strip's * trailing slot is where the open tab puts its verbs and the Save/Discard * cluster, so the header row keeps only the name and the Live badge. * diff --git a/services/platform/app/features/home/lib/home-paths.test.ts b/services/platform/app/features/home/lib/home-paths.test.ts index da5f3d761e..5956e8d06d 100644 --- a/services/platform/app/features/home/lib/home-paths.test.ts +++ b/services/platform/app/features/home/lib/home-paths.test.ts @@ -4,8 +4,8 @@ import { hasOwnPhoneHeader, isHomePath, isPanelCollapsible, + isProjectAutomationPage, readHomeLocation, - showsHomePanel, } from './home-paths'; const ORG = 'org-1'; @@ -18,6 +18,8 @@ describe('isHomePath', () => { '/dashboard/org-1/chat/thread-1', '/dashboard/org-1/projects', '/dashboard/org-1/projects/p-1/tasks/board', + // The project's Automations tab, the bound list, is the project's page. + '/dashboard/org-1/projects/p-1/automations', '/dashboard/org-1/tasks/t-1', '/dashboard/org-1/conversations/open', ]) { @@ -38,36 +40,41 @@ describe('isHomePath', () => { expect(isHomePath(path, ORG), path).toBe(false); } }); -}); -describe('showsHomePanel', () => { - it('stands the panel beside every Home route', () => { + // An automation opened inside a project wears the Automations chrome: the + // rail lights Automations there, and its canvas keeps the full width. + it("leaves a project's automation page to Automations", () => { for (const path of [ - '/dashboard/org-1/chat/t1', - '/dashboard/org-1/projects/p1', - '/dashboard/org-1/projects/p1/tasks/board', - '/dashboard/org-1/projects/p1/automations', - '/dashboard/org-1/tasks/k1', + '/dashboard/org-1/projects/p1/automations/intake', + '/dashboard/org-1/projects/p1/automations/intake/editor', + '/dashboard/org-1/projects/p1/automations/intake/runs/r1', ]) { - expect(showsHomePanel(path, 'org-1'), path).toBe(true); + expect(isHomePath(path, ORG), path).toBe(false); } }); +}); - it("leaves a project's automation workbench the full width", () => { +describe('isProjectAutomationPage', () => { + it("names an automation's own pages inside a project", () => { for (const path of [ '/dashboard/org-1/projects/p1/automations/intake', '/dashboard/org-1/projects/p1/automations/intake/editor', '/dashboard/org-1/projects/p1/automations/intake/runs/r1', ]) { - expect(showsHomePanel(path, 'org-1'), path).toBe(false); - // Still Home as far as the rail is concerned. - expect(isHomePath(path, 'org-1'), path).toBe(true); + expect(isProjectAutomationPage(path, ORG), path).toBe(true); } }); - it('never shows outside Home', () => { - expect(showsHomePanel('/dashboard/org-1/automations', 'org-1')).toBe(false); - expect(showsHomePanel('/dashboard/org-1/settings', 'org-1')).toBe(false); + it("leaves the project's Automations tab, the org's automations and other orgs alone", () => { + for (const path of [ + '/dashboard/org-1/projects/p1/automations', + '/dashboard/org-1/projects/p1/automations/', + '/dashboard/org-1/projects/p1/tasks/board', + '/dashboard/org-1/automations/intake', + '/dashboard/org-2/projects/p1/automations/intake', + ]) { + expect(isProjectAutomationPage(path, ORG), path).toBe(false); + } }); }); diff --git a/services/platform/app/features/home/lib/home-paths.ts b/services/platform/app/features/home/lib/home-paths.ts index 83e7b22c39..a5a8078e46 100644 --- a/services/platform/app/features/home/lib/home-paths.ts +++ b/services/platform/app/features/home/lib/home-paths.ts @@ -2,7 +2,8 @@ * Which dashboard routes belong to Home — the one section that holds chats, * projects with their tasks, and the inbox. The shell mounts the Home panel * beside every one of them, so moving between a chat, a task, a project and - * a customer conversation never swaps the navigation out from under you. + * a customer conversation never swaps the navigation out from under you, and + * the rail lights Home on every one of them. */ const HOME_SEGMENTS = [ @@ -20,33 +21,36 @@ function orgRelative(pathname: string, organizationId: string): string | null { return pathname.slice(prefix.length); } +/** + * Whether the page is one automation's own page inside a project — its tabs + * and runs (`/projects//automations//…`). It wears the Automations + * chrome, so it belongs to the Automations section: the rail lights + * Automations, and no Home panel stands beside its canvas, exactly like an + * automation outside a project. The project's Automations tab + * (`/projects//automations`, the bound list) stays Home's. + */ +export function isProjectAutomationPage( + pathname: string, + organizationId: string, +): boolean { + const rest = orgRelative(pathname, organizationId); + return ( + rest !== null && /^\/projects\/[^/]+\/automations\/[^/]+(?:\/|$)/.test(rest) + ); +} + export function isHomePath(pathname: string, organizationId: string): boolean { const rest = orgRelative(pathname, organizationId); if (rest === null) return false; // A shared-chat snapshot is a standalone reading page with its own close // button; it keeps the full width. if (rest.startsWith('/chat/shared/')) return false; + if (isProjectAutomationPage(pathname, organizationId)) return false; return HOME_SEGMENTS.some( (segment) => rest === `/${segment}` || rest.startsWith(`/${segment}/`), ); } -/** - * Whether the Home panel sits beside the page: on every Home route but a - * project's automation workbench (`/projects//automations//…`), - * which wears the Automations chrome and keeps the full width for its - * canvas — exactly like an automation outside a project. The rail still - * marks Home there; the workbench simply has the room. - */ -export function showsHomePanel( - pathname: string, - organizationId: string, -): boolean { - if (!isHomePath(pathname, organizationId)) return false; - const rest = orgRelative(pathname, organizationId) ?? ''; - return !/^\/projects\/[^/]+\/automations\/[^/]+(?:\/|$)/.test(rest); -} - /** What the open page is, as far as the Home panel's highlight cares. */ export type HomeLocation = | { kind: 'chat'; threadId?: string } diff --git a/services/platform/app/hooks/use-navigation-items.test.ts b/services/platform/app/hooks/use-navigation-items.test.ts index e9a0e86039..c0885b4aa6 100644 --- a/services/platform/app/hooks/use-navigation-items.test.ts +++ b/services/platform/app/hooks/use-navigation-items.test.ts @@ -174,6 +174,8 @@ describe('the Home nav entry', () => { '/dashboard/org-1/chat/thread-1', '/dashboard/org-1/projects', '/dashboard/org-1/projects/p-1/tasks/board', + // The project's Automations tab is the project's own page. + '/dashboard/org-1/projects/p-1/automations', '/dashboard/org-1/tasks/t-1', '/dashboard/org-1/conversations/open', ]) { @@ -185,6 +187,10 @@ describe('the Home nav entry', () => { '/dashboard/org-1/settings/account', // A shared-chat snapshot is a standalone reading page. '/dashboard/org-1/chat/shared/token-1', + // An automation opened inside a project is Automations' page. + '/dashboard/org-1/projects/p-1/automations/intake', + '/dashboard/org-1/projects/p-1/automations/intake/editor', + '/dashboard/org-1/projects/p-1/automations/intake/runs/r-1', ]) { expect(item?.isActivePath?.(path), path).toBe(false); } @@ -248,4 +254,27 @@ describe('the Automations nav entry', () => { it('opens the list', () => { expect(automationsItem()?.to).toBe('/dashboard/$id/automations'); }); + + it('lights up on an automation opened inside a project', () => { + const item = automationsItem(); + for (const path of [ + '/dashboard/org-1/automations', + '/dashboard/org-1/automations/intake/runs', + '/dashboard/org-1/projects/p-1/automations/intake', + '/dashboard/org-1/projects/p-1/automations/intake/editor', + '/dashboard/org-1/projects/p-1/automations/intake/runs/r-1', + ]) { + expect(item && isItemActive(item, path), path).toBe(true); + } + for (const path of [ + // The project's own Automations tab stays Home's. + '/dashboard/org-1/projects/p-1/automations', + '/dashboard/org-1/projects/p-1/tasks/board', + '/dashboard/org-1/documents', + '/dashboard/org-1/automationsx', + '/dashboard/org-2/projects/p-1/automations/intake', + ]) { + expect(item && isItemActive(item, path), path).toBe(false); + } + }); }); diff --git a/services/platform/app/hooks/use-navigation-items.ts b/services/platform/app/hooks/use-navigation-items.ts index a8c238a096..862f7e5157 100644 --- a/services/platform/app/hooks/use-navigation-items.ts +++ b/services/platform/app/hooks/use-navigation-items.ts @@ -13,7 +13,10 @@ import { useMemo } from 'react'; import { useCanUseAutomations } from '@/app/features/automations/hooks/use-can-use-automations'; import { useUnreadConversationCount } from '@/app/features/conversations/hooks/queries'; import { useInboxAvailability } from '@/app/features/conversations/hooks/use-inbox-availability'; -import { isHomePath } from '@/app/features/home/lib/home-paths'; +import { + isHomePath, + isProjectAutomationPage, +} from '@/app/features/home/lib/home-paths'; import { useT } from '@/lib/i18n/client'; import { type AppAction, type AppSubject } from '@/lib/permissions/ability'; @@ -174,6 +177,12 @@ export function useNavigationItems(businessId: string): NavigationItems { params: { id: businessId }, href: `/dashboard/${businessId}/automations`, icon: Workflow, + isActivePath: (path: string) => + isPathMatch(`/dashboard/${businessId}/automations`, path) || + // An automation opened inside a project wears the + // Automations chrome, so it is Automations' page: the rail + // says so too. + isProjectAutomationPage(path, businessId), }, ] : []), diff --git a/services/platform/app/lib/org-switch-subpath.test.ts b/services/platform/app/lib/org-switch-subpath.test.ts index e2e180e362..8d79052365 100644 --- a/services/platform/app/lib/org-switch-subpath.test.ts +++ b/services/platform/app/lib/org-switch-subpath.test.ts @@ -11,6 +11,25 @@ describe('resetCrossOrgDetailSubpath', () => { expect(resetCrossOrgDetailSubpath('chat/t_1#mid')).toBe('chat'); }); + it("lands an automation's page inside a project on the Automations list", () => { + // It belongs to Automations, and the project is not in the target org. + expect( + resetCrossOrgDetailSubpath( + 'projects/abc/automations/github__triage/editor', + ), + ).toBe('automations'); + expect( + resetCrossOrgDetailSubpath('projects/abc/automations/x/runs/r1?y=1'), + ).toBe('automations'); + // The project's own Automations tab is the project's page. + expect(resetCrossOrgDetailSubpath('projects/abc/automations')).toBe( + 'projects', + ); + expect(resetCrossOrgDetailSubpath('projects/abc/automations?x=1')).toBe( + 'projects', + ); + }); + it('preserves section roots, filters, and config subpaths', () => { expect(resetCrossOrgDetailSubpath('projects')).toBe('projects'); expect(resetCrossOrgDetailSubpath('projects?archived=true')).toBe( diff --git a/services/platform/app/lib/org-switch-subpath.ts b/services/platform/app/lib/org-switch-subpath.ts index 659cb4169d..662de260da 100644 --- a/services/platform/app/lib/org-switch-subpath.ts +++ b/services/platform/app/lib/org-switch-subpath.ts @@ -23,12 +23,19 @@ * preserved like `agents/{slug}`. */ const ENTITY_DETAIL_SECTIONS = new Set(['projects', 'chat']); +/** `projects//automations//…` — an automation's page inside a + * project. It belongs to the Automations section, but the project does not + * exist in the target organization, so it lands on that section's overview. */ +const PROJECT_AUTOMATION_PAGE = /^projects\/[^/?#]+\/automations\/[^/?#]+/; + /** - * `projects/abc123/tasks` → `projects`; `chat/t_1#mid` → `chat`. Section roots, + * `projects/abc123/tasks` → `projects`; `chat/t_1#mid` → `chat`; + * `projects/abc123/automations/intake/editor` → `automations`. Section roots, * filters, and config subpaths pass through untouched: `projects?archived=true`, * `settings/governance?group=security`. */ export function resetCrossOrgDetailSubpath(subpath: string): string { + if (PROJECT_AUTOMATION_PAGE.test(subpath)) return 'automations'; // The section is the first path segment, before any '/', '?' or '#'. const section = subpath.split(/[/?#]/, 1)[0]; if (!ENTITY_DETAIL_SECTIONS.has(section)) return subpath; diff --git a/services/platform/app/routes/dashboard/$id.tsx b/services/platform/app/routes/dashboard/$id.tsx index 4547470238..1c28f3bb02 100644 --- a/services/platform/app/routes/dashboard/$id.tsx +++ b/services/platform/app/routes/dashboard/$id.tsx @@ -46,8 +46,8 @@ import { HomePanel } from '@/app/features/home/components/home-panel'; import { HomePanelProvider } from '@/app/features/home/components/home-panel-context'; import { hasOwnPhoneHeader, + isHomePath, readHomeLocation, - showsHomePanel, } from '@/app/features/home/lib/home-paths'; import { EmbeddingSetupBanner } from '@/app/features/settings/data-residency/components/embedding-setup-banner'; import { ClockOffsetProvider } from '@/app/hooks/use-clock-offset'; @@ -425,7 +425,7 @@ function DashboardLayout() { * inbox) the Home panel sits beside the page, mounted ONCE here so moving * between those routes keeps it — scroll position, open groups and all — * instead of each page bringing its own navigation. Other sections render - * their page alone. + * their page alone, an automation opened inside a project among them. */ function HomeSectionFrame({ organizationId, @@ -446,7 +446,7 @@ function HomeSectionFrame({ ? `project:${location.projectId ?? ''}` : location.kind, ); - if (!showsHomePanel(pathname, organizationId)) return <>{children}; + if (!isHomePath(pathname, organizationId)) return <>{children}; return (
{!isMobile && } diff --git a/services/platform/app/routes/dashboard/$id/projects/$projectId.tsx b/services/platform/app/routes/dashboard/$id/projects/$projectId.tsx index 46930aae67..0786ca6030 100644 --- a/services/platform/app/routes/dashboard/$id/projects/$projectId.tsx +++ b/services/platform/app/routes/dashboard/$id/projects/$projectId.tsx @@ -90,9 +90,10 @@ function ProjectDetailLayout() { const navigate = useNavigate(); // Project-scoped automation DETAIL routes live under the AUTOMATIONS chrome - // (`AutomationDetailShell` — "Automations / " breadcrumb + its own - // tab strip), not inside the project shell — so those child routes render - // bare, exactly like the agents layout skips its header on detail pages. + // (`AutomationDetailShell` — " / Automations / " breadcrumb + // + its own tab strip), not inside the project shell — so those child + // routes render bare, exactly like the agents layout skips its header on + // detail pages. The rail lights Automations there (`isProjectAutomationPage`). // The project-nav Automations tab opens the bound-automations LIST; detail // keeps this bare-outlet match so only the list stays under project chrome. const isAutomationDetail = useMatch({ diff --git a/services/platform/index.html b/services/platform/index.html index 5e26531869..5258c6182c 100644 --- a/services/platform/index.html +++ b/services/platform/index.html @@ -141,7 +141,7 @@ if (section !== undefined && home.indexOf(section) === -1) return; if (section === 'chat' && match[3] === 'shared') return; // A project's automation workbench keeps the full width, like an - // automation outside a project (see showsHomePanel). + // automation outside a project (see isProjectAutomationPage). if ( section === 'projects' && /\/projects\/[^/]+\/automations\/[^/]+/.test( diff --git a/services/platform/tests/manual/reference/automation.md b/services/platform/tests/manual/reference/automation.md index acd0dd45f3..e36c283c31 100644 --- a/services/platform/tests/manual/reference/automation.md +++ b/services/platform/tests/manual/reference/automation.md @@ -556,6 +556,7 @@ Legend: ✅ fully automated · 🔶 partially automated · ⛔ manual-only (no s | [auth](../suites/auth.md) | `AUTH-F15`, `AUTH-F16`, `AUTH-B7` | ✅ automated | `auth.spec.ts` (SSO error / conditional-access / verbatim-fallback via `?error=` params) + component `log-in-sso-error.test.tsx`; backend redirect `authorize_handler.test.ts` | | [auth](../suites/auth.md) | `AUTH-F1`, `AUTH-F13` | 🔶 partial | `auth.spec.ts` e2e + the `login-idle-notice.test.tsx` unit test | | [auth](../suites/auth.md) | `AUTH-F5`, `AUTH-F10`–`AUTH-F12`, `AUTH-F17`, `AUTH-B3`, `AUTH-B4` | ⛔ manual-only | — (fresh DB / WebAuthn / IdP / mid-session policy / TOTP / needs 2 orgs) | +| [automations](../suites/automations.md) | `AUTO-F57`: an automation opened inside a project starts its trail at the project — the project's name leads to the project, **Automations** to the project's Automations tab, the automation's name (on a run) to its editor; a project that cannot be read leaves a **Projects** crumb, a loading one a skeleton; only the leaf is the current page, a long project name truncates while the leaf stays whole, and the phone's back arrow returns to the project's Automations tab; the rail and the tab bar light **Automations** there, never **Home**, and no Home panel stands beside it | 🔶 Chromium + component | `app/features/automations/components/automation-breadcrumbs.browser.test.tsx`, `app/features/automations/components/automation-breadcrumbs.test.tsx`, `app/hooks/use-navigation-items.test.ts`, `app/features/home/lib/home-paths.test.ts`, `app/components/layout/mobile-bottom-nav.test.tsx`, `app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx`; the pill's glide, the look of the truncation and the DE/FR read stay manual | | [automations](../suites/automations.md) | `AUTO-F1` (toolbar create), `AUTO-F1b`, `AUTO-F4` (org-level row), `AUTO-F8` (yml lane, Later), `AUTO-F12` (leaf switcher), `AUTO-F35` (tab strip walk) | 🔶 partial | `automations.spec.ts` (upload → detail tabs + switcher → delete) | | [automations](../suites/automations.md) | The leaf switcher keeps all automations after project navigation, lists organization automations above a separator and project-specific ones below, searches across both groups, routes each selection to its bound project or the organization, and resets the editor's version and draft when the automation changes | ✅ automated | `app/features/automations/components/automation-breadcrumb-switcher.browser.test.tsx` (real Chromium navigation and grouping), `automation-breadcrumb-switcher.test.tsx` (project binding destinations), `automation-editor.test.tsx` (editor identity reset), `app/components/ui/forms/searchable-select.test.tsx` (group filtering and keyboard navigation) | | [automations](../suites/automations.md) | `AUTO-F12` workbench layout: at phone width the canvas fills the available height at every point — before selection and after — with editor actions inside it never overlapping zoom or navigation; picking a node opens its fields (and Save/Discard) in a sheet over the canvas instead of stacking below it, and the canvas never grows or scrolls under that sheet; at desktop width the canvas and inspector split into columns and fill the tab without scrolling the page | ✅ automated | `app/features/automations/components/automation-editor.browser.test.tsx` (real Chromium layout at 390×844 and 1280×800; tablet node dialogs keep one localized close control in EN/DE/FR; compact automation navigation is covered by `app/components/layout/mobile-bottom-nav.test.tsx`) | @@ -679,7 +680,8 @@ Legend: ✅ fully automated · 🔶 partially automated · ⛔ manual-only (no s | [navigation](../suites/navigation.md) | `NAV-F42` (the header line): a bordered page header is the `h-13` box with its divider inside, so it ends on the line a section panel's header ends on | 🔶 browser | `packages/ui/src/components/layout/adaptive-header.browser.test.tsx` (real Chromium, `SubPanelHeader` beside a bordered `AdaptiveHeaderRoot`); each section's page stays manual | | [navigation](../suites/navigation.md) | `NAV-F1` | 🔶 automated + component | `navigation.spec.ts` (each rail tile commits its section — Knowledge, Automations, Settings from the rail's foot — and Home opens a fresh chat with the Home panel beside it) + `app/hooks/use-navigation-items.test.ts` (the three working sections with Settings pinned to the foot; every tile opens its section's first page, Home a fresh chat; Home lights on every Home route) + `app/components/layout/app-sidebar/sidebar-nav.test.tsx` (tile names, section entry points) + `app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx` (the clicks in a real router); the gliding pill and the active styling stay manual | | [navigation](../suites/navigation.md) | `NAV-F17`, `NAV-F18`, `NAV-F23` (the Home tile's half): Home opens a fresh chat from anywhere, and so do the rail's logo and a desktop visit to `/home`; the tile carries the unread inbox count scoped to the active organization, rests bare while it loads or at zero, skips the read without an inbox, and puts the count's meaning in its accessible name | 🔶 component | `app/hooks/use-navigation-items.test.ts`, `app/components/layout/app-sidebar/sidebar-nav.test.tsx`, `app/components/layout/app-sidebar/app-sidebar.test.tsx`, `app/routes/dashboard/$id/home.test.tsx`; the organization's address resuming the last-READ chat, the live drop after reading and the per-viewer scope (`NAV-F24`) stay manual | -| [navigation](../suites/navigation.md) | `NAV-F16`, `NAV-A9`: every rail tile opens its section's overview from another section and from inside it — Documents from Websites, the automation list from a run, the Settings landing from Teams, a fresh chat from a project's board — and places an earlier build remembered are ignored; exactly one rail tile carries `aria-current="page"`, the one the pill marks, and Enter on a focused tile opens its section | 🔶 Chromium + component | `app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx`, `app/hooks/use-navigation-items.test.ts`, `app/components/layout/app-sidebar/sidebar-nav.test.tsx`, `app/components/layout/mobile-bottom-nav.test.tsx`; the screen-reader read-out, the focus ring and the tab bar on a device stay manual | +| [navigation](../suites/navigation.md) | `NAV-F16`, `NAV-A9`: every rail tile opens its section's overview from another section and from inside it — Documents from Websites, the automation list from a run or from an automation opened inside a project, the Settings landing from Teams, a fresh chat from a project's board — and places an earlier build remembered are ignored; exactly one rail tile carries `aria-current="page"`, the one the pill marks (Automations on an automation opened inside a project), and Enter on a focused tile opens its section | 🔶 Chromium + component | `app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx`, `app/hooks/use-navigation-items.test.ts`, `app/components/layout/app-sidebar/sidebar-nav.test.tsx`, `app/components/layout/mobile-bottom-nav.test.tsx`; the screen-reader read-out, the focus ring and the tab bar on a device stay manual | +| [navigation](../suites/navigation.md) | `NAV-B19` (the target's half): switching organization from an automation's page inside a project lands on the other organization's Automations list, while the project's own Automations tab lands on its Projects list | 🔶 unit | `app/lib/org-switch-subpath.test.ts`; the switch itself stays manual | | [navigation](../suites/navigation.md) / [projects](../suites/projects.md) | `NAV-F41`, `NAV-F26`, `PROJ-F28` (the e2e half): the Home panel stays beside a project opened from its **Projects** section, the project row turns current, **All projects** opens the list beside the panel; the view switcher's **Tasks** radio takes `aria-checked` | 🔶 automated | `navigation.spec.ts` (the Home panel); the panel's persistence across routes, **New project**, the collapse and the switcher's memory and arrow keys stay manual | | [navigation](../suites/navigation.md) / [conversations](../suites/conversations.md) | `NAV-F26`–`NAV-F30`, `NAV-A5`, `CONV-G1` (the component half): chats, tasks and conversations share one stream, newest first in day bands with pinned chats above them; each row's context line; the open item marked current; the view narrowed and remembered; the draft row while a fresh chat is written; the empty views and the way on from each (**New chat**, **All projects**); no Inbox view without an inbox; the panel's axe audit; which routes are Home, what the open item is, the compact ages per locale | 🔶 component | `app/features/home/components/home-panel.test.tsx`, `app/features/home/hooks/use-home-data.test.tsx` (All reads the OPEN conversations whatever the Inbox view shows, skips the read without an inbox, lists a task once when it is both assigned to you and waiting on your review, counts the switcher's dots), `app/features/home/lib/home-items.test.ts` (day bands on local midnight, across a daylight-saving change too), `app/features/home/lib/home-paths.test.ts` (which routes are Home and which of them carry the panel — not a project's automation workbench), `app/features/home/hooks/use-compact-age.test.tsx`; real layout and drops are `home-panel.browser.test.tsx`'s (see the `CHAT-B11` row); the glide, scrolling an open task or conversation into view, live ages and the menus' keyboard visibility stay manual | | [navigation](../suites/navigation.md) | `NAV-P3`, `NAV-F31` (the boot half): the pre-hydration script reserves the Home panel on every Home route, keeps a folded panel folded only on the pages that can unfold it (a chat, a task page, an open conversation, a project's page), reserves nothing outside Home or on a shared-chat snapshot, and keeps the composer stand-in to chat routes | 🔶 unit | `app/components/layout/boot-chat-script.test.ts`, `app/components/layout/boot-shell-render.test.tsx`; the real geometry on a throttled reload stays manual | diff --git a/services/platform/tests/manual/reference/pins.md b/services/platform/tests/manual/reference/pins.md index 28fdeaa6b1..873e92f8e0 100644 --- a/services/platform/tests/manual/reference/pins.md +++ b/services/platform/tests/manual/reference/pins.md @@ -32,8 +32,9 @@ time you are tempted to shorten one. | `AUTH-F18` | Better Auth's browser fetch plugin already follows successful consent/continuation responses. A second navigation can race the callback's one-use state and code; `oauth-authorization.test.tsx` pins single redirect ownership, StrictMode continuation and both consent actions. | | `SET-A7` | The device label and revoked badge competed for one non-wrapping flex row, so a long label shrank the badge into an ellipsis. The group wraps and the status keeps its intrinsic width. This box holds visible EN/DE/FR status text at desktop and narrow widths; `webdav-settings.test.tsx` separately holds active/null and revoked action states. | -| `NAV-F1` | The rail's first tile is **Home** (`navigation.home`), not Chat, and there is no Projects or Inbox tile: chats, projects with their tasks, and the inbox fold into Home, whose tile opens a fresh chat and lights on every Home route through `isHomePath` rather than its own href. New chat is the panel header's action and the Home tile's, from anywhere. A rail click always commits the section's default entry, whatever the user did there before — `sidebar-nav.test.tsx` and `use-navigation-items.test.ts` hold those rules, `navigation.spec.ts` drives the clicks; this box judges the labels, order, the gliding pill and the active styling. | +| `NAV-F1` | The rail's first tile is **Home** (`navigation.home`), not Chat, and there is no Projects or Inbox tile: chats, projects with their tasks, and the inbox fold into Home, whose tile opens a fresh chat and lights on every Home route through `isHomePath` rather than its own href — except an automation opened inside a project, which is Automations' page (`isProjectAutomationPage`). New chat is the panel header's action and the Home tile's, from anywhere. A rail click always commits the section's default entry, whatever the user did there before — `sidebar-nav.test.tsx` and `use-navigation-items.test.ts` hold those rules, `navigation.spec.ts` drives the clicks; this box judges the labels, order, the gliding pill and the active styling. | | `NAV-F16` / `NAV-F18` | The rail's per-section memory shipped twice — a remembered section place, then (#3959) a remembered automation, project and Knowledge tab, with Home resuming the last-read chat — and was retired twice on the owner's call (2026-09-20, 2026-10-08): a tile always opens its section's overview, also from inside the section, and Home always a fresh chat. Places an earlier build stored stay in browsers and are never read. `use-navigation-items.test.ts` asserts that no item carries history state and that the stored places are ignored; `sidebar-nav.browser.test.tsx` drives the clicks in a real router. Do not reintroduce it. The organization's own address still resumes the last-read chat (the sign-in landing), which NAV-F18 keeps under manual watch. | +| `AUTO-F57` | The owner reversed the 2026-09-27 call that project automations stay Home-routed (2026-10-08): an automation opened from a project's Automations tab showed no project and left the rail on Home. The trail now starts at the project, and its Automations crumb returns to the project's Automations tab, where the user came from; the rail follows the chrome (`isProjectAutomationPage`). Both ancestor crumbs are prefixes of the URL, so they need `activeOptions={{ exact: true }}` or TanStack marks them current beside the leaf — `automation-breadcrumbs.browser.test.tsx` checks it in a real router. An organization-list row bound to exactly one project opens here too (`AUTO-F4`), by design: its runs belong to that project. | | `NAV-A9` | TanStack's `Link` stamps `aria-current="page"` only when the URL starts with the link's own `to`, so the rail named no current section on Knowledge's other tabs or on most Home pages, while the pill still marked one. The rail now sets `aria-current` from `isItemActive`, the pill's own rule; `sidebar-nav.browser.test.tsx` checks in a real router that exactly one tile is current and that it is the one the pill marks. | | `NAV-F31` | The panel folds only on a chat, a task page, an open conversation and a project's page, because only their headers carry the toggle that brings it back; the projects list or the inbox index has none, so a stored fold is ignored there on purpose — otherwise the panel could be hidden with no way to show it. A project's page joined on 2026-10-02: its header had no toggle, so the panel could not be hidden beside a board. The fold rule and the phone-header rule (RESP-F12) are separate: a project folds its panel but keeps the shell bar on a phone. The boot script applies the same rules before paint (`home-paths.test.ts` `isPanelCollapsible` / `hasOwnPhoneHeader`, `boot-chat-script.test.ts`). | | `NAV-F9` | The API page now links developer prose and raw OpenAPI separately. `app/routes/docs.test.tsx` holds link destinations and accessibility; the manual box judges readable and keyboard-reachable links at phone width. | diff --git a/services/platform/tests/manual/suites/automations.md b/services/platform/tests/manual/suites/automations.md index fdbd4c0113..3bd16859cb 100644 --- a/services/platform/tests/manual/suites/automations.md +++ b/services/platform/tests/manual/suites/automations.md @@ -1,6 +1,6 @@ # Automations -> **Prefix** `AUTO-` · **Reset** none · **Cost** 80 boxes +> **Prefix** `AUTO-` · **Reset** none · **Cost** 81 boxes Exercise the draft→deploy→version automation surface: each automation is one workflow document under a name, with an append-only version history, at most @@ -620,6 +620,23 @@ output: appears. Turn **Enabled** off and **Save** → no run starts at the next minute. (Without a runnable harness the agent run itself fails at its launch; the start and the coalesced occurrence still show.) +- [ ] `AUTO-F57` · **An automation opened in a project shows its project** — + Bind an automation to exactly one project, open the project, choose its + **Automations** tab (`automations.title`) and open the automation, then + one of its runs → The URL stays under + `/dashboard/{org}/projects/{projectId}/automations/{slug}/…`; the trail + reads ` / Automations / ` (on the run + `… / / Run`, `automations.runs.breadcrumb`); the project's + name opens the project's board and **Automations** its **Automations** + tab; only the leaf heading carries `aria-current="page"` in the trail; + the rail lights **Automations** (`navigation.automations`) and the pill + glides there, not to **Home**; a long project name truncates without + hiding the automation's name. Below 768 px the back arrow + (`common.aria.back`) returns to the project's **Automations** tab (from + a run: to the automation) and the tab bar lights **Automations**. Open + the same automation from the organization's list (`AUTO-F4`) → The same + trail and rail. Choose **Automations** in the rail → The organization's + list. Repeat in DE and FR (**Automatisierungen** / **Automatisations**). ## Boundary & error tests diff --git a/services/platform/tests/manual/suites/navigation.md b/services/platform/tests/manual/suites/navigation.md index a412e3e642..f5be74e179 100644 --- a/services/platform/tests/manual/suites/navigation.md +++ b/services/platform/tests/manual/suites/navigation.md @@ -1,6 +1,6 @@ # Navigation & shell -> **Prefix** `NAV-` · **Reset** none · **Cost** 71 boxes +> **Prefix** `NAV-` · **Reset** none · **Cost** 72 boxes Exercise cross-app navigation — the primary side-nav rail and the section panels beside the page (the Home panel with its projects and its one stream of @@ -68,7 +68,8 @@ loaded, and reads **No teams** for an account in none. The main nav holds exactly those three tiles in that order — no Chat, Projects or Inbox tile; one highlight pill glides from the tile you left to the one you chose; Home stays lit on every Home route (a chat, a project, a - task page, the inbox); the rail persists across navigations. + task page, the inbox) — but an automation opened inside a project lights + **Automations** (`AUTO-F57`); the rail persists across navigations. - [ ] `NAV-F2` · **Breadcrumbs** — Open `/dashboard/{org}/projects`, click a project row to open it (`/dashboard/{org}/projects/{projectId}`) → The adaptive header shows a breadcrumb trail (e.g. **Projects** → project name); @@ -279,8 +280,8 @@ loaded, and reads **No teams** for an account in none. chat (`/dashboard/{org}/chat/shared/{shareToken}`) and a project's automation workbench (`/dashboard/{org}/projects/{projectId}/automations/{slug}/…`, full width - like an automation outside a project, the rail still on **Home**) show no - Home panel. + like an automation outside a project, the rail on **Automations**, + `AUTO-F57`) show no Home panel. - [ ] `NAV-F42` · **The Settings panel's header and the page header end on one line** — At ≥ 768 px open `/dashboard/{org}/settings/account` and two more settings pages, then zoom the browser to 200 % over the place where the panel meets @@ -618,6 +619,13 @@ loaded, and reads **No teams** for an account in none. HTML 503 for a navigation and a direct `offline.html` visit → The green connection screen runs its recovery script under the existing CSP and recovers when the gateway returns. +- [ ] `NAV-B19` · **Switching organization from a project's automation** — + Open `/dashboard/{org}/projects/{projectId}/automations/{slug}/editor`, then + switch to a second organization (`NAV-F5`) → You land on + `/dashboard/{otherOrg}/automations` with **Automations** lit, never on a + "not found" for the other organization's project. From the project's own + **Automations** tab (`/dashboard/{org}/projects/{projectId}/automations`) + you land on its **Projects** list instead. ## Accessibility (WCAG 2.1 AA) @@ -659,11 +667,12 @@ loaded, and reads **No teams** for an account in none. - [ ] `NAV-A8` · **Keep pinch zoom available after focusing a compact field on iOS** → In Safari 10 or later, open a compact field such as an inline rename, focus it and dismiss the keyboard: focus does not enlarge the page automatically, and a manual pinch still enlarges and restores it. Repeat the manual pinch in an installed home-screen app and in another iOS browser or an embedded web view; those contexts retain their original viewport settings and may still zoom on focus. Repeat on Android: manual pinch remains available. - [ ] `NAV-A9` · **The rail names the section you are in** → In the accessibility tree (or with a screen reader) visit - `/dashboard/{org}/websites`, `/dashboard/{org}/automations/{slug}/runs`, a + `/dashboard/{org}/websites`, `/dashboard/{org}/automations/{slug}/runs`, + `/dashboard/{org}/projects/{projectId}/automations/{slug}/editor`, a project's board and `/dashboard/{org}/settings/teams` → Exactly one tile of the rail carries `aria-current="page"`: **Knowledge**, **Automations**, - **Home**, and **Settings** at the rail's foot — always the tile the pill - sits on. Below 768 px the tab bar's buttons say the same. Tab to a tile and + **Automations**, **Home**, and **Settings** at the rail's foot — always the + tile the pill sits on. Below 768 px the tab bar's buttons say the same. Tab to a tile and press Enter → Its section's first page opens, and the tile keeps a visible focus ring. From db84fd0a3117bc3b002c0b0ca537288ff8443883 Mon Sep 17 00:00:00 2001 From: yannickmonney Date: Thu, 8 Oct 2026 01:56:09 +0200 Subject: [PATCH 3/7] fix(platform): keep a project automation's trail reachable An automation opened under a project whose read answers without it (deleted, or out of the reader's reach) now gets the organization's trail: Automations and the phone's back arrow lead to the org list instead of a project page that only says it was not found. A failed read keeps the project trail, whose tab offers a retry. Long project and automation names in the trail are capped, so the Run title on a run page keeps its room, and a cut name shows whole in a tooltip on hover or keyboard focus. --- .../automation-breadcrumbs.browser.test.tsx | 99 ++++++++++++- .../automation-breadcrumbs.test.tsx | 109 ++++++++++++-- .../components/automation-breadcrumbs.tsx | 140 +++++++++++++++--- .../tests/manual/reference/automation.md | 2 +- .../platform/tests/manual/reference/pins.md | 1 + .../tests/manual/suites/automations.md | 28 +++- 6 files changed, 334 insertions(+), 45 deletions(-) diff --git a/services/platform/app/features/automations/components/automation-breadcrumbs.browser.test.tsx b/services/platform/app/features/automations/components/automation-breadcrumbs.browser.test.tsx index bcb8e3baa5..157b1b157b 100644 --- a/services/platform/app/features/automations/components/automation-breadcrumbs.browser.test.tsx +++ b/services/platform/app/features/automations/components/automation-breadcrumbs.browser.test.tsx @@ -22,17 +22,19 @@ import '@/app/globals.css'; * The trail of an automation opened inside a project, under a real router in * Chromium: where its crumbs lead, that only the leaf names the current page * (the ancestors are prefixes of the URL, which TanStack would otherwise mark - * current too), the phone's back arrow, and a long project name that must - * not crowd the automation's own name out. + * current too), the phone's back arrow, and long project and automation + * names that must not crowd the page's own title out, whose whole text a + * tooltip shows while they are cut. */ const fixtures = vi.hoisted(() => ({ projectName: 'Apollo', + automationName: 'Intake', })); vi.mock('../hooks/queries', () => ({ useAutomation: () => ({ - data: { presentation: { name: 'Intake' } }, + data: { presentation: { name: fixtures.automationName } }, isPending: false, }), useAutomations: () => ({ data: [], isPending: false }), @@ -42,20 +44,29 @@ vi.mock('@/app/features/projects/hooks/queries', () => ({ useProject: () => ({ project: { name: fixtures.projectName }, isLoading: false, + unavailable: false, }), })); beforeEach(async () => { fixtures.projectName = 'Apollo'; + fixtures.automationName = 'Intake'; + fixedHeader.width = undefined; await page.viewport(1280, 800); }); afterEach(cleanup); +/** The header's width at `md` in the app: the viewport less the rail. */ +const fixedHeader = { width: undefined as number | undefined }; + function AutomationPage() { const { id, automationSlug, projectId } = useParams({ strict: false }); return ( -
+
{ expect(leaf.getBoundingClientRect().width).toBeGreaterThan(0); expect(leaf.getBoundingClientRect().right).toBeLessThanOrEqual(1280); }); + + it('caps a long automation name on a run so the Run title keeps its room', async () => { + // At `md` the header is the viewport less the 3rem rail and the padding. + await page.viewport(768, 800); + fixedHeader.width = 720; + fixtures.projectName = 'Quarterly regional operations review'; + fixtures.automationName = + 'Chase every overdue invoice across all regional customer accounts'; + renderTrail(`${PROJECT_AUTOMATION}/intake/runs/r-1`); + + const automation = await screen.findByRole('link', { + name: fixtures.automationName, + }); + await waitFor(() => + expect(automation.scrollWidth).toBeGreaterThan(automation.clientWidth), + ); + expect(automation.getBoundingClientRect().width).toBeLessThanOrEqual(192); + const header = screen.getByRole('banner').getBoundingClientRect(); + const leaf = screen + .getByRole('heading', { level: 1, name: 'Run' }) + .getBoundingClientRect(); + expect(leaf.width).toBeGreaterThan(0); + expect(leaf.right).toBeLessThanOrEqual(header.right); + }); + + it('shows a cut name whole in a tooltip, on hover and on focus', async () => { + fixtures.projectName = + `Quarterly regional operations ${'review '.repeat(13)}`.trim(); + const { user } = renderTrail(`${PROJECT_AUTOMATION}/intake/editor`); + + const project = await screen.findByRole('link', { + name: fixtures.projectName, + }); + await waitFor(() => + expect(project.scrollWidth).toBeGreaterThan(project.clientWidth), + ); + + await user.hover(project); + expect(await screen.findByRole('tooltip')).toHaveTextContent( + fixtures.projectName, + ); + await user.unhover(project); + await waitFor(() => expect(screen.queryByRole('tooltip')).toBeNull()); + + // The back arrow is the phone's; on a computer the project's name is the + // first stop. + await user.tab(); + expect(project).toHaveFocus(); + expect(await screen.findByRole('tooltip')).toHaveTextContent( + fixtures.projectName, + ); + await user.keyboard('{Escape}'); + await waitFor(() => expect(screen.queryByRole('tooltip')).toBeNull()); + }); + + it('opens no tooltip over a name that fits', async () => { + const { user } = renderTrail(`${PROJECT_AUTOMATION}/intake/editor`); + + const project = await screen.findByRole('link', { name: 'Apollo' }); + await user.hover(project); + // Past the tooltip's open delay. + await new Promise((resolve) => setTimeout(resolve, 500)); + expect(screen.queryByRole('tooltip')).toBeNull(); + }); + + it("keeps the phone's back arrow an icon button on a run", async () => { + await page.viewport(390, 800); + fixtures.automationName = + 'Chase every overdue invoice across all regional customer accounts'; + renderTrail(`${PROJECT_AUTOMATION}/intake/runs/r-1`); + + const back = await screen.findByRole('link', { name: 'Back' }); + expect(back).toBeVisible(); + expect(back).toHaveAttribute('href', `${PROJECT_AUTOMATION}/intake/editor`); + const box = back.getBoundingClientRect(); + // The capped crumb's classes leave the square icon button as it was. + expect(box.width).toBe(box.height); + expect(box.width).toBeGreaterThanOrEqual(24); + expect(back.querySelector('svg')).toBeVisible(); + }); }); diff --git a/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx b/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx index af8aa24191..52f9beb3af 100644 --- a/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx +++ b/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx @@ -17,6 +17,7 @@ const fixtures = vi.hoisted(() => ({ projectRead: { project: { name: 'Apollo' } as { name: string } | null, isLoading: false, + unavailable: false, }, projectReadArgs: [] as (string | undefined)[], })); @@ -30,6 +31,14 @@ interface MockLinkProps extends React.AnchorHTMLAttributes { activeOptions?: unknown; } +/** The path a mocked link resolves to: `to` with its params filled in. */ +function mockHref({ to, params }: Pick) { + return Object.entries(params ?? {}).reduce( + (path, [key, value]) => path.replace(`$${key}`, value), + to ?? '', + ); +} + vi.mock('@tanstack/react-router', () => ({ Link: React.forwardRef(function Link( { @@ -42,16 +51,24 @@ vi.mock('@tanstack/react-router', () => ({ }, ref, ) { - const href = Object.entries(params ?? {}).reduce( - (path, [key, value]) => path.replace(`$${key}`, value), - to ?? '', - ); return ( - + {children} ); }), + // A link over the caller's own anchor: the anchor gets the resolved href + // and every prop the router does not consume. + createLink: (Anchor: React.ComponentType>) => + function CreatedLink({ + to, + params, + preload: _preload, + activeOptions: _active, + ...rest + }: MockLinkProps & Record) { + return ; + }, useMatch: ({ from }: { from: string }) => { if (!fixtures.onRun) return undefined; if (from.includes('/runs/$runId')) return { params: {} }; @@ -96,7 +113,11 @@ describe('AutomationBreadcrumbs', () => { // Empty listing → the leaf renders the plain name, so the cases that // assert exact h1 names stay valid without knowing about the switcher. fixtures.automations = []; - fixtures.projectRead = { project: { name: 'Apollo' }, isLoading: false }; + fixtures.projectRead = { + project: { name: 'Apollo' }, + isLoading: false, + unavailable: false, + }; fixtures.projectReadArgs = []; }); @@ -189,8 +210,68 @@ describe('AutomationBreadcrumbs', () => { ); }); - it('falls back to the project list when the project cannot be read', () => { - fixtures.projectRead = { project: null, isLoading: false }; + it('falls back to the organization trail when the project is gone', () => { + // Deleted, or out of this person's reach: the read answers without a + // project, and its Automations tab would only say it was not found. + fixtures.projectRead = { + project: null, + isLoading: false, + unavailable: false, + }; + + render( + , + ); + + expect(trailLinks()).toEqual([ + ['Automations', '/dashboard/org-1/automations'], + ]); + expect(screen.getByRole('link', { name: /back/i })).toHaveAttribute( + 'href', + '/dashboard/org-1/automations', + ); + }); + + it("keeps a gone project's run on the route it was opened under", () => { + fixtures.projectRead = { + project: null, + isLoading: false, + unavailable: false, + }; + fixtures.presentation = { name: 'Chase overdue invoices' }; + fixtures.onRun = true; + + render( + , + ); + + // The automation's own pages open without their project, so the name + // still leads there; only the list falls back to the organization's. + expect(trailLinks()).toEqual([ + ['Automations', '/dashboard/org-1/automations'], + [ + 'Chase overdue invoices', + '/dashboard/org-1/projects/proj-1/automations/billing__dunning/editor', + ], + ]); + }); + + it('falls back to the project list when the project read fails', () => { + // A failed read is not a gone project: the project's Automations tab + // names the failure and offers a retry, so the trail keeps leading there. + fixtures.projectRead = { + project: null, + isLoading: false, + unavailable: true, + }; render( { }); it('holds the project crumb as a skeleton while the project loads', () => { - fixtures.projectRead = { project: null, isLoading: true }; + fixtures.projectRead = { + project: null, + isLoading: true, + unavailable: false, + }; render( { expect(trailLinks()).toEqual([ ['Automations', '/dashboard/org-1/automations'], ]); - expect(fixtures.projectReadArgs).toEqual([]); + // Asked with no project, the read is skipped. + expect(fixtures.projectReadArgs.length).toBeGreaterThan(0); + expect( + fixtures.projectReadArgs.every((projectId) => projectId === undefined), + ).toBe(true); }); it('on a run, links the automation name back to the automation page', () => { diff --git a/services/platform/app/features/automations/components/automation-breadcrumbs.tsx b/services/platform/app/features/automations/components/automation-breadcrumbs.tsx index 0787e40809..91871d6699 100644 --- a/services/platform/app/features/automations/components/automation-breadcrumbs.tsx +++ b/services/platform/app/features/automations/components/automation-breadcrumbs.tsx @@ -14,10 +14,11 @@ * ` / Automations / ` (and `… / Run`). The project's name * returns to the project, and Automations to the project's own Automations * tab, the list the automation was opened from — so the phone's back arrow - * leads there too. + * leads there too. A project the read answers without (deleted, or out of + * this person's reach) has no tab to return to, so the trail is then the + * organization's. */ -import { cn } from '@tale/ui/cn'; import { HEADER_CRUMB_LINK_CLASS, HeaderBreadcrumbs, @@ -25,7 +26,15 @@ import { import { useLocale } from '@tale/ui/i18n/locale-provider'; import { SkeletonBox } from '@tale/ui/skeleton'; import { Skeletonize } from '@tale/ui/skeleton-context'; -import { Link, useMatch } from '@tanstack/react-router'; +import { Tooltip } from '@tale/ui/tooltip'; +import { createLink, Link, useMatch } from '@tanstack/react-router'; +import { + useRef, + useState, + type ComponentProps, + type FocusEvent, + type PointerEvent, +} from 'react'; import { useProject } from '@/app/features/projects/hooks/queries'; import { asProjectId } from '@/app/features/projects/hooks/use-project-id-param'; @@ -44,7 +53,8 @@ export function AutomationBreadcrumbs({ organizationId: string; automationSlug: string; /** When set, the trail starts at this project and every crumb stays on - * the project route. */ + * the project route — unless the project is gone, when the trail is the + * organization's. */ projectId?: string; }) { const { t } = useT('automations'); @@ -58,6 +68,24 @@ export function AutomationBreadcrumbs({ ); const slugParam = automationSlugToParam(automationSlug); + // The project the automation is opened in; the project shell's loader + // already read it, so it is usually there on the first frame. Outside a + // project the read is skipped. + const projectRead = useProject( + projectId !== undefined ? asProjectId(projectId) : undefined, + ); + // The read ANSWERED without a project: it is gone, or out of this person's + // reach. Its Automations tab would only say the project was not found, so + // the trail is the organization's, as for an automation opened outside a + // project. A read that failed is not that: the project trail stays, and + // the tab it leads to names the failure and offers a retry. + const projectGone = + projectId !== undefined && + !projectRead.isLoading && + projectRead.project === null && + !projectRead.unavailable; + const trailProjectId = projectGone ? undefined : projectId; + // Either shell can host a run under this slug; the trail only cares that // we ARE on a run, so the name crumb can point back at the automation. const onOrgRun = @@ -77,10 +105,10 @@ export function AutomationBreadcrumbs({ // URL, so it matches exactly: TanStack would otherwise mark it as the // current page beside the leaf. const listCrumb = - projectId !== undefined ? ( + trailProjectId !== undefined ? ( @@ -98,10 +126,13 @@ export function AutomationBreadcrumbs({ ); // The automation's default surface, exactly where a list row lands — the - // bare entity URL would only forward there. + // bare entity URL would only forward there. It stays on the route the run + // was opened under: an automation's pages inside a project render without + // the project's own shell, so they open even when the project is gone. + // Capped like the project's name, so a long name leaves the leaf its room. const automationCrumb = projectId !== undefined ? ( - {displayName} - + ) : ( - {displayName} - + ); const nameLeaf = ( @@ -149,14 +182,16 @@ export function AutomationBreadcrumbs({ ), }, @@ -171,22 +206,24 @@ export function AutomationBreadcrumbs({ } /** - * The project an automation was opened in, leading back to it. The project - * shell's loader already read it, so the name is usually there on the first - * frame. Like the Automations crumb it is an ancestor of the current URL, so - * it matches exactly. A long name truncates, so the automation's own name - * keeps its room; the accessible name stays whole. A project that cannot be - * read leaves the way out its not-found page offers: the project list. + * The project an automation was opened in, leading back to it. Like the + * Automations crumb it is an ancestor of the current URL, so it matches + * exactly. A long name is capped, so the automation's own name keeps its + * room. A read that failed leaves the way out the project's error page + * offers: the project list. */ function ProjectCrumb({ organizationId, projectId, + project, + isLoading, }: { organizationId: string; projectId: string; + project: { name: string } | null; + isLoading: boolean; }) { const { t } = useT('projects'); - const { project, isLoading } = useProject(asProjectId(projectId)); if (isLoading) { return ( @@ -198,14 +235,15 @@ function ProjectCrumb({ ); } return project ? ( - {project.name} - + ) : ( ); } + +/** + * An ancestor crumb that names one thing — a project, an automation — whose + * name can be long. It is capped in width so the trail keeps room for the + * page's own title, and while the name is cut its whole text shows in a + * tooltip, on hover and on keyboard focus alike; the accessible name is + * always whole. The crumb's list item is a flex row, which already makes + * the link a block box, so the cap carries no display class — and must not: + * the phone's back arrow re-uses the immediate parent's link, with an icon + * in place of the name, and keeps the icon button's own layout. An icon + * never overflows, so the arrow opens no tip. + */ +function CappedCrumbAnchor({ + fullName, + children, + className, + onPointerEnter, + onFocus, + ...props +}: ComponentProps<'a'> & { fullName: string }) { + const [open, setOpen] = useState(false); + // Measured when a tip can open — on pointer entry and on focus — rather + // than observed: the cut only matters at those moments. + const cut = useRef(false); + const measure = (element: HTMLAnchorElement) => { + cut.current = element.scrollWidth > element.clientWidth + 1; + }; + + return ( + setOpen(next && cut.current)} + > + ) => { + measure(event.currentTarget); + onPointerEnter?.(event); + }} + onFocus={(event: FocusEvent) => { + measure(event.currentTarget); + onFocus?.(event); + }} + > + {children} + + + ); +} + +const CappedCrumbLink = createLink(CappedCrumbAnchor); diff --git a/services/platform/tests/manual/reference/automation.md b/services/platform/tests/manual/reference/automation.md index e36c283c31..f81307592f 100644 --- a/services/platform/tests/manual/reference/automation.md +++ b/services/platform/tests/manual/reference/automation.md @@ -556,7 +556,7 @@ Legend: ✅ fully automated · 🔶 partially automated · ⛔ manual-only (no s | [auth](../suites/auth.md) | `AUTH-F15`, `AUTH-F16`, `AUTH-B7` | ✅ automated | `auth.spec.ts` (SSO error / conditional-access / verbatim-fallback via `?error=` params) + component `log-in-sso-error.test.tsx`; backend redirect `authorize_handler.test.ts` | | [auth](../suites/auth.md) | `AUTH-F1`, `AUTH-F13` | 🔶 partial | `auth.spec.ts` e2e + the `login-idle-notice.test.tsx` unit test | | [auth](../suites/auth.md) | `AUTH-F5`, `AUTH-F10`–`AUTH-F12`, `AUTH-F17`, `AUTH-B3`, `AUTH-B4` | ⛔ manual-only | — (fresh DB / WebAuthn / IdP / mid-session policy / TOTP / needs 2 orgs) | -| [automations](../suites/automations.md) | `AUTO-F57`: an automation opened inside a project starts its trail at the project — the project's name leads to the project, **Automations** to the project's Automations tab, the automation's name (on a run) to its editor; a project that cannot be read leaves a **Projects** crumb, a loading one a skeleton; only the leaf is the current page, a long project name truncates while the leaf stays whole, and the phone's back arrow returns to the project's Automations tab; the rail and the tab bar light **Automations** there, never **Home**, and no Home panel stands beside it | 🔶 Chromium + component | `app/features/automations/components/automation-breadcrumbs.browser.test.tsx`, `app/features/automations/components/automation-breadcrumbs.test.tsx`, `app/hooks/use-navigation-items.test.ts`, `app/features/home/lib/home-paths.test.ts`, `app/components/layout/mobile-bottom-nav.test.tsx`, `app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx`; the pill's glide, the look of the truncation and the DE/FR read stay manual | +| [automations](../suites/automations.md) | `AUTO-F57` and the trail half of `AUTO-B12`: an automation opened inside a project starts its trail at the project — the project's name leads to the project, **Automations** to the project's Automations tab, the automation's name (on a run) to its editor; a project the read answers without (deleted, or out of reach) gives the organization's trail, whose **Automations** and back arrow lead to the organization's list, a read that failed leaves a **Projects** crumb, a loading one a skeleton; only the leaf is the current page, a long project or automation name truncates while the leaf keeps its room and shows whole in a tooltip on hover or focus (never over a name that fits), and the phone's back arrow returns to the project's Automations tab; the rail and the tab bar light **Automations** there, never **Home**, and no Home panel stands beside it | 🔶 Chromium + component | `app/features/automations/components/automation-breadcrumbs.browser.test.tsx`, `app/features/automations/components/automation-breadcrumbs.test.tsx`, `app/hooks/use-navigation-items.test.ts`, `app/features/home/lib/home-paths.test.ts`, `app/components/layout/mobile-bottom-nav.test.tsx`, `app/components/layout/app-sidebar/sidebar-nav.browser.test.tsx`; the pill's glide, the look of the truncation and the DE/FR read stay manual | | [automations](../suites/automations.md) | `AUTO-F1` (toolbar create), `AUTO-F1b`, `AUTO-F4` (org-level row), `AUTO-F8` (yml lane, Later), `AUTO-F12` (leaf switcher), `AUTO-F35` (tab strip walk) | 🔶 partial | `automations.spec.ts` (upload → detail tabs + switcher → delete) | | [automations](../suites/automations.md) | The leaf switcher keeps all automations after project navigation, lists organization automations above a separator and project-specific ones below, searches across both groups, routes each selection to its bound project or the organization, and resets the editor's version and draft when the automation changes | ✅ automated | `app/features/automations/components/automation-breadcrumb-switcher.browser.test.tsx` (real Chromium navigation and grouping), `automation-breadcrumb-switcher.test.tsx` (project binding destinations), `automation-editor.test.tsx` (editor identity reset), `app/components/ui/forms/searchable-select.test.tsx` (group filtering and keyboard navigation) | | [automations](../suites/automations.md) | `AUTO-F12` workbench layout: at phone width the canvas fills the available height at every point — before selection and after — with editor actions inside it never overlapping zoom or navigation; picking a node opens its fields (and Save/Discard) in a sheet over the canvas instead of stacking below it, and the canvas never grows or scrolls under that sheet; at desktop width the canvas and inspector split into columns and fill the tab without scrolling the page | ✅ automated | `app/features/automations/components/automation-editor.browser.test.tsx` (real Chromium layout at 390×844 and 1280×800; tablet node dialogs keep one localized close control in EN/DE/FR; compact automation navigation is covered by `app/components/layout/mobile-bottom-nav.test.tsx`) | diff --git a/services/platform/tests/manual/reference/pins.md b/services/platform/tests/manual/reference/pins.md index 873e92f8e0..9e514aaf54 100644 --- a/services/platform/tests/manual/reference/pins.md +++ b/services/platform/tests/manual/reference/pins.md @@ -35,6 +35,7 @@ time you are tempted to shorten one. | `NAV-F1` | The rail's first tile is **Home** (`navigation.home`), not Chat, and there is no Projects or Inbox tile: chats, projects with their tasks, and the inbox fold into Home, whose tile opens a fresh chat and lights on every Home route through `isHomePath` rather than its own href — except an automation opened inside a project, which is Automations' page (`isProjectAutomationPage`). New chat is the panel header's action and the Home tile's, from anywhere. A rail click always commits the section's default entry, whatever the user did there before — `sidebar-nav.test.tsx` and `use-navigation-items.test.ts` hold those rules, `navigation.spec.ts` drives the clicks; this box judges the labels, order, the gliding pill and the active styling. | | `NAV-F16` / `NAV-F18` | The rail's per-section memory shipped twice — a remembered section place, then (#3959) a remembered automation, project and Knowledge tab, with Home resuming the last-read chat — and was retired twice on the owner's call (2026-09-20, 2026-10-08): a tile always opens its section's overview, also from inside the section, and Home always a fresh chat. Places an earlier build stored stay in browsers and are never read. `use-navigation-items.test.ts` asserts that no item carries history state and that the stored places are ignored; `sidebar-nav.browser.test.tsx` drives the clicks in a real router. Do not reintroduce it. The organization's own address still resumes the last-read chat (the sign-in landing), which NAV-F18 keeps under manual watch. | | `AUTO-F57` | The owner reversed the 2026-09-27 call that project automations stay Home-routed (2026-10-08): an automation opened from a project's Automations tab showed no project and left the rail on Home. The trail now starts at the project, and its Automations crumb returns to the project's Automations tab, where the user came from; the rail follows the chrome (`isProjectAutomationPage`). Both ancestor crumbs are prefixes of the URL, so they need `activeOptions={{ exact: true }}` or TanStack marks them current beside the leaf — `automation-breadcrumbs.browser.test.tsx` checks it in a real router. An organization-list row bound to exactly one project opens here too (`AUTO-F4`), by design: its runs belong to that project. | +| `AUTO-B12` | When project automations first started their trail at the project, a project the read answered without (deleted, or a Developer outside its audience) left a **Projects** crumb while **Automations** and the phone's back arrow still led to the project's Automations tab, whose shell only says the project was not found. The trail now falls back to the organization's, the way out the crumb offered before. A read that failed is different: the project trail stays, because that tab names the failure and offers a retry. The automation's own pages render without the project shell, so the run's name crumb keeps the URL it was opened under. | | `NAV-A9` | TanStack's `Link` stamps `aria-current="page"` only when the URL starts with the link's own `to`, so the rail named no current section on Knowledge's other tabs or on most Home pages, while the pill still marked one. The rail now sets `aria-current` from `isItemActive`, the pill's own rule; `sidebar-nav.browser.test.tsx` checks in a real router that exactly one tile is current and that it is the one the pill marks. | | `NAV-F31` | The panel folds only on a chat, a task page, an open conversation and a project's page, because only their headers carry the toggle that brings it back; the projects list or the inbox index has none, so a stored fold is ignored there on purpose — otherwise the panel could be hidden with no way to show it. A project's page joined on 2026-10-02: its header had no toggle, so the panel could not be hidden beside a board. The fold rule and the phone-header rule (RESP-F12) are separate: a project folds its panel but keeps the shell bar on a phone. The boot script applies the same rules before paint (`home-paths.test.ts` `isPanelCollapsible` / `hasOwnPhoneHeader`, `boot-chat-script.test.ts`). | | `NAV-F9` | The API page now links developer prose and raw OpenAPI separately. `app/routes/docs.test.tsx` holds link destinations and accessibility; the manual box judges readable and keyboard-reachable links at phone width. | diff --git a/services/platform/tests/manual/suites/automations.md b/services/platform/tests/manual/suites/automations.md index 3bd16859cb..174b975357 100644 --- a/services/platform/tests/manual/suites/automations.md +++ b/services/platform/tests/manual/suites/automations.md @@ -627,13 +627,16 @@ output: `/dashboard/{org}/projects/{projectId}/automations/{slug}/…`; the trail reads ` / Automations / ` (on the run `… / / Run`, `automations.runs.breadcrumb`); the project's - name opens the project's board and **Automations** its **Automations** - tab; only the leaf heading carries `aria-current="page"` in the trail; - the rail lights **Automations** (`navigation.automations`) and the pill - glides there, not to **Home**; a long project name truncates without - hiding the automation's name. Below 768 px the back arrow - (`common.aria.back`) returns to the project's **Automations** tab (from - a run: to the automation) and the tab bar lights **Automations**. Open + name opens the project's **Tasks** (`tasks.title`) and **Automations** + its **Automations** tab; only the leaf heading carries + `aria-current="page"` in the trail; the rail lights **Automations** + (`navigation.automations`) and the pill glides there, not to **Home**; a + long project name truncates without hiding the automation's name, and + hovering or tabbing to it shows the whole name in a tooltip; on a run a + long automation name truncates the same way and **Run** stays readable. + Below 768 px the back arrow (`common.aria.back`) returns to the + project's **Automations** tab (from a run: to the automation) and the + tab bar lights **Automations**. Open the same automation from the organization's list (`AUTO-F4`) → The same trail and rail. Choose **Automations** in the rail → The organization's list. Repeat in DE and FR (**Automatisierungen** / **Automatisations**). @@ -715,6 +718,17 @@ output: the Member sees the terminal state after reload. Use the task panel: Member and Editor seats have no Automations navigation (`AUTO-F53`). +- [ ] `AUTO-B12` · **A project automation whose project is gone keeps a way + out** — Open an automation from a project's **Automations** tab + (`AUTO-F57`) and copy the URL. As a Developer outside the project's + audience, open that URL; then, as an Owner, delete the project and open + it again → the automation still opens; the trail reads + `Automations / ` with no project, and **Automations** + (`automations.title`) opens the organization's list, never a page + saying the project was not found; below 768 px the back arrow + (`common.aria.back`) leads there too. Open one of its runs → the + automation's name returns to the automation under the same URL. + ## Run liveness — chaos recovery (backend, scripted) Proves on a real backend that a parked run whose scheduled wakes are all lost From 0615d52003cd3c17ef0fa1be53a01adecb34cc93 Mon Sep 17 00:00:00 2001 From: yannickmonney Date: Thu, 8 Oct 2026 01:56:29 +0200 Subject: [PATCH 4/7] docs: say where the rail and New chat lead without ambiguity The workflow editor page said the rail marks Automations "either way" right after naming two crumbs that both lead to Home pages; it now says the rail marks Automations whether the automation was opened from a project or from the list. The chat basics page told phone users to choose Home again for a new chat, which opens the Home list there; it now names New chat first and Home only on a computer. EN, DE and FR. --- docs/de/platform/automations/editor.md | 2 +- docs/de/platform/chat/basics.md | 2 +- docs/en/platform/automations/editor.md | 2 +- docs/en/platform/chat/basics.md | 2 +- docs/fr/platform/automations/editor.md | 2 +- docs/fr/platform/chat/basics.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/de/platform/automations/editor.md b/docs/de/platform/automations/editor.md index fcef05b18f..64abe8220a 100644 --- a/docs/de/platform/automations/editor.md +++ b/docs/de/platform/automations/editor.md @@ -5,7 +5,7 @@ description: Prüfe und ändere Knoten, gib Testdaten ein, speichere eine Versio Im Workflow-Editor änderst du den Ablauf einer Automatisierung und wählst die gespeicherte Version für Live-Läufe. Änderungen brauchen Entwickler-, Admin- oder Inhaberrechte. Speichern, Testen und Bereitstellen sind getrennte Schritte: Die Arbeit an einem Entwurf lässt die bereitgestellte Version bestehen. -Öffne **Automatisierungen** und wähle einen Eintrag. Er öffnet sich im Tab **Editor**. Öffnest du eine Automatisierung im Tab **Automatisierungen** eines Projekts, beginnt der Navigationspfad mit diesem Projekt: Wähle den Projektnamen, um zum Projekt zurückzukehren, oder **Automatisierungen**, um zu seinen Automatisierungen zurückzukehren. Die Navigationsleiste markiert in beiden Fällen **Automatisierungen**. Für einen neuen Ablauf beginne mit [Automatisierungen erstellen oder importieren](/de/platform/automations/catalog). +Öffne **Automatisierungen** und wähle einen Eintrag. Er öffnet sich im Tab **Editor**. Öffnest du eine Automatisierung im Tab **Automatisierungen** eines Projekts, beginnt der Navigationspfad mit diesem Projekt: Wähle den Projektnamen, um zum Projekt zurückzukehren, oder **Automatisierungen**, um zu seinen Automatisierungen zurückzukehren. Ob du eine Automatisierung in einem Projekt oder in der Liste öffnest, die Navigationsleiste markiert **Automatisierungen**. Für einen neuen Ablauf beginne mit [Automatisierungen erstellen oder importieren](/de/platform/automations/catalog). | Tab | Wofür du ihn nutzt | | --- | --- | diff --git a/docs/de/platform/chat/basics.md b/docs/de/platform/chat/basics.md index 7d655dc545..065fe8c2cc 100644 --- a/docs/de/platform/chat/basics.md +++ b/docs/de/platform/chat/basics.md @@ -13,7 +13,7 @@ Nutze den Chat, um Fragen zu stellen, ein Dokument zu verstehen oder Information ## Die erste Nachricht senden -Öffne **Start**. Am Computer öffnet sich ein neuer Chat, und die Seitenleiste von **Start** daneben listet deine bisherigen Chats; auf dem Smartphone wählst du **Chats** und dann **Neuer Chat**. Für ein weiteres Thema wählst du später erneut **Start** oder **Neuer Chat** oben in der Liste von **Start**. Schreibe in das Nachrichtenfeld. Mit **Enter** sendest du, mit **Shift+Enter** fügst du einen Zeilenumbruch ein. Ein vorgeschlagener Gesprächseinstieg funktioniert wie eine eigene erste Frage. Ergänze Quelle, Thema und die Art der Antwort, die du brauchst. +Öffne **Start**. Am Computer öffnet sich ein neuer Chat, und die Seitenleiste von **Start** daneben listet deine bisherigen Chats; auf dem Smartphone wählst du **Chats** und dann **Neuer Chat**. Für ein weiteres Thema wählst du später **Neuer Chat** oder, am Computer, erneut **Start**. Schreibe in das Nachrichtenfeld. Mit **Enter** sendest du, mit **Shift+Enter** fügst du einen Zeilenumbruch ein. Ein vorgeschlagener Gesprächseinstieg funktioniert wie eine eigene erste Frage. Ergänze Quelle, Thema und die Art der Antwort, die du brauchst. Zum Beispiel: „Finde die Onboarding-Rückmeldungen und fasse die drei häufigsten Probleme zusammen. Nenne die Dokumente als Quellen und trenne gemeldete Probleme von deinen Vorschlägen.“ diff --git a/docs/en/platform/automations/editor.md b/docs/en/platform/automations/editor.md index 103f21ecbf..d89d537cab 100644 --- a/docs/en/platform/automations/editor.md +++ b/docs/en/platform/automations/editor.md @@ -5,7 +5,7 @@ description: Inspect and edit nodes, supply test input, save a version, and depl Use the workflow editor to change what an automation does and decide which saved version runs live. You need Developer, Admin, or Owner permissions to make changes. Saving, testing, and deployment are separate steps: editing a draft leaves the deployed version in place. -Open **Automations**, then select an automation. It opens on **Editor**. An automation you open from a project's **Automations** tab shows that project at the start of the breadcrumb trail: choose the project's name to return to the project, or **Automations** to return to its automations. The rail marks **Automations** either way. To create one first, use [Create or import an automation](/platform/automations/catalog). +Open **Automations**, then select an automation. It opens on **Editor**. An automation you open from a project's **Automations** tab shows that project at the start of the breadcrumb trail: choose the project's name to return to the project, or **Automations** to return to its automations. Whether you open an automation from a project or from the automation list, the rail marks **Automations**. To create one first, use [Create or import an automation](/platform/automations/catalog). | Tab | Use it to | | --- | --- | diff --git a/docs/en/platform/chat/basics.md b/docs/en/platform/chat/basics.md index f0aa6ff7d7..4cb631c79d 100644 --- a/docs/en/platform/chat/basics.md +++ b/docs/en/platform/chat/basics.md @@ -13,7 +13,7 @@ Use chat to ask questions, understand a document, or investigate information in ## Send your first message -Open **Home**. On a computer, a new chat opens, and the Home panel beside it lists your earlier chats; on a phone, choose **Chats**, then **New chat**. To begin another subject later, choose **Home** again or **New chat** at the top of the Home list. Type in the message field. Press **Enter** to send or **Shift+Enter** for a new line. A starter prompt fills the same role as your own first question; edit your request to include the source, subject, and kind of answer you need. +Open **Home**. On a computer, a new chat opens, and the Home panel beside it lists your earlier chats; on a phone, choose **Chats**, then **New chat**. To begin another subject later, choose **New chat** or, on a computer, **Home** again. Type in the message field. Press **Enter** to send or **Shift+Enter** for a new line. A starter prompt fills the same role as your own first question; edit your request to include the source, subject, and kind of answer you need. For example: “Find the onboarding feedback and summarize the three most common problems. Cite the documents and separate reported problems from your suggestions.” diff --git a/docs/fr/platform/automations/editor.md b/docs/fr/platform/automations/editor.md index 9bfb191454..a7dd76a4e1 100644 --- a/docs/fr/platform/automations/editor.md +++ b/docs/fr/platform/automations/editor.md @@ -5,7 +5,7 @@ description: Examine et modifie les nœuds, fournis les données de test, puis e L’éditeur de workflow permet de modifier le comportement d’une automatisation et de choisir sa version active. Il faut les droits Développeur, Admin ou Propriétaire pour apporter des changements. Enregistrer, tester et mettre en service sont des étapes distinctes : modifier un brouillon laisse la version déployée en place. -Ouvre **Automatisations**, puis sélectionne une automatisation. Elle s’ouvre dans l’onglet **Éditeur**. Une automatisation ouverte depuis l’onglet **Automatisations** d’un projet affiche ce projet au début du fil d’Ariane : choisis le nom du projet pour revenir au projet, ou **Automatisations** pour revenir à ses automatisations. Dans les deux cas, la barre de navigation met **Automatisations** en évidence. Pour en créer une, consulte [Créer ou importer une automatisation](/fr/platform/automations/catalog). +Ouvre **Automatisations**, puis sélectionne une automatisation. Elle s’ouvre dans l’onglet **Éditeur**. Une automatisation ouverte depuis l’onglet **Automatisations** d’un projet affiche ce projet au début du fil d’Ariane : choisis le nom du projet pour revenir au projet, ou **Automatisations** pour revenir à ses automatisations. Que tu ouvres une automatisation depuis un projet ou depuis la liste, la barre de navigation met **Automatisations** en évidence. Pour en créer une, consulte [Créer ou importer une automatisation](/fr/platform/automations/catalog). | Onglet | Utilisation | | --- | --- | diff --git a/docs/fr/platform/chat/basics.md b/docs/fr/platform/chat/basics.md index 46c81dc21e..c987f9e661 100644 --- a/docs/fr/platform/chat/basics.md +++ b/docs/fr/platform/chat/basics.md @@ -13,7 +13,7 @@ Utilise le chat pour poser une question, comprendre un document ou rechercher un ## Envoyer un premier message -Ouvre **Accueil**. Sur ordinateur, un nouveau chat s’ouvre, et le panneau latéral d’**Accueil**, à côté, liste tes chats précédents ; sur téléphone, choisis **Chats**, puis **Nouveau chat**. Pour aborder un autre sujet plus tard, choisis à nouveau **Accueil** ou **Nouveau chat** en haut de la liste d’**Accueil**. Écris dans le champ de message. Appuie sur **Entrée** pour envoyer ou sur **Maj+Entrée** pour aller à la ligne. Une suggestion de départ joue le même rôle que ta propre question : précise la source, le sujet et le type de réponse attendu. +Ouvre **Accueil**. Sur ordinateur, un nouveau chat s’ouvre, et le panneau latéral d’**Accueil**, à côté, liste tes chats précédents ; sur téléphone, choisis **Chats**, puis **Nouveau chat**. Pour aborder un autre sujet plus tard, choisis **Nouveau chat** ou, sur ordinateur, à nouveau **Accueil**. Écris dans le champ de message. Appuie sur **Entrée** pour envoyer ou sur **Maj+Entrée** pour aller à la ligne. Une suggestion de départ joue le même rôle que ta propre question : précise la source, le sujet et le type de réponse attendu. Par exemple : « Retrouve les retours d’onboarding et résume les trois problèmes les plus fréquents. Cite les documents et sépare les problèmes signalés de tes suggestions. » From 54b8b296bb77461cede202fd2a46c2d92765cc06 Mon Sep 17 00:00:00 2001 From: yannickmonney Date: Thu, 8 Oct 2026 01:56:32 +0200 Subject: [PATCH 5/7] docs(platform): name each role's Settings landing in the rail The comment on the rail's Settings entry said the index route lands admins on organization settings and everyone else on Account, leaving out Developers, who land on Connectors. --- services/platform/app/hooks/use-navigation-items.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/platform/app/hooks/use-navigation-items.ts b/services/platform/app/hooks/use-navigation-items.ts index 862f7e5157..9e5fa26c6f 100644 --- a/services/platform/app/hooks/use-navigation-items.ts +++ b/services/platform/app/hooks/use-navigation-items.ts @@ -190,11 +190,12 @@ export function useNavigationItems(businessId: string): NavigationItems { pinned: [ { // Single Settings entry, pinned with the account tiles at the foot - // of the rail: configuration is not a place you work in. The index - // route redirects to the permission-appropriate landing page (org - // settings for admins, account for everyone else) via - // getDefaultSettingsRoute; the default active-path matcher lights - // it up for every `/settings` sub-route. + // of the rail: configuration is not a place you work in. On a + // computer the index route redirects to the permission-appropriate + // landing page via getDefaultSettingsRoute: Organization for + // Owners and Admins, Connectors for Developers, Account for + // everyone else. The default active-path matcher lights it up for + // every `/settings` sub-route. label: tNav('userSettings'), to: '/dashboard/$id/settings', params: { id: businessId }, From 64d50e04825c9bebd365ca4be2fd981608f28c54 Mon Sep 17 00:00:00 2001 From: yannickmonney Date: Thu, 8 Oct 2026 06:13:33 +0200 Subject: [PATCH 6/7] fix(platform): open Settings on its first page for every role The rail's Settings tile now lands on Account, the Settings panel's first row, for owners, admins, developers and members alike, instead of a role-dependent page. The role-based landing helper and its test are removed. --- design/docs/app.md | 2 +- .../app/hooks/use-navigation-items.ts | 8 ++-- .../routes/dashboard/$id/settings/index.tsx | 28 +++-------- .../get-default-settings-route.test.ts | 47 ------------------- .../permissions/get-default-settings-route.ts | 20 -------- .../tests/e2e/specs/navigation.spec.ts | 2 +- services/platform/tests/manual/readme.md | 2 +- .../tests/manual/suites/navigation.md | 6 +-- .../platform/tests/manual/suites/settings.md | 5 +- 9 files changed, 18 insertions(+), 102 deletions(-) delete mode 100644 services/platform/lib/permissions/get-default-settings-route.test.ts delete mode 100644 services/platform/lib/permissions/get-default-settings-route.ts diff --git a/design/docs/app.md b/design/docs/app.md index 3558d52133..fe7cf9f9c1 100644 --- a/design/docs/app.md +++ b/design/docs/app.md @@ -30,7 +30,7 @@ what is there, and the page shows the one thing you opened. tiles are muted; each shows a no-arrow tooltip to its right. Built from `@tale/ui` primitives, not a bespoke layout. A phone shows the same sections, from the same list, inside a floating, fully rounded bottom capsule. Its lightly translucent surface contains both icons and labels; one selected background glides between destinations. Scroll content continues behind it, with end clearance for the last item. Composers and page-action docks sit above it. The capsule is 60px tall with 20px icons and 11px labels. Downward scrolling reduces it to a 52px icon-only capsule, at most 280px wide and 4px lower; upward scrolling restores it. Both states keep 44px touch targets, accessible names and stable content clearance. The capsule hides while the software keyboard is open and returns when it closes. A tile always opens its section's overview — Home a new chat (on a phone, the Home list), - Knowledge its first tab, Automations the list, Settings its landing page — never the place you + Knowledge its first tab, Automations the list, Settings its first row (Account) — never the place you left, also when you are already in that section. The page's section decides the lit tile and its `aria-current="page"`: an automation opened inside a project belongs to Automations. - **Section panels** — a section with navigation of its own opens it in a panel beside the page, diff --git a/services/platform/app/hooks/use-navigation-items.ts b/services/platform/app/hooks/use-navigation-items.ts index 9e5fa26c6f..d0fd91db6e 100644 --- a/services/platform/app/hooks/use-navigation-items.ts +++ b/services/platform/app/hooks/use-navigation-items.ts @@ -191,11 +191,9 @@ export function useNavigationItems(businessId: string): NavigationItems { { // Single Settings entry, pinned with the account tiles at the foot // of the rail: configuration is not a place you work in. On a - // computer the index route redirects to the permission-appropriate - // landing page via getDefaultSettingsRoute: Organization for - // Owners and Admins, Connectors for Developers, Account for - // everyone else. The default active-path matcher lights it up for - // every `/settings` sub-route. + // computer the index route opens the Settings panel's first row, + // Account, for every role. The default active-path matcher lights + // it up for every `/settings` sub-route. label: tNav('userSettings'), to: '/dashboard/$id/settings', params: { id: businessId }, diff --git a/services/platform/app/routes/dashboard/$id/settings/index.tsx b/services/platform/app/routes/dashboard/$id/settings/index.tsx index ecab03687c..ae50a9dd33 100644 --- a/services/platform/app/routes/dashboard/$id/settings/index.tsx +++ b/services/platform/app/routes/dashboard/$id/settings/index.tsx @@ -1,40 +1,24 @@ import { useIsMobile } from '@tale/ui/use-is-mobile'; -import { - createFileRoute, - useLoaderData, - useNavigate, -} from '@tanstack/react-router'; +import { createFileRoute, useNavigate } from '@tanstack/react-router'; import { useEffect } from 'react'; import { SettingsSectionList } from '@/app/features/settings/components/settings-section-list'; import { useSettingsMenuGroups } from '@/app/features/settings/components/use-settings-menu-groups'; -import { memberContextQuery } from '@/app/lib/backend/org'; import { useT } from '@/lib/i18n/client'; -import { getDefaultSettingsRoute } from '@/lib/permissions/get-default-settings-route'; export const Route = createFileRoute('/dashboard/$id/settings/')({ - loader: async ({ context, params }) => { - const memberContext = await context.queryClient - .ensureQueryData(memberContextQuery(params.id)) - .catch((error: unknown) => { - console.warn('Failed to load member context for settings index', error); - return null; - }); - - return { role: memberContext?.role ?? null }; - }, component: SettingsIndex, }); /** * Workspace settings overview (mobile). Shows the `workspace` + `governance` * groups — the personal-settings counterpart lives at - * `/settings/personal`. Desktop bounces to the default permission-aware - * leaf so the user lands on something useful instead of an empty list. + * `/settings/personal`. A computer has the Settings panel beside the page, so + * the index opens the panel's first row, Account, for every role: the rail's + * Settings tile always lands on the same first page. */ function SettingsIndex() { const { id: organizationId } = Route.useParams(); - const { role } = useLoaderData({ from: Route.id }); const isMobile = useIsMobile(); const navigate = useNavigate(); const { t: tNav } = useT('navigation'); @@ -42,12 +26,12 @@ function SettingsIndex() { useEffect(() => { if (!isMobile) { void navigate({ - to: getDefaultSettingsRoute(role), + to: '/dashboard/$id/settings/account', params: { id: organizationId }, replace: true, }); } - }, [isMobile, navigate, organizationId, role]); + }, [isMobile, navigate, organizationId]); const groups = useSettingsMenuGroups(organizationId, 'workspace'); diff --git a/services/platform/lib/permissions/get-default-settings-route.test.ts b/services/platform/lib/permissions/get-default-settings-route.test.ts deleted file mode 100644 index bcf91d66dd..0000000000 --- a/services/platform/lib/permissions/get-default-settings-route.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { describe, expect, it } from 'vitest'; - -import { getDefaultSettingsRoute } from './get-default-settings-route'; - -describe('getDefaultSettingsRoute', () => { - it('redirects owner to organization settings', () => { - expect(getDefaultSettingsRoute('owner')).toBe( - '/dashboard/$id/settings/organization', - ); - }); - - it('redirects admin to organization settings', () => { - expect(getDefaultSettingsRoute('admin')).toBe( - '/dashboard/$id/settings/organization', - ); - }); - - it('redirects developer to connectors', () => { - expect(getDefaultSettingsRoute('developer')).toBe( - '/dashboard/$id/settings/connectors', - ); - }); - - it('redirects editor to account settings', () => { - expect(getDefaultSettingsRoute('editor')).toBe( - '/dashboard/$id/settings/account', - ); - }); - - it('redirects member to account settings', () => { - expect(getDefaultSettingsRoute('member')).toBe( - '/dashboard/$id/settings/account', - ); - }); - - it('redirects null role to account settings', () => { - expect(getDefaultSettingsRoute(null)).toBe( - '/dashboard/$id/settings/account', - ); - }); - - it('redirects unknown role to account settings', () => { - expect(getDefaultSettingsRoute('disabled')).toBe( - '/dashboard/$id/settings/account', - ); - }); -}); diff --git a/services/platform/lib/permissions/get-default-settings-route.ts b/services/platform/lib/permissions/get-default-settings-route.ts deleted file mode 100644 index 8f32064aef..0000000000 --- a/services/platform/lib/permissions/get-default-settings-route.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { defineAbilityFor } from './ability'; - -type SettingsRoute = - | '/dashboard/$id/settings/organization' - | '/dashboard/$id/settings/connectors' - | '/dashboard/$id/settings/account'; - -export function getDefaultSettingsRoute(role: string | null): SettingsRoute { - const ability = defineAbilityFor(role); - - if (ability.can('read', 'orgSettings')) { - return '/dashboard/$id/settings/organization'; - } - - if (ability.can('read', 'developerSettings')) { - return '/dashboard/$id/settings/connectors'; - } - - return '/dashboard/$id/settings/account'; -} diff --git a/services/platform/tests/e2e/specs/navigation.spec.ts b/services/platform/tests/e2e/specs/navigation.spec.ts index 7946418d7a..eaab4444dc 100644 --- a/services/platform/tests/e2e/specs/navigation.spec.ts +++ b/services/platform/tests/e2e/specs/navigation.spec.ts @@ -92,7 +92,7 @@ function navCases(organizationId: string): readonly NavCase[] { { key: 'settings', hrefSuffix: `/dashboard/${organizationId}/settings`, - // Settings index redirects to a permission-appropriate sub-page; the + // Settings index redirects to its first page, Account; the // Settings panel beside it is the settled anchor. urlPattern: /\/settings(?:[/?#]|$)/, anchor: (page) => diff --git a/services/platform/tests/manual/readme.md b/services/platform/tests/manual/readme.md index ae86ca0913..273318a56b 100644 --- a/services/platform/tests/manual/readme.md +++ b/services/platform/tests/manual/readme.md @@ -127,7 +127,7 @@ A fast "is this build even drivable" pass. Green ⇒ proceed; red ⇒ stop and f | `NAV-F9` | the render-only pages mount | | `CHAT-F1` | a chat turn reaches a terminal state | | `PROJ-F1` | a project opens and lists its tasks | -| `SET-F1` | settings lands on the role default | +| `SET-F1` | settings lands on its first row, Account | ## How a box works diff --git a/services/platform/tests/manual/suites/navigation.md b/services/platform/tests/manual/suites/navigation.md index f5be74e179..24b49af923 100644 --- a/services/platform/tests/manual/suites/navigation.md +++ b/services/platform/tests/manual/suites/navigation.md @@ -23,7 +23,7 @@ live in [chat.md](chat.md), the Inbox view in | Home routes | `/dashboard/{org}/{chat\|projects\|conversations}/…` and `/dashboard/{org}/tasks/{taskId}` — the Home panel stands beside every one | | Home list (phone) | `/dashboard/{org}/home` — a desktop visit redirects to a fresh chat, `/dashboard/{org}/chat?new=true` | | Knowledge | `/dashboard/{org}/documents` (the "Knowledge" rail item) | -| Settings landing | `/dashboard/{org}/settings` → redirects by role (`getDefaultSettingsRoute`): `…/settings/organization` (owner/admin), `…/settings/connectors` (developer), else `…/settings/account` | +| Settings landing | `/dashboard/{org}/settings` → on a computer redirects to the panel's first row, `…/settings/account`, for every role | | Governance group | `/dashboard/{org}/settings/governance` → redirects to `…/governance/content-models` | | Governance sub-page | `/dashboard/{org}/settings/governance/policies-limits` | | Org-switch staging | `/dashboard/switching?to={otherOrg}` → redirects to `/dashboard/{otherOrg}` | @@ -177,7 +177,7 @@ loaded, and reads **No teams** for an account in none. **Knowledge** and switch to **Websites**; click **Home**, then **Knowledge** again → You land on `/documents`, not Websites. Repeat for **Automations** (open one automation's **Runs** tab → `/automations`) and **Settings** (open - **Teams** → the role's default landing): each opens the section's own first + **Teams** → **Account**): each opens the section's own first page, never the tab or record you left. **Home** too: open a project's board with a task open (`?task=…`), click **Knowledge**, then **Home** → a fresh composer (`/chat?new=true`), neither the board nor the chat you last @@ -189,7 +189,7 @@ loaded, and reads **No teams** for an account in none. A fresh composer opens (`/chat?new=true`) and the Home panel's list gains the draft row **New chat** (`home.newChat`) at the top, marked current. Same gesture in **Knowledge** (from **Websites**) lands on `/documents`; in - **Settings** on the role's default landing. + **Settings** on **Account**. - [ ] `NAV-F18` · **Home always starts a new chat** — From **Knowledge**, click **Home** → A fresh composer opens (`/chat?new=true`) with the Home panel beside it, not the chat you last read. Click **Home** again while diff --git a/services/platform/tests/manual/suites/settings.md b/services/platform/tests/manual/suites/settings.md index f6b969ff5c..6f06f7c973 100644 --- a/services/platform/tests/manual/suites/settings.md +++ b/services/platform/tests/manual/suites/settings.md @@ -89,8 +89,9 @@ run. ## Functional tests - [ ] `SET-F1` · **Rail structure & index redirect** — Desktop: open - `/dashboard/{org}/settings` as owner → The URL is replaced by a - permission-appropriate leaf; the Settings panel runs the full height beside + `/dashboard/{org}/settings` as owner, then as a developer and a member → + The URL is replaced by `…/settings/account`, the panel's first row, for + every role; the Settings panel runs the full height beside the page under its own header, **Settings** (`navigation.userSettings`), and shows the three section headers **Personal** / **Organization** / **Advanced** (`settings.menu.railSections.*`); every row carries an icon; From c83f220f806f33dae6ad4961767384c275d42154 Mon Sep 17 00:00:00 2001 From: yannickmonney Date: Thu, 8 Oct 2026 06:38:42 +0200 Subject: [PATCH 7/7] fix(platform): read the project only for a project's automation trail The breadcrumb read the project through a query hook on every automation page, so an automation opened from the organization's list needed a query client for a read it skips. The project read now mounts only on a page opened inside a project. --- .../automation-breadcrumbs.test.tsx | 8 +- .../components/automation-breadcrumbs.tsx | 89 +++++++++++++++---- 2 files changed, 73 insertions(+), 24 deletions(-) diff --git a/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx b/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx index 52f9beb3af..6c02b172c9 100644 --- a/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx +++ b/services/platform/app/features/automations/components/automation-breadcrumbs.test.tsx @@ -319,11 +319,9 @@ describe('AutomationBreadcrumbs', () => { expect(trailLinks()).toEqual([ ['Automations', '/dashboard/org-1/automations'], ]); - // Asked with no project, the read is skipped. - expect(fixtures.projectReadArgs.length).toBeGreaterThan(0); - expect( - fixtures.projectReadArgs.every((projectId) => projectId === undefined), - ).toBe(true); + // Outside a project the project read is never mounted, so a page opened + // from the organization's list needs no query for it at all. + expect(fixtures.projectReadArgs).toEqual([]); }); it('on a run, links the automation name back to the automation page', () => { diff --git a/services/platform/app/features/automations/components/automation-breadcrumbs.tsx b/services/platform/app/features/automations/components/automation-breadcrumbs.tsx index 91871d6699..0469fb8ac5 100644 --- a/services/platform/app/features/automations/components/automation-breadcrumbs.tsx +++ b/services/platform/app/features/automations/components/automation-breadcrumbs.tsx @@ -57,34 +57,85 @@ export function AutomationBreadcrumbs({ * organization's. */ projectId?: string; }) { - const { t } = useT('automations'); - const { t: tCommon } = useT('common'); - const { locale } = useLocale(); - const automationQuery = useAutomation(organizationId, automationSlug); - const displayName = automationDisplayName( - automationQuery.data?.presentation, - automationSlug, - locale, + // Only a page opened inside a project reads the project; an automation + // opened from the organization's list needs no project read at all. + return projectId !== undefined ? ( + + ) : ( + ); - const slugParam = automationSlugToParam(automationSlug); +} +function ProjectAutomationBreadcrumbs({ + organizationId, + automationSlug, + projectId, +}: { + organizationId: string; + automationSlug: string; + projectId: string; +}) { // The project the automation is opened in; the project shell's loader - // already read it, so it is usually there on the first frame. Outside a - // project the read is skipped. - const projectRead = useProject( - projectId !== undefined ? asProjectId(projectId) : undefined, - ); + // already read it, so it is usually there on the first frame. + const projectRead = useProject(asProjectId(projectId)); // The read ANSWERED without a project: it is gone, or out of this person's // reach. Its Automations tab would only say the project was not found, so // the trail is the organization's, as for an automation opened outside a // project. A read that failed is not that: the project trail stays, and // the tab it leads to names the failure and offers a retry. const projectGone = - projectId !== undefined && !projectRead.isLoading && projectRead.project === null && !projectRead.unavailable; - const trailProjectId = projectGone ? undefined : projectId; + return ( + + ); +} + +function AutomationTrail({ + organizationId, + automationSlug, + projectId, + projectTrail, +}: { + organizationId: string; + automationSlug: string; + /** The project route the page was opened under, if any. */ + projectId?: string; + /** Present when the trail starts at that project: the project's read. */ + projectTrail?: { + project: ReturnType['project']; + isLoading: boolean; + }; +}) { + const { t } = useT('automations'); + const { t: tCommon } = useT('common'); + const { locale } = useLocale(); + const automationQuery = useAutomation(organizationId, automationSlug); + const displayName = automationDisplayName( + automationQuery.data?.presentation, + automationSlug, + locale, + ); + const slugParam = automationSlugToParam(automationSlug); + const trailProjectId = projectTrail !== undefined ? projectId : undefined; // Either shell can host a run under this slug; the trail only cares that // we ARE on a run, so the name crumb can point back at the automation. @@ -182,7 +233,7 @@ export function AutomationBreadcrumbs({ ), },