Skip to content

Conversation

guidomodarelli
Copy link
Member

@guidomodarelli guidomodarelli commented Sep 18, 2025

Description

This PR add error handling and backend consistency when a model registration fails.

  1. Validation of failed Test Model Connection

    • Tests the flow of adding a model with an invalid API Key.
    • Ensures the connection step fails as expected.
    • Verifies that clicking the failed step’s cross now displays detailed error information (instead of just the status code).
  2. Rollback execution when model registration step fails

    • Tests model registration with an invalid API Key to force a failure.
    • Validates that the UI shows a rollback executed message.
    • Confirms through DevTools (Network tab) that the correct backend rollback endpoints are triggered.

Issue resolved

closes #10

Tasks/Evidence

  • Verifies that clicking the failed step’s cross now displays detailed error information (instead of just the status code).

    image
  • Enhance the error popover by adding a «panelStyle» property with word-wrapping. This ensures long text breaks properly, improving readability and preventing layout issues.

  • Enhance error propagation and contextual data in HTTP client operations by introducing a detailed «HttpError» utility.

  • Refactor installation steps to incorporate structured error handling using «StepError», providing detailed context and possible causes for failures. Improve diagnostic messaging during installation, including step-specific details and enriched error descriptions.

  • Add utility functions to extract status codes and derive potential causes for issues, improving debugging capabilities.

  • Introduce rollback functionality to the installation process, enabling the reversal of completed steps upon failure. Extend «InstallationAIAssistantStep» with a new «rollback» method and update «InstallationProgressManager» to manage rollback execution. Add rollback handling for agent, connector, and model creation steps, ensuring created resources are cleaned up if subsequent steps fail.

  • Enhance the UI to display rollback summaries using «addInfoToast» when installation errors occur.
    image

    • Introduce rollback tracking in the installation process to record reverted steps during failures.
    • Update the response structure to include a «rollbacks» field and propagate this data through the installation workflow.
    • Modify tests to verify rollback behavior and ensure accurate reporting of reverted steps.
    • Improve error handling and state management by adding a reference to track the last rollback summary and avoid duplicate toasts.

Evidence

🟢 Test Legend

Symbol Meaning
The test hasn't started yet.
🟢 All checks passed.
🟡 There is at least one expected fail or skipped test and no failures.
🔴 There is at least one failed check.
Doesn't apply.
🔧 Request changes.
Needs more information.

🧪 UI Tests

Test Description Chrome Firefox Safari
1️⃣ In Explore > Machine Learning: Click Add Model → Fill required fields → Enter invalid API Key → Step Test Model Connection should fail → Clicking the failed step's cross should display detailed error info (not just status code)
2️⃣ In Explore > Machine Learning: Click Add Model → Fill required fields → Enter invalid API Key → Registration should fail → UI must show rollback executed message → In DevTools > Network, verify rollback endpoints were called in backend

📋Test Details

⚫ 1️⃣ In **Explore > Machine Learning**: Click **Add Model** → Fill required fields → Enter invalid **API Key** → Step **Test Model Connection** should fail → Clicking the failed step's cross should display **detailed error info (not just status code)**

CHROME - ⚫

FIREFOX - ⚫

SAFARI - ⚫

⚫ 2️⃣ In **Explore > Machine Learning**: Click **Add Model** → Fill required fields → Enter invalid **API Key** → Registration should fail → UI must show **rollback executed** message → In **DevTools > Network**, verify rollback endpoints were called in backend

CHROME - ⚫

FIREFOX - ⚫

SAFARI - ⚫

Enhance the error popover by adding a «panelStyle» property with word-wrapping. This ensures long text breaks properly, improving readability and preventing layout issues.
@guidomodarelli guidomodarelli self-assigned this Sep 18, 2025
@guidomodarelli guidomodarelli added the type/bug Bug issue label Sep 18, 2025
Enhance error propagation and contextual data in HTTP client operations by introducing a detailed «HttpError» utility. Update test cases to validate enriched error messages, including status text and request details.

Refactor installation steps to incorporate structured error handling using «StepError», providing detailed context and possible causes for failures. Improve diagnostic messaging during installation, including step-specific details and enriched error descriptions.

Add utility functions to extract status codes and derive potential causes for issues, improving debugging capabilities. Update related unit tests to ensure comprehensive coverage of new behaviors.
@guidomodarelli guidomodarelli linked an issue Sep 18, 2025 that may be closed by this pull request
@guidomodarelli guidomodarelli changed the title improve error popover readability in «DeploymentStatus» Refine AI chatbot registration process Sep 18, 2025
Introduce rollback functionality to the installation process, enabling the reversal of completed steps upon failure. Extend «InstallationAIAssistantStep» with a new «rollback» method and update «InstallationProgressManager» to manage rollback execution. Add rollback handling for agent, connector, and model creation steps, ensuring created resources are cleaned up if subsequent steps fail.

Enhance integration tests to validate rollback behavior and update the «InstallationResult» structure to include «rollbackErrors» for improved error reporting.
Refine the error message in the «TestModelConnectionStep» test to improve clarity and match the updated phrasing. This ensures the test provides more precise feedback when the step validation fails.
Simplify the «HttpError» implementation by removing all logic related to determining and handling the presence of a response body. Eliminate the «responseBodyOmitted» property, the «hasMeaningfulBody» function, and associated references.

This change reduces complexity and aligns with a security-focused approach by avoiding reliance on response body content.
Enhance the test for «WindowFetchHttpClient» by adding assertions for «status» and «statusText» in propagated HTTP errors, ensuring more comprehensive error validation.

Simplify the failure message validation in «InstallationProgressManager» tests by removing redundant details, improving clarity and focus on the core error message.
Simplify code structure by normalizing formatting for better readability across files. Replace «RollbackError» type with an «interface» for consistency. Update multiline constructs to align with style guidelines.

These changes improve code maintainability and adhere to standardized practices.
@guidomodarelli
Copy link
Member Author

All errors related to this specific linter rule will be ignored.

Error:   1:1  error  File must start with a license header  @osd/eslint/require-license-header

Introduce an optional «onRollback» callback to the «TestStep» class, enabling custom rollback logic during test execution. Update the «rollback» method to invoke this callback if provided.

Add a new test case to verify proper rollback execution order for failed and completed steps. Ensure rollback errors are collected and validated.

Enhances test coverage and ensures consistent behavior during rollback scenarios.
Introduce a unit test to verify the behavior of the «ModelRegister» component during installation failure. Mock dependencies like «ModelForm» and «useAssistantInstallation» to simulate scenarios, ensuring proper handling of error states and absence of success messages.
Introduce rollback tracking in the installation process to record reverted steps during failures. Update the response structure to include a «rollbacks» field and propagate this data through the installation workflow.

Enhance the UI to display rollback summaries using «addInfoToast» when installation errors occur. Modify tests to verify rollback behavior and ensure accurate reporting of reverted steps.

Improve error handling and state management by adding a reference to track the last rollback summary and avoid duplicate toasts.
Standardize imports across test files by replacing inline React imports with named imports. Simplify code structure for readability by reformatting multiline arrays and conditionals.

Remove the «override» keyword from rollback methods in multiple classes to align with TypeScript conventions and ensure compatibility.

Improve readability in «derivePossibleCauses» by reformatting conditional checks for network issues.

These changes enhance code consistency, maintainability, and readability.
Update mocked components and hooks to use explicit «React» references
instead of named imports. This change ensures compatibility with Jest's
module mocking and avoids potential conflicts with React's internal
APIs.

Additionally, replace JSX syntax with «React.createElement» in the
mocked «MockModelForm» for consistency and clarity in the mock's
implementation.
@gonzaarancibia gonzaarancibia self-requested a review September 22, 2025 10:08
@gonzaarancibia
Copy link
Member

gonzaarancibia commented Sep 22, 2025

🟢 Test Legend

Symbol Meaning
The test hasn't started yet.
🟢 All checks passed.
🟡 There is at least one expected fail or skipped test and no failures.
🔴 There is at least one failed check.
Doesn't apply.
🔧 Request changes.
Needs more information.

🧪 UI Tests 🟢

Test Description Chrome Firefox Safari
1️⃣ In Explore > Machine Learning: Click Add Model → Fill required fields → Enter invalid API Key → Step Test Model Connection should fail → Clicking the failed step's cross should display detailed error info (not just status code) 🟢 🟢 🟢
2️⃣ In Explore > Machine Learning: Click Add Model → Fill required fields → Enter invalid API Key → Registration should fail → UI must show rollback executed message → In DevTools > Network, verify rollback endpoints were called in backend 🟢 🟢 🟢

📋Test Details

🟢 1️⃣ In **Explore > Machine Learning**: Click **Add Model** → Fill required fields → Enter invalid **API Key** → Step **Test Model Connection** should fail → Clicking the failed step's cross should display **detailed error info (not just status code)**

CHROME - 🟢

Screenshot 2025-09-22 at 7 28 48 AM

FIREFOX - 🟢

Screenshot 2025-09-22 at 7 36 11 AM

SAFARI - 🟢

Screenshot 2025-09-22 at 7 37 22 AM
🟢 2️⃣ In **Explore > Machine Learning**: Click **Add Model** → Fill required fields → Enter invalid **API Key** → Registration should fail → UI must show **rollback executed** message → In **DevTools > Network**, verify rollback endpoints were called in backend

CHROME - 🟢

Screenshot 2025-09-22 at 7 41 13 AM

FIREFOX - 🟢

Screenshot 2025-09-22 at 7 42 44 AM

SAFARI - 🟢

Screenshot 2025-09-22 at 7 41 47 AM

Copy link
Member

@gonzaarancibia gonzaarancibia left a comment

Choose a reason for hiding this comment

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

🟢 LGTM

@Machi3mfl Machi3mfl self-requested a review September 22, 2025 19:41
@Machi3mfl
Copy link
Member

Machi3mfl commented Sep 23, 2025

🧪 UI Tests 🟢

Test Description Chrome Firefox Safari
1️⃣ In Explore > Machine Learning: Click Add Model → Fill required fields → Enter invalid API Key → Step Test Model Connection should fail → Clicking the failed step's cross should display detailed error info (not just status code) 🟢
2️⃣ In Explore > Machine Learning: Click Add Model → Fill required fields → Enter invalid API Key → Registration should fail → UI must show rollback executed message → In DevTools > Network, verify rollback endpoints were called in backend 🟢

📋Test Details

🟢 1️⃣ In **Explore > Machine Learning**: Click **Add Model** → Fill required fields → Enter invalid **API Key** → Step **Test Model Connection** should fail → Clicking the failed step's cross should display **detailed error info (not just status code)**

CHROME - 🟢

Screen.Recording.2025-09-23.at.11.14.25.AM.mov

FIREFOX - ⚪

SAFARI - ⚪

🟢 2️⃣ In **Explore > Machine Learning**: Click **Add Model** → Fill required fields → Enter invalid **API Key** → Registration should fail → UI must show **rollback executed** message → In **DevTools > Network**, verify rollback endpoints were called in backend

CHROME - 🟢

Screen.Recording.2025-09-23.at.11.16.31.AM.mov

FIREFOX - ⚪

SAFARI - ⚪

Copy link
Member

@Machi3mfl Machi3mfl left a comment

Choose a reason for hiding this comment

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

LGTM!

@asteriscos asteriscos merged commit e583800 into 4.14.0 Sep 23, 2025
3 of 4 checks passed
@asteriscos asteriscos deleted the bug/10-refine-ai-chatbot-registration-process branch September 23, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bug issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refine AI chatbot registration process
4 participants