Skip to content

Commit

Permalink
👻 Fix up logs for easier use (#589)
Browse files Browse the repository at this point in the history
* Make the output of the code plan loop give details but what was actually done # This is the commit message #2:

* Making priority queue logs move to trace
* Some logs when determining what to do with tasks, now are trace logs

Signed-off-by: Shawn Hurley <[email protected]>

* fixing lexer parser to get the correct lexer and aliases

Signed-off-by: Shawn Hurley <[email protected]>

* updating cache to have more than one file

Signed-off-by: Shawn Hurley <[email protected]>

* We are now able to fix more issues

Signed-off-by: Shawn Hurley <[email protected]>

* deal with case when no more priority tasks

Signed-off-by: Shawn Hurley <[email protected]>

* fixing cache test

Signed-off-by: Shawn Hurley <[email protected]>

* fixup of workflow mistake

Signed-off-by: Shawn Hurley <[email protected]>

---------

Signed-off-by: Shawn Hurley <[email protected]>
  • Loading branch information
shawn-hurley authored Jan 29, 2025
1 parent 89d9d59 commit 53aff70
Show file tree
Hide file tree
Showing 66 changed files with 1,153 additions and 756 deletions.
11 changes: 5 additions & 6 deletions kai/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from kai.jsonrpc.util import AutoAbsPath
from kai.logging.logging import TRACE, get_logger
from kai.reactive_codeplanner.task_manager.api import Task, ValidationError
from kai.reactive_codeplanner.task_runner.analyzer_lsp.api import AnalyzerRuleViolation

LOG = get_logger(__name__)

Expand Down Expand Up @@ -224,12 +225,10 @@ def _dfs(self, task: Optional[Task]) -> Path:
segments = filename.split("_")
filename = "_".join(segments[-min(3, len(segments)) :])
filename = filename[-min(50, len(filename)) :]
return (
self._dfs(task.parent)
/ task.__class__.__name__
/ filename
/ f"line_{task.line}"
)
base_path = self._dfs(task.parent) / task.__class__.__name__ / filename
if isinstance(task, AnalyzerRuleViolation):
base_path = base_path / task.violation.id
return base_path / f"line_{task.line}"
else:
return (
self._dfs(task.parent)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"input": [
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"messages",
"SystemMessage"
],
"kwargs": {
"content": "\n You are an experienced xml developer, who specializes in migrating code from java-ee to quarkus\n ",
"type": "system"
}
},
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"messages",
"HumanMessage"
],
"kwargs": {
"content": "\n I will give you a java-ee file for which I want to take one step towards migrating to quarkus.\n\nI will provide you with static source code analysis information highlighting an issue which needs to be addressed.\n\nFix only the problem described. Other problems will be solved in subsequent steps so it is unnecessary to handle them now.\n\nBefore attempting to migrate the code to quarkus reason through what changes are required and why.\n\nPay attention to changes you make and impacts to external dependencies in the pom.xml as well as changes to imports we need to consider.\n\nRemember when updating or adding annotations that the class must be imported.\n\nAs you make changes that impact the pom.xml or imports, be sure you explain what needs to be updated.\n\nAfter you have shared your step by step thinking, provide a full output of the updated file.\n\n# Input information\n\n## Input File\n\nFile name: \"pom.xml\"\nSource file contents:\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project \n xmlns=\"http://maven.apache.org/POM/4.0.0\" \n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n <modelVersion>4.0.0</modelVersion>\n <groupId>com.redhat.coolstore</groupId>\n <artifactId>monolith</artifactId>\n <version>1.0.0-SNAPSHOT</version>\n <packaging>war</packaging>\n <name>coolstore-monolith</name>\n <properties>\n <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>\n <project.encoding>UTF-8</project.encoding>\n <maven.test.skip>true</maven.test.skip>\n <compiler-plugin.version>3.10.1</compiler-plugin.version>\n <maven.compiler.release>11</maven.compiler.release>\n <surefire-plugin.version>3.0.0</surefire-plugin.version>\n <failsafe-plugin.version>3.0.0</failsafe-plugin.version>\n </properties>\n <dependencies>\n <dependency>\n <groupId>javax</groupId>\n <artifactId>javaee-web-api</artifactId>\n <version>7.0</version>\n <scope>provided</scope>\n </dependency>\n <dependency>\n <groupId>javax</groupId>\n <artifactId>javaee-api</artifactId>\n <version>7.0</version>\n <scope>provided</scope>\n </dependency>\n <dependency>\n <groupId>org.jboss.spec.javax.jms</groupId>\n <artifactId>jboss-jms-api_2.0_spec</artifactId>\n <version>2.0.0.Final</version>\n </dependency>\n <dependency>\n <groupId>org.flywaydb</groupId>\n <artifactId>flyway-core</artifactId>\n <version>4.1.2</version>\n </dependency>\n <dependency>\n <groupId>org.jboss.spec.javax.rmi</groupId>\n <artifactId>jboss-rmi-api_1.0_spec</artifactId>\n <version>1.0.2.Final</version>\n </dependency>\n </dependencies>\n <build>\n <finalName>ROOT</finalName>\n <plugins>\n <plugin>\n <artifactId>maven-compiler-plugin</artifactId>\n <version>${compiler-plugin.version}</version>\n <configuration>\n <encoding>${project.encoding}</encoding>\n <compilerArgs>\n <arg>-parameters</arg>\n </compilerArgs>\n </configuration>\n </plugin>\n <plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifactId>maven-war-plugin</artifactId>\n <version>3.2.0</version>\n </plugin>\n <plugin>\n <artifactId>maven-surefire-plugin</artifactId>\n <version>${surefire-plugin.version}</version>\n <configuration>\n <systemPropertyVariables>\n <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>\n <maven.home>${maven.home}</maven.home>\n </systemPropertyVariables>\n </configuration>\n </plugin>\n <plugin>\n <artifactId>maven-failsafe-plugin</artifactId>\n <version>${failsafe-plugin.version}</version>\n <executions>\n <execution>\n <goals>\n <goal>integration-test</goal>\n <goal>verify</goal>\n </goals>\n <configuration>\n <systemPropertyVariables>\n <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>\n <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>\n <maven.home>${maven.home}</maven.home>\n </systemPropertyVariables>\n </configuration>\n </execution>\n </executions>\n </plugin>\n </plugins>\n </build>\n <profiles>\n <profile>\n <id>native</id>\n <activation>\n <property>\n <name>native</name>\n </property>\n </activation>\n <properties>\n <skipITs>false</skipITs>\n <quarkus.package.type>native</quarkus.package.type>\n </properties>\n </profile>\n </profiles>\n</project>\n```\n\n## Issues\n\n\n### incident 0\nincident to fix: \"Use the Quarkus BOM to omit the version of the different Quarkus dependencies. \n Add the following sections to the `pom.xml` file: \n\n ```xml\n <properties> \n <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> \n <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id> \n <quarkus.platform.version>3.1.0.Final</quarkus.platform.version>\n </properties> \n <dependencyManagement> \n <dependencies> \n <dependency> \n <groupId>$</groupId> \n <artifactId>$</artifactId> \n <version>$</version> \n <type>pom</type> \n <scope>import</scope> \n </dependency> \n </dependencies> \n </dependencyManagement> \n ```\n Check the latest Quarkus version available from the `Quarkus - Releases` link below.\"\nLine number: 5\n\n\n\n# Output Instructions\nStructure your output in Markdown format such as:\n\n## Reasoning\nWrite the step by step reasoning in this markdown section. If you are unsure of a step or reasoning, clearly state you are unsure and why.\n\n## Updated xml File\n```xml\n// Write the updated file in this section. If the file should be removed, make the content of the updated file a comment explaining it should be removed.\n```\n\n## Additional Information (optional)\n\nIf you have any additional details or steps that need to be performed, put it here.\n\n ",
"type": "human"
}
}
],
"output": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"messages",
"AIMessage"
],
"kwargs": {
"content": "## Reasoning\nTo address the issue described in \"incident 0\", we need to update the `pom.xml` file to use the Quarkus BOM (Bill of Materials) to manage the versions of Quarkus dependencies. This involves adding the Quarkus platform properties and the dependency management section to the `pom.xml` file.\n\nHere are the steps to update the `pom.xml` file:\n\n1. Add the Quarkus platform properties to the `properties` section of the `pom.xml` file. This includes the `quarkus.platform.artifact-id`, `quarkus.platform.group-id`, and `quarkus.platform.version`.\n2. Add the dependency management section to the `pom.xml` file. This includes a dependency on the Quarkus BOM with the `type` set to `pom` and the `scope` set to `import`.\n3. Update the version of the Quarkus platform to the latest available version. This can be found on the Quarkus - Releases page.\n\n## Updated xml File\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project \n xmlns=\"http://maven.apache.org/POM/4.0.0\" \n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n <modelVersion>4.0.0</modelVersion>\n <groupId>com.redhat.coolstore</groupId>\n <artifactId>monolith</artifactId>\n <version>1.0.0-SNAPSHOT</version>\n <packaging>war</packaging>\n <name>coolstore-monolith</name>\n <properties>\n <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>\n <project.encoding>UTF-8</project.encoding>\n <maven.test.skip>true</maven.test.skip>\n <compiler-plugin.version>3.10.1</compiler-plugin.version>\n <maven.compiler.release>11</maven.compiler.release>\n <surefire-plugin.version>3.0.0</surefire-plugin.version>\n <failsafe-plugin.version>3.0.0</failsafe-plugin.version>\n <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>\n <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>\n <quarkus.platform.version>3.1.0.Final</quarkus.platform.version>\n </properties>\n <dependencyManagement>\n <dependencies>\n <dependency>\n <groupId>${quarkus.platform.group-id}</groupId>\n <artifactId>${quarkus.platform.artifact-id}</artifactId>\n <version>${quarkus.platform.version}</version>\n <type>pom</type>\n <scope>import</scope>\n </dependency>\n </dependencies>\n </dependencyManagement>\n <dependencies>\n <dependency>\n <groupId>javax</groupId>\n <artifactId>javaee-web-api</artifactId>\n <version>7.0</version>\n <scope>provided</scope>\n </dependency>\n <dependency>\n <groupId>javax</groupId>\n <artifactId>javaee-api</artifactId>\n <version>7.0</version>\n <scope>provided</scope>\n </dependency>\n <dependency>\n <groupId>org.jboss.spec.javax.jms</groupId>\n <artifactId>jboss-jms-api_2.0_spec</artifactId>\n <version>2.0.0.Final</version>\n </dependency>\n <dependency>\n <groupId>org.flywaydb</groupId>\n <artifactId>flyway-core</artifactId>\n <version>4.1.2</version>\n </dependency>\n <dependency>\n <groupId>org.jboss.spec.javax.rmi</groupId>\n <artifactId>jboss-rmi-api_1.0_spec</artifactId>\n <version>1.0.2.Final</version>\n </dependency>\n </dependencies>\n <build>\n <finalName>ROOT</finalName>\n <plugins>\n <plugin>\n <artifactId>maven-compiler-plugin</artifactId>\n <version>${compiler-plugin.version}</version>\n <configuration>\n <encoding>${project.encoding}</encoding>\n <compilerArgs>\n <arg>-parameters</arg>\n </compilerArgs>\n </configuration>\n </plugin>\n <plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifactId>maven-war-plugin</artifactId>\n <version>3.2.0</version>\n </plugin>\n <plugin>\n <artifactId>maven-surefire-plugin</artifactId>\n <version>${surefire-plugin.version}</version>\n <configuration>\n <systemPropertyVariables>\n <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>\n <maven.home>${maven.home}</maven.home>\n </systemPropertyVariables>\n </configuration>\n </plugin>\n <plugin>\n <artifactId>maven-failsafe-plugin</artifactId>\n <version>${failsafe-plugin.version}</version>\n <executions>\n <execution>\n <goals>\n <goal>integration-test</goal>\n <goal>verify</goal>\n </goals>\n <configuration>\n <systemPropertyVariables>\n <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>\n <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>\n <maven.home>${maven.home}</maven.home>\n </systemPropertyVariables>\n </configuration>\n </execution>\n </executions>\n </plugin>\n </plugins>\n </build>\n <profiles>\n <profile>\n <id>native</id>\n <activation>\n <property>\n <name>native</name>\n </property>\n </activation>\n <properties>\n <skipITs>false</skipITs>\n <quarkus.package.type>native</quarkus.package.type>\n </properties>\n </profile>\n </profiles>\n</project>\n```\n\n## Additional Information\nNote that the version of the Quarkus platform used in this example is `3.1.0.Final`. You should check the Quarkus - Releases page for the latest available version and update the `quarkus.platform.version` property accordingly.",
"response_metadata": {
"finish_reason": "stop",
"model_name": "kai-test-generation"
},
"type": "ai",
"id": "run-dc74b8e5-2b07-4376-a308-3dda32816a5a-0",
"tool_calls": [],
"invalid_tool_calls": []
}
},
"meta": {
"taskType": "AnalyzerDependencyRuleViolation",
"taskString": "AnalyzerDependencyRuleViolation<loc=/Users/shurley/repos/kai/kai/example/coolstore/pom.xml:5:-1, violation.id=javaee-pom-to-quarkus-00010>(priority=0(1), depth=0, retries=0)",
"file": "/Users/shurley/repos/kai/kai/example/coolstore/pom.xml",
"message": "Use the Quarkus BOM to omit the version of the different Quarkus dependencies. \n Add the following sections to the `pom.xml` file: \n\n ```xml\n <properties> \n <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> \n <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id> \n <quarkus.platform.version>3.1.0.Final</quarkus.platform.version>\n </properties> \n <dependencyManagement> \n <dependencies> \n <dependency> \n <groupId>$</groupId> \n <artifactId>$</artifactId> \n <version>$</version> \n <type>pom</type> \n <scope>import</scope> \n </dependency> \n </dependencies> \n </dependencyManagement> \n ```\n Check the latest Quarkus version available from the `Quarkus - Releases` link below."
}
}
Loading

0 comments on commit 53aff70

Please sign in to comment.