feat(uko): add UKO ontology scaffolding #466
Merged
CoreRasurae
merged 1 commits from 2026-03-04 23:00:37 +00:00
feature/m6-acms-uko-schema into master
No Reviewers
Labels
Clear labels
auto/needs-reevaluation
controller-managed
overdue
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Needs Feedback
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
Controller deferred this PR; awaiting Phase 6+ scope-evaluator or operator re-enablement.
Auto-agents controller manages this PR/issue (see tools/controller/deploy/RUNBOOK.md). Remove this label to abandon controller management.
PR blocked by an open issue dependency. Operator must close the dep (or remove the dependency link) before the merge driver can act. Auto-cleared by merge_drive when no open deps remain.
Most recent merge cycle hit CI timeout. Driver excludes this PR while last merge_cycle row is < 30 min old; label persists thereafter as visible history.
Currently being processed by an implementer worker.
Currently being processed by the merge driver.
Currently being processed by a reviewer worker.
Merge driver heartbeat stale; pipeline halted. Closed automatically on next clean tick.
Detected master commit violating the strict merge invariant. Tracked as an issue (not a PR label); kept here for label completeness.
In-cycle escalation: most recent attempt ran at the Tier 0 slot (`tier-0`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 1 slot (`tier-1`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 2 slot (`tier-2`). Slot's model defined in .opencode/models/tiers.yaml. Gated behind IMPLEMENTER_ESCALATION_TIER2_ENABLED.
In-cycle escalation: most recent attempt ran at the Tier -1 slot (`tier-min`). Slot's model defined in .opencode/models/tiers.yaml. Suffix is ``-min`` (not ``--1``) so the Forgejo UI reads naturally.
Tracking issues used by the AI Automation system for agents to communicate and report.
Rebase conflict needs LLM conflict-resolver.
Failing CI needs implementer attention.
Documenting a driver incident or rollback.
Reviewer has APPROVED this PR and no later REQUEST_CHANGES is outstanding. The merge driver requires this label to even consider a PR for merging. Set by the reviewer worker on APPROVE; cleared on REQUEST_CHANGES.
Train repeatedly lost master-tempo races. Driver excludes via merge_cycle until cooldown elapses; label persists as visible history.
Revert PR backing out an invariant violation. Fast-tracked through the merge driver.
Sentinel PR duplicated from upstream into a personal fork by tools/duplicate_prs_to_fork.py for pipeline testing. Lives only in the fork; the canonical pipeline never sees it.
No implementer activity for N days. Flagged for human review. Auto-cleared on next push to head branch.
Repeatedly fails on current master (>= 3 ci-fail-on-rebased-sha releases in 12 h). Excluded from driver until human triage.
A ticket in a blocked state and unable to complete until some other task is completed first.
Bounty
$100
A bounty of $100 for any open-source contributor who provides a MR that solves this issue
Bounty
$1000
A bounty of $1000 for any open-source contributor who provides a MR that solves this issue
Bounty
$10000
A bounty of $10000 for any open-source contributor who provides a MR that solves this issue
Bounty
$20
A bounty of $20 for any open-source contributor who provides a MR that solves this issue
Bounty
$2000
A bounty of $2000 for any open-source contributor who provides a MR that solves this issue
Bounty
$250
A bounty of $250 for any open-source contributor who provides a MR that solves this issue
Bounty
$50
A bounty of $50 for any open-source contributor who provides a MR that solves this issue
Bounty
$500
A bounty of $500 for any open-source contributor who provides a MR that solves this issue
Bounty
$5000
A bounty of $5000 for any open-source contributor who provides a MR that solves this issue
Bounty
$750
A bounty of $750 for any open-source contributor who provides a MR that solves this issue
MoSCoW
Could have
Could have feature in order to satisfy the epic/legendary.
MoSCoW
Must have
Must have feature in order to satisfy the epic/legendary.
MoSCoW
Should have
Should have feature in order to satisfy the epic/legendary.
There are questions in the ticket that can not be completed until the project owner provides clarity.
Points
1
1 man-hours worth of work for an expert with no learning curve.
Points
13
13 man-hours worth of work for an expert with no learning curve.
Points
2
2 man-hours worth of work for an expert with no learning curve.
Points
21
21 man-hours worth of work for an expert with no learning curve.
Points
3
3 man-hours worth of work for an expert with no learning curve.
Points
34
34 man-hours worth of work for an expert with no learning curve.
Points
5
5 man-hours worth of work for an expert with no learning curve.
Points
55
55 man-hours worth of work for an expert with no learning curve.
Points
8
8 man-hours worth of work for an expert with no learning curve.
Points
88
88 man-hours worth of work for an expert with no learning curve.
Priority
Backlog
This ticket has backlogged priority and is not to be worked on yet
Priority
CI Blocker
Critical priority issue that blocks CI/CD pipeline and prevents PR merges
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
A ticket for learning a tool or technology that is needed to be able to do future planning and design.
State
Completed
The ticket has been fully implemented, completed, and merged with the source code. This label should only be applied once a ticket is closed.
State
Duplicate
A ticket that represents the same content as an existing ticket.
State
In Progress
A ticket that is actively being developed.
State
In Review
A ticket that has had some code completed to implement but is waiting to pass peer review and is not yet merged in.
State
Paused
This ticket's work started but wasn't finished. It's on hold (likely in a feature branch) and will be resumed later, either due to a blocker or a delay.
State
Unverified
All new tickets start in this state. A developer may set it to show the ticket is unverified. This means we haven't agreed to work on it. It will either move to a verified state or be closed as wontdo.
State
Verified
The issue has been verified by a developer as legitimate. It will be worked on and verified tickets are now considered part of the backlog.
State
Wont Do
This ticket has been decided it wont be done. This may mean the bug has been determined to not be real (cant verify) or the feature is one we have decided we dont want to adopt.
Type
Automation
Any edits or discussion about the AI automated coding system.
Type
Bug
Something that doesnt work as intended.
Type
Discussion
Anytime a ticket represents a discussion about a subject and doesnt fall into one of the other categories.
Type
Documentation
An error or improvement needed in the documentation.
Type
Epic
Any first tier epic. That is, an epic which contains only issues as children and will not have sub-epics.
Type
Feature
Some new functionality not present.
Type
Legendary
A type of Epic which will contain other Epics.
Type
Refactor
A code change that restructures existing code without changing its external behavior.
Type
Support
Someone needs help using the project.
Type
Task
A generic task that doesnt fit into the other type categories.
Type
Testing
Work exclusively focusing on fixing or expanding testing.
No Label
Type
Feature
Projects
Clear projects
No project
Assignees
aditya (Aditya Chhabra)
aleenaumair (Aleena Umair)
brent.edwards (Brent Edwards)
CoreRasurae (Luis Mendes)
drew (Drew Morris)
eugen.thaci (Eugen Thaci)
freemo (Jeffrey Phillips Freeman)
HAL9000 (HAL 9000)
HAL9001 (HAL9001)
hamza.khyari (Hamza Khyari)
hurui200320 (Rui Hu)
justin.morris
khird (Kyle Hird)
org.cleveragents
Clear assignees
No Assignees
hamza.khyari
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cleveragents/cleveragents-core#466
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "feature/m6-acms-uko-schema"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
docs/ontology/uko.ttl) with base URI, version IRI, and prefix conventionsUKOLoaderservice for URI parsing, inheritance resolution, and validationUKONode,UKOPrefix,UKOVersion,UKOOntologyfrozen Pydantic v2 modelsrdf:typefor nodesTesting
robot/uko_ontology.robot)benchmarks/uko_load_bench.py)Files Changed
docs/ontology/uko.ttl— RDF/TTL ontology skeletonsrc/cleveragents/domain/models/core/uko.py— UKO Pydantic v2 modelssrc/cleveragents/application/services/uko_loader.py— TTL parser + validator + inheritance resolverfeatures/uko_ontology.feature+features/steps/uko_ontology_steps.py— BDD testsrobot/uko_ontology.robot+robot/helper_uko_ontology.py— Integration testsbenchmarks/uko_load_bench.py— ASV benchmarksdocs/reference/uko.md— Reference documentationCHANGELOG.md— UpdatedCloses #189
Code Review Report
Commit:
8206fad—fix(uko): address review findings for UKO ontology scaffoldingAuthor: khyari hamza (Hamza Khyari)
Branch:
feature/m6-acms-uko-schemaIssue: #189 — feat(uko): add UKO ontology scaffolding
Files changed: 5 files, +96 / -4
Severity Summary
CRITICAL — Specification Mismatches
C-1. Ontology URI Namespace Diverges from Specification
Files:
docs/ontology/uko.ttl,src/cleveragents/application/services/uko_loader.py:42-47The specification (
docs/specification.md, ~line 40785-40800) defines the UKO namespace prefixes as domain-based names:uko:https://cleveragents.ai/ontology/uko#uko-code:https://cleveragents.ai/ontology/uko/code#uko-oo:https://cleveragents.ai/ontology/uko/oo#uko-py:https://cleveragents.ai/ontology/uko/py#The implementation uses a completely different naming convention — numeric layer IDs:
uko0:https://ontology.cleverthis.com/uko/layer0/uko1:https://ontology.cleverthis.com/uko/layer1/uko2:https://ontology.cleverthis.com/uko/layer2/uko3:https://ontology.cleverthis.com/uko/layer3/Both the base domain (
cleveragents.aivsontology.cleverthis.com) and the naming strategy (semantic domain names vs numeric indices) differ. The_LAYER_PREFIXESdict inuko_loader.py:42-47hardcodes the numeric scheme. This will require a complete rewrite when aligning with the specification.C-2. Layer 0 Class Hierarchy Does Not Match Specification
File:
docs/ontology/uko.ttl:17-35The specification defines five Layer 0 base classes following an information-theory model:
uko:InformationUnit(root)uko:Container(subClassOf InformationUnit)uko:Atom(subClassOf InformationUnit)uko:Annotation(subClassOf InformationUnit)uko:Boundary(subClassOf InformationUnit)The implementation defines four classes following an artifact-centric model:
uko0:Resource(root)uko0:Artifact(subClassOf Resource)uko0:CodeArtifact(subClassOf Artifact)uko0:Document(subClassOf Artifact)These are fundamentally different ontologies. The spec's Layer 0 is a general-purpose information classification system, while the implementation's Layer 0 is a software-artifact taxonomy. The test in
features/uko_ontology.feature:167hardcodescount: 4for Layer 0, cementing this divergence.C-3. Layers 1-3 Structure Does Not Match Specification
File:
docs/ontology/uko.ttl:37-80Module,Callable,TypeDefinition), Documents, Data, InfrastructureModule,Function,ClassClass,Interface,Method), Functional, Proceduralimports,defines,inheritsPythonModule,PythonClass,PythonFunctionNotable: the spec places
Classat Layer 2 (OO paradigm) but the implementation puts it at Layer 1. The spec's Layer 2 contains classes (OO specializations), while the implementation's Layer 2 contains only ObjectProperty relationships. The spec usesCallable(Layer 1) andMethod(Layer 2); the implementation usesFunction(Layer 1) which has no spec equivalent at that layer.BUG
B-1. Validation Produces False-Positive "Undefined Prefix" for Resolved HTTP URIs
File:
src/cleveragents/application/services/uko_loader.py:186-201Two problems:
False prefix error on external URIs. If
parent_uripoints to an external ontology class (e.g.,owl:Thingwhich resolves tohttp://www.w3.org/2002/07/owl#Thing), then":" in resolved_parentisTrue(because ofhttp:),prefix_partbecomes"http", and"http" not in known_prefixesisTrue. This produces a spurious "undefined prefix 'http:'" error. While the current TTL avoids this scenario, it violates standard RDF practice where cross-ontology references are common.Duplicate errors. The new existence check at line 197 is not guarded by
elif, so both the prefix error and the non-existent parent error fire for the same node. This clutters the error output with redundant messages for a single root cause.TEST FLAWS
T-1. No Test for
rdfs:domain/rdfs:rangeURI ResolutionImpact: The primary code fix in this commit
The commit message states "Resolve rdfs:domain and rdfs:range values to full URIs in parser" (
uko_loader.py:125-135), yet no Behave scenario or step verifies this behavior. There is no assertion checking thatnode.properties["rdfs:domain"]contains a fully resolved URI rather than a prefixed name. If this resolution logic regresses, no test will catch it.T-2. No Test for Parent-URI Existence Validation
Impact: New validation rule at
uko_loader.py:196-201The commit adds a new validation check that rejects nodes whose
parent_urireferences a non-existent node. But no test scenario exercises this path. The new "Validate rejects ontology with typeless node" test only verifies missingrdf:type, not missing parent references.T-3. Duplicate/Inconsistent Context Attributes in Step Definitions
File:
features/steps/uko_ontology_steps.pyThe commit introduces parallel naming conventions for the same concepts:
context.layer_nodes(line 117)context.uko_layer_nodes(line 123)context.validation_errors(line 129)context.uko_validation_errors(line 163)context.ontology(line 38)context.uko_ontology(line 155)The new step
step_when_get_all_layer_nodes(line 120-123) is functionally identical tostep_when_get_layer(line 114-117) — both callloader.get_layer_nodes()— but store results in different attributes. This creates maintenance confusion and increases the risk of reading the wrong attribute in a future step.T-4. Hardcoded Node Counts Coupled to Non-Spec TTL
File:
features/uko_ontology.feature:165-170These exact counts are tightly coupled to the current TTL file that diverges from the spec (see C-2, C-3). When the TTL is corrected to match the specification (Layer 0 = 5 classes, Layer 1 = many more domain classes), every row in this table will break. The older
there should be at least 4 nodesassertion (line 157) is more resilient to ontology evolution.DESIGN ISSUES
D-1. Validator Assumes Closed-World (All Parents Internal)
File:
uko_loader.py:196-201Standard RDF ontologies commonly reference classes from external vocabularies (
owl:Thing,rdfs:Resource, etc.). The new parent-existence check treats any reference to a class not defined within the same TTL file as an error. This closed-world assumption is incompatible with RDF best practices and will need to be relaxed when the ontology grows to reference standard vocabularies.D-2.
rdfs:subPropertyOfNot HandledFile:
uko_loader.pyThe spec's TTL definitions use
rdfs:subPropertyOffor property inheritance (e.g.,uko-oo:inheritsFrom rdfs:subPropertyOf uko:dependsOn). The parser extractsrdfs:domain,rdfs:range, andrdfs:subClassOfbut ignoresrdfs:subPropertyOf. When the ontology adds property hierarchies per the specification, this will need to be addressed.MINOR / STYLE
M-1. Inconsistent Quoting in Error Messages
File:
uko_loader.py:183-209Older error messages omit quotes around URIs (
f"Node {node.uri} missing rdf:type"), while the new messages added in this commit use quotes (f"Node '{node.uri}' references ..."). This should be consistent across all error strings.M-2. Premature
ISSUES CLOSED: #189Both commits on this branch include
ISSUES CLOSED: #189, but at least two subtasks from the issue's acceptance criteria remain unverified:nox -s coverage_report"nox(all default sessions, including benchmark), fix any errors"The issue should not be auto-closed until these are confirmed passing.
Recommendations
uko_loader.py:188-201— addelifto avoid duplicate errors and exclude fully-resolved HTTP URIs from the prefix check.step_when_get_all_layer_nodes/uko_layer_nodesand reuse the existingstep_when_get_layer/layer_nodespattern.noxand coverage verification are completed per the issue's acceptance criteria.Code Review — Commit
c8df7e5(fix(uko): add missing Layer 0 properties, fix validation and immutability)Reviewed against: Issue #189 acceptance criteria,
docs/specification.md(Section 14 / ACMS Architecture / UKO), and general code quality standards.Scope: test coverage, test flaws, performance, bug detection, security, spec fidelity.
Findings
BUG-1 (Medium): UKO namespace prefix match is overly broad
File:
src/cleveragents/application/services/uko_loader.py:227-245The internal-URI validation check uses a prefix string without a trailing delimiter:
"https://cleveragents.ai/ontology/ukobogus#Something".startswith(_uko_ns)evaluates toTrue. Any URI whose path happens to start with.../uko(e.g., a hypotheticalukobogus:, a typo likeukoo:, or any future external ontology whose IRI shares that prefix) would be incorrectly treated as an internal UKO URI and then rejected as non-existent — a false-positive validation error.Suggested fix — guard with a delimiter check:
BUG-2 (Low):
_extract_version_stringfix has no dedicated testFile:
src/cleveragents/application/services/uko_loader.py:515-527The old code returned the raw last path segment for non-semver IRIs (e.g.,
https://cleveragents.ai/ontology/ukowould return"uko"). The fix now correctly returns"".However, the only new test for version rejection uses version IRI
99.0.0, which is a valid semver string — it just isn't inSUPPORTED_VERSIONS. That test exercises thevalidate()version-check, not the_extract_version_stringcode path. There is no test that sends a version IRI with a non-semver last segment (e.g.,<https://cleveragents.ai/ontology/uko>or<https://example.com/foo/bar>) and verifies the loader rejects it with "Unsupported version" and version"".SPEC-1 (Medium):
rdfs:commentvalues truncated relative to specificationFile:
docs/ontology/uko.ttl:69-87Three content property comments are shortened compared to the specification (
docs/specification.mdlines ~40847-40861):hasRenderingrenderingDepthhasFullContentThe truncated portions carry important semantic constraints (multiplicity, pairing via blank node/reification, equivalence to max-depth rendering) that downstream consumers of the ontology may rely on. The TTL should mirror the specification comments verbatim.
TEST-1 (Medium): No BDD test for
rdfs:domain/rdfs:rangecorrectness of new propertiesFile:
features/uko_ontology.feature:230-257The three new scenarios verify that the 10 new properties exist as nodes with the correct labels. However, none of them verify:
rdfs:domainis correctly resolved touko:InformationUnitfor each property.rdfs:rangeis correctly set (e.g.,xsd:stringforhasRendering,xsd:dateTimeforvalidFrom,xsd:booleanforisCurrent,uko:InformationUnitforisRevisionOf).sourceResource(anowl:ObjectProperty) has nordfs:range— matching the spec.The existing
@uko_domain_rangescenarios only testcontainsandinheritsFrom. A similar pattern should cover the 10 new properties to ensure they match the specification.TEST-2 (Low): No test for duplicate-key handling after
propertiestype changeFile:
src/cleveragents/domain/models/core/uko.py:31,features/steps/uko_ontology_steps.py:355The
propertiesfield was changed fromdict[str, str]totuple[tuple[str, str], ...]. The step code now doesprop_dict = dict(node.properties)which silently drops duplicates (keeps last value). While the current loader code cannot produce duplicates (it populates from adict), a future TTL extension with multi-valued predicates (valid in RDF) could introduce them. A test asserting the expected lookup behavior for duplicate keys would prevent silent data loss.SPEC-2 (Low): Commit message references wrong specification line numbers
The commit body says "per specification lines 41909-41956", but the actual content/provenance/temporal property definitions are at approximately lines 40847-40894 in
docs/specification.md. Minor traceability issue that could confuse future reviewers.PERF-1 (Informational):
get_layer_nodesdoes a linear scan on every callFile:
src/cleveragents/application/services/uko_loader.py:317-323This is O(n) per call. For the current 32-node ontology it is negligible. As the spec envisions projects with 10,000+ indexed files (milestone v3.4.0 success criteria), precomputing a
dict[int, list[UKONode]]index during load would be more efficient. Not a blocker now but worth a# TODOfor the scaling milestone.Positive Notes
dict→tuple[tuple[str,str],...]change forpropertiescorrectly enforces deep immutability on afrozen=Truemodel._extract_version_stringreturning""for non-semver segments prevents confusing error messages.Severity Summary
c8df7e58c6to41254ccffcThanks for the UKO scaffolding work. I found several blocking issues before this can merge.
Good
docs/ontology/uko.ttl).src/cleveragents/application/services/uko_loader.py).src/cleveragents/domain/models/core/uko.py).Needs attention
alembic/versions/m6_001_checkpoint_metadata_table.py), services (src/cleveragents/application/services/checkpoint_service.py), specs/docs (docs/specification.md), tests (features/*,robot/*), and CI config. Please revert unrelated deletions and keep this PR focused on UKO scaffolding only.docs/specification.mdis massively reduced/edited in this PR without an ADR or clear alignment to the stated architecture. If this is intentional, it requires a dedicated ADR and a separate PR. Otherwise, revert the spec changes.Type/label and noState/,Priority/, orMoSCoW/labels. This PR currently has extra labels (e.g.,State/Verified,Priority/Medium,MoSCoW/Should have). Please fix the labels before merge.Given the P1 items, I’m marking this as request changes. Happy to re-review once the PR is reduced to the UKO changes and the process issues are corrected.
41254ccffcto9f685ee9bbApprove.
9f685ee9bbtoad53a659deNew commits pushed, approval review dismissed automatically according to repository settings