Skip to content

fix(models): Update model enum translations for reasoning#20

Merged
heliocastro merged 4 commits intomainfrom
fix/enumerations
Mar 4, 2026
Merged

fix(models): Update model enum translations for reasoning#20
heliocastro merged 4 commits intomainfrom
fix/enumerations

Conversation

@heliocastro
Copy link
Owner

No description provided.

Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
@heliocastro heliocastro self-assigned this Mar 4, 2026
Copilot AI review requested due to automatic review settings March 4, 2026 16:40
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 updates configuration model parsing to better handle enum “reason” fields coming from YAML, and adds validation coverage for repository configuration fixtures.

Changes:

  • Add Pydantic field_validator hooks to convert string inputs into IssueResolutionReason / VulnerabilityResolutionReason enum members.
  • Add hashing/equality to Scope to allow it to be used in set[...] fields.
  • Add a pytest that validates all tests/data/repo_config/*.yml fixtures (except the known-invalid one) load into RepositoryConfiguration.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ort/models/config/issue_resolution.py Converts pre-validation reason strings into IssueResolutionReason via convert_enum().
src/ort/models/config/vulnerability_resolution.py Converts pre-validation reason strings into VulnerabilityResolutionReason via convert_enum().
src/ort/models/scope.py Adds __hash__ / __eq__ so Scope instances can be stored in sets.
tests/test_repo_config_files.py Adds a fixture-validation test for repository config YAML files.
tests/data/repo_config/str_boolean.ort.yml Extends repo-config fixture with resolutions.issues examples.
tests/data/analyzer-result.yml Adds a scopes: [] field to a fixture (currently under a package entry).
examples/model_relation_test.py Adds a script to iterate models and call model_rebuild().
.github/workflows/publish.yml Changes Publish workflow to run on workflow_run (Build/Validation) with a branch-prefix gate.
Comments suppressed due to low confidence (3)

examples/model_relation_test.py:20

  • This script executes work at import time (the loop over models runs at module load). For consistency with the other examples/*.py scripts and to avoid surprising side effects if this module is imported, wrap the execution portion in a main() and guard it with if __name__ == "__main__":.
for model in iter_models(ort.models):
    try:
        print("Rebuilding:", model)
        model.model_rebuild()
    except Exception:
        print("FAILED:", model)
        raise

.github/workflows/publish.yml:19

  • The job condition relies on github.event.workflow_run.head_branch starting with v, but for tag-triggered workflow runs this field is often empty or reflects a branch name rather than the tag. This can prevent publishing on version tags. Consider basing the condition on the triggering ref/tag (or reintroducing a push.tags: [v*] trigger) so releases reliably publish.
    if: github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_branch, 'v')

examples/model_relation_test.py:5

  • This new example file is missing the SPDX copyright / license header that the other files in examples/ include. Add the standard SPDX header at the top to keep licensing metadata consistent across the repository.
import inspect

from pydantic import BaseModel

import ort.models  # or your top-level models package

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

Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
@heliocastro heliocastro merged commit b4798f0 into main Mar 4, 2026
16 checks passed
@heliocastro heliocastro deleted the fix/enumerations branch March 4, 2026 17:06
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.

2 participants