Skip to content

[T-085b] Web app shell: router (all routes), providers, MarginRail navigation, theme toggle, error boundary #163

Closed

Description

@CodewithJha

Task T-085b · Milestone M8 — Dashboard · Size S · Priority P0 · Epic #8

Implements FR-DSH-008

Branch feat/t-085b-web-app-shell-router-all — one task = one branch = one PR (doc 32 §6)

Summary

Implement web/src/app/router.tsx with every route of doc 13 §2 (lazy-loaded feature pages with placeholder EmptyStates), providers.tsx (QueryClient, Theme, SSE provider stub), MarginRail (Bench, Campaigns, Trials, Spaces, Workbench, Settings, theme toggle) and a top-level error boundary rendering problem+json details.

Context / motivation

Gives every screen task a stable mount point so feature work can proceed in parallel without touching shared files.

Scope

In scope

  • Route modules registered from features/*/routes.tsx (one line each in router.tsx).

Implementation guidance

  • web/src/app/router.tsx: createBrowserRouter with the routes of doc 13 §2: /, /campaigns/new, /campaigns/:id (nested tabs console|runs|casebook|atlas|insights|settings, default console), /runs/:id, /trials, /trials/:id, /spaces, /spaces/:id/:version, /workbench, /reports/:id, and * NotFound.
  • Each feature exports routes.tsx (export const benchRoutes: RouteObject[]) using lazy: () => import('./BenchPage'); router.tsx only concatenates arrays (one line per feature, append-only).
  • providers.tsx: QueryClientProvider (defaults in lib/queryClient.ts: staleTime 10 s, retry only on network errors, never on 4xx), ThemeProvider (initial theme from runtime defaultTheme, user choice persisted in localStorage, sets data-theme), SseProvider placeholder (implemented in T-085d), Radix TooltipProvider.
  • MarginRail (doc 13 §3.1): vertical nav with icons + accessible labels, active route via aria-current="page", theme toggle at the bottom, MarginRailSlot context so features (e.g. the console Spine) can render into the rail; collapses to icons below 1024 px.
  • Error boundary: route errorElement renders ProblemView (title, detail, copyable trace_id) for ProblemError, a generic message otherwise.
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Acceptance criteria

  • Every route renders without errors (Vitest smoke over route list).
  • MarginRail keyboard navigable with visible focus ring.
  • Unknown route renders NotFound with a link back to Bench.
  • Theme choice persists across reload.
  • Each lazy route produces its own chunk (build manifest check).
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • web/src/app/router.test.tsx.
  • Vitest route smoke test iterating over the route table with MSW handlers.

Dependencies

Blocked by: #162 (T-085a)

Blocks: #165 (T-085d), #184 (T-115)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • web/src/app/**
  • web/src/components/MarginRail/**

After this, features are independent folders.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-085b (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 13 §2 · doc 13 §5 · doc 13 §4

Requirements: FR-DSH-008 (traceability: doc 28)

External:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:dashboardReact web dashboardmilestone:M8M8 — Dashboardpriority:P0Critical path / blocks otherssize:S<= 1 daytaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions