UAT: ClassificationResult missing spec-required source_resource_id field — UKO query interface returns incomplete classification data #5857

Open
opened 2026-04-09 10:59:42 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

What Was Tested

ClassificationResult dataclass in src/cleveragents/application/services/uko_query_interface.py — the return type of UKOQueryInterface.classify_resource().

Expected Behavior (from spec)

Per docs/specification.md §45519:

UKOQueryInterface — Typed interface for ACMS context strategies to query UKO classification data. Provides classify_resource(uri) returning a ClassificationResult with layer (0–3), primary_type, source_resource_id, and relationships.

The spec explicitly requires source_resource_id as a field on ClassificationResult.

Actual Behavior

The ClassificationResult dataclass (lines 63–89) has these fields:

  • resource_id
  • layer
  • primary_type
  • all_types
  • implicit_relations

But it is missing source_resource_id — the spec-required field that links the classification back to the originating resource ULID. The resource_id field appears to serve a different purpose (it's the ULID of the resource being classified), while source_resource_id would be the URI of the source resource in the UKO graph.

Additionally, the spec mentions relationships (not implicit_relations) as the field name. The implementation uses implicit_relations which only captures inferred relationships, not all relationships.

Code Location

  • src/cleveragents/application/services/uko_query_interface.py, lines 63–89 (ClassificationResult)

Impact

ACMS context strategies that rely on ClassificationResult.source_resource_id to trace a UKO classification back to its originating resource will fail with AttributeError. This breaks the provenance chain that the spec requires for UKO-based context assembly.

Fix Suggestion

Add source_resource_id: str = "" to ClassificationResult and populate it in classify_resource() by extracting the uko:sourceResource predicate value from the graph bindings.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report ### What Was Tested `ClassificationResult` dataclass in `src/cleveragents/application/services/uko_query_interface.py` — the return type of `UKOQueryInterface.classify_resource()`. ### Expected Behavior (from spec) Per `docs/specification.md` §45519: > `UKOQueryInterface` — Typed interface for ACMS context strategies to query UKO classification data. Provides `classify_resource(uri)` returning a `ClassificationResult` with `layer` (0–3), `primary_type`, **`source_resource_id`**, and `relationships`. The spec explicitly requires `source_resource_id` as a field on `ClassificationResult`. ### Actual Behavior The `ClassificationResult` dataclass (lines 63–89) has these fields: - `resource_id` ✓ - `layer` ✓ - `primary_type` ✓ - `all_types` ✓ - `implicit_relations` ✓ But it is **missing `source_resource_id`** — the spec-required field that links the classification back to the originating resource ULID. The `resource_id` field appears to serve a different purpose (it's the ULID of the resource being classified), while `source_resource_id` would be the URI of the source resource in the UKO graph. Additionally, the spec mentions `relationships` (not `implicit_relations`) as the field name. The implementation uses `implicit_relations` which only captures inferred relationships, not all relationships. ### Code Location - `src/cleveragents/application/services/uko_query_interface.py`, lines 63–89 (`ClassificationResult`) ### Impact ACMS context strategies that rely on `ClassificationResult.source_resource_id` to trace a UKO classification back to its originating resource will fail with `AttributeError`. This breaks the provenance chain that the spec requires for UKO-based context assembly. ### Fix Suggestion Add `source_resource_id: str = ""` to `ClassificationResult` and populate it in `classify_resource()` by extracting the `uko:sourceResource` predicate value from the graph bindings. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-09 11:37:11 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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#5857
No description provided.