generated from coulomb/repo-seed
utility relationships understanding of INTENT.md vs. SCOPE.md and documentation.
This commit is contained in:
@@ -489,6 +489,8 @@ class RegistryService:
|
||||
graph = self.store.get_candidate_graph(repository_id, analysis_run_id)
|
||||
approved_count = 0
|
||||
skipped_count = 0
|
||||
approved_reasons: list[str] = []
|
||||
skipped_reasons: list[str] = []
|
||||
for ability in graph.abilities:
|
||||
if ability.status != "candidate":
|
||||
continue
|
||||
@@ -497,11 +499,14 @@ class RegistryService:
|
||||
for capability in ability.capabilities
|
||||
if capability.status == "candidate"
|
||||
]
|
||||
safe_capabilities = [
|
||||
capability
|
||||
for capability in candidate_capabilities
|
||||
if self._trusted_auto_approve_capability_safe(capability)
|
||||
]
|
||||
safe_capabilities = []
|
||||
for capability in candidate_capabilities:
|
||||
safe, reason = self._trusted_auto_approve_capability_decision(capability)
|
||||
if safe:
|
||||
safe_capabilities.append(capability)
|
||||
approved_reasons.append(f"{capability.name}: {reason}")
|
||||
else:
|
||||
skipped_reasons.append(f"{capability.name}: {reason}")
|
||||
skipped_count += len(candidate_capabilities) - len(safe_capabilities)
|
||||
if not safe_capabilities:
|
||||
continue
|
||||
@@ -536,6 +541,7 @@ class RegistryService:
|
||||
notes=(
|
||||
f"{notes} Auto-approved {approved_count} safe candidate "
|
||||
f"capability(s); left {skipped_count} for review."
|
||||
f"{self._trusted_auto_approve_notes(approved_reasons, skipped_reasons)}"
|
||||
).strip(),
|
||||
)
|
||||
return self.store.get_ability_map(repository_id)
|
||||
@@ -544,23 +550,64 @@ class RegistryService:
|
||||
self,
|
||||
capability: CandidateCapability,
|
||||
) -> bool:
|
||||
safe, _reason = self._trusted_auto_approve_capability_decision(capability)
|
||||
return safe
|
||||
|
||||
def _trusted_auto_approve_capability_decision(
|
||||
self,
|
||||
capability: CandidateCapability,
|
||||
) -> tuple[bool, str]:
|
||||
has_source_refs = bool(capability.source_refs) or any(
|
||||
feature.source_refs for feature in capability.features
|
||||
)
|
||||
if not has_source_refs:
|
||||
return False
|
||||
return False, "missing source references"
|
||||
if capability.primary_class == "repository-structure":
|
||||
return False
|
||||
return False, "structural/dependency context requires curator review"
|
||||
utility_relationships = self._candidate_utility_relationships(capability)
|
||||
eligible_relationships = {"owned", "facade", "adapter"}
|
||||
if not utility_relationships:
|
||||
return False, "missing utility relationship"
|
||||
if not (utility_relationships & eligible_relationships):
|
||||
relationships = ", ".join(sorted(utility_relationships))
|
||||
return False, f"utility relationship is not eligible ({relationships})"
|
||||
if capability.primary_class == "llm-integration":
|
||||
return bool(
|
||||
{"utility-owned", "utility-facade", "utility-adapter"}
|
||||
& set(capability.attributes)
|
||||
)
|
||||
return True, "eligible LLM utility relationship with source support"
|
||||
if capability.primary_class in {"interface", "API", "CLI", "callable", "api", "cli"}:
|
||||
return capability.confidence >= 0.55
|
||||
if capability.confidence >= 0.55:
|
||||
return True, "owned interface with sufficient confidence"
|
||||
return False, "owned interface confidence below trusted threshold"
|
||||
if capability.features:
|
||||
return capability.confidence >= 0.55
|
||||
return capability.confidence >= 0.75
|
||||
if capability.confidence >= 0.55:
|
||||
return True, "eligible utility relationship with feature support"
|
||||
return False, "feature-backed capability confidence below trusted threshold"
|
||||
if capability.confidence >= 0.75:
|
||||
return True, "eligible utility relationship with high confidence"
|
||||
return False, "capability confidence below trusted threshold"
|
||||
|
||||
def _candidate_utility_relationships(
|
||||
self,
|
||||
capability: CandidateCapability,
|
||||
) -> set[str]:
|
||||
return {
|
||||
attribute.removeprefix("utility-")
|
||||
for attribute in capability.attributes
|
||||
if attribute.startswith("utility-")
|
||||
}
|
||||
|
||||
def _trusted_auto_approve_notes(
|
||||
self,
|
||||
approved_reasons: list[str],
|
||||
skipped_reasons: list[str],
|
||||
) -> str:
|
||||
details: list[str] = []
|
||||
if approved_reasons:
|
||||
details.append("Approved: " + "; ".join(approved_reasons) + ".")
|
||||
if skipped_reasons:
|
||||
details.append("Skipped: " + "; ".join(skipped_reasons) + ".")
|
||||
if not details:
|
||||
return ""
|
||||
return " " + " ".join(details)
|
||||
|
||||
def _approved_counts(self, repository_id: int) -> dict[str, int]:
|
||||
ability_map = self.store.get_ability_map(repository_id)
|
||||
|
||||
Reference in New Issue
Block a user