test: raise coverage from 62.8% to 97% with comprehensive new test suite - #1
Merged
Merged
Conversation
Copilot created this pull request from a session on behalf of
denisecase
May 30, 2026 17:44
View session
denisecase
marked this pull request as ready for review
May 30, 2026 17:53
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds comprehensive unit tests to improve branch coverage for manifest graph verification, schema/manifest validation, and role-capability-map validation.
Changes:
- Introduces new test suites for graph loading, validation, diagnostics rendering, report rendering, and the
verify-graphcommand. - Expands existing schema/manifest/load tests to cover additional branches and error cases.
- Adds command-level tests for validating role-capability-map files.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_verify_graph.py | New tests covering schema repo/path resolution helpers and verify-graph command execution. |
| tests/test_validate_schema.py | Adds additional branch-coverage tests for schema validation helpers and edge cases. |
| tests/test_validate_role_capability_map.py | New tests for role-capability-map data/file validation. |
| tests/test_validate_manifest.py | Adds additional branch-coverage tests for manifest validation error/skip paths. |
| tests/test_load.py | Adds tests for git tag retrieval, manifest path discovery/loading, and packaged/repo-root schema helpers. |
| tests/test_graph_validate.py | New tests for SI invariant validation behavior and diagnostics emitted. |
| tests/test_graph_report.py | New tests for Markdown report rendering across empty/edge/diagnostic cases. |
| tests/test_graph_load.py | New tests for graph loading helpers and graph construction from manifests. |
| tests/test_graph_diagnostics.py | New tests for GraphDiagnostic.render() formatting and root-relative path rendering. |
| tests/commands/test_validate_role_capability_map.py | New tests for CLI command return codes for role-capability-map validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+108
to
+119
| def test_file_valid_returns_no_errors(tmp_path: Path) -> None: | ||
| import tomllib, io | ||
|
|
||
| # Write valid TOML from the data dict | ||
| data = _minimal_valid_data() | ||
| # Build a simple TOML string manually for only the top-level keys | ||
| # Use the actual project file instead | ||
| project_root = Path(__file__).parent.parent | ||
| real_path = project_root / "data" / "schema" / "role-capability-map.toml" | ||
| if real_path.exists(): | ||
| errors = validate_role_capability_map_file(real_path) | ||
| assert errors == [], "\n".join(errors) |
Comment on lines
+28
to
+33
| def test_run_against_real_file_returns_0() -> None: | ||
| project_root = Path(__file__).parent.parent.parent | ||
| real_path = project_root / "data" / "schema" / "role-capability-map.toml" | ||
| if real_path.exists(): | ||
| result = run(path=real_path) | ||
| assert result == 0 |
Comment on lines
+3
to
+5
| from pathlib import Path | ||
| from typing import Any | ||
| from unittest.mock import patch |
Comment on lines
+6
to
+8
| import pytest | ||
|
|
||
| from se_manifest_schema.graph.diagnostics import GraphDiagnostic |
|
|
||
| from pathlib import Path | ||
| from typing import Any | ||
| from unittest.mock import patch |
| import subprocess | ||
| from pathlib import Path | ||
| from unittest.mock import patch | ||
| from unittest.mock import MagicMock, patch |
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.
Test coverage was at 62.8% (barely above the 55% hard floor), with several modules at 17–38% — primarily the graph subsystem and role-capability-map validation, which were effectively untested.
New test files
test_graph_diagnostics.py— allGraphDiagnostic.render()branches (root-relative paths, missing fields, string root)test_graph_load.py— full coverage of manifest discovery helpers (_string_value,_contains_contiguous_parts,_is_excluded_manifest_path,_discover_manifest_paths,_dependency_edges_from_items) andload_manifest_graphtest_graph_validate.py— SI01–SI04 invariants: cycle detection, unresolved deps, missing artifacts, class registrytest_graph_report.py—render_markdown_reportacross empty/populated/diagnostic scenariostest_validate_role_capability_map.py— all validation paths forvalidate_role_capability_map_data/file(missing sections, missing fields, empty values, unknown roles, malformed TOML)tests/commands/test_validate_role_capability_map.py— commandrun()pass/fail/file-not-found pathstest_verify_graph.py—_looks_like_schema_repo,_find_schema_repo, all_resolve_*helpers, andrun()with pass/fail/report-write casesSupplemental coverage in existing tests
test_load.py—get_git_tagsuccess +CalledProcessErrorpaths,find_manifest_path,repo_root_schema_path;packaged_schema_textgracefully skipped in editable installstest_validate_manifest.py— missingrepo.class/repo.name,Nonesection/field definitions, contract section as non-dicttest_validate_schema.py— custom type registry (kind="record", missingfieldskey), invalid items inallowed_filenames/contract_roles.allowed, optional/forbidden sections with unknown refs