consiliency-contract 0.1.0__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.
- consiliency_contract/__init__.py +64 -0
- consiliency_contract/_data/conformance/vectors/canonical-html-contract-loaded.json +15 -0
- consiliency_contract/_data/conformance/vectors/interface-invalid-host-path.json +26 -0
- consiliency_contract/_data/conformance/vectors/interface-valid-realized-and-promised.json +36 -0
- consiliency_contract/_data/conformance/vectors/loop-gate-invalid-blocking-default.json +15 -0
- consiliency_contract/_data/conformance/vectors/loop-gate-missing-doc-warns.json +16 -0
- consiliency_contract/_data/conformance/vectors/manifest-invalid-absolute-path.json +20 -0
- consiliency_contract/_data/conformance/vectors/manifest-invalid-certified-maturity.json +20 -0
- consiliency_contract/_data/conformance/vectors/manifest-invalid-path-and-ref.json +20 -0
- consiliency_contract/_data/conformance/vectors/manifest-invalid-unknown-archetype.json +18 -0
- consiliency_contract/_data/conformance/vectors/manifest-valid-baseline-only.json +20 -0
- consiliency_contract/_data/conformance/vectors/manifest-valid-product.json +21 -0
- consiliency_contract/_data/conformance/vectors/version-skew-compatible.json +15 -0
- consiliency_contract/_data/conformance/vectors/version-skew-incompatible-warns.json +15 -0
- consiliency_contract/_data/core/canonical-html/contract-v1.json +459 -0
- consiliency_contract/_data/core/canonical-html/provenance.json +22 -0
- consiliency_contract/_data/core/contract.json +45 -0
- consiliency_contract/_data/core/registries/archetypes.json +62 -0
- consiliency_contract/_data/core/registries/document-classes.json +33 -0
- consiliency_contract/_data/core/registries/maturity-labels.json +22 -0
- consiliency_contract/_data/core/registries/required-documents.json +74 -0
- consiliency_contract/_data/core/schemas/canonical-html-v1.schema.json +15 -0
- consiliency_contract/_data/core/schemas/contract-version-status.schema.json +26 -0
- consiliency_contract/_data/core/schemas/decision.schema.json +26 -0
- consiliency_contract/_data/core/schemas/interface-declaration.schema.json +67 -0
- consiliency_contract/_data/core/schemas/loop-gate-protocol.schema.json +25 -0
- consiliency_contract/_data/core/schemas/loop-gate-scenario.schema.json +25 -0
- consiliency_contract/_data/core/schemas/manifest.schema.json +97 -0
- consiliency_contract/_data/core/schemas/version-skew-protocol.schema.json +32 -0
- consiliency_contract/_data/core/schemas/version-skew-scenario.schema.json +13 -0
- consiliency_contract-0.1.0.dist-info/METADATA +68 -0
- consiliency_contract-0.1.0.dist-info/RECORD +34 -0
- consiliency_contract-0.1.0.dist-info/WHEEL +4 -0
- consiliency_contract-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Thin Python reader for the Consiliency shared contract data."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from importlib import resources
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
CONTRACT_PACKAGE = "consiliency-contract"
|
|
11
|
+
CONTRACT_VERSION = "0.1.0"
|
|
12
|
+
__version__ = "0.1.0"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _source_root() -> Path:
|
|
16
|
+
return Path(__file__).resolve().parent.parent
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _read_text(relative_path: str) -> str:
|
|
20
|
+
source_path = _source_root() / relative_path
|
|
21
|
+
if source_path.exists():
|
|
22
|
+
return source_path.read_text(encoding="utf-8")
|
|
23
|
+
data_path = resources.files(__package__).joinpath("_data", relative_path)
|
|
24
|
+
return data_path.read_text(encoding="utf-8")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _read_json(relative_path: str) -> dict[str, Any]:
|
|
28
|
+
return json.loads(_read_text(relative_path))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def load_contract() -> dict[str, Any]:
|
|
32
|
+
return _read_json("core/contract.json")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
CONTRACT = load_contract()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def load_schema(name: str) -> dict[str, Any]:
|
|
39
|
+
relative_path = CONTRACT["schemas"].get(name)
|
|
40
|
+
if not relative_path:
|
|
41
|
+
raise ValueError(f"Unknown schema: {name}")
|
|
42
|
+
return _read_json(relative_path)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def load_registry(name: str) -> dict[str, Any]:
|
|
46
|
+
relative_path = CONTRACT["registries"].get(name)
|
|
47
|
+
if not relative_path:
|
|
48
|
+
raise ValueError(f"Unknown registry: {name}")
|
|
49
|
+
return _read_json(relative_path)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def list_vectors() -> list[str]:
|
|
53
|
+
source_dir = _source_root() / CONTRACT["conformance"]["vector_root"]
|
|
54
|
+
if source_dir.exists():
|
|
55
|
+
return sorted(path.name for path in source_dir.glob("*.json"))
|
|
56
|
+
data_dir = resources.files(__package__).joinpath("_data", CONTRACT["conformance"]["vector_root"])
|
|
57
|
+
return sorted(path.name for path in data_dir.iterdir() if path.name.endswith(".json"))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def load_vector(name: str) -> dict[str, Any]:
|
|
61
|
+
filename = name if name.endswith(".json") else f"{name}.json"
|
|
62
|
+
if filename not in list_vectors():
|
|
63
|
+
raise ValueError(f"Unknown vector: {name}")
|
|
64
|
+
return _read_json(f"{CONTRACT['conformance']['vector_root']}/{filename}")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "canonical-html-contract-loaded",
|
|
3
|
+
"description": "The relocated canonical_html.v1 contract is present with recorded provenance.",
|
|
4
|
+
"input": {
|
|
5
|
+
"contract_path": "core/canonical-html/contract-v1.json",
|
|
6
|
+
"provenance_path": "core/canonical-html/provenance.json",
|
|
7
|
+
"expected_sha256": "3c0c11b7be8b2301409c47416269dd5579fac90f6e7a4e9ca9c3caef50bd2e28"
|
|
8
|
+
},
|
|
9
|
+
"decision": {
|
|
10
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
11
|
+
"status": "accepted",
|
|
12
|
+
"maturity": "hash-checked",
|
|
13
|
+
"findings": []
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "interface-invalid-host-path",
|
|
3
|
+
"description": "Local sibling checkout paths are rejected from public interface data.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.interface_declaration.v1",
|
|
6
|
+
"repo_id": "governed-pipeline",
|
|
7
|
+
"realized_edges": [
|
|
8
|
+
{
|
|
9
|
+
"id": "bad-path",
|
|
10
|
+
"provider_repo": "spec",
|
|
11
|
+
"consumer_repo": "governed-pipeline",
|
|
12
|
+
"interface_id": "spec-certificate",
|
|
13
|
+
"ref": {"kind": "repo-relative-path", "value": "/absolute/private/spec-certificate-canon.mjs"},
|
|
14
|
+
"maturity": "realized-edge-observed",
|
|
15
|
+
"evidence": []
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"promised_edges": []
|
|
19
|
+
},
|
|
20
|
+
"decision": {
|
|
21
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
22
|
+
"status": "rejected",
|
|
23
|
+
"maturity": "presence-only",
|
|
24
|
+
"findings": [{"code": "interface.ref.host_path", "severity": "block", "message": "Interface refs must not contain host absolute paths."}]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "interface-valid-realized-and-promised",
|
|
3
|
+
"description": "Interface declarations can carry realized and promised edges with safe refs.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.interface_declaration.v1",
|
|
6
|
+
"repo_id": "governed-pipeline",
|
|
7
|
+
"realized_edges": [
|
|
8
|
+
{
|
|
9
|
+
"id": "harness-pin",
|
|
10
|
+
"provider_repo": "agent-harness",
|
|
11
|
+
"consumer_repo": "governed-pipeline",
|
|
12
|
+
"interface_id": "phase-loop-cli-entrypoint",
|
|
13
|
+
"ref": {"kind": "git-ref", "value": "v0.1.12"},
|
|
14
|
+
"maturity": "realized-edge-observed",
|
|
15
|
+
"evidence": [{"ref": "tools/agent-harness.pin.json", "digest": "sha256:0000000000000000000000000000000000000000000000000000000000000000"}]
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"promised_edges": [
|
|
19
|
+
{
|
|
20
|
+
"id": "contract-package",
|
|
21
|
+
"provider_repo": "consiliency-contract",
|
|
22
|
+
"consumer_repo": "governed-pipeline",
|
|
23
|
+
"interface_id": "consiliency-contract-v1",
|
|
24
|
+
"ref": {"kind": "package-coordinate", "value": "@consiliency/contract@^0.1.0"},
|
|
25
|
+
"maturity": "presence-only",
|
|
26
|
+
"evidence": []
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"decision": {
|
|
31
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
32
|
+
"status": "accepted",
|
|
33
|
+
"maturity": "realized-edge-observed",
|
|
34
|
+
"findings": []
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "loop-gate-invalid-blocking-default",
|
|
3
|
+
"description": "Phase 0 contract data must not make blocking the default.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.loop_gate_scenario.v1",
|
|
6
|
+
"gate": "presence",
|
|
7
|
+
"severity_default": "block"
|
|
8
|
+
},
|
|
9
|
+
"decision": {
|
|
10
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
11
|
+
"status": "rejected",
|
|
12
|
+
"maturity": "presence-only",
|
|
13
|
+
"findings": [{"code": "gate.default.blocking", "severity": "block", "message": "Blocking must be opt-in during Phase 0."}]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "loop-gate-missing-doc-warns",
|
|
3
|
+
"description": "Phase 0 missing document checks warn by default.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.loop_gate_scenario.v1",
|
|
6
|
+
"gate": "presence",
|
|
7
|
+
"missing": ["runbook"],
|
|
8
|
+
"consumer_policy": {"blocking_opt_in": false}
|
|
9
|
+
},
|
|
10
|
+
"decision": {
|
|
11
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
12
|
+
"status": "warn",
|
|
13
|
+
"maturity": "presence-only",
|
|
14
|
+
"findings": [{"code": "presence.missing_doc", "severity": "warn", "message": "Required document is missing at L0."}]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "manifest-invalid-absolute-path",
|
|
3
|
+
"description": "Host absolute paths are rejected from public package data.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.manifest.v1",
|
|
6
|
+
"contract_version": "0.1.0",
|
|
7
|
+
"repo": {"id": "bad", "display_name": "Bad", "default_branch": "main"},
|
|
8
|
+
"declaration": {"mode": "baseline-only"},
|
|
9
|
+
"documents": [
|
|
10
|
+
{"id": "readme", "class": "index", "path": "/absolute/private/README.md", "maturity": "presence-only", "target_level": "L0", "required": true}
|
|
11
|
+
],
|
|
12
|
+
"interfaces": ".consiliency/interfaces.json"
|
|
13
|
+
},
|
|
14
|
+
"decision": {
|
|
15
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
16
|
+
"status": "rejected",
|
|
17
|
+
"maturity": "presence-only",
|
|
18
|
+
"findings": [{"code": "path.absolute", "severity": "block", "message": "Paths must be repo-relative."}]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "manifest-invalid-certified-maturity",
|
|
3
|
+
"description": "Phase 0 vectors must not claim certified maturity.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.manifest.v1",
|
|
6
|
+
"contract_version": "0.1.0",
|
|
7
|
+
"repo": {"id": "bad", "display_name": "Bad", "default_branch": "main"},
|
|
8
|
+
"declaration": {"mode": "baseline-only"},
|
|
9
|
+
"documents": [
|
|
10
|
+
{"id": "glossary", "class": "proj-S", "path": "docs/glossary.html", "maturity": "certified", "target_level": "L1", "required": true}
|
|
11
|
+
],
|
|
12
|
+
"interfaces": ".consiliency/interfaces.json"
|
|
13
|
+
},
|
|
14
|
+
"decision": {
|
|
15
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
16
|
+
"status": "rejected",
|
|
17
|
+
"maturity": "presence-only",
|
|
18
|
+
"findings": [{"code": "maturity.certified.phase0", "severity": "block", "message": "Certified maturity is reserved for post-XG-1 evidence."}]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "manifest-invalid-path-and-ref",
|
|
3
|
+
"description": "A document declaration must use exactly one of path or ref.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.manifest.v1",
|
|
6
|
+
"contract_version": "0.1.0",
|
|
7
|
+
"repo": {"id": "bad", "display_name": "Bad", "default_branch": "main"},
|
|
8
|
+
"declaration": {"mode": "baseline-only"},
|
|
9
|
+
"documents": [
|
|
10
|
+
{"id": "readme", "class": "index", "path": "README.md", "ref": {"kind": "url", "value": "https://example.invalid"}, "maturity": "presence-only", "target_level": "L0", "required": true}
|
|
11
|
+
],
|
|
12
|
+
"interfaces": ".consiliency/interfaces.json"
|
|
13
|
+
},
|
|
14
|
+
"decision": {
|
|
15
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
16
|
+
"status": "rejected",
|
|
17
|
+
"maturity": "presence-only",
|
|
18
|
+
"findings": [{"code": "document.path_ref.exclusive", "severity": "block", "message": "Document declarations must use exactly one of path or ref."}]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "manifest-invalid-unknown-archetype",
|
|
3
|
+
"description": "Unknown archetypes are rejected.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.manifest.v1",
|
|
6
|
+
"contract_version": "0.1.0",
|
|
7
|
+
"repo": {"id": "bad", "display_name": "Bad", "default_branch": "main"},
|
|
8
|
+
"declaration": {"mode": "archetyped", "archetypes": ["website"], "modifiers": []},
|
|
9
|
+
"documents": [],
|
|
10
|
+
"interfaces": ".consiliency/interfaces.json"
|
|
11
|
+
},
|
|
12
|
+
"decision": {
|
|
13
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
14
|
+
"status": "rejected",
|
|
15
|
+
"maturity": "presence-only",
|
|
16
|
+
"findings": [{"code": "archetype.unknown", "severity": "block", "message": "Archetype is not in the contract registry."}]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "manifest-valid-baseline-only",
|
|
3
|
+
"description": "A baseline-only declaration is legal and carries no archetype list.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.manifest.v1",
|
|
6
|
+
"contract_version": "0.1.0",
|
|
7
|
+
"repo": {"id": "notes", "display_name": "Notes", "default_branch": "main"},
|
|
8
|
+
"declaration": {"mode": "baseline-only"},
|
|
9
|
+
"documents": [
|
|
10
|
+
{"id": "readme", "class": "index", "path": "README.md", "maturity": "presence-only", "target_level": "L0", "required": true}
|
|
11
|
+
],
|
|
12
|
+
"interfaces": ".consiliency/interfaces.json"
|
|
13
|
+
},
|
|
14
|
+
"decision": {
|
|
15
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
16
|
+
"status": "accepted",
|
|
17
|
+
"maturity": "presence-only",
|
|
18
|
+
"findings": []
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "manifest-valid-product",
|
|
3
|
+
"description": "An archetyped product manifest with repo-relative documents is accepted at L0.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.manifest.v1",
|
|
6
|
+
"contract_version": "0.1.0",
|
|
7
|
+
"repo": {"id": "portal", "display_name": "Consiliency Portal", "default_branch": "main"},
|
|
8
|
+
"declaration": {"mode": "archetyped", "archetypes": ["product"], "modifiers": ["user-facing"]},
|
|
9
|
+
"documents": [
|
|
10
|
+
{"id": "readme", "class": "index", "path": "README.md", "maturity": "presence-only", "target_level": "L0", "required": true},
|
|
11
|
+
{"id": "contract-version-status", "class": "index", "path": ".consiliency/status.json", "maturity": "presence-only", "target_level": "L0", "required": true}
|
|
12
|
+
],
|
|
13
|
+
"interfaces": ".consiliency/interfaces.json"
|
|
14
|
+
},
|
|
15
|
+
"decision": {
|
|
16
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
17
|
+
"status": "accepted",
|
|
18
|
+
"maturity": "presence-only",
|
|
19
|
+
"findings": []
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "version-skew-compatible",
|
|
3
|
+
"description": "Contract and package versions in the 0.1 range are compatible.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.version_skew_scenario.v1",
|
|
6
|
+
"contract_version": "0.1.0",
|
|
7
|
+
"package_version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"decision": {
|
|
10
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
11
|
+
"status": "accepted",
|
|
12
|
+
"maturity": "presence-only",
|
|
13
|
+
"findings": []
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "version-skew-incompatible-warns",
|
|
3
|
+
"description": "Version skew emits a warning by default during Phase 0.",
|
|
4
|
+
"input": {
|
|
5
|
+
"schema": "consiliency.version_skew_scenario.v1",
|
|
6
|
+
"contract_version": "0.2.0",
|
|
7
|
+
"package_version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"decision": {
|
|
10
|
+
"schema": "consiliency.conformance_decision.v1",
|
|
11
|
+
"status": "warn",
|
|
12
|
+
"maturity": "presence-only",
|
|
13
|
+
"findings": [{"code": "version_skew.incompatible", "severity": "warn", "message": "Contract and package versions are outside the compatible range."}]
|
|
14
|
+
}
|
|
15
|
+
}
|