Skip to content

refactor(web): migrate tools/MCP/external-knowledge toast usage to UI toast and add i18n#33797

Merged
lyzno1 merged 2 commits intomainfrom
codex/migrate-old-toast-calls-in-web-doc
Mar 20, 2026
Merged

refactor(web): migrate tools/MCP/external-knowledge toast usage to UI toast and add i18n#33797
lyzno1 merged 2 commits intomainfrom
codex/migrate-old-toast-calls-in-web-doc

Conversation

@lyzno1
Copy link
Copy Markdown
Member

@lyzno1 lyzno1 commented Mar 20, 2026

Motivation

  • Continue the overlay migration by replacing deprecated legacy toast call sites with the new design-system toast primitive so touched files comply with @/app/components/base/ui/* policies.
  • Replace nearby hardcoded notification copy with translation-backed keys to keep UI strings localized.
  • Update test mocks and expectations to the new toast surface so unit coverage remains accurate after the API change.

Description

  • Replaced legacy toast usages with the new API by switching imports to @/app/components/base/ui/toast and calling toast.add({...}) (replacing Toast.notify / legacy context calls) in provider custom-create, provider detail, MCP modal, schema importer, and external-knowledge connector (web/app/components/tools/provider/*, web/app/components/tools/mcp/*, web/app/components/tools/edit-custom-collection-modal/*, web/app/components/datasets/external-knowledge-base/connector/*).
  • Converted notification payloads to use title for the new toast shape and preserved type (e.g. toast.add({ type: 'error', title: ... })).
  • Added i18n keys and English strings for new messages: mcp.modal.invalidServerUrl, mcp.modal.invalidServerIdentifier, externalKnowledgeForm.connectedSuccess, and externalKnowledgeForm.connectedFailed (web/i18n/en-US/tools.json and web/i18n/en-US/dataset.json).
  • Updated unit tests to mock @/app/components/base/ui/toast (hoisted mocks) and assert toast.add calls, and adjusted expectations to the i18n-backed titles; also pruned obsolete ESLint suppressions affected by the migration (web/eslint-suppressions.json).

Testing

  • Ran lint auto-fix and suppression pruning with pnpm -C web lint:fix --prune-suppressions <changed-files> which completed without errors.
  • Ran focused unit tests with pnpm -C web test for the updated suites (custom-create-card.spec.tsx, detail.spec.tsx, get-schema.spec.tsx, mcp/modal.spec.tsx, external-knowledge-base/connector/index.spec.tsx) and all targeted tests passed (105 tests across the run passed).
  • Verified project TypeScript check (pnpm -C web type-check:tsgo) during the commit pipeline which completed successfully.

Codex Task

Copilot AI review requested due to automatic review settings March 20, 2026 04:30
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 20, 2026
@github-actions github-actions bot added the web This relates to changes on the web. label Mar 20, 2026
@dosubot dosubot bot added javascript Pull requests that update javascript code refactor labels Mar 20, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the application's notification system by migrating from a legacy toast component to a new, standardized UI toast primitive. This change ensures consistency in user feedback, improves maintainability by adhering to current design system policies, and enhances localization capabilities by integrating internationalization for all notification messages. The update also includes necessary adjustments to testing infrastructure and code quality configurations.

Highlights

  • Toast Component Migration: Replaced deprecated legacy toast usages with the new design-system UI toast primitive across various components, including provider custom-create, provider detail, MCP modal, schema importer, and external-knowledge connector.
  • Internationalization (i18n) Integration: Converted hardcoded notification messages to use translation-backed keys for localization, adding new i18n entries for specific messages.
  • Unit Test and ESLint Updates: Updated unit tests to mock the new UI toast component and adjusted expectations for i18n-backed titles. Obsolete ESLint suppressions affected by the migration were also pruned.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively refactors legacy toast notifications to use the new design system's toast primitive, complete with internationalization support. The changes are consistently applied across components, tests, and i18n resource files. My review includes suggestions to improve the quality of the tests by removing an anti-pattern, which will enhance their robustness and maintainability.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 continues the web overlay migration by replacing legacy toast call sites with the design-system toast primitive and localizing newly introduced notification copy via i18n keys.

Changes:

  • Migrated legacy toast usage (Toast.notify / context toasts) to toast.add({ type, title }) from @/app/components/base/ui/toast across tools/MCP/external-knowledge flows.
  • Added i18n keys for new MCP validation errors and external knowledge connection success/failure messages.
  • Updated unit tests and ESLint suppressions to match the new toast surface and localized strings.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web/i18n/en-US/tools.json Adds new MCP modal validation toast strings.
web/i18n/en-US/dataset.json Adds localized titles for external knowledge connection toasts.
web/eslint-suppressions.json Prunes/adjusts suppressions after import/toast refactors.
web/app/components/tools/provider/detail.tsx Migrates multiple success notifications to toast.add with title.
web/app/components/tools/provider/custom-create-card.tsx Migrates create success toast to toast.add.
web/app/components/tools/provider/tests/detail.spec.tsx Updates mocks to the new @/app/components/base/ui/toast API.
web/app/components/tools/provider/tests/custom-create-card.spec.tsx Updates toast mocks/expectations for title field.
web/app/components/tools/mcp/modal.tsx Replaces hardcoded validation toasts with i18n-backed toast.add calls.
web/app/components/tools/mcp/tests/modal.spec.tsx Updates toast mocking and asserts i18n-keyed toast titles.
web/app/components/tools/edit-custom-collection-modal/get-schema.tsx Migrates URL validation toast to toast.add with title.
web/app/components/tools/edit-custom-collection-modal/tests/get-schema.spec.tsx Updates toast mock and expectations to toast.add({ title }).
web/app/components/datasets/external-knowledge-base/connector/index.tsx Localizes external knowledge connect success/failure toasts via useTranslation.
web/app/components/datasets/external-knowledge-base/connector/tests/index.spec.tsx Updates toast expectations to i18n-keyed titles under the new toast module.

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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.58%. Comparing base (978ebbf) to head (55c860f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33797   +/-   ##
=======================================
  Coverage   77.58%   77.58%           
=======================================
  Files        4418     4418           
  Lines      176780   176781    +1     
  Branches    33981    33981           
=======================================
+ Hits       137160   137162    +2     
+ Misses      36371    36370    -1     
  Partials     3249     3249           
Flag Coverage Δ
web 78.97% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 20, 2026
@lyzno1 lyzno1 merged commit 4d538c3 into main Mar 20, 2026
24 checks passed
@lyzno1 lyzno1 deleted the codex/migrate-old-toast-calls-in-web-doc branch March 20, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code lgtm This PR has been approved by a maintainer refactor size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants