TEST-INFRA: [coverage-gaps] Improve test coverage for src/cleveragents/application/services/uko_loader.py #1882

Open
opened 2026-04-03 00:05:02 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: test/missing-test-levels-uko-loader-service
  • Commit Message: test(application): add Behave unit tests, Robot integration tests, and ASV benchmarks for uko_loader service
  • Milestone: v3.7.0
  • Parent Epic: #739

Background and Context

The src/cleveragents/application/services/uko_loader.py module currently has 0.00% test coverage. This is a critical gap that must be addressed to ensure the reliability of the UKO loading service.

UKOLoader is responsible for parsing UKO ontology TTL files into UKOOntology Pydantic models. It handles prefix parsing, block splitting, predicate parsing, URI resolution, version extraction, inheritance DAG traversal (BFS), and cycle detection (DFS). Given the complexity of this module and its role in the system's ontology layer, the absence of any test coverage represents a significant reliability and regression risk.

Per CONTRIBUTING.md's Multi-Level Testing Mandate: "Every coding task must include or update tests at multiple levels: unit tests, integration tests, and performance benchmarks. Testing is non-optional and is part of the definition of done for any task."

Current Behavior

  • Test coverage for src/cleveragents/application/services/uko_loader.py is 0.00%.
  • No Behave (BDD/Gherkin) unit tests exist for UKOLoader.
  • No Robot Framework integration tests exist for UKOLoader.
  • No ASV performance benchmarks exist for UKOLoader.

Expected Behavior

  • Test coverage for src/cleveragents/application/services/uko_loader.py is ≥ 97%.
  • Behave BDD scenarios cover all public methods and key edge cases of UKOLoader.
  • Robot integration tests exercise UKOLoader against real TTL files with no mocks.
  • ASV benchmarks track performance of load_from_string, validate, and resolve_inheritance.

Acceptance Criteria

  • Behave feature file(s) cover UKOLoader.load, UKOLoader.load_from_string, UKOLoader.validate, UKOLoader.resolve_inheritance, UKOLoader.get_layer_nodes, and all private parsing helpers via their public surface.
  • Scenarios include: valid TTL parsing, malformed TTL, unsupported version, cycle detection, diamond inheritance, undefined prefix validation, multi-parent rdfs:subClassOf, and empty/edge-case inputs.
  • Robot integration tests exercise UKOLoader end-to-end against real TTL fixture files (no mocks).
  • ASV benchmarks measure load_from_string and resolve_inheritance performance.
  • Coverage for uko_loader.py reaches ≥ 97% as verified by nox -s coverage_report.
  • All nox default sessions pass without errors.

Subtasks

  • Write Behave unit test scenarios for UKOLoader.load and UKOLoader.load_from_string (happy path, file not found, encoding)
  • Write Behave scenarios for UKOLoader.validate (valid ontology, unsupported version, undefined prefix, non-existent parent URI)
  • Write Behave scenarios for UKOLoader.resolve_inheritance (linear chain, diamond inheritance, cycle detection, unknown node)
  • Write Behave scenarios for UKOLoader.get_layer_nodes (all layers 0–3, empty ontology)
  • Write Behave scenarios for private helpers: _parse_prefixes, _split_blocks, _parse_predicates, _split_on_semicolon, _resolve_uri, _extract_version_string
  • Write Robot Framework integration tests for UKOLoader using real TTL fixture files
  • Write ASV performance benchmarks for load_from_string and resolve_inheritance
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage ≥ 97%.

Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-new-issue-creator

## Metadata - **Branch**: `test/missing-test-levels-uko-loader-service` - **Commit Message**: `test(application): add Behave unit tests, Robot integration tests, and ASV benchmarks for uko_loader service` - **Milestone**: v3.7.0 - **Parent Epic**: #739 ## Background and Context The `src/cleveragents/application/services/uko_loader.py` module currently has **0.00% test coverage**. This is a critical gap that must be addressed to ensure the reliability of the UKO loading service. `UKOLoader` is responsible for parsing UKO ontology TTL files into `UKOOntology` Pydantic models. It handles prefix parsing, block splitting, predicate parsing, URI resolution, version extraction, inheritance DAG traversal (BFS), and cycle detection (DFS). Given the complexity of this module and its role in the system's ontology layer, the absence of any test coverage represents a significant reliability and regression risk. Per CONTRIBUTING.md's **Multi-Level Testing Mandate**: *"Every coding task must include or update tests at multiple levels: unit tests, integration tests, and performance benchmarks. Testing is non-optional and is part of the definition of done for any task."* ## Current Behavior - Test coverage for `src/cleveragents/application/services/uko_loader.py` is **0.00%**. - No Behave (BDD/Gherkin) unit tests exist for `UKOLoader`. - No Robot Framework integration tests exist for `UKOLoader`. - No ASV performance benchmarks exist for `UKOLoader`. ## Expected Behavior - Test coverage for `src/cleveragents/application/services/uko_loader.py` is **≥ 97%**. - Behave BDD scenarios cover all public methods and key edge cases of `UKOLoader`. - Robot integration tests exercise `UKOLoader` against real TTL files with no mocks. - ASV benchmarks track performance of `load_from_string`, `validate`, and `resolve_inheritance`. ## Acceptance Criteria - [ ] Behave feature file(s) cover `UKOLoader.load`, `UKOLoader.load_from_string`, `UKOLoader.validate`, `UKOLoader.resolve_inheritance`, `UKOLoader.get_layer_nodes`, and all private parsing helpers via their public surface. - [ ] Scenarios include: valid TTL parsing, malformed TTL, unsupported version, cycle detection, diamond inheritance, undefined prefix validation, multi-parent `rdfs:subClassOf`, and empty/edge-case inputs. - [ ] Robot integration tests exercise `UKOLoader` end-to-end against real TTL fixture files (no mocks). - [ ] ASV benchmarks measure `load_from_string` and `resolve_inheritance` performance. - [ ] Coverage for `uko_loader.py` reaches ≥ 97% as verified by `nox -s coverage_report`. - [ ] All nox default sessions pass without errors. ## Subtasks - [ ] Write Behave unit test scenarios for `UKOLoader.load` and `UKOLoader.load_from_string` (happy path, file not found, encoding) - [ ] Write Behave scenarios for `UKOLoader.validate` (valid ontology, unsupported version, undefined prefix, non-existent parent URI) - [ ] Write Behave scenarios for `UKOLoader.resolve_inheritance` (linear chain, diamond inheritance, cycle detection, unknown node) - [ ] Write Behave scenarios for `UKOLoader.get_layer_nodes` (all layers 0–3, empty ontology) - [ ] Write Behave scenarios for private helpers: `_parse_prefixes`, `_split_blocks`, `_parse_predicates`, `_split_on_semicolon`, `_resolve_uri`, `_extract_version_string` - [ ] Write Robot Framework integration tests for `UKOLoader` using real TTL fixture files - [ ] Write ASV performance benchmarks for `load_from_string` and `resolve_inheritance` - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage ≥ 97%. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-03 00:06:23 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: MoSCoW/Could Have — CI/test infrastructure improvement.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: MoSCoW/Could Have — CI/test infrastructure improvement. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#1882
No description provided.