Skip to content

[codex] Improve UI architecture guardrails#623

Open
linghaoSu wants to merge 1 commit into
matrixhub-ai:mainfrom
linghaoSu:codex/ui-optimization-guardrails
Open

[codex] Improve UI architecture guardrails#623
linghaoSu wants to merge 1 commit into
matrixhub-ai:mainfrom
linghaoSu:codex/ui-optimization-guardrails

Conversation

@linghaoSu

Copy link
Copy Markdown
Collaborator

Summary

  • move ModelCard out of shared to remove the shared -> features dependency
  • centralize additional query/mutation definitions and route/component notification metadata
  • add ESLint guardrails for UI architecture boundaries and query/table usage
  • add missing TanStack Form blur handlers and locale coverage
  • split major Vite vendor chunks to avoid the large chunk warning

Why

The UI layer had several repeated patterns that were easy to regress: feature imports from shared components, component-owned notifications, inline query keys, and direct table imports outside the shared table wrapper. This PR codifies those expectations and moves more behavior into feature-level query and mutation factories.

Validation

  • pnpm lint
  • pnpm typecheck
  • pnpm build
  • git diff --check

@netlify

netlify Bot commented May 15, 2026

Copy link
Copy Markdown

Deploy Preview for matrixhub-ai canceled.

Name Link
🔨 Latest commit 5d9e1b0
🔍 Latest deploy log https://app.netlify.com/projects/matrixhub-ai/deploys/6a06e69a80f36b00089db118

@github-actions

Copy link
Copy Markdown
Contributor

Hi @linghaoSu,
Thanks for your pull request!
If the PR is ready, use the /auto-cc command to assign Reviewer to Review.
We will review it shortly.

Details

Instructions for interacting with me using comments are available here.
If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

@linghaoSu
linghaoSu marked this pull request as ready for review May 19, 2026 09:27
Copilot AI review requested due to automatic review settings May 19, 2026 09:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR strengthens the UI’s architectural boundaries by centralizing query/mutation option factories (including notification metadata), moving feature-specific UI out of shared, adding ESLint guardrails to prevent regressions, and improving UX/build output via form blur handling, locale coverage, and Vite chunk splitting.

Changes:

  • Centralized query/mutation definitions (incl. notification metadata) and migrated call sites to use *QueryOptions() / *MutationOptions().
  • Added ESLint rules to enforce shared↔features boundaries, forbid component-owned notifications, and discourage inline query keys / direct MRT usage.
  • Improved UX/build output: added missing TanStack Form blur handlers, filled missing i18n keys, and split major vendor chunks in Vite.

Reviewed changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ui/vite.config.ts Adds Rollup manualChunks to split large vendor bundles.
ui/src/types/tanstack-query.ts Extends notification meta typing to support resolver-based success message/color.
ui/src/routes/(auth)/route.tsx Switches logout to centralized mutation options.
ui/src/routes/(auth)/(app)/projects/index.tsx Uses prefetchQuery for route-level prefetching.
ui/src/queryClient.ts Adds resolver support for mutation success notifications and colors.
ui/src/locales/zh/projects.json Adds missing member-mutation notification strings.
ui/src/locales/zh/profile.json Adds missing error notification strings for profile actions.
ui/src/locales/zh/login.json Adds missing login/logout error strings.
ui/src/locales/en/projects.json Adds missing member-mutation notification strings.
ui/src/locales/en/profile.json Adds missing error notification strings for profile actions.
ui/src/locales/en/login.json Adds missing login/logout error strings.
ui/src/features/projects/pages/ProjectModelsPage.tsx Uses feature-owned ModelCard to avoid shared→features dependency.
ui/src/features/projects/members/members.mutation.ts Centralizes member mutation meta error messages + invalidations.
ui/src/features/projects/members/components/EditRoleModal.tsx Adds missing blur handler for TanStack Form field.
ui/src/features/projects/members/components/AddMemberModal.tsx Reuses allUsersQueryOptions() and adds missing blur handlers.
ui/src/features/projects/components/CreateProjectModal.tsx Reuses allRegistriesQueryOptions() and adds missing blur handlers.
ui/src/features/profile/profile.mutation.ts Centralizes profile mutation option factories + notifications.
ui/src/features/profile/pages/SecurityPage.tsx Reuses centralized reset-password mutation + improves field validation UX.
ui/src/features/profile/pages/AccessTokenPage.tsx Reuses centralized create-token mutation + adds blur handling.
ui/src/features/profile/components/ExpireAtField.tsx Plumbs optional blur handler through the custom field component.
ui/src/features/profile/components/CreateSshKeyModal.tsx Wires blur handling to ExpireAtField.
ui/src/features/profile/components/AccessTokenTable.tsx Reuses centralized delete-token mutation and fixes delete variable handling.
ui/src/features/models/components/ModelCard.tsx Introduces feature-owned ModelCard component.
ui/src/features/models/components/HotModelList.tsx Updates to import ModelCard from features.
ui/src/features/models/components/AllModelList.tsx Updates to import ModelCard from features.
ui/src/features/login/pages/LoginPage.tsx Reuses centralized login mutation + adds blur handling.
ui/src/features/login/login.mutation.ts Adds centralized login/logout mutation option factories with notification meta.
ui/src/features/admin/users/users.query.ts Adds allUsersQueryOptions() + corresponding key.
ui/src/features/admin/users/users.mutation.ts Adds typed batch-delete result + resolver-based success notification meta.
ui/src/features/admin/users/components/BatchDeleteUsersModal.tsx Removes component-owned notifications in favor of mutation meta.
ui/src/features/admin/replications/components/ReplicationFormModal.tsx Reuses allRegistriesQueryOptions() for dropdown data.
ui/src/features/admin/registries/registries.query.ts Adds allRegistriesQueryOptions() + corresponding key.
ui/eslint.config.js Adds architectural guardrails (restricted imports, queryKey syntax restriction).
ui/agents/patterns.md Updates docs to describe resolver-based success message/color behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/eslint.config.js
{
patterns: [
{
group: ['@/features/*'],
Comment thread ui/src/queryClient.ts
Comment on lines +22 to +31
function resolveNotificationMetaValue(
value: string | ((data: unknown, variables: unknown, context: unknown) => string | undefined) | undefined,
data: unknown,
variables: unknown,
context: unknown,
) {
return typeof value === 'function'
? value(data, variables, context)
: value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants