Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(ui): restore not-found behavior
Josué0c31ad4954df
diff --git a/control-ui/app/global-not-found.tsx b/control-ui/app/global-not-found.tsxnew file mode 100644index 000000000..41d9a8486--- /dev/null+++ b/control-ui/app/global-not-found.tsx@@ -0,0 +1,14 @@+import './globals.css'+import { ControlNotFoundContent } from './not-found'++export default function GlobalNotFound() {+ return (+ <html lang="en" data-theme="dark">+ <body className="cu-body">+ <main className="cu-app cu-app--auth cu-not-found">+ <ControlNotFoundContent />+ </main>+ </body>+ </html>+ )+}diff --git a/control-ui/app/not-found.tsx b/control-ui/app/not-found.tsxindex 1afd7d8d9..e283a5a21 100644--- a/control-ui/app/not-found.tsx+++ b/control-ui/app/not-found.tsx@@ -2,10 +2,10 @@ import Image from 'next/image'import Link from 'next/link'import { CONTROL_ROUTES } from '@constants/routes'-export default function NotFound() {+export function ControlNotFoundContent() {return (- <main className="cu-app cu-app--auth cu-not-found">- <section className="cu-card cu-not-found__card" aria-labelledby="cu-not-found-title">+ <section className="cu-not-found" aria-labelledby="cu-not-found-title">+ <div className="cu-card cu-not-found__card"><div className="cu-card__body cu-not-found__body"><ImageclassName="cu-not-found__brand-mark"@@ -27,7 +27,11 @@ export default function NotFound() {Back to Control UI</Link></div>- </section>- </main>+ </div>+ </section>)}++export default function NotFound() {+ return <ControlNotFoundContent />+}diff --git a/control-ui/components/__tests__/NotFound.test.tsx b/control-ui/components/__tests__/NotFound.test.tsxnew file mode 100644index 000000000..c388f5445--- /dev/null+++ b/control-ui/components/__tests__/NotFound.test.tsx@@ -0,0 +1,46 @@+import React from 'react'+import { describe, expect, it, vi } from 'vitest'+import '@testing-library/jest-dom/vitest'+import { render, screen } from '@testing-library/react'+import GlobalNotFound from '../../app/global-not-found'+import NotFound from '../../app/not-found'+import nextConfig from '../../next.config.js'++vi.mock('next/image', () => ({+ default: ({ alt = '', ...props }: React.ImgHTMLAttributes<HTMLImageElement>) => (+ // eslint-disable-next-line @next/next/no-img-element+ <img alt={alt} {...props} />+ ),+}))++vi.mock('next/link', () => ({+ default: ({+ children,+ href,+ ...props+ }: React.AnchorHTMLAttributes<HTMLAnchorElement> & { href: string }) => (+ <a href={href} {...props}>+ {children}+ </a>+ ),+}))++describe('Control UI not-found rendering', () => {+ it('keeps the route-level not-found content frame-safe', () => {+ const view = render(<NotFound />)++ expect(screen.getByRole('heading', { name: /Page not found/i })).toBeInTheDocument()+ expect(view.container.querySelector('main')).not.toBeInTheDocument()+ expect(view.container.querySelector('.cu-app--auth')).not.toBeInTheDocument()+ })++ it('uses a global not-found page for unmatched routes outside the auth frame', () => {+ expect(nextConfig.experimental?.globalNotFound).toBe(true)++ const view = render(<GlobalNotFound />)++ expect(screen.getByRole('heading', { name: /Page not found/i })).toBeInTheDocument()+ expect(view.container.querySelector('.cu-app--auth')).toBeInTheDocument()+ expect(view.container.querySelector('.cu-app-layout')).not.toBeInTheDocument()+ })+})diff --git a/control-ui/next.config.js b/control-ui/next.config.jsindex 0de33e68c..fd33c01b7 100644--- a/control-ui/next.config.js+++ b/control-ui/next.config.js@@ -3,6 +3,9 @@ const path = require('path')/** @type {import('next').NextConfig} */const nextConfig = {reactStrictMode: true,+ experimental: {+ globalNotFound: true,+ },// Keep Turbopack rooted at the monorepo so it can resolve the linked// @clerum packages without guessing from whichever lockfile it finds first.turbopack: {diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 40bb70a3c..dab1ec250 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.380",+ "version": "0.1.381","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.380",+ "version": "0.1.381","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex e7be76a82..ea18ac732 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.380",+ "version": "0.1.381","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/profile-ui/app/components/__tests__/NotFound.test.tsx b/profile-ui/app/components/__tests__/NotFound.test.tsxnew file mode 100644index 000000000..9f26b2b46--- /dev/null+++ b/profile-ui/app/components/__tests__/NotFound.test.tsx@@ -0,0 +1,55 @@+import React from 'react'+import { describe, expect, it, vi } from 'vitest'+import '@testing-library/jest-dom/vitest'+import { render, screen } from '@testing-library/react'+import { createRequire } from 'node:module'+import GlobalNotFound from '../../global-not-found'+import NotFound from '../../not-found'++type NextConfigSubset = {+ experimental?: {+ globalNotFound?: boolean+ }+}++const requireNextConfig = createRequire(import.meta.url)+const nextConfig = requireNextConfig('../../../next.config.js') as NextConfigSubset++vi.mock('next/image', () => ({+ default: ({ alt = '', ...props }: React.ImgHTMLAttributes<HTMLImageElement>) => (+ // eslint-disable-next-line @next/next/no-img-element+ <img alt={alt} {...props} />+ ),+}))++vi.mock('next/link', () => ({+ default: ({+ children,+ href,+ ...props+ }: React.AnchorHTMLAttributes<HTMLAnchorElement> & { href: string }) => (+ <a href={href} {...props}>+ {children}+ </a>+ ),+}))++describe('Profile UI not-found rendering', () => {+ it('keeps the route-level not-found content frame-safe', () => {+ const view = render(<NotFound />)++ expect(screen.getByRole('heading', { name: /Page not found/i })).toBeInTheDocument()+ expect(view.container.querySelector('main')).not.toBeInTheDocument()+ expect(view.container.querySelector('.cu-app--auth')).not.toBeInTheDocument()+ })++ it('uses a global not-found page for unmatched routes outside the auth frame', () => {+ expect(nextConfig.experimental?.globalNotFound).toBe(true)++ const view = render(<GlobalNotFound />)++ expect(screen.getByRole('heading', { name: /Page not found/i })).toBeInTheDocument()+ expect(view.container.querySelector('.cu-app--auth')).toBeInTheDocument()+ expect(view.container.querySelector('.cu-app-layout')).not.toBeInTheDocument()+ })+})diff --git a/profile-ui/app/global-not-found.tsx b/profile-ui/app/global-not-found.tsxnew file mode 100644index 000000000..6b582f339--- /dev/null+++ b/profile-ui/app/global-not-found.tsx@@ -0,0 +1,14 @@+import './globals.css'+import { ProfileNotFoundContent } from './not-found'++export default function GlobalNotFound() {+ return (+ <html lang="en" data-theme="dark">+ <body className="cu-body">+ <main className="cu-app cu-app--auth cu-not-found">+ <ProfileNotFoundContent />+ </main>+ </body>+ </html>+ )+}diff --git a/profile-ui/app/not-found.tsx b/profile-ui/app/not-found.tsxindex 23ebbae6f..bd3d96e89 100644--- a/profile-ui/app/not-found.tsx+++ b/profile-ui/app/not-found.tsx@@ -2,10 +2,10 @@ import Image from 'next/image'import Link from 'next/link'import { PROFILE_ROUTES } from '@constants/routes'-export default function NotFound() {+export function ProfileNotFoundContent() {return (- <main className="cu-app cu-app--auth cu-not-found">- <section className="cu-card cu-not-found__card" aria-labelledby="cu-not-found-title">+ <section className="cu-not-found" aria-labelledby="cu-not-found-title">+ <div className="cu-card cu-not-found__card"><div className="cu-card__body cu-not-found__body"><ImageclassName="cu-not-found__brand-mark"@@ -27,7 +27,11 @@ export default function NotFound() {Back to Profile UI</Link></div>- </section>- </main>+ </div>+ </section>)}++export default function NotFound() {+ return <ProfileNotFoundContent />+}diff --git a/profile-ui/next.config.js b/profile-ui/next.config.jsindex fed4361f7..7ff07a6b0 100644--- a/profile-ui/next.config.js+++ b/profile-ui/next.config.js@@ -1,17 +1,20 @@/** @type {import('next').NextConfig} */const nextConfig = {reactStrictMode: true,+ experimental: {+ globalNotFound: true,+ },async rewrites() {const destination =process.env.EXTERNAL_REST_API_INTERNAL_URL ||- "http://external-rest-api.profiles.svc.cluster.local:8091";+ 'http://external-rest-api.profiles.svc.cluster.local:8091'return [{- source: "/external-rest-api/:path*",- destination: `${destination}/:path*`- }- ];- }-};+ source: '/external-rest-api/:path*',+ destination: `${destination}/:path*`,+ },+ ]+ },+}-module.exports = nextConfig;+module.exports = nextConfigdiff --git a/profile-ui/package-lock.json b/profile-ui/package-lock.jsonindex 03cfe1675..8804fc8cd 100644--- a/profile-ui/package-lock.json+++ b/profile-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-profile-ui",- "version": "0.1.113",+ "version": "0.1.115","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-profile-ui",- "version": "0.1.113",+ "version": "0.1.115","dependencies": {"next": "16.2.11","react": "^18.3.1",diff --git a/profile-ui/package.json b/profile-ui/package.jsonindex eaac7331b..3e231cace 100644--- a/profile-ui/package.json+++ b/profile-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-profile-ui",- "version": "0.1.113",+ "version": "0.1.115","private": true,"scripts": {"dev": "next dev",