Skip to content

Improvements in AI Scriptless testing#23

Open
3dgiordano wants to merge 10 commits into
developmentfrom
AI_SCRIPTLESS_EDITOR
Open

Improvements in AI Scriptless testing#23
3dgiordano wants to merge 10 commits into
developmentfrom
AI_SCRIPTLESS_EDITOR

Conversation

@3dgiordano

@3dgiordano 3dgiordano commented May 27, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces substantial enhancements and new functionality for handling AI Scriptless test data, command catalogs, and related API endpoints. The main changes include the addition of new utility functions for API endpoints, a comprehensive set of data models for AI Scriptless entities, and new formatters for transforming and presenting test, variable, snapshot, and command definition data. Additionally, improvements were made to utility functions to handle JSON decoding more robustly.

API Endpoint Utilities:

  • Added new functions in config/perfecto.py to generate URLs for AI Scriptless draft management, command repository, and repository management APIs, supporting new backend integrations.

AI Scriptless Data Models:

  • Introduced a new module models/ai_scriptless.py containing Pydantic models for representing script flow elements, test structures, command catalog entries, variables, snapshots, and command definitions. These models provide a structured and type-safe way to handle AI Scriptless test data.

AI Scriptless Formatters:

  • Implemented a new formatter module in formatters/ai_scriptless.py that includes:
    • A command selection policy helper for agents.
    • Functions to format test structures, command catalogs, variables, snapshots, and command definitions using the new models.
    • Helper functions for extracting and transforming command and step information from raw payloads. [1] [2]

Utility Improvements:

  • Updated the api_request function in tools/utils.py to more gracefully handle empty or non-JSON responses by returning the raw text if JSON decoding fails, improving robustness when dealing with diverse API responses. [1] [2]

@3dgiordano 3dgiordano changed the title WIP: Improvements in AI Scriptless testing Improvements in AI Scriptless testing Jun 17, 2026
@3dgiordano 3dgiordano marked this pull request as ready for review June 17, 2026 10:42

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What do you think about adding tests to verify correct behaviour? I see that we have a lot of logic with nodes manipulation, navigations in between elements, persistance. Feel like a lot of responsibilities.
I attempted to create a modularization resulting in a responsibility delegation and this is the result 👇 what do you think?

Image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I was able to create the mermaid for this, it could be useful for quick refactor in case you agree on changes:

classDiagram
    class AiScriptlessManager {
      +list_commands()
      +view_test_structure()
      +add_command()
      +move_command()
      +save_test()
    }

    class ScriptMutationService {
      +load_and_mutate()
      +script_write_lock()
    }

    class ScriptRepository {
      +fetch_script_payload()
      +persist_script()
      +fetch_current_username()
    }

    class ScriptTree {
      +find_element_by_path()
      +find_step_path_for_element()
      +insert_flow_element()
      +move_element_by_path()
      +delete_element_by_path()
      +set_element_enabled()
    }

    class ScriptBuilders {
      +build_flow_element()
      +build_if_statement()
      +build_loop()
      +build_logical_step()
      +build_arguments()
    }

    class ScriptVariables {
      +add_script_variable()
      +modify_script_variable()
      +delete_script_variable()
      +validate_variable_name()
      +build_variable_data()
    }

    class ScriptPaths {
      +build_item_key()
      +split_item_key()
      +format_test_ui_location()
      +validate_step_path()
    }

    AiScriptlessManager --> ScriptMutationService : orchestrates edits
    AiScriptlessManager --> ScriptRepository : reads / saves
    AiScriptlessManager --> ScriptBuilders : creates elements
    AiScriptlessManager --> ScriptVariables : variable operations
    AiScriptlessManager --> ScriptPaths : itemKey / path helpers

    ScriptMutationService --> ScriptRepository : fetch + persist
    ScriptMutationService --> ScriptTree : apply mutations

    ScriptTree --> ScriptPaths : validates step_path
    ```
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants