Implement canon conformance and maintenance optimizations
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a06e82-3e08-7042-a79d-438ac6eed8db
This commit is contained in:
parent
a2e7f22d8d
commit
b081d39da1
64 changed files with 4491 additions and 373 deletions
|
|
@ -19,10 +19,11 @@ from .bench import (
|
|||
run_collection_checks,
|
||||
)
|
||||
from .validation import structural_checks
|
||||
from .paths import infospace_root
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
DEFAULT_INFOSPACE_ROOT = REPO_ROOT / "infospace"
|
||||
DEFAULT_INFOSPACE_ROOT = infospace_root()
|
||||
|
||||
REVIEW_KIT_COMPONENTS = {
|
||||
"manifest": "agent/review-kit/review-kit.yaml",
|
||||
|
|
@ -65,18 +66,18 @@ class CanonContext:
|
|||
|
||||
|
||||
def load_context(root: Path | str | None = None) -> CanonContext:
|
||||
infospace_root = Path(root) if root else DEFAULT_INFOSPACE_ROOT
|
||||
resolved_root = infospace_root(root)
|
||||
try:
|
||||
infospace = load_infospace(infospace_root)
|
||||
infospace = load_infospace(resolved_root)
|
||||
except Exception as exc:
|
||||
raise CanonServiceError(
|
||||
"infospace_load_failed",
|
||||
f"Unable to load infospace at {infospace_root}",
|
||||
{"root": str(infospace_root), "reason": str(exc)},
|
||||
f"Unable to load infospace at {resolved_root}",
|
||||
{"root": str(resolved_root), "reason": str(exc)},
|
||||
) from exc
|
||||
return CanonContext(
|
||||
repo_root=REPO_ROOT,
|
||||
infospace_root=infospace_root,
|
||||
repo_root=resolved_root.parent,
|
||||
infospace_root=resolved_root,
|
||||
infospace=infospace,
|
||||
)
|
||||
|
||||
|
|
@ -217,6 +218,11 @@ def validate_canon(root: Path | str | None = None) -> dict[str, Any]:
|
|||
structural = structural_checks(context)
|
||||
errors.extend(structural["errors"])
|
||||
warnings.extend(structural["warnings"])
|
||||
from .contracts import bound_artifact_errors, coverage
|
||||
errors.extend(bound_artifact_errors(context))
|
||||
ownership = generation.concept_ownership(context)
|
||||
errors.extend(dict(item, code="concept_ownership_conflict")
|
||||
for item in ownership["ownership_conflicts"])
|
||||
|
||||
return {
|
||||
"ok": not errors,
|
||||
|
|
@ -224,6 +230,7 @@ def validate_canon(root: Path | str | None = None) -> dict[str, Any]:
|
|||
"warnings": warnings,
|
||||
"metrics": checks.metrics,
|
||||
"details": checks.details,
|
||||
"coverage": coverage(context),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -232,6 +239,8 @@ def write_validation_report(
|
|||
root: Path | str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
payload = validate_canon(root)
|
||||
from .maintenance import source_evidence
|
||||
payload["evidence"] = source_evidence(infospace_root(root))
|
||||
path = Path(destination)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
|
|
@ -335,7 +344,7 @@ def review_capability_record(
|
|||
from .capability import CapabilityReviewError, review_path
|
||||
|
||||
try:
|
||||
return review_path(path)
|
||||
return review_path(path, infospace_root(root) / "models/capability/capabilities.yaml")
|
||||
except CapabilityReviewError as exc:
|
||||
raise CanonServiceError(exc.code, exc.message) from exc
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue