Astra: PO/GL actions, usage coverage, assisted sign-in, self-healing, recorder, new top navigation and theme (172a4e22a2bf)
fb62a97 verified |
Download docs/FRONTEND_AUDIT.md from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 20.2 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/docs/FRONTEND_AUDIT.md
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/docs/FRONTEND_AUDIT.md
-
curl -L -o FRONTEND_AUDIT.md https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/docs/FRONTEND_AUDIT.md
20.2 kB
| > **Historical record.** This page describes the product as it was when it was written, under an earlier name, and is not kept up to date. For the current system (Astra) read [DESIGN_SYSTEM.md](DESIGN_SYSTEM.md) for the UI, and [ARCHITECTURE.md](ARCHITECTURE.md), [DEPLOYMENT.md](DEPLOYMENT.md), [RUNBOOK.md](RUNBOOK.md), [REMOTE_RUNNER.md](REMOTE_RUNNER.md) and [SECURITY.md](SECURITY.md). | |
| # Frontend audit (Patchwise web app) | |
| Branch `frontend-polish`, base commit `84145a2`. Step 1 of the frontend-polish plan: findings only, no code changed. | |
| This is what Steps 2 to 5 (tokens, components, page rebuilds, quality gates) will fix. | |
| **Method** | |
| - **Screenshots.** Playwright took full-page screenshots of 28 screens at 375, 768, 1280 and 1920 px, in light and dark, against the production build (`npm run build`) served by the FastAPI backend with a fresh admin and one stub P2P run. That is 224 screenshots. Reduced motion was on so the images are stable. | |
| - **Accessibility.** axe-core 4.11 ran on every screen at 375 and 1280 px in both schemes (112 scans). It was injected from a scratch install, not added to the repo. The raw results are in [frontend-audit/axe-results.json](frontend-audit/axe-results.json). | |
| - **Code metrics.** Counts were taken with grep over `web/src` (7 CSS files with 2,088 lines in total, and all TSX files). | |
| - **Screenshots in the repo.** 20 representative screenshots are committed in [frontend-audit/](frontend-audit/). The full set of 224 is outside the repo (30 MB) and can be regenerated with the same throwaway spec. | |
| - **What was checked by eye.** I looked at about 20 of the 224 screenshots. Every screen got the automated checks (axe, horizontal overflow, console errors), but not every screen was inspected visually. Step 4 re-screenshots each page as it is rebuilt. | |
| Severity: **P0** broken or blocks a task · **P1** clearly wrong, visible to every user · **P2** inconsistency or polish. | |
| --- | |
| ## 1. Top 10 (fix first) | |
| | # | Sev | Finding | Where | Evidence | | |
| |---|---|---|---|---| | |
| | 1 | P0 | On phones the page header overlaps itself. On Home, the environment and patch selects sit on top of the "Patch readiness" title, and "New test run" is pushed off screen. On Test runs, Export CSV, Scheduled runs and "+ New" cover the title, and the subtitle wraps one word per line. Nothing scrolls sideways, so the clipped controls cannot be reached. | `PageHeader` / `.trio-head` actions in `ReadinessPage.tsx`, `RunsPage.tsx` | [home 375](frontend-audit/home__375_light.png), [runs 375](frontend-audit/runs__375_light.png) | | |
| | 2 | P0 | The Ask panel stays open after you leave `/assistant`. Below 1024 px it is a full-screen drawer, so on a phone every later page shows only the chat. In the sidebar, "Ask" stays highlighted together with the current page. | App shell, Ask dock state in `components/shell/prefs.tsx` and `AppSidebar.tsx` | [audit 375](frontend-audit/audit__375_light.png), [users 768](frontend-audit/admin_users__768_light.png), [404 1280](frontend-audit/no-such-page__1280_light.png) | | |
| | 3 | P1 | The run header on phones loses its first line ("ocal mock pod · started…"). The back link turns into an odd icon. The primary button is clipped ("Approve all 79 and start test"). | `RunWorkspace.tsx` top bar, `RunGuide.tsx` | [run 375 dark](frontend-audit/run__375_dark.png) | | |
| | 4 | P1 | At 1280 px the run page has three columns (sidebar, guide, 450 px side panel). The title truncates to "Proc…" / "Local mc", and the tab strip scrolls with its first tab cut ("ios • your review"). | `RunWorkspace.tsx`, `SidePanel` | [run 1280](frontend-audit/run__1280_light.png), [report tab](frontend-audit/run_report__1280_light.png) | | |
| | 5 | P1 | Colour contrast fails on 22 of 24 signed-in screens (125 elements). The main offenders are the amber practice-environment badge (`.fpt-envbadge`, `.fpt-env-long`), Mantine `c="dimmed"` / `size="xs"` text, light-variant button labels, `.trio-chip`, empty-state copy and the orange "Awaiting approval" status. | `styles.css`, `apple.css`, Mantine `dimmed` | axe `color-contrast` | | |
| | 6 | P1 | Run tabs use invalid ARIA (`aria-controls` points to panels that aren't rendered; critical, 16 pages). Tab lists and cards declare roles without the required children (critical, 24 pages). | `RunWorkspace.tsx` tabs, `.trio-group`, `.fpt-card` | axe `aria-valid-attr-value`, `aria-required-children` | | |
| | 7 | P1 | Pagination buttons have no accessible name (critical). | Mantine `Pagination` in `LibraryPages.tsx` (Scenarios), `AdminPages.tsx` (Audit) | axe `button-name` | | |
| | 8 | P1 | Two systems style the same things. There are two type and token stacks (`--fpt-*` with 729 uses and the Apple tokens `--label`, `--r-*`, `--pill-*`), two icon sets (Tabler in 32 files, lucide in 5), and two component libraries (Mantine and beUI/Tailwind). | all CSS, `theme.ts`, `beui.css` | section 2 | | |
| | 9 | P1 | Settings at 1280 with the Ask panel open: the content column is about 300 px wide. Cards stack with a large empty gap, and a card is cut off at the right edge. | `SettingsPage.tsx` grid | [admin 1280](frontend-audit/admin__1280_light.png) | | |
| | 10 | P2 | Scenario filters "Process step" and "Priority" show empty selects with no placeholder. | `LibraryPages.tsx` | [scenarios 1920](frontend-audit/scenarios__1920_light.png) | | |
| --- | |
| ## 2. Typography | |
| **Font family.** One family (Inter Variable via `@fontsource-variable/inter`) with a monospace stack. It is reached through four different variables (`--font`, `--fpt-font`, `--fpt-font-display`, `--mono`/`--fpt-mono`) and set again in `theme.ts`. **P2:** keep one family token and one mono token. | |
| **Font sizes in CSS.** There are 16 distinct px values and no scale. | |
| | Size | Uses | Size | Uses | | |
| |---|---|---|---| | |
| | 13px | 34 | 14.5px | 4 | | |
| | 12px | 19 | 10.5px | | | |
| | 13.5px | 16 | 16, 17, 18, 20px | few | | |
| | 12.5px | 13 | 28, 30, 34px | few | | |
| | 11.5px | 13 | | | | |
| | 15px | 10 | | | | |
| | 14px | 10 | | | | |
| - **P1:** Half-pixel sizes (11.5, 12.5, 13.5, 14.5, 10.5) are the bulk of the body copy. | |
| - **P1:** Body text is 13 to 13.5 px almost everywhere, below a comfortable 14 to 15 px reading size. | |
| **Font sizes in TSX.** Three more sources: | |
| - Mantine `fz="xs"` / `size="xs"` / `size="sm"`. | |
| - Inline `style={{ fontSize }}`. | |
| - Tailwind arbitrary values on the account pages: `text-[13px]`, `[15px]`, `[16px]`, `[17px]`, `[28px]`, `[52px]` (`AuthShell.tsx`). | |
| The sign-in pages and the app therefore use different size ladders. Page titles look similar (about 28 px) but come from different code. | |
| **Weights.** CSS uses 400 (10), 500 (22), **550 (20)**, 600 (98), **650 (12)** and 700 (4); TSX adds `fw={600}` ×85. The 550 and 650 weights only work with the variable font. **P2:** keep three weights (400 / 500 / 600) and one display weight. | |
| **Line height.** It is set as px values tied to one font size: 16px (16), 18px (14), 20px (7), 22px, 19px, 14px, 17px, 21px, 26px, 34px, 36px, 40px. There are also a few unitless values (1.25, 1.5) and var. **P2:** pixel line heights break when the font size changes. Use unitless ratios per text style. | |
| **Letter spacing.** There are 13 distinct values from −0.03em to +0.04em (−0.014, −0.006, −0.024, −0.016, −0.012, −0.008, −0.004…), plus Tailwind `tracking-tight` and `tracking-[-0.035em]`. **P2:** fold into 3 values (display, title, body = 0). | |
| **Headings.** axe `heading-order` fails on Run, Test environments, Scripts, Learner and Users (an h3 or h5 directly after h1). The four run sub-tabs (`/runs/:id/scenarios|failures|report|workflow`) have **no h1** (`page-has-heading-one`). **P1** for screen-reader navigation. | |
| --- | |
| ## 3. Components, spacing, radius, shadows, colour | |
| **Control sizes.** | |
| - Mantine sizes are used inconsistently: Button `xs` ×38, `md` ×5, `sm` ×1; TextInput `xs` ×7; Select `xs` ×3; Textarea `xs` ×2; Badge `xs` ×5, `lg` ×1; ActionIcon `sm` ×1. | |
| - Heights hard-coded in CSS: 32px (16), 40px (15), 36px (11), 34px (10), 28px (10), plus 22px and 20px. There is no height scale, so a "default" button can be 28, 32, 34, 36 or 40 px depending on the page. | |
| - The account pages use 48 px controls (`h-12`); Account → Change password uses Mantine's 36 px. Both are forms. | |
| - **P1:** set 3 control heights (32 / 40 / 48) and one default per context. | |
| **Hand-styled buttons.** Raw `<button>` elements with their own CSS in `TopBar`, `SidePanel`, `ChatDock`, `RunStages`, `AppSidebar` and `common.tsx`. Each has its own hover, focus and disabled styles. **P2:** move them to the shared Button or IconButton. | |
| **Radius.** | |
| - Tokens (`--fpt-radius-card`, `--r-*`) are mixed with raw values: 999px, 50%, 2px, 3px, 5px, 8px, 9px, 13px. | |
| - The account pages add `rounded-[28px]`, `rounded-2xl` and `rounded-full`. | |
| - Cards are 28 px on sign-in and about 20 px in the app. Pills are 999px, `rounded-full` and `--pill-*`. | |
| - **P2:** use 4 radius tokens (sm, md, lg, full). | |
| **Shadows.** There are 43 raw `box-shadow` declarations outside the tokens: `inset 0 0 0 1px var(--sep-strong)`, `var(--fpt-border)` and `1.5px var(--red-dot)` rings, plus `box-shadow: none` ×28 overriding Mantine. Two token families exist (`--sh-card`, `--sh-pop` and the `--fpt-*` shadows). `AuthShell` uses `shadow-[0_30px_80px_rgba(0,0,0,0.55)]`. **P2.** | |
| **Spacing.** There is no spacing scale in CSS. Paddings and gaps are raw px. Mantine `gap="xs|sm|md"` and Tailwind `gap-2…gap-10` are used side by side. Visible results: | |
| - Card padding differs between Home (about 20 px), Settings (about 16 px) and Account (about 20 px). | |
| - The Home summary row's middle card is taller than its content, leaving empty space ([home 1280](frontend-audit/home__1280_light.png)). | |
| - **P2.** | |
| **Colour.** | |
| Hex values outside the token blocks: | |
| | File | Count | | |
| |---|---| | |
| | `styles.css` | 27 | | |
| | `apple.css` | 9 | | |
| | `apple-run.css` | 8 | | |
| | `apple-screens.css` | 2 | | |
| | `theme.ts` | 22 | | |
| | `AuthShell.tsx` | 8 (`#0a0a0c`, `#141416`, `#30d158`, `#f5f5f7`, `#1d1d1f`…) | | |
| | `BrandMark.tsx` | 5 | | |
| | `RegisterPage.tsx` | 3 | | |
| | `App.tsx` | 1 | | |
| Other colour sources: | |
| - `ScenarioGlobe.tsx` hard-codes its status colours (0x30d158, 0xff453a, 0xff9f0a, 0x8e8e93), separate from the CSS status tokens. | |
| - There are three token namespaces for the same idea: `--fpt-*` (729 uses), Apple tokens (`--label-*` 112, `--pill-*` 121, `--r-*` 70) and shadcn names mapped in `beui.css`. | |
| **P1:** the same status green, red and amber is defined in at least four places. Step 2 sets one palette. | |
| **Inline styles.** Components that pass `style={{…}}` most often: | |
| | Component | Inline styles | | |
| |---|---| | |
| | `ScenarioReview` | 17 | | |
| | `RunPage` | 17 | | |
| | `SignOffReport` | 12 | | |
| | `AgentTeamPage` | 12 | | |
| | `SettingsPage` | 9 | | |
| | `ScheduledRunsPage` | 9 | | |
| | `common.tsx` | 9 | | |
| These are mostly spacing, widths and colours that bypass tokens. **P2.** | |
| **Breakpoints.** There are 11 different `max-width`/`min-width` values: 720, 767, 768, 860, 899, 1023, 1100, 1180, 1279 and others. Mantine's own breakpoints and Tailwind `sm`/`lg` are also in use. **P1:** the overlaps in Top 10 #1 to #4 happen in the gaps between these ad-hoc breakpoints. Set 4 breakpoints (640 / 768 / 1024 / 1280). | |
| **Animation.** `apple-run.css:73` uses `transition: all`. **P2:** list the properties instead. | |
| --- | |
| ## 4. Layout, page by page | |
| What each row is based on: "Checked" means I looked at the screenshot. The axe and overflow columns were checked on every screen. | |
| | Page | Route | Findings | | |
| |---|---|---| | |
| | Sign in | `/login` | 375: good. The card fits, and the 3D scene sits behind at 40%. A grey disc from the 3D scene peeks in at the right edge ([login 375](frontend-audit/login__375_light.png)). 1920 dark: fine. No axe violations. **P2** | | |
| | Create account / Forgot / Reset | `/register` `/forgot` `/reset` | Same frame as sign in, no axe violations. Sizes come from Tailwind arbitrary values, not app tokens (section 2). **P2** | | |
| | Home | `/` | 375: header overlap (Top 10 #1). 768: the title wraps to two lines and the subtitle squeezes to about 170 px beside the controls ([home 768](frontend-audit/home__768_light.png)). 1280: the summary row has uneven card heights, and "Waiting for you" uses an amber number with low contrast. Dark: fine. | | |
| | Test runs | `/runs` | 375: header overlap, subtitle one word per line, "+ New" clipped. The table's actions column header is empty (axe `empty-table-header`). | | |
| | Run: guide | `/runs/:id` | Top 10 #3 and #4. `heading-order` (h3 under h1, skipping h2). | | |
| | Run: sub-tabs | `/runs/:id/scenarios`, `failures`, `report`, `workflow` | No h1. Invalid tab ARIA. The Report tab before the run finishes is one grey sentence in a large empty page ([report](frontend-audit/run_report__1280_light.png)). The Team tab nests `section`s with an invalid role, and Mantine popover targets have disallowed `aria-*` (axe, critical). | | |
| | Ask | `/assistant` | The panel opens here and then stays open everywhere (Top 10 #2). The dialog has no accessible name (`aria-dialog-name`). The "+" button gets focus on open and shows a heavy black focus ring. | | |
| | Scenarios | `/scenarios` | Empty filter selects. Pagination has no names. Status text is orange on white (contrast). At 1920 the table is limited to about 720 px while the page has space. | | |
| | Defects | `/tickets` | The scroll area can't be reached by keyboard (`scrollable-region-focusable`). | | |
| | Test environments | `/pods` | One narrow 260 px card on a wide page. `heading-order`. Dark: the amber note box is very saturated ([pods dark](frontend-audit/pods__1280_dark.png)). | | |
| | Reports | `/reports` | Missing required ARIA children. | | |
| | Your account | `/account` | Forms are capped at 400 px inside an 840 px card. The disabled "Change password" has contrast too low to read. The sessions table lists every session with no limit or paging ([account dark](frontend-audit/account__1280_dark.png)). | | |
| | Settings | `/admin` | Top 10 #9. The scroll region can't be reached by keyboard. | | |
| | Agent team, Self-heal, Scripts, Learner, Audit, Emergency stop, Automatic approval, Schedules, Users | admin routes | Scripts, Learner, Users: `heading-order`. Audit: pagination without names, and a scroll region without keyboard access. Schedules: missing ARIA children. Users at 768: the description box is cut off on the right under the open Ask drawer. | | |
| | Not found | `*` | Two `main` landmarks: the page puts its own `main` inside the shell's `main` (`landmark-no-duplicate-main`, `landmark-main-is-top-level`). | | |
| **All signed-in screens:** | |
| - The command palette and the Ask drawer are portals outside any landmark (`region`, 96 scans). | |
| - They use `aria-*` attributes not allowed on their element (`aria-prohibited-attr`, 96 scans, serious). | |
| --- | |
| ## 5. Placeholder and dead content | |
| - **`console.*`.** Only `console.error` in `ErrorPages.tsx`, which is intentional (the error boundary reports). OK. | |
| - **TODO / FIXME / lorem.** None found. | |
| - **Unused file.** `web/src/pages/run/RunTriage.tsx` was not imported anywhere. **Done:** deleted. | |
| - **Console errors at runtime.** 20 `401 Unauthorized` errors on the public pages. These come from the "who am I" check before sign-in. That is expected, but it is logged as an error in the browser console. **P2:** treat 401 as "signed out" quietly. | |
| - **Two parallel style sheets.** `styles.css` (1,100 lines, `--fpt-*`) and the `apple*.css` files (about 900 lines) both style the same components. The later file wins by load order (`main.tsx` imports 6 CSS files in sequence). This is the main source of the inconsistencies above. Step 2 resolves it. | |
| --- | |
| ## 6. Missing states | |
| Each page module was checked for loading, error and empty handling (useQuery `isLoading`/`isError`, Skeleton/Loader, empty copy). | |
| | Gap | Pages | | |
| |---|---| | |
| | No loading state. Values show "-" or blank until data arrives. | `AgentTeamPage.tsx` (only one inline "loading…"), `InsightPages.tsx`, `RunWorkflow.tsx`, `AssistantPage.tsx` (no error state) | | |
| | No empty state | `AccountPage.tsx` sessions table, `AdminPages.tsx` (Audit and Users tables), `SettingsPage.tsx` panels, `RunData.tsx`, `RunResearch.tsx` | | |
| | Weak "not ready yet" state | Run → Report and sign-off: one grey sentence, no illustration or next action | | |
| | Loading styles differ by page | Skeletons in some places, Mantine `Loader` in others, text "loading…" or "checking…" in others | | |
| **P1:** Step 3 adds shared `Loading`, `Empty` and `ErrorState` components. Step 4 uses them on every page. | |
| --- | |
| ## 7. Accessibility summary (axe-core, 112 scans) | |
| | Rule | Impact | Scans | Elements | Main source | | |
| |---|---|---|---|---| | |
| | aria-prohibited-attr | serious | 96 | 110 | Command palette root, Ask drawer root | | |
| | region | moderate | 96 | 144 | Portals outside landmarks | | |
| | color-contrast | serious | 40 | 125 | Env badge, `dimmed` xs text, light buttons, chips, amber status | | |
| | aria-dialog-name | serious | 34 | 34 | Ask drawer, Mantine modal content | | |
| | aria-required-children | critical | 24 | 36 | Tab lists, `.trio-group`, `.fpt-card` with list roles | | |
| | heading-order | moderate | 20 | 20 | Run guide, Test environments, Scripts, Learner, Users | | |
| | aria-valid-attr-value | critical | 16 | 16 | Run tab `aria-controls` | | |
| | page-has-heading-one | moderate | 16 | 16 | Run sub-tabs | | |
| | scrollable-region-focusable | serious | 16 | 16 | Defects, Settings, Scripts, Audit | | |
| | button-name | critical | 8 | 16 | Pagination controls | | |
| | aria-allowed-role / aria-allowed-attr | minor / critical | 4 / 2 | 24 / 30 | Team view sections and popover targets | | |
| | landmark-no-duplicate-main, landmark-main-is-top-level | moderate | 4 | 4 | Not-found page | | |
| | empty-table-header | minor | 4 | 4 | Test runs actions column | | |
| **What already works:** | |
| - The four account pages have no axe violations. | |
| - Every page honours `prefers-reduced-motion`. The 3D scenes go still and the globe has a text equivalent. | |
| - No page scrolls sideways at 375 px. Content gets clipped instead (Top 10 #1). | |
| - Not covered by this audit: keyboard-only walkthroughs and screen-reader testing. These are in Step 5. | |
| --- | |
| ## 8. What Steps 2 to 5 will address | |
| | Step | Fixes | | |
| |---|---| | |
| | **2 Tokens** | One colour palette with light and dark values, including the status colours shared with the 3D globe. One type scale (about 7 steps, unitless line heights, 3 tracking values). Spacing 4-px scale, 4 radii, 3 shadows, 3 control heights, 4 breakpoints. Mantine theme, Tailwind theme and CSS variables all generated from it. Removes the `--fpt-*` / Apple duplication. | | |
| | **3 Components** | Button and IconButton (replacing the raw `<button>`s), Field, Select, Card, Badge and Status, PageHeader (wraps on phones), Tabs (correct ARIA), Table (empty, loading and paging states with labelled pagination), Loading, Empty, ErrorState, Dialog and Drawer (named). One icon set. | | |
| | **4 Pages** | Sign-in first, then the app shell: Ask dock state, nav highlight, landmarks and the 404 `main`. Then each page with before and after screenshots. | | |
| | **5 Quality** | axe in CI (no serious or critical issues), visual regression at the four widths, Lighthouse budgets, Storybook for the components, Husky with lint-staged. | | |
| ### Owner review (approved, with additions) | |
| The audit was approved. The owner added two requirements for Step 4: | |
| 1. **Ask is a real chat page.** `/assistant` becomes a full-page chat: a conversation list, the message thread and a composer. It replaces the drawer that stays open across pages. The quick "Ask" from other pages may open the chat page, but it no longer leaves a panel covering the next page. | |
| 2. **No wide-open empty space, overlaps or cramped layouts.** Every rebuilt page must: | |
| - fill its width with a deliberate grid (content max width, side columns where useful); | |
| - wrap headers instead of overlapping; | |
| - keep cards the height of their content. | |
| The before and after screenshots at the four widths are the acceptance check. | |
| ### Manual check of this audit | |
| 1. Open the images in `docs/frontend-audit/` next to the Top 10 table and confirm each finding is visible. | |
| 2. On a phone-sized window, sign in and open Home and Test runs: the header controls overlap the title. | |
| 3. Open Ask, then any other page: the chat panel stays open, and "Ask" stays highlighted in the sidebar. | |