core-runtime-engine 11.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- core_runtime/__init__.py +10 -0
- core_runtime/__version__.py +17 -0
- core_runtime/cli/__init__.py +7 -0
- core_runtime/cli/__main__.py +22 -0
- core_runtime/cli/bump_version.py +176 -0
- core_runtime/cli/contract_preflight.py +69 -0
- core_runtime/cli/create_domain.py +66 -0
- core_runtime/cli/doctor.py +44 -0
- core_runtime/cli/inventory.py +85 -0
- core_runtime/cli/lint.py +8 -0
- core_runtime/cli/main.py +579 -0
- core_runtime/cli/release_check.py +65 -0
- core_runtime/cli/repair_artifact_paths.py +48 -0
- core_runtime/cli/sync_template.py +67 -0
- core_runtime/cli/validate.py +73 -0
- core_runtime/core/__init__.py +34 -0
- core_runtime/core/audit_event.py +760 -0
- core_runtime/core/audit_trail_index.py +100 -0
- core_runtime/core/canonicalization.py +55 -0
- core_runtime/core/contract_evaluator.py +945 -0
- core_runtime/core/contract_executability.py +307 -0
- core_runtime/core/contract_loader.py +57 -0
- core_runtime/core/contract_probes.py +630 -0
- core_runtime/core/contract_program.py +131 -0
- core_runtime/core/contract_program_registry.py +104 -0
- core_runtime/core/contract_program_v2.py +126 -0
- core_runtime/core/dsk_v3.py +142 -0
- core_runtime/core/explainability.py +2115 -0
- core_runtime/core/numeric_normalization.py +120 -0
- core_runtime/core/rule_anchor.py +1388 -0
- core_runtime/core/schema_fingerprint.py +69 -0
- core_runtime/core/sensor_evidence.py +548 -0
- core_runtime/data/contracts/CoreAnchor.sol +109 -0
- core_runtime/data/contracts/CoreRuleAnchor.abi.json +111 -0
- core_runtime/data/contracts/CoreRuleAnchor.bin +1 -0
- core_runtime/data/contracts/CoreRuleAnchor.build.json +20 -0
- core_runtime/data/contracts/CoreRuleAnchor.runtime.bin +1 -0
- core_runtime/data/contracts/CoreRuleAnchor.sol +74 -0
- core_runtime/data/package_data_manifest.v1.json +173 -0
- core_runtime/data/schemas/core/causal_trace.v1.json +141 -0
- core_runtime/data/schemas/core/context_gate.v1.json +38 -0
- core_runtime/data/schemas/core/context_threshold.v1.json +46 -0
- core_runtime/data/schemas/core/contract_program.v1.json +186 -0
- core_runtime/data/schemas/core/contract_program.v2.json +187 -0
- core_runtime/data/schemas/core/control_decision.v1.json +114 -0
- core_runtime/data/schemas/core/dsk.v3.json +105 -0
- core_runtime/data/schemas/core/effect_result.v1.json +39 -0
- core_runtime/data/schemas/core/entropy_signal.v1.json +108 -0
- core_runtime/data/schemas/core/execution_receipt.v1.json +93 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v1.json +87 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v2.json +72 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v3.json +38 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v4.json +72 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v5.json +38 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v6.json +116 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v7.json +37 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v8.json +114 -0
- core_runtime/data/schemas/core/frozen_rule_set.v1.json +282 -0
- core_runtime/data/schemas/core/memory_artifact.v1.json +120 -0
- core_runtime/data/schemas/core/memory_generation_result.v1.json +37 -0
- core_runtime/data/schemas/core/operational_learning_event.v1.json +63 -0
- core_runtime/data/schemas/core/pattern_candidate.v1.json +114 -0
- core_runtime/data/schemas/core/physical_safety_assurance_case.v1.json +676 -0
- core_runtime/data/schemas/core/policy_lifecycle.v1.json +99 -0
- core_runtime/data/schemas/core/retention_manifest.v1.json +53 -0
- core_runtime/data/schemas/core/reversibility_policy.v1.json +107 -0
- core_runtime/data/schemas/core/rule_anchor_batch.v1.json +93 -0
- core_runtime/data/schemas/core/rule_anchor_chain_evidence.v1.json +56 -0
- core_runtime/data/schemas/core/rule_approval.v1.json +49 -0
- core_runtime/data/schemas/core/rule_approval_request.v1.json +42 -0
- core_runtime/data/schemas/core/state_transition.v1.json +115 -0
- core_runtime/data/schemas/core/task_closeout.v1.json +47 -0
- core_runtime/data/schemas/core/template_promotion_candidate.v1.json +83 -0
- core_runtime/data/schemas/core/unsigned_rule_anchor_deployment.v1.json +106 -0
- core_runtime/data/schemas/core/unsigned_rule_anchor_transaction.v1.json +116 -0
- core_runtime/tooling/__init__.py +48 -0
- core_runtime/tooling/bump_version.py +900 -0
- core_runtime/tooling/contract_preflight.py +293 -0
- core_runtime/tooling/create_domain.py +254 -0
- core_runtime/tooling/diagnostics.py +129 -0
- core_runtime/tooling/doctor.py +482 -0
- core_runtime/tooling/file_inventory.py +182 -0
- core_runtime/tooling/json_checks.py +100 -0
- core_runtime/tooling/release_check.py +1017 -0
- core_runtime/tooling/repair_artifact_paths.py +458 -0
- core_runtime/tooling/report_writer.py +176 -0
- core_runtime/tooling/repository_inventory.py +399 -0
- core_runtime/tooling/safety_checks.py +172 -0
- core_runtime/tooling/sync_template.py +303 -0
- core_runtime/tooling/validation.py +507 -0
- core_runtime/tooling/version_inventory.py +256 -0
- core_runtime_engine-11.5.1.dist-info/METADATA +35 -0
- core_runtime_engine-11.5.1.dist-info/RECORD +96 -0
- core_runtime_engine-11.5.1.dist-info/WHEEL +5 -0
- core_runtime_engine-11.5.1.dist-info/entry_points.txt +2 -0
- core_runtime_engine-11.5.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""JSON parse checks - validate JSON files parse correctly."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from core_runtime.tooling.diagnostics import DiagnosticCollection
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class JSONChecks:
|
|
12
|
+
"""Check that JSON files parse correctly."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, repo_root: Path):
|
|
15
|
+
self.repo_root = repo_root
|
|
16
|
+
|
|
17
|
+
def check_schemas(self, diagnostics: DiagnosticCollection) -> tuple[int, int]:
|
|
18
|
+
"""Check all schema JSON files."""
|
|
19
|
+
schemas_dir = self.repo_root / "schemas"
|
|
20
|
+
if not schemas_dir.is_dir():
|
|
21
|
+
diagnostics.add_blocked(
|
|
22
|
+
code="core.json.schemas_dir_missing",
|
|
23
|
+
message="schemas/ directory not found",
|
|
24
|
+
path="schemas/",
|
|
25
|
+
)
|
|
26
|
+
return 0, 0
|
|
27
|
+
|
|
28
|
+
checked = 0
|
|
29
|
+
errors = 0
|
|
30
|
+
for json_file in schemas_dir.glob("*.json"):
|
|
31
|
+
checked += 1
|
|
32
|
+
if not self._check_json_file(json_file, diagnostics, "schemas"):
|
|
33
|
+
errors += 1
|
|
34
|
+
return checked, errors
|
|
35
|
+
|
|
36
|
+
def check_examples(self, diagnostics: DiagnosticCollection) -> tuple[int, int]:
|
|
37
|
+
"""Check example JSON files."""
|
|
38
|
+
examples_dir = self.repo_root / "examples"
|
|
39
|
+
if not examples_dir.is_dir():
|
|
40
|
+
diagnostics.add_blocked(
|
|
41
|
+
code="core.json.examples_dir_missing",
|
|
42
|
+
message="examples/ directory not found",
|
|
43
|
+
path="examples/",
|
|
44
|
+
)
|
|
45
|
+
return 0, 0
|
|
46
|
+
|
|
47
|
+
checked = 0
|
|
48
|
+
errors = 0
|
|
49
|
+
# Limit to avoid very long runs; focus on key areas
|
|
50
|
+
for json_file in examples_dir.rglob("*.json"):
|
|
51
|
+
# Skip some large generated directories
|
|
52
|
+
rel = json_file.relative_to(self.repo_root)
|
|
53
|
+
if any(skip in str(rel) for skip in [".pycache", "core_protocol_model/candidate_outputs_v1", "core_protocol_model/model_artifacts_v1"]):
|
|
54
|
+
continue
|
|
55
|
+
checked += 1
|
|
56
|
+
if not self._check_json_file(json_file, diagnostics, "examples"):
|
|
57
|
+
errors += 1
|
|
58
|
+
return checked, errors
|
|
59
|
+
|
|
60
|
+
def _check_json_file(self, json_file: Path, diagnostics: DiagnosticCollection, category: str) -> bool:
|
|
61
|
+
"""Check a single JSON file. Returns True if valid."""
|
|
62
|
+
try:
|
|
63
|
+
with json_file.open("r", encoding="utf-8") as f:
|
|
64
|
+
json.load(f)
|
|
65
|
+
return True
|
|
66
|
+
except json.JSONDecodeError as e:
|
|
67
|
+
rel = json_file.relative_to(self.repo_root)
|
|
68
|
+
diagnostics.add_error(
|
|
69
|
+
code="core.json.invalid",
|
|
70
|
+
message="Invalid JSON in {0}: {1}".format(rel, e.msg),
|
|
71
|
+
path=str(rel),
|
|
72
|
+
details="line {0}, column {1}: {2}".format(e.lineno, e.colno, e.msg),
|
|
73
|
+
)
|
|
74
|
+
return False
|
|
75
|
+
except OSError as e:
|
|
76
|
+
rel = json_file.relative_to(self.repo_root)
|
|
77
|
+
diagnostics.add_error(
|
|
78
|
+
code="core.json.unreadable",
|
|
79
|
+
message="Cannot read JSON file {0}: {1}".format(rel, e),
|
|
80
|
+
path=str(rel),
|
|
81
|
+
)
|
|
82
|
+
return False
|
|
83
|
+
|
|
84
|
+
def check_requirements_lock(self, diagnostics: DiagnosticCollection) -> bool:
|
|
85
|
+
"""Check requirements.lock is valid JSON (if it is JSON)."""
|
|
86
|
+
lock_file = self.repo_root / "requirements.lock"
|
|
87
|
+
if not lock_file.exists():
|
|
88
|
+
return False
|
|
89
|
+
# requirements.lock is a pip lockfile (text), not JSON
|
|
90
|
+
# We just check it's readable
|
|
91
|
+
try:
|
|
92
|
+
lock_file.read_text(encoding="utf-8")
|
|
93
|
+
return True
|
|
94
|
+
except OSError as e:
|
|
95
|
+
diagnostics.add_error(
|
|
96
|
+
code="core.file.unreadable",
|
|
97
|
+
message="Cannot read requirements.lock: {0}".format(e),
|
|
98
|
+
path="requirements.lock",
|
|
99
|
+
)
|
|
100
|
+
return False
|