Skip to content

feat: ontology compliance — sync core.yaml with NodeType/EdgeType enums#26

Merged
zaebee merged 4 commits into
mainfrom
feat/ontology-compliance
Jun 7, 2026
Merged

feat: ontology compliance — sync core.yaml with NodeType/EdgeType enums#26
zaebee merged 4 commits into
mainfrom
feat/ontology-compliance

Conversation

@zaebee

@zaebee zaebee commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Rewrote docs/ontology/core.yaml to v0.2.0: covers all 14 NodeType and 21 EdgeType values from models.py, plus confidence thresholds and raw_call: / FQN format conventions
  • Added tests/unit/test_ontology_compliance.py: 7 bidirectional checks (YAML → Python and Python → YAML), so adding a new enum value without updating the YAML breaks CI
  • Added pyyaml to dev dependencies

Test plan

  • uv run pytest tests/unit/test_ontology_compliance.py -v — 7 passed
  • make pytest — 68 passed
  • make lint && make type-check — clean

Closes #23

🤖 Generated with Claude Code

- 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>
@zaebee zaebee self-assigned this Jun 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/unit/test_ontology_compliance.py
…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>
@zaebee

zaebee commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/unit/test_ontology_compliance.py Outdated
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>
@zaebee

zaebee commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pyproject.toml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

@zaebee

zaebee commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +3 to +4
from functools import lru_cache
from pathlib import Path

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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).

Suggested change
from functools import lru_cache
from pathlib import Path
from pathlib import Path

Comment on lines +14 to +20
@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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
@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

@zaebee zaebee merged commit 4dec94e into main Jun 7, 2026
1 check passed
@zaebee zaebee deleted the feat/ontology-compliance branch June 7, 2026 04:53
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.

test: ontology compliance — sync docs/ontology/core.yaml with NodeType/EdgeType enums

1 participant