Skip to content

Commit

Permalink
🐛 CollapsableErrors assume validation field values are empty (#692)
Browse files Browse the repository at this point in the history
* CollapsableErrors assume validation field values are empty

* When doing comparison for collapsable errors, we assume that only the
  fields that matter are different, and everything else is reset.
* We were not reseting the column for collapsable errors, causing them
  to look different for both fuzzy match and equality.
* When it was unable to be solved, due to an error, we infinitly added
  parent task as a child task.

Signed-off-by: Shawn Hurley <shawn@hurley.page>

* adding file collapse to PackageDoesNotExistError

Signed-off-by: Shawn Hurley <shawn@hurley.page>

---------

Signed-off-by: Shawn Hurley <shawn@hurley.page>
  • Loading branch information
shawn-hurley authored Feb 26, 2025
1 parent 351ad91 commit 74b4682
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion kai/reactive_codeplanner/task_runner/compiler/maven_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ def error_lines(self) -> list[int] | None:
def get_collapsable_key(self) -> str:
pass

@abstractmethod
def remove_unused_fields(self) -> None:
pass


# Subclasses for specific error categories
@dataclass(eq=False)
Expand Down Expand Up @@ -195,6 +199,10 @@ def get_cache_path(self, root: Path) -> Path:
root_path /= self._clean_filename(self.missing_symbol)
return root_path

def remove_unused_fields(self) -> None:
self.line = 0
self.column = 0


@dataclass(eq=False)
class PackageDoesNotExistError(CollapsedMavenCompilerError):
Expand Down Expand Up @@ -224,6 +232,14 @@ def get_cache_path(self, root: Path) -> Path:
stem /= self._clean_filename(f"retry_{self.retry_count}")
return root / stem

def remove_unused_fields(self) -> None:
self.line = 0
self.column = 0
# The only place to fix packages not found is the pom.xml
# Once the package is in the pom we will no longer have this
# error.
self.file = "pom.xml"


@dataclass(eq=False)
class SyntaxError(MavenCompilerError):
Expand Down Expand Up @@ -625,7 +641,7 @@ def deduplicate_errors(errors: list[MavenCompilerError]) -> list[MavenCompilerEr
new_error.lines = [new_error.line]
## Setting this, because we don't want these collapsed errors
## to ever skip fuzzy matching, which not matching line numbers will do
new_error.line = 0
new_error.remove_unused_fields()
new_error.lines.append(error.line)
else:
file_type_to_collapsable_error[dict_key] = error
Expand Down

0 comments on commit 74b4682

Please sign in to comment.