feat: ontology compliance — sync core.yaml with NodeType/EdgeType enums#26
Conversation
- Rewrote docs/ontology/core.yaml v0.2.0: covers all NodeType (14) and EdgeType (21) values from models.py, adds confidence thresholds and raw_call: / FQN format conventions - Added tests/unit/test_ontology_compliance.py: 7 bidirectional checks (YAML→Python and Python→YAML) so new enum values without a YAML entry fail at CI time - Added pyyaml to dev dependencies Closes #23 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the core code graph ontology in docs/ontology/core.yaml to act as the source of truth for node and edge types, and adds a new test suite in tests/unit/test_ontology_compliance.py to verify synchronization with Python enums. Feedback on the tests suggests using functools.lru_cache to avoid redundant file I/O and upgrading the type annotations to use standard generic collections instead of type ignores.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…test - @lru_cache(maxsize=1) on _load_ontology() — file read once per session - dict[str, Any] replaces bare dict + type: ignore[type-arg] (Python 3.12+) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the core code graph ontology in docs/ontology/core.yaml to act as the source of truth for node and edge types, adds pyyaml as a development dependency, and introduces a test suite to ensure the YAML definition remains synchronized with Python enums. The reviewer suggested adding an explicit type check when loading the YAML file to ensure it returns a dictionary, which improves type safety and removes a type: ignore comment.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Replace type: ignore with an isinstance check — raises TypeError with a clear message if core.yaml is empty or malformed instead of failing later with a cryptic AttributeError. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the core code graph ontology in docs/ontology/core.yaml to version 0.2.0, introducing structured node types, edge types, confidence levels, and formatting conventions. It also adds a new test suite in tests/unit/test_ontology_compliance.py to ensure the Python enums (NodeType and EdgeType) remain synchronized with the YAML definition, introducing pyyaml as a development dependency. A review comment suggests adding types-pyyaml to the development dependencies to prevent static type-checking failures under strict mypy configurations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the core code graph ontology in docs/ontology/core.yaml to version 0.2.0, establishing it as the source of truth for NodeType and EdgeType enums. It also introduces a new test suite in tests/unit/test_ontology_compliance.py to ensure the YAML file stays in sync with the Python enums, adding pyyaml and its type stubs as development dependencies. The review feedback suggests removing the @lru_cache decorator from the ontology loader in the tests to avoid shared mutable state and potential test flakiness, as well as removing the now-unused lru_cache import.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| from functools import lru_cache | ||
| from pathlib import Path |
There was a problem hiding this comment.
Since we are removing the @lru_cache decorator to ensure proper test isolation and avoid shared mutable state, the lru_cache import from functools is no longer needed. Removing it prevents any unused import lint errors (e.g., Ruff F401).
| from functools import lru_cache | |
| from pathlib import Path | |
| from pathlib import Path |
| @lru_cache(maxsize=1) | ||
| def _load_ontology() -> dict[str, Any]: | ||
| data = yaml.safe_load(_ONTOLOGY_PATH.read_text(encoding="utf-8")) | ||
| if not isinstance(data, dict): | ||
| msg = f"Expected a dictionary from {_ONTOLOGY_PATH}, got {type(data)}" | ||
| raise TypeError(msg) | ||
| return data |
There was a problem hiding this comment.
Caching the parsed ontology dictionary using @lru_cache in tests introduces shared mutable state across test cases. If any test mutates the dictionary in the future, it could lead to flaky tests and hard-to-debug side effects. Since the YAML file is very small (under 100 lines), parsing it for each test has negligible performance impact. Removing the @lru_cache decorator entirely ensures proper test isolation.
| @lru_cache(maxsize=1) | |
| def _load_ontology() -> dict[str, Any]: | |
| data = yaml.safe_load(_ONTOLOGY_PATH.read_text(encoding="utf-8")) | |
| if not isinstance(data, dict): | |
| msg = f"Expected a dictionary from {_ONTOLOGY_PATH}, got {type(data)}" | |
| raise TypeError(msg) | |
| return data | |
| def _load_ontology() -> dict[str, Any]: | |
| data = yaml.safe_load(_ONTOLOGY_PATH.read_text(encoding="utf-8")) | |
| if not isinstance(data, dict): | |
| msg = f"Expected a dictionary from {_ONTOLOGY_PATH}, got {type(data)}" | |
| raise TypeError(msg) | |
| return data |



Summary
docs/ontology/core.yamlto v0.2.0: covers all 14NodeTypeand 21EdgeTypevalues frommodels.py, plus confidence thresholds andraw_call:/ FQN format conventionstests/unit/test_ontology_compliance.py: 7 bidirectional checks (YAML → Python and Python → YAML), so adding a new enum value without updating the YAML breaks CIpyyamlto dev dependenciesTest plan
uv run pytest tests/unit/test_ontology_compliance.py -v— 7 passedmake pytest— 68 passedmake lint && make type-check— cleanCloses #23
🤖 Generated with Claude Code