From d734a1c905a0513da77c6fa905226cb132a2fa2c Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 16:58:50 -0700 Subject: [PATCH 01/11] feat(ucns): add multi-origin convergence witness --- src/ucns/structural_convergence.py | 218 +++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 src/ucns/structural_convergence.py diff --git a/src/ucns/structural_convergence.py b/src/ucns/structural_convergence.py new file mode 100644 index 0000000..7acca96 --- /dev/null +++ b/src/ucns/structural_convergence.py @@ -0,0 +1,218 @@ +"""Domain-neutral UCNS evidence for multi-origin structural convergence. + +The module records geometric/structural evidence only. It does not decide +semantic equivalence, analogy, truth, or domain meaning; METAPAT owns that +adjudication. +""" + +# === MODULE_BUILD === +# id: ucns_multi_origin_convergence_v0 +# module_name: structural_convergence +# module_kind: schema +# summary: records deterministic multi-origin path, mapping, invariant, replay, and ancestry evidence for downstream recurrence adjudication +# owner: Erin Spencer +# public_surface: OriginPath, StructuralMapping, InvariantObservation, StructuralConvergenceWitness, build_convergence_witness +# internal_surface: canonical digest validation +# auth_boundary: none +# storage_boundary: serialization-only +# network_boundary: none +# user_data_boundary: none +# admin_only: false +# tests: tests.test_structural_convergence +# rollout: candidate geometry/representation evidence surface +# rollback: remove module and tests +# requires: ucns scale/representation jurisdiction +# since: 2026-10-03 +# unresolved: no universal path metric or equivalence theorem is asserted +# === END MODULE_BUILD === + +# === CONTRACTS === +# id: convergence_preserves_path_distinction +# given: two paths are recorded +# then: their origins, path identities, structure identities, and provenance remain separate +# class: correctness +# id: convergence_records_not_judges +# given: a witness is built +# then: it contains structural facts and no semantic-equivalence or analogy outcome +# class: boundary_contract +# id: convergence_replay_is_typed +# given: replay has not been established +# then: replay_passed remains null rather than becoming false or zero +# class: safety +# id: convergence_digest_tamper_rejected +# given: a serialized witness is changed without digest rotation +# then: reconstruction fails closed +# class: correctness +# === END CONTRACTS === + +from __future__ import annotations + +from dataclasses import asdict, dataclass +from hashlib import sha256 +import json +from typing import Any, Mapping, Optional + +SCHEMA = "ucns.structural-convergence" +VERSION = "0.1.0" + + +def _canonical(value: Mapping[str, Any]) -> bytes: + return json.dumps(value, sort_keys=True, ensure_ascii=False, + separators=(",", ":"), allow_nan=False).encode("utf-8") + + +def _nonempty(value: str, label: str) -> str: + if not isinstance(value, str) or not value.strip(): + raise ValueError(f"{label} must be a non-empty string") + return value + + +@dataclass(frozen=True, slots=True) +class OriginPath: + origin_id: str + path_id: str + structure_id: str + provenance_ids: tuple[str, ...] = () + + def __post_init__(self) -> None: + _nonempty(self.origin_id, "origin_id") + _nonempty(self.path_id, "path_id") + _nonempty(self.structure_id, "structure_id") + if any(not isinstance(x, str) or not x.strip() for x in self.provenance_ids): + raise ValueError("provenance_ids must contain non-empty strings") + + +@dataclass(frozen=True, slots=True) +class StructuralMapping: + source_component: str + target_component: str + + def __post_init__(self) -> None: + _nonempty(self.source_component, "source_component") + _nonempty(self.target_component, "target_component") + + +@dataclass(frozen=True, slots=True) +class InvariantObservation: + invariant_id: str + source_value: str + target_value: str + preserved: bool + + def __post_init__(self) -> None: + _nonempty(self.invariant_id, "invariant_id") + _nonempty(self.source_value, "source_value") + _nonempty(self.target_value, "target_value") + if type(self.preserved) is not bool: + raise ValueError("preserved must be bool") + + +@dataclass(frozen=True, slots=True) +class StructuralConvergenceWitness: + source: OriginPath + target: OriginPath + mappings: tuple[StructuralMapping, ...] + invariants: tuple[InvariantObservation, ...] + mapping_complete: Optional[bool] + replay_passed: Optional[bool] + equivalence_proof_id: Optional[str] = None + shared_ancestry: tuple[str, ...] = () + unresolved: tuple[str, ...] = () + schema: str = SCHEMA + version: str = VERSION + receipt_sha256: str = "" + + def __post_init__(self) -> None: + if self.source == self.target: + raise ValueError("source and target paths must be distinct records") + if not self.mappings: + raise ValueError("at least one structural mapping is required") + if not self.invariants: + raise ValueError("at least one invariant observation is required") + ids = [item.invariant_id for item in self.invariants] + if len(ids) != len(set(ids)): + raise ValueError("invariant_id values must be unique") + for value, label in ( + (self.shared_ancestry, "shared_ancestry"), + (self.unresolved, "unresolved"), + ): + if any(not isinstance(x, str) or not x.strip() for x in value): + raise ValueError(f"{label} must contain non-empty strings") + if self.equivalence_proof_id is not None: + _nonempty(self.equivalence_proof_id, "equivalence_proof_id") + if self.schema != SCHEMA or self.version != VERSION: + raise ValueError("unsupported structural convergence schema") + expected = sha256(_canonical(self._payload())).hexdigest() + if self.receipt_sha256 and self.receipt_sha256 != expected: + raise ValueError("receipt_sha256 mismatch") + object.__setattr__(self, "receipt_sha256", expected) + + @property + def preserved_invariant_ids(self) -> tuple[str, ...]: + return tuple(i.invariant_id for i in self.invariants if i.preserved) + + @property + def paths_distinct(self) -> bool: + return ( + self.source.origin_id != self.target.origin_id + or self.source.path_id != self.target.path_id + ) + + @property + def independent(self) -> bool: + return self.paths_distinct and not self.shared_ancestry + + def _payload(self) -> dict[str, Any]: + return { + "schema": self.schema, + "version": self.version, + "source": asdict(self.source), + "target": asdict(self.target), + "mappings": [asdict(x) for x in self.mappings], + "invariants": [asdict(x) for x in self.invariants], + "mapping_complete": self.mapping_complete, + "replay_passed": self.replay_passed, + "equivalence_proof_id": self.equivalence_proof_id, + "shared_ancestry": list(self.shared_ancestry), + "unresolved": list(self.unresolved), + } + + def to_dict(self) -> dict[str, Any]: + return {**self._payload(), "receipt_sha256": self.receipt_sha256} + + @classmethod + def from_dict(cls, data: Mapping[str, Any]) -> "StructuralConvergenceWitness": + if not isinstance(data, Mapping): + raise ValueError("witness must be a mapping") + expected = { + "schema", "version", "source", "target", "mappings", "invariants", + "mapping_complete", "replay_passed", "equivalence_proof_id", + "shared_ancestry", "unresolved", "receipt_sha256", + } + if set(data) != expected: + raise ValueError("witness fields do not match schema") + return cls( + schema=data["schema"], + version=data["version"], + source=OriginPath(**data["source"]), + target=OriginPath(**data["target"]), + mappings=tuple(StructuralMapping(**x) for x in data["mappings"]), + invariants=tuple(InvariantObservation(**x) for x in data["invariants"]), + mapping_complete=data["mapping_complete"], + replay_passed=data["replay_passed"], + equivalence_proof_id=data["equivalence_proof_id"], + shared_ancestry=tuple(data["shared_ancestry"]), + unresolved=tuple(data["unresolved"]), + receipt_sha256=data["receipt_sha256"], + ) + + +def build_convergence_witness(**kwargs: Any) -> StructuralConvergenceWitness: + return StructuralConvergenceWitness(**kwargs) + + +__all__ = [ + "SCHEMA", "VERSION", "OriginPath", "StructuralMapping", + "InvariantObservation", "StructuralConvergenceWitness", + "build_convergence_witness", +] From b75b4f86f9c003f2cb973208ae6f7a4cf92e293b Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 16:58:52 -0700 Subject: [PATCH 02/11] test(ucns): falsify convergence witness boundaries --- tests/test_structural_convergence.py | 64 ++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/test_structural_convergence.py diff --git a/tests/test_structural_convergence.py b/tests/test_structural_convergence.py new file mode 100644 index 0000000..6622aa1 --- /dev/null +++ b/tests/test_structural_convergence.py @@ -0,0 +1,64 @@ +from dataclasses import replace +import pytest + +from ucns.structural_convergence import ( + InvariantObservation, + OriginPath, + StructuralConvergenceWitness, + StructuralMapping, +) + + +def witness(**overrides): + data = dict( + source=OriginPath("asimov", "population-statistics", "system-set:a", ("book:foundation",)), + target=OriginPath("erin", "distributed-attractor", "system-set:b", ("note:ps-fauna",)), + mappings=( + StructuralMapping("many-agents", "many-hosts"), + StructuralMapping("system-regularity", "distributed-regularity"), + ), + invariants=( + InvariantObservation("many-to-system", "many->system", "many->system", True), + InvariantObservation("higher-order-regularity", "present", "present", True), + ), + mapping_complete=True, + replay_passed=True, + ) + data.update(overrides) + return StructuralConvergenceWitness(**data) + + +def test_witness_preserves_distinct_paths_and_independence(): + record = witness() + assert record.paths_distinct + assert record.independent + assert record.preserved_invariant_ids == ("many-to-system", "higher-order-regularity") + + +def test_shared_ancestry_is_recorded_without_destroying_witness(): + record = witness(shared_ancestry=("source:shared-corpus",)) + assert not record.independent + assert record.shared_ancestry == ("source:shared-corpus",) + + +def test_unknown_replay_remains_typed_unknown(): + record = witness(replay_passed=None, unresolved=("replay unavailable",)) + assert record.replay_passed is None + assert record.unresolved + + +def test_receipt_is_deterministic_and_tamper_fails_closed(): + record = witness() + clone = StructuralConvergenceWitness.from_dict(record.to_dict()) + assert clone.receipt_sha256 == record.receipt_sha256 + payload = record.to_dict() + payload["mapping_complete"] = False + with pytest.raises(ValueError, match="receipt_sha256 mismatch"): + StructuralConvergenceWitness.from_dict(payload) + + +def test_no_semantic_outcome_is_encoded(): + keys = witness().to_dict() + assert "outcome" not in keys + assert "analogy" not in keys + assert "semantic_equivalence" not in keys From 491e80d19a121bfec75ed3e3527aa9eb0b963207 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:02:26 -0700 Subject: [PATCH 03/11] test: bind checks to convergence contracts --- tests/test_structural_convergence.py | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/test_structural_convergence.py b/tests/test_structural_convergence.py index 6622aa1..8275a87 100644 --- a/tests/test_structural_convergence.py +++ b/tests/test_structural_convergence.py @@ -1,3 +1,45 @@ +# === CHECKS === +# id: check_convergence_path_distinction +# proves: convergence_preserves_path_distinction +# call: self::test_witness_preserves_distinct_paths_and_independence +# requires: python3 +# timeout: 10 +# mutates: none +# cleanup: none +# +# id: check_convergence_shared_ancestry +# proves: convergence_preserves_path_distinction +# call: self::test_shared_ancestry_is_recorded_without_destroying_witness +# requires: python3 +# timeout: 10 +# mutates: none +# cleanup: none +# +# id: check_convergence_typed_replay +# proves: convergence_replay_is_typed +# call: self::test_unknown_replay_remains_typed_unknown +# requires: python3 +# timeout: 10 +# mutates: none +# cleanup: none +# +# id: check_convergence_digest_tamper +# proves: convergence_digest_tamper_rejected +# call: self::test_receipt_is_deterministic_and_tamper_fails_closed +# requires: python3 +# timeout: 10 +# mutates: none +# cleanup: none +# +# id: check_convergence_no_semantic_judgment +# proves: convergence_records_not_judges +# call: self::test_no_semantic_outcome_is_encoded +# requires: python3 +# timeout: 10 +# mutates: none +# cleanup: none +# === END CHECKS === + from dataclasses import replace import pytest From b4c8b90896454f329b8d41f2281aa81263281906 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:05:08 -0700 Subject: [PATCH 04/11] feat(ucns): expose structural convergence witness --- src/ucns/__init__.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ucns/__init__.py b/src/ucns/__init__.py index 1d5079f..7b7c180 100644 --- a/src/ucns/__init__.py +++ b/src/ucns/__init__.py @@ -103,6 +103,12 @@ # then: the exact domain-agnostic multiplicative scale action, application receipt, invariant helper, builders, and replay are public with candidate standing # class: correctness # since: 2026-09-23 +# +# id: geometry_public_surface_includes_structural_convergence_candidate +# given: the active ucns package facade is imported +# then: the domain-neutral multi-origin path mapping invariant and convergence witness records are public without semantic recurrence judgment +# class: correctness +# since: 2026-10-03 # === END CONTRACTS === """UCNS geometry. @@ -265,6 +271,15 @@ monomial_value, replay_scale_action_record, ) +from .structural_convergence import ( + SCHEMA as STRUCTURAL_CONVERGENCE_SCHEMA, + VERSION as STRUCTURAL_CONVERGENCE_VERSION, + OriginPath, + StructuralMapping, + InvariantObservation, + StructuralConvergenceWitness, + build_convergence_witness, +) from .mobius_vesica import __all__ as _mobius_vesica_all from .mobius_vesica import * # noqa: F401,F403 - geometric public module from .mobius_seed import __all__ as _mobius_seed_all @@ -324,6 +339,13 @@ "ScaleActionError", "ScaleActionRecord", "MultiplicativeScaleAction", + "STRUCTURAL_CONVERGENCE_SCHEMA", + "STRUCTURAL_CONVERGENCE_VERSION", + "OriginPath", + "StructuralMapping", + "InvariantObservation", + "StructuralConvergenceWitness", + "build_convergence_witness", "STRUCTURAL_NULL", "STRUCTURAL_NULL_ORIGIN", "StructuralNullIdentity", From bfffbf734639a3bc5f1edaa9a9e05eb5b68cc042 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:05:15 -0700 Subject: [PATCH 05/11] test(ucns): bind convergence facade contract --- tests/test_structural_convergence.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_structural_convergence.py b/tests/test_structural_convergence.py index 8275a87..41f7123 100644 --- a/tests/test_structural_convergence.py +++ b/tests/test_structural_convergence.py @@ -38,10 +38,18 @@ # timeout: 10 # mutates: none # cleanup: none +# id: check_convergence_facade +# proves: geometry_public_surface_includes_structural_convergence_candidate +# call: self::test_facade_exports_structural_convergence_candidate +# requires: python3 +# timeout: 10 +# mutates: none +# cleanup: none # === END CHECKS === from dataclasses import replace import pytest +import ucns from ucns.structural_convergence import ( InvariantObservation, @@ -104,3 +112,11 @@ def test_no_semantic_outcome_is_encoded(): assert "outcome" not in keys assert "analogy" not in keys assert "semantic_equivalence" not in keys + + +def test_facade_exports_structural_convergence_candidate(): + assert hasattr(ucns, "StructuralConvergenceWitness") + assert hasattr(ucns, "OriginPath") + assert hasattr(ucns, "StructuralMapping") + assert hasattr(ucns, "InvariantObservation") + assert hasattr(ucns, "build_convergence_witness") From f755b94d0d2d887c5b0ac46302355c053859f260 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:06:14 -0700 Subject: [PATCH 06/11] docs: pin system-set recurrence work graph --- .../work-graphs/system-set-recurrence-v0.json | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 docs/work-graphs/system-set-recurrence-v0.json diff --git a/docs/work-graphs/system-set-recurrence-v0.json b/docs/work-graphs/system-set-recurrence-v0.json new file mode 100644 index 0000000..395b9ea --- /dev/null +++ b/docs/work-graphs/system-set-recurrence-v0.json @@ -0,0 +1,43 @@ +{ + "schema": "the-interdependency.stack-manifest", + "version": "1.0.0", + "work_graph_sha256": "74489c1f753acf520452ad1271ee37c0824aac8b7a048172fc9438eb061e984b", + "repositories": [ + { + "repository": "The-Interdependency/metapat", + "commit": "c9131e02493947e6fa84caaf31be639491de50bb", + "authority": "cross-domain semantic recurrence adjudication", + "relation": "adjudicates UCNS structural evidence without semantic transfer" + }, + { + "repository": "The-Interdependency/ucns", + "commit": "bfffbf734639a3bc5f1edaa9a9e05eb5b68cc042", + "authority": "geometry and domain-neutral structural convergence evidence", + "relation": "records paths mappings invariants replay ancestry and proof identity" + }, + { + "repository": "The-Interdependency/uchc", + "commit": "c60eb8240469164c8bc0e6090837db378b6b9212", + "authority": "language semantic trajectory construction", + "relation": "produces ordered provenance-bearing comparison inputs" + }, + { + "repository": "The-Interdependency/edcm", + "commit": "616484d0caaa7a9ad82937d85c28bb43773d909b", + "authority": "measurement and evaluation", + "relation": "audits architecture revisions using candidate EDCM metrics without status transfer" + } + ], + "boundaries": { + "authority_transfer": false, + "proof_status_transfer": false, + "measurement_status_transfer": false, + "semantic_mapping": "declared mapping", + "agent_scope": "cross-repository-work-graph", + "hmmm": [ + "UCNS has no universal path-distance metric or structural-equivalence theorem", + "UCHC automatic extraction from complete sense-selected inference trajectories is unresolved", + "EDCM metrics remain candidate measurement evidence and do not select canon" + ] + } +} From 9892a35e1801617d113bb684a8bd4e884fe0495c Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:08:59 -0700 Subject: [PATCH 07/11] docs: correct recurrence authority to Stack forge --- .../work-graphs/system-set-recurrence-v0.json | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/work-graphs/system-set-recurrence-v0.json b/docs/work-graphs/system-set-recurrence-v0.json index 395b9ea..60e076b 100644 --- a/docs/work-graphs/system-set-recurrence-v0.json +++ b/docs/work-graphs/system-set-recurrence-v0.json @@ -1,25 +1,31 @@ { "schema": "the-interdependency.stack-manifest", "version": "1.0.0", - "work_graph_sha256": "74489c1f753acf520452ad1271ee37c0824aac8b7a048172fc9438eb061e984b", + "work_graph_sha256": "6022b338ed3dc5679cfaa73d55d0f158b29b08ce60305e70cead730332bc4e3c", "repositories": [ { "repository": "The-Interdependency/metapat", - "commit": "c9131e02493947e6fa84caaf31be639491de50bb", + "commit": "7443791e6fd6641555102fe86b7d603c90ff5d1a", "authority": "cross-domain semantic recurrence adjudication", "relation": "adjudicates UCNS structural evidence without semantic transfer" }, { "repository": "The-Interdependency/ucns", - "commit": "bfffbf734639a3bc5f1edaa9a9e05eb5b68cc042", + "commit": "f755b94d0d2d887c5b0ac46302355c053859f260", "authority": "geometry and domain-neutral structural convergence evidence", "relation": "records paths mappings invariants replay ancestry and proof identity" }, + { + "repository": "The-Interdependency/stack", + "commit": "566383d9000c836bb5b84cda382418e8855c505a", + "authority": "current Stack-forged English semantic trajectory implementation", + "relation": "constructs ordered provenance-bearing system-set trajectory candidates" + }, { "repository": "The-Interdependency/uchc", - "commit": "c60eb8240469164c8bc0e6090837db378b6b9212", - "authority": "language semantic trajectory construction", - "relation": "produces ordered provenance-bearing comparison inputs" + "commit": "82964778f7b1c4acc59cdc8c5d815ab43c776bb5", + "authority": "intended independent UCHC authority after graduation", + "relation": "migration target only; no current system-set trajectory implementation authority" }, { "repository": "The-Interdependency/edcm", @@ -36,7 +42,8 @@ "agent_scope": "cross-repository-work-graph", "hmmm": [ "UCNS has no universal path-distance metric or structural-equivalence theorem", - "UCHC automatic extraction from complete sense-selected inference trajectories is unresolved", + "exact closure criterion for higher-order system-set identity is unresolved", + "UCHC graduation and authority transfer remain incomplete", "EDCM metrics remain candidate measurement evidence and do not select canon" ] } From 41fc16c75e13ca088e26f1f3079ae17caf5ebe90 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:10:04 -0700 Subject: [PATCH 08/11] revert(ucns): reject generic convergence schema placement --- src/ucns/__init__.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/ucns/__init__.py b/src/ucns/__init__.py index 7b7c180..1d5079f 100644 --- a/src/ucns/__init__.py +++ b/src/ucns/__init__.py @@ -103,12 +103,6 @@ # then: the exact domain-agnostic multiplicative scale action, application receipt, invariant helper, builders, and replay are public with candidate standing # class: correctness # since: 2026-09-23 -# -# id: geometry_public_surface_includes_structural_convergence_candidate -# given: the active ucns package facade is imported -# then: the domain-neutral multi-origin path mapping invariant and convergence witness records are public without semantic recurrence judgment -# class: correctness -# since: 2026-10-03 # === END CONTRACTS === """UCNS geometry. @@ -271,15 +265,6 @@ monomial_value, replay_scale_action_record, ) -from .structural_convergence import ( - SCHEMA as STRUCTURAL_CONVERGENCE_SCHEMA, - VERSION as STRUCTURAL_CONVERGENCE_VERSION, - OriginPath, - StructuralMapping, - InvariantObservation, - StructuralConvergenceWitness, - build_convergence_witness, -) from .mobius_vesica import __all__ as _mobius_vesica_all from .mobius_vesica import * # noqa: F401,F403 - geometric public module from .mobius_seed import __all__ as _mobius_seed_all @@ -339,13 +324,6 @@ "ScaleActionError", "ScaleActionRecord", "MultiplicativeScaleAction", - "STRUCTURAL_CONVERGENCE_SCHEMA", - "STRUCTURAL_CONVERGENCE_VERSION", - "OriginPath", - "StructuralMapping", - "InvariantObservation", - "StructuralConvergenceWitness", - "build_convergence_witness", "STRUCTURAL_NULL", "STRUCTURAL_NULL_ORIGIN", "StructuralNullIdentity", From 5b7f3c02eaf7dce1edd97039ec66807ac63f95ef Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:10:10 -0700 Subject: [PATCH 09/11] revert(ucns): remove generic convergence layer --- src/ucns/structural_convergence.py | 218 ----------------------------- 1 file changed, 218 deletions(-) delete mode 100644 src/ucns/structural_convergence.py diff --git a/src/ucns/structural_convergence.py b/src/ucns/structural_convergence.py deleted file mode 100644 index 7acca96..0000000 --- a/src/ucns/structural_convergence.py +++ /dev/null @@ -1,218 +0,0 @@ -"""Domain-neutral UCNS evidence for multi-origin structural convergence. - -The module records geometric/structural evidence only. It does not decide -semantic equivalence, analogy, truth, or domain meaning; METAPAT owns that -adjudication. -""" - -# === MODULE_BUILD === -# id: ucns_multi_origin_convergence_v0 -# module_name: structural_convergence -# module_kind: schema -# summary: records deterministic multi-origin path, mapping, invariant, replay, and ancestry evidence for downstream recurrence adjudication -# owner: Erin Spencer -# public_surface: OriginPath, StructuralMapping, InvariantObservation, StructuralConvergenceWitness, build_convergence_witness -# internal_surface: canonical digest validation -# auth_boundary: none -# storage_boundary: serialization-only -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: tests.test_structural_convergence -# rollout: candidate geometry/representation evidence surface -# rollback: remove module and tests -# requires: ucns scale/representation jurisdiction -# since: 2026-10-03 -# unresolved: no universal path metric or equivalence theorem is asserted -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: convergence_preserves_path_distinction -# given: two paths are recorded -# then: their origins, path identities, structure identities, and provenance remain separate -# class: correctness -# id: convergence_records_not_judges -# given: a witness is built -# then: it contains structural facts and no semantic-equivalence or analogy outcome -# class: boundary_contract -# id: convergence_replay_is_typed -# given: replay has not been established -# then: replay_passed remains null rather than becoming false or zero -# class: safety -# id: convergence_digest_tamper_rejected -# given: a serialized witness is changed without digest rotation -# then: reconstruction fails closed -# class: correctness -# === END CONTRACTS === - -from __future__ import annotations - -from dataclasses import asdict, dataclass -from hashlib import sha256 -import json -from typing import Any, Mapping, Optional - -SCHEMA = "ucns.structural-convergence" -VERSION = "0.1.0" - - -def _canonical(value: Mapping[str, Any]) -> bytes: - return json.dumps(value, sort_keys=True, ensure_ascii=False, - separators=(",", ":"), allow_nan=False).encode("utf-8") - - -def _nonempty(value: str, label: str) -> str: - if not isinstance(value, str) or not value.strip(): - raise ValueError(f"{label} must be a non-empty string") - return value - - -@dataclass(frozen=True, slots=True) -class OriginPath: - origin_id: str - path_id: str - structure_id: str - provenance_ids: tuple[str, ...] = () - - def __post_init__(self) -> None: - _nonempty(self.origin_id, "origin_id") - _nonempty(self.path_id, "path_id") - _nonempty(self.structure_id, "structure_id") - if any(not isinstance(x, str) or not x.strip() for x in self.provenance_ids): - raise ValueError("provenance_ids must contain non-empty strings") - - -@dataclass(frozen=True, slots=True) -class StructuralMapping: - source_component: str - target_component: str - - def __post_init__(self) -> None: - _nonempty(self.source_component, "source_component") - _nonempty(self.target_component, "target_component") - - -@dataclass(frozen=True, slots=True) -class InvariantObservation: - invariant_id: str - source_value: str - target_value: str - preserved: bool - - def __post_init__(self) -> None: - _nonempty(self.invariant_id, "invariant_id") - _nonempty(self.source_value, "source_value") - _nonempty(self.target_value, "target_value") - if type(self.preserved) is not bool: - raise ValueError("preserved must be bool") - - -@dataclass(frozen=True, slots=True) -class StructuralConvergenceWitness: - source: OriginPath - target: OriginPath - mappings: tuple[StructuralMapping, ...] - invariants: tuple[InvariantObservation, ...] - mapping_complete: Optional[bool] - replay_passed: Optional[bool] - equivalence_proof_id: Optional[str] = None - shared_ancestry: tuple[str, ...] = () - unresolved: tuple[str, ...] = () - schema: str = SCHEMA - version: str = VERSION - receipt_sha256: str = "" - - def __post_init__(self) -> None: - if self.source == self.target: - raise ValueError("source and target paths must be distinct records") - if not self.mappings: - raise ValueError("at least one structural mapping is required") - if not self.invariants: - raise ValueError("at least one invariant observation is required") - ids = [item.invariant_id for item in self.invariants] - if len(ids) != len(set(ids)): - raise ValueError("invariant_id values must be unique") - for value, label in ( - (self.shared_ancestry, "shared_ancestry"), - (self.unresolved, "unresolved"), - ): - if any(not isinstance(x, str) or not x.strip() for x in value): - raise ValueError(f"{label} must contain non-empty strings") - if self.equivalence_proof_id is not None: - _nonempty(self.equivalence_proof_id, "equivalence_proof_id") - if self.schema != SCHEMA or self.version != VERSION: - raise ValueError("unsupported structural convergence schema") - expected = sha256(_canonical(self._payload())).hexdigest() - if self.receipt_sha256 and self.receipt_sha256 != expected: - raise ValueError("receipt_sha256 mismatch") - object.__setattr__(self, "receipt_sha256", expected) - - @property - def preserved_invariant_ids(self) -> tuple[str, ...]: - return tuple(i.invariant_id for i in self.invariants if i.preserved) - - @property - def paths_distinct(self) -> bool: - return ( - self.source.origin_id != self.target.origin_id - or self.source.path_id != self.target.path_id - ) - - @property - def independent(self) -> bool: - return self.paths_distinct and not self.shared_ancestry - - def _payload(self) -> dict[str, Any]: - return { - "schema": self.schema, - "version": self.version, - "source": asdict(self.source), - "target": asdict(self.target), - "mappings": [asdict(x) for x in self.mappings], - "invariants": [asdict(x) for x in self.invariants], - "mapping_complete": self.mapping_complete, - "replay_passed": self.replay_passed, - "equivalence_proof_id": self.equivalence_proof_id, - "shared_ancestry": list(self.shared_ancestry), - "unresolved": list(self.unresolved), - } - - def to_dict(self) -> dict[str, Any]: - return {**self._payload(), "receipt_sha256": self.receipt_sha256} - - @classmethod - def from_dict(cls, data: Mapping[str, Any]) -> "StructuralConvergenceWitness": - if not isinstance(data, Mapping): - raise ValueError("witness must be a mapping") - expected = { - "schema", "version", "source", "target", "mappings", "invariants", - "mapping_complete", "replay_passed", "equivalence_proof_id", - "shared_ancestry", "unresolved", "receipt_sha256", - } - if set(data) != expected: - raise ValueError("witness fields do not match schema") - return cls( - schema=data["schema"], - version=data["version"], - source=OriginPath(**data["source"]), - target=OriginPath(**data["target"]), - mappings=tuple(StructuralMapping(**x) for x in data["mappings"]), - invariants=tuple(InvariantObservation(**x) for x in data["invariants"]), - mapping_complete=data["mapping_complete"], - replay_passed=data["replay_passed"], - equivalence_proof_id=data["equivalence_proof_id"], - shared_ancestry=tuple(data["shared_ancestry"]), - unresolved=tuple(data["unresolved"]), - receipt_sha256=data["receipt_sha256"], - ) - - -def build_convergence_witness(**kwargs: Any) -> StructuralConvergenceWitness: - return StructuralConvergenceWitness(**kwargs) - - -__all__ = [ - "SCHEMA", "VERSION", "OriginPath", "StructuralMapping", - "InvariantObservation", "StructuralConvergenceWitness", - "build_convergence_witness", -] From 65197be31a864f7b46f7a97c93f07daac545fc66 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:10:12 -0700 Subject: [PATCH 10/11] revert(ucns): remove generic convergence layer --- tests/test_structural_convergence.py | 122 --------------------------- 1 file changed, 122 deletions(-) delete mode 100644 tests/test_structural_convergence.py diff --git a/tests/test_structural_convergence.py b/tests/test_structural_convergence.py deleted file mode 100644 index 41f7123..0000000 --- a/tests/test_structural_convergence.py +++ /dev/null @@ -1,122 +0,0 @@ -# === CHECKS === -# id: check_convergence_path_distinction -# proves: convergence_preserves_path_distinction -# call: self::test_witness_preserves_distinct_paths_and_independence -# requires: python3 -# timeout: 10 -# mutates: none -# cleanup: none -# -# id: check_convergence_shared_ancestry -# proves: convergence_preserves_path_distinction -# call: self::test_shared_ancestry_is_recorded_without_destroying_witness -# requires: python3 -# timeout: 10 -# mutates: none -# cleanup: none -# -# id: check_convergence_typed_replay -# proves: convergence_replay_is_typed -# call: self::test_unknown_replay_remains_typed_unknown -# requires: python3 -# timeout: 10 -# mutates: none -# cleanup: none -# -# id: check_convergence_digest_tamper -# proves: convergence_digest_tamper_rejected -# call: self::test_receipt_is_deterministic_and_tamper_fails_closed -# requires: python3 -# timeout: 10 -# mutates: none -# cleanup: none -# -# id: check_convergence_no_semantic_judgment -# proves: convergence_records_not_judges -# call: self::test_no_semantic_outcome_is_encoded -# requires: python3 -# timeout: 10 -# mutates: none -# cleanup: none -# id: check_convergence_facade -# proves: geometry_public_surface_includes_structural_convergence_candidate -# call: self::test_facade_exports_structural_convergence_candidate -# requires: python3 -# timeout: 10 -# mutates: none -# cleanup: none -# === END CHECKS === - -from dataclasses import replace -import pytest -import ucns - -from ucns.structural_convergence import ( - InvariantObservation, - OriginPath, - StructuralConvergenceWitness, - StructuralMapping, -) - - -def witness(**overrides): - data = dict( - source=OriginPath("asimov", "population-statistics", "system-set:a", ("book:foundation",)), - target=OriginPath("erin", "distributed-attractor", "system-set:b", ("note:ps-fauna",)), - mappings=( - StructuralMapping("many-agents", "many-hosts"), - StructuralMapping("system-regularity", "distributed-regularity"), - ), - invariants=( - InvariantObservation("many-to-system", "many->system", "many->system", True), - InvariantObservation("higher-order-regularity", "present", "present", True), - ), - mapping_complete=True, - replay_passed=True, - ) - data.update(overrides) - return StructuralConvergenceWitness(**data) - - -def test_witness_preserves_distinct_paths_and_independence(): - record = witness() - assert record.paths_distinct - assert record.independent - assert record.preserved_invariant_ids == ("many-to-system", "higher-order-regularity") - - -def test_shared_ancestry_is_recorded_without_destroying_witness(): - record = witness(shared_ancestry=("source:shared-corpus",)) - assert not record.independent - assert record.shared_ancestry == ("source:shared-corpus",) - - -def test_unknown_replay_remains_typed_unknown(): - record = witness(replay_passed=None, unresolved=("replay unavailable",)) - assert record.replay_passed is None - assert record.unresolved - - -def test_receipt_is_deterministic_and_tamper_fails_closed(): - record = witness() - clone = StructuralConvergenceWitness.from_dict(record.to_dict()) - assert clone.receipt_sha256 == record.receipt_sha256 - payload = record.to_dict() - payload["mapping_complete"] = False - with pytest.raises(ValueError, match="receipt_sha256 mismatch"): - StructuralConvergenceWitness.from_dict(payload) - - -def test_no_semantic_outcome_is_encoded(): - keys = witness().to_dict() - assert "outcome" not in keys - assert "analogy" not in keys - assert "semantic_equivalence" not in keys - - -def test_facade_exports_structural_convergence_candidate(): - assert hasattr(ucns, "StructuralConvergenceWitness") - assert hasattr(ucns, "OriginPath") - assert hasattr(ucns, "StructuralMapping") - assert hasattr(ucns, "InvariantObservation") - assert hasattr(ucns, "build_convergence_witness") From f2e55ed7ebaf241541df569ccd8a376fa4dfa281 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 3 Oct 2026 17:10:14 -0700 Subject: [PATCH 11/11] revert(ucns): remove generic convergence layer --- .../work-graphs/system-set-recurrence-v0.json | 50 ------------------- 1 file changed, 50 deletions(-) delete mode 100644 docs/work-graphs/system-set-recurrence-v0.json diff --git a/docs/work-graphs/system-set-recurrence-v0.json b/docs/work-graphs/system-set-recurrence-v0.json deleted file mode 100644 index 60e076b..0000000 --- a/docs/work-graphs/system-set-recurrence-v0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "schema": "the-interdependency.stack-manifest", - "version": "1.0.0", - "work_graph_sha256": "6022b338ed3dc5679cfaa73d55d0f158b29b08ce60305e70cead730332bc4e3c", - "repositories": [ - { - "repository": "The-Interdependency/metapat", - "commit": "7443791e6fd6641555102fe86b7d603c90ff5d1a", - "authority": "cross-domain semantic recurrence adjudication", - "relation": "adjudicates UCNS structural evidence without semantic transfer" - }, - { - "repository": "The-Interdependency/ucns", - "commit": "f755b94d0d2d887c5b0ac46302355c053859f260", - "authority": "geometry and domain-neutral structural convergence evidence", - "relation": "records paths mappings invariants replay ancestry and proof identity" - }, - { - "repository": "The-Interdependency/stack", - "commit": "566383d9000c836bb5b84cda382418e8855c505a", - "authority": "current Stack-forged English semantic trajectory implementation", - "relation": "constructs ordered provenance-bearing system-set trajectory candidates" - }, - { - "repository": "The-Interdependency/uchc", - "commit": "82964778f7b1c4acc59cdc8c5d815ab43c776bb5", - "authority": "intended independent UCHC authority after graduation", - "relation": "migration target only; no current system-set trajectory implementation authority" - }, - { - "repository": "The-Interdependency/edcm", - "commit": "616484d0caaa7a9ad82937d85c28bb43773d909b", - "authority": "measurement and evaluation", - "relation": "audits architecture revisions using candidate EDCM metrics without status transfer" - } - ], - "boundaries": { - "authority_transfer": false, - "proof_status_transfer": false, - "measurement_status_transfer": false, - "semantic_mapping": "declared mapping", - "agent_scope": "cross-repository-work-graph", - "hmmm": [ - "UCNS has no universal path-distance metric or structural-equivalence theorem", - "exact closure criterion for higher-order system-set identity is unresolved", - "UCHC graduation and authority transfer remain incomplete", - "EDCM metrics remain candidate measurement evidence and do not select canon" - ] - } -}