fix(models): Update model enum translations for reasoning#20
Merged
heliocastro merged 4 commits intomainfrom Mar 4, 2026
Merged
fix(models): Update model enum translations for reasoning#20heliocastro merged 4 commits intomainfrom
heliocastro merged 4 commits intomainfrom
Conversation
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>
There was a problem hiding this comment.
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_validatorhooks to convert string inputs intoIssueResolutionReason/VulnerabilityResolutionReasonenum members. - Add hashing/equality to
Scopeto allow it to be used inset[...]fields. - Add a pytest that validates all
tests/data/repo_config/*.ymlfixtures (except the known-invalid one) load intoRepositoryConfiguration.
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/*.pyscripts and to avoid surprising side effects if this module is imported, wrap the execution portion in amain()and guard it withif __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_branchstarting withv, 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 apush.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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.