Skip to content

SED-4429 initial draft of mapping fragments to plans#594

Draft
cmisev wants to merge 5 commits intomasterfrom
SED-4429-step-ap-ide
Draft

SED-4429 initial draft of mapping fragments to plans#594
cmisev wants to merge 5 commits intomasterfrom
SED-4429-step-ap-ide

Conversation

@cmisev
Copy link

@cmisev cmisev commented Feb 12, 2026

No description provided.

@cmisev cmisev requested a review from david-stephan February 12, 2026 08:32
@gemini-code-assist
Copy link

Summary of Changes

Hello @cmisev, 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 establishes the foundational components for enhanced IDE integration with automation packages. It introduces a dedicated module and refactors the core mechanism for reading and managing automation package content, specifically plans defined in YAML fragments. The changes enable direct manipulation of these plans, paving the way for future IDE features that can seamlessly interact with and persist changes to automation package definitions.

Highlights

  • New IDE Module for Automation Packages: A new Maven module, step-automation-packages-ide, has been introduced to house IDE-specific functionalities for managing automation packages.
  • Fragment-to-Plan Mapping and Management: New classes AutomationPackageCollectionFactory and AutomationPackagePlanCollection enable the system to treat plans defined within YAML fragments as collections, allowing for CRUD operations. The AutomationPackageYamlFragmentManager is responsible for managing the lifecycle of these plans, including saving modifications back to their original YAML files.
  • Refactored Automation Package Reading: The AutomationPackageReader has been updated to build a hierarchical tree of YAML fragments and to store the URL of the fragment and the original name within the YAML for each plan. This provides better traceability and enables direct manipulation of plans within their source files.
  • Comprehensive Test Coverage: Extensive test cases have been added to validate the new collection and fragment management functionalities, covering scenarios like reading, modifying, renaming, and removing plans within automation packages.
Changelog
  • step-automation-packages/pom.xml
    • Added step-automation-packages-ide as a new Maven module.
  • step-automation-packages/step-automation-packages-ide/pom.xml
    • Created new Maven module for IDE-specific automation package functionalities, including necessary dependencies.
  • step-automation-packages/step-automation-packages-ide/src/main/java/step/core/collections/AutomationPackageCollectionFactory.java
    • Implemented a collection factory to provide AutomationPackagePlanCollection for Plan entities, integrating with the fragment manager.
  • step-automation-packages/step-automation-packages-ide/src/main/java/step/core/collections/AutomationPackagePlanCollection.java
    • Created a collection for Plan entities that extends InMemoryCollection and interacts with AutomationPackageYamlFragmentManager for persistence operations like save and remove.
  • step-automation-packages/step-automation-packages-ide/src/test/java/step/core/collections/AutomationPackageCollectionTest.java
    • Added comprehensive unit tests for AutomationPackageCollectionFactory and AutomationPackagePlanCollection, covering reading, modifying, renaming, and removing plans from YAML fragments.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/.apignore
    • Added a test resource file for ignored patterns within an automation package.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/automation-package.yml
    • Added a test resource YAML descriptor for a sample automation package.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/expected/plan1AfterModification.yml
    • Added an expected YAML file representing a plan after modification for testing purposes.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/expected/plan1AfterRemove.yml
    • Added an expected YAML file representing a plan after removal for testing purposes.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/expected/plan1AfterRename.yml
    • Added an expected YAML file representing a plan after renaming for testing purposes.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/ignoredFile.yml
    • Added a test resource YAML file intended to be ignored by the automation package reader.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/keywords.yml
    • Added a test resource YAML file defining sample keywords.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/parameters.yml
    • Added a test resource YAML file defining sample parameters.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/parameters2.yml
    • Added another test resource YAML file defining additional sample parameters.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/plan.plan
    • Added a test resource plain text plan file.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/plans/plan1.yml
    • Added a test resource YAML file defining a sample plan.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/plans/plan2.plan
    • Added a test resource plain text plan file.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/plans/plan2.yml
    • Added another test resource YAML file defining a sample plan with composite elements.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/plansPlainText/firstPlainText.plan
    • Added a test resource plain text plan file.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/plansPlainText/secondPlainText.plan
    • Added another test resource plain text plan file.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/schedules.yml
    • Added a test resource YAML file defining sample schedules.
  • step-automation-packages/step-automation-packages-ide/src/test/resources/samples/step-automation-packages-sample1/unknown.yml
    • Added a test resource YAML file for unknown fragments.
  • step-automation-packages/step-automation-packages-manager/src/main/java/step/automation/packages/AutomationPackageReader.java
    • Modified readAutomationPackage to use URL for descriptor access, removed IOException from method signature, and introduced readAutomationPackageYamlFragmentTree to build a fragment hierarchy. Plans now store their fragment URL and original name in YAML attributes.
  • step-automation-packages/step-automation-packages-manager/src/main/java/step/automation/packages/JavaAutomationPackageReader.java
    • Added a convenient method provideAutomationPackageYamlFragmentManager for testing purposes, allowing direct access to the fragment manager from a file.
  • step-automation-packages/step-automation-packages-yaml/src/main/java/step/automation/packages/yaml/AutomationPackageDescriptorReader.java
    • Updated to read YAML fragments from URLs, added new readAutomationPackageDescriptor and readAutomationPackageFragment overloads, and exposed getYamlObjectMapper for external use.
  • step-automation-packages/step-automation-packages-yaml/src/main/java/step/automation/packages/yaml/AutomationPackageYamlFragmentManager.java
    • Implemented a manager to handle plans within YAML fragments, including initializing maps, retrieving plans, saving plans by writing back to the YAML files, and removing plans.
  • step-automation-packages/step-automation-packages-yaml/src/main/java/step/automation/packages/yaml/model/AbstractAutomationPackageFragmentYaml.java
    • Added fields for fragmentUrl, parent, and children to represent the fragment hierarchy, and corresponding getters/setters.
  • step-automation-packages/step-automation-packages-yaml/src/main/java/step/automation/packages/yaml/model/AutomationPackageFragmentYaml.java
    • Extended the interface with methods for fragmentUrl, parent, and children to support the new fragment hierarchy.
  • step-core/src/main/java/step/automation/packages/AutomationPackageArchive.java
    • Added an abstract method getDescriptorYamlUrl() to retrieve the URL of the automation package descriptor YAML.
  • step-core/src/main/java/step/automation/packages/JavaAutomationPackageArchive.java
    • Implemented getDescriptorYamlUrl() to return the URL of the automation package descriptor from the classloader.
  • step-plans/step-plans-yaml-parser/src/main/java/step/plans/parser/yaml/YamlPlanReader.java
    • Changed the visibility of the planToYamlPlan method from protected to public to allow external access.
Activity
  • The pull request introduces a new Maven module and refactors core components to enable mapping and managing plans within YAML fragments, addressing the SED-4429 task.
  • New classes for collection management and fragment management have been added to facilitate CRUD operations on plans stored in YAML.
  • Extensive test resources and unit tests were created to ensure the correctness and robustness of the new functionalities.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@cmisev cmisev requested a review from jeromecomte February 12, 2026 08:37
Copy link

@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 introduces a new step-automation-packages-ide module to support mapping YAML fragments to plans, which is a great step towards better IDE integration. The changes include a new collection factory and collection implementation for plans, along with significant refactoring in AutomationPackageReader to support a tree structure of fragments. My review focuses on improving dependency management, fixing a potential bug with a hardcoded limit, and enhancing exception handling for better maintainability.

Comment on lines +52 to +57
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>

Choose a reason for hiding this comment

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

high

The mockito-all dependency is used with a very old version 1.9.5 (from 2012). This artifact is deprecated and can cause dependency conflicts as it bundles other libraries. The project already includes mockito-core (lines 47-50), which is the recommended approach. Please remove the mockito-all dependency to avoid potential issues and keep the dependencies clean.


@Override
public void remove(Filter filter) {
find(filter, null, null, null, 100).forEach(fragmentManager::removePlan);

Choose a reason for hiding this comment

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

high

The remove method uses a hardcoded limit of 100 when finding plans to remove. If more than 100 plans match the filter, only the first 100 will be removed by fragmentManager::removePlan, but super.remove(filter) will remove all matching plans from the in-memory collection. This will lead to an inconsistent state between the file system and the in-memory representation. To fix this, you should fetch all matching plans, for example by passing Integer.MAX_VALUE as the limit.

Suggested change
find(filter, null, null, null, 100).forEach(fragmentManager::removePlan);
find(filter, null, null, null, Integer.MAX_VALUE).forEach(fragmentManager::removePlan);

Comment on lines +115 to +117
} catch (URISyntaxException | IOException e) {
throw new RuntimeException(e);
}

Choose a reason for hiding this comment

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

medium

Catching URISyntaxException | IOException and re-throwing it as a generic RuntimeException can obscure the original cause of the error and make debugging more difficult. It is better to wrap the original exception in a more specific, custom exception or at least include a descriptive message in the new RuntimeException.

Suggested change
} catch (URISyntaxException | IOException e) {
throw new RuntimeException(e);
}
} catch (URISyntaxException | IOException e) {
throw new RuntimeException("Failed to write fragment: " + fragment.getFragmentUrl(), e);
}

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.

1 participant