Skip to content

feat(evaluator): Implement evaluator-result parsing#22

Merged
heliocastro merged 2 commits intomainfrom
feat/evaluation_result
Mar 12, 2026
Merged

feat(evaluator): Implement evaluator-result parsing#22
heliocastro merged 2 commits intomainfrom
feat/evaluation_result

Conversation

@heliocastro
Copy link
Owner

  • Enum conversions are treated by a base class do do proper mapping.
  • Added a utility to load ort yaml with specialized treatment to invalid
    entries.
  • Ort run classes now derive of a common class

Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
- Enum conversions are treated by a base class do do proper mapping.
- Added a utility to load ort yaml with specialized treatment to invalid
  entries.
- Ort run classes now derive of a common class

Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
@heliocastro heliocastro self-assigned this Mar 12, 2026
Copilot AI review requested due to automatic review settings March 12, 2026 16:43
@heliocastro heliocastro added the enhancement New feature or request label Mar 12, 2026
@heliocastro heliocastro merged commit f05464d into main Mar 12, 2026
18 checks passed
@heliocastro heliocastro deleted the feat/evaluation_result branch March 12, 2026 16:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements evaluator-result parsing by adding EvaluatorRun and RuleViolation models, introduces a ValidatedIntEnum base class to centralize enum string-to-member conversion (replacing per-field @field_validator + convert_enum() calls), adds a custom YAML loader for ORT-specific tags, and extracts common run fields into a BaseRun base class.

Changes:

  • Replaced convert_enum utility and per-field validators with a ValidatedIntEnum base class that provides built-in Pydantic validation for string enum names.
  • Added OrtYamlLoader / ort_yaml_load to handle ORT-specific YAML tags (e.g. !<.PostgresStorageConfiguration>), replacing yaml.safe_load across the codebase.
  • Added EvaluatorRun, RuleViolation, LicenseSource, and BaseRun models; refactored AnalyzerRun and AdvisorRun to derive from BaseRun.

Reviewed changes

Copilot reviewed 41 out of 43 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/ort/utils/validated_enum.py New ValidatedIntEnum base class for enum validation
src/ort/utils/yaml_loader.py New ORT-aware YAML loader handling custom tags
src/ort/utils/convert_enum.py Removed in favor of ValidatedIntEnum
src/ort/utils/init.py Updated exports
src/ort/models/base_run.py New base class for run models
src/ort/models/evaluator_run.py New EvaluatorRun model
src/ort/models/rule_violation.py New RuleViolation model
src/ort/models/license_source.py New LicenseSource enum
src/ort/models/severity.py New duplicate Severity enum (issue)
src/ort/models/ort_result.py Added evaluator field to OrtResult
src/ort/models/analyzer_run.py Refactored to inherit from BaseRun
src/ort/models/advisor_run.py Refactored to inherit from BaseRun
src/ort/models/issue.py Removed field_validator for severity
src/ort/models/advisor_details.py Removed manual capability validator
src/ort/models/dependency_graph_node.py Removed manual linkage validator
src/ort/models/config/*.py All enum models switched to ValidatedIntEnum, validators removed
tests/test_evaluator_run.py Tests for EvaluatorRun
tests/data/evaluation-result.yml Test fixture
examples/*.py Switched to ort_yaml_load
pyproject.toml, uv.lock Version bump and dependency updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,11 +1,12 @@
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <dev@heliocastro.info
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The closing > is missing from the SPDX copyright header. It should be <dev@heliocastro.info> instead of <dev@heliocastro.info.

Suggested change
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <dev@heliocastro.info
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <dev@heliocastro.info>

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +43
description="A [ResolvedConfiguration] containing data resolved during the analysis which augments the"
"automatically determined data.",
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The description for the evaluator field says "A [ResolvedConfiguration] containing data resolved during the analysis which augments the automatically determined data." — this appears to be a copy-paste error. It should describe the evaluator run, e.g. "An [EvaluatorRun] containing details about the evaluator that was run. Can be null if no evaluator was run."

Suggested change
description="A [ResolvedConfiguration] containing data resolved during the analysis which augments the"
"automatically determined data.",
description="An [EvaluatorRun] containing details about the evaluator that was run. "
"Can be null if no evaluator was run.",

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +23
# SPDX-FileCopyrightText: 2026 Helio Chissini de Castro <dev@heliocastro.info>
# SPDX-License-Identifier: MIT


from ..utils.validated_enum import ValidatedIntEnum


class Severity(ValidatedIntEnum):
"""
A generic class describing a severity, e.g. of issues, sorted from least severe to most severe.

properties:
HINT:
A hint is something that is provided for information only.
WARNING:
A warning is something that should be addressed.
ERROR:
An error is something that has to be addressed.
"""

HINT = 1
WARNING = 2
ERROR = 3
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

There are now two identical Severity classes: src/ort/severity.py and src/ort/models/severity.py. The former is used by issue.py and the latter by rule_violation.py. Having two copies of the same enum will cause subtle bugs — for example, ort.severity.Severity.ERROR != ort.models.severity.Severity.ERROR in identity checks and they won't match in isinstance checks. Please consolidate into a single location and update all imports.

Copilot uses AI. Check for mistakes.

class BaseRun(BaseModel):
"""
The summary of a single run of the analyzer.
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The BaseRun docstring says "The summary of a single run of the analyzer" but this is a generic base class used by AnalyzerRun, AdvisorRun, and EvaluatorRun. The docstring should reflect that it's a base class, e.g. "Base class for ORT tool run summaries."

Suggested change
The summary of a single run of the analyzer.
Base class for ORT tool run summaries.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants