Repository navigation
fix(quality): isolate unreadable skill manifests #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Afloat16
wants to merge
12
commits into
NVIDIA:main
Choose a base branch
from
Afloat16:fix/quality-manifest-read-errors-20261126
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c512ea8
fix(quality): isolate unreadable skill manifests
Afloat16 1d3623b
test(quality): retain precommit failure isolation coverage
Afloat16 3a82406
fix(quality): clarify manifest read failures
Afloat16 c8e7c07
Merge main and preserve the 910 release note
Afloat16 af9cb8f
fix(quality): exclude manifests lost after discovery from scores
Afloat16 4143a3f
Merge current main while preserving quality discovery fix
Afloat16 a248196
Merge current main and preserve PR 910 release notes
Afloat16 a8430d0
Merge main to resolve PR #910 changelog conflict
Afloat16 7b1cf04
Merge main and retain the unreleased changelog entry
Afloat16 043edc9
Merge main and preserve the unreleased changelog entry
Afloat16 f5ee3a7
Merge frozen main and preserve PR #910 release notes
Afloat16 7e4c8c2
Merge main and preserve PR #910 release notes
Afloat16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """One unreadable manifest must not discard quality results for other skills.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from skillevaluator.validators.quality_score import QualityScoreValidator | ||
|
|
||
|
|
||
| def _skill(root, name, *, readable=True): | ||
| skill = root / name | ||
| skill.mkdir() | ||
| content = f"---\nname: {name}\ndescription: Use when checking a valid skill.\n---\n# Instructions\n" | ||
| (skill / "SKILL.md").write_bytes(content.encode("utf-8") + (b"" if readable else b"\xff")) | ||
| return skill | ||
|
|
||
|
|
||
| def test_invalid_utf8_manifest_fails_without_a_quality_grade(tmp_path): | ||
| skill = _skill(tmp_path, "broken", readable=False) | ||
|
|
||
| result = QualityScoreValidator().validate(skill) | ||
|
|
||
| assert result.passed is False | ||
| assert any(str(skill / "SKILL.md") in reason and "read" in reason for reason in result.gate_failures) | ||
| assert "quality_scores" not in result.metadata | ||
| assert "quality_config" in result.metadata | ||
| assert not any(detail.check_name == "quality_score" for detail in result.success_details) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("failure", ["encoding", "permission", "disappeared"]) | ||
| def test_unreadable_member_keeps_healthy_quality_results(tmp_path, monkeypatch, failure): | ||
| broken = _skill(tmp_path, "broken", readable=failure != "encoding") | ||
| healthy = _skill(tmp_path, "healthy") | ||
| validator = QualityScoreValidator() | ||
| expected = validator.validate(healthy).metadata["quality_scores"] | ||
| manifest = broken / "SKILL.md" | ||
|
|
||
| if failure != "encoding": | ||
| original = Path.read_text | ||
|
|
||
| def fail_read(path, *args, **kwargs): | ||
| if path == manifest: | ||
| if failure == "permission": | ||
| raise PermissionError("manifest is not readable") | ||
| raise FileNotFoundError("manifest disappeared after discovery") | ||
| return original(path, *args, **kwargs) | ||
|
|
||
| monkeypatch.setattr(Path, "read_text", fail_read) | ||
|
|
||
| result = validator.validate(tmp_path) | ||
|
|
||
| assert result.passed is False | ||
| assert any("[broken]" in reason and str(manifest) in reason for reason in result.gate_failures) | ||
| assert result.metadata["quality_scores_all"] == [expected] | ||
| assert result.metadata["quality_scores"]["skill_count"] == 1 | ||
| assert result.metadata["quality_scores"]["overall_score"] == expected["overall_score"] | ||
|
|
||
|
|
||
| def test_all_unreadable_members_do_not_produce_an_aggregate_grade(tmp_path): | ||
| _skill(tmp_path, "first", readable=False) | ||
| _skill(tmp_path, "second", readable=False) | ||
|
|
||
| result = QualityScoreValidator().validate(tmp_path) | ||
|
|
||
| assert result.passed is False | ||
| assert len(result.gate_failures) == 2 | ||
| assert "quality_scores" not in result.metadata | ||
| assert "quality_scores_all" not in result.metadata |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.