From 7e1cd631b3de05a3bdf3b0a3a983d895bebfcee9 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 06:45:46 -0700 Subject: [PATCH 1/5] feat(world): add measured intelligence artifact convergence --- .gitignore | 3 + README.md | 4 + ROADMAP.md | 5 +- ...ence-release-convergence-work-packet-v1.md | 67 +++++ ...asured_intelligence_release_convergence.py | 98 +++++++ ...asured_intelligence_release_convergence.py | 255 ++++++++++++++++++ 6 files changed, 431 insertions(+), 1 deletion(-) create mode 100644 docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md create mode 100644 domain_packs/tests/test_measured_intelligence_release_convergence.py create mode 100644 scripts/measured_intelligence_release_convergence.py diff --git a/.gitignore b/.gitignore index cfca734..5f1c5cf 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ artifacts/public-demo/* !artifacts/public-demo/demo-data.json !artifacts/public-demo/index.html !artifacts/public-demo/*.png +!artifacts/measured-intelligence/ +artifacts/measured-intelligence/* +!artifacts/measured-intelligence/convergence-v1.json diff --git a/README.md b/README.md index 1b616b9..b4378ad 100644 --- a/README.md +++ b/README.md @@ -414,6 +414,10 @@ The source-checkout measured-feedback candidate is recorded in [`docs/audits/world-intelligence-p2c3-measured-feedback-2026-08-10.md`](docs/audits/world-intelligence-p2c3-measured-feedback-2026-08-10.md). The latest independent-source correction candidate is recorded in [`docs/audits/world-intelligence-p2c10-independent-correction-reproduction-2026-08-10.md`](docs/audits/world-intelligence-p2c10-independent-correction-reproduction-2026-08-10.md). +The bounded installed-Core artifact convergence packet is frozen in +[`docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md`](docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md). +It generates one canonical machine-readable P2C10 result without importing Core from a checkout; +it is candidate evidence, not a release or SI4 pass. Release-level scope and evidence are recorded in [`docs/releases/world-intelligence-p2c2-v0.9.0.md`](docs/releases/world-intelligence-p2c2-v0.9.0.md), diff --git a/ROADMAP.md b/ROADMAP.md index 2b1d209..a850102 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -16,7 +16,7 @@ source code into the platform. See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). -## Candidate — P2C3–P2C10 measured feedback and product-owned outcomes +## Candidate — P2C3–P2C10 measured feedback and artifact convergence - The exact 0.9.0 Brief and a World-owned source-only control pass through two matched reviewed export pairs under one frozen structural citation-coverage criterion. @@ -58,6 +58,9 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). bounded two-pair difference useful, and leaves the proposal non-effective and unapplied. - This is source-checkout evidence against stacked Core candidates, not a released World capability, human benefit finding, causal claim, network-freshness proof, or applied governance change. +- The additive convergence packet hashes built Core, reference-adapter, and World wheels, rejects + a Core checkout on the runtime path, and freezes a canonical machine-readable P2C10 result. It + remains candidate artifact evidence pending combined release gates and publication. See the [P2C3 candidate work packet](docs/design/world-intelligence-p2c3-measured-feedback-work-packet-v1.md). The follow-on [P2C4 work packet](docs/design/world-intelligence-p2c4-reviewed-impact-disposition-work-packet-v1.md) diff --git a/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md b/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md new file mode 100644 index 0000000..c3b98b5 --- /dev/null +++ b/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md @@ -0,0 +1,67 @@ +# World measured-intelligence release convergence work packet (v1) + +**Status:** bounded artifact candidate. This packet does not publish World or Core, close ACE Core +issue [#38](https://github.com/augmented-cognition-engine/core/issues/38), pass SI4, or complete ACE +0.6.0. + +**Frozen:** 2026-08-10 from World P2C10 commit +`112c0725b87ff59cf6b480a519aa2d4aa6a5fb53` and Core observed-result commit +`433e3d16c5458c975557dcd1552824fb959d4d12`. + +## Objective + +Turn the source-checkout P2C10 result into one canonical, machine-readable candidate record whose +Core runtime is installed from exact built artifacts outside the Core checkout: + +```text +recorded public BLS release + erratum + -> exact Observation / correction lineage + -> matched corrected and stale-form artifacts + -> Decision -> reviewed Action -> exact observed result -> Outcome + -> useful evaluation -> non-effective proposal -> historical replay + -> canonical convergence-v1.json +``` + +## Acceptance + +The generator must: + +1. hash the exact Core, separate reference action-adapter, and World wheels; +2. reject a runtime importing `ace` from any declared Core checkout; +3. rerun the complete P2C2-P2C10 append-only journey without network access; +4. freeze stable source, product-policy, comparison, classification, proposal, replay, and + non-claim fields while excluding wall-clock-dependent record identities; +5. fail if the fixture, source identities, scores, matched effect, useful classification, + proposal-only authority, or historical replay drifts; and +6. reproduce the committed JSON byte-for-byte from a fresh workspace. + +The candidate still carries package version `0.5.0` because no release version is changed in this +packet. The full artifact hash and source commit distinguish it from the released 0.5.0 wheel. + +## Ownership and exclusions + +World owns the BLS fixture, correction policy, matched control, artifact generator, and public +record. Core owns immutable identity, authority, Decision, reviewed Action, Outcome, and durable +replay. Intelligence owns only the neutral evaluation and proposal contracts. No BLS or World noun +moves into Core or Intelligence. + +This packet does not add network transport, source freshness, a proposal-application path, a new +Domain Pack entry, schema, package version, CLI, or action authority. It does not establish +causality, population performance, statistical validity, general source independence, or human +benefit. + +## Owned files and rollback + +- `scripts/measured_intelligence_release_convergence.py` +- `domain_packs/tests/test_measured_intelligence_release_convergence.py` +- `artifacts/measured-intelligence/convergence-v1.json` +- this work packet, its audit, and restrained README/roadmap references + +Rollback removes those additive files and references. No durable history or released artifact is +rewritten. + +## External release gates + +Independent Market reproduction now exists as a separate candidate, but combined compatibility, +security, repository hygiene, and release-owner review remain required. Core issue #49 F1, F3, +and F5 retain overdue `next minor` deadlines; this packet neither implements nor re-dates them. diff --git a/domain_packs/tests/test_measured_intelligence_release_convergence.py b/domain_packs/tests/test_measured_intelligence_release_convergence.py new file mode 100644 index 0000000..98cee61 --- /dev/null +++ b/domain_packs/tests/test_measured_intelligence_release_convergence.py @@ -0,0 +1,98 @@ +from __future__ import annotations + +import copy +import importlib.util +from pathlib import Path + +import pytest + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact") is None: + pytest.skip("release convergence requires the stacked Core measured-impact candidate") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("release convergence requires the separately packaged Core action adapter") + + +def test_artifact_identity_is_exact_and_content_derived(tmp_path: Path) -> None: + _require_candidate_contracts() + from scripts.measured_intelligence_release_convergence import artifact_identity + + candidate = tmp_path / "candidate.whl" + candidate.write_bytes(b"candidate-artifact") + + assert artifact_identity(candidate) == { + "filename": "candidate.whl", + "sha256": "sha256:75ec5f680183fbca988b8bd9f3090f00d31dbf34792a50cd7e66763d994ab083", + } + + +def test_core_checkout_runtime_is_rejected(tmp_path: Path) -> None: + _require_candidate_contracts() + from scripts.measured_intelligence_release_convergence import ( + validate_core_runtime_outside_checkouts, + ) + + checkout = tmp_path / "core" + module = checkout / "ace" / "__init__.py" + module.parent.mkdir(parents=True) + module.write_text("", encoding="utf-8") + + with pytest.raises(RuntimeError, match="requires the built Core artifact"): + validate_core_runtime_outside_checkouts(module_path=module, forbidden_roots=(checkout,)) + + +@pytest.mark.asyncio +async def test_public_projection_freezes_the_bounded_measured_result(tmp_path: Path) -> None: + _require_candidate_contracts() + from scripts.measured_intelligence_release_convergence import build_public_projection + from scripts.p2c10_independent_correction_reproduction import ( + run_independent_correction_reproduction, + ) + + result = await run_independent_correction_reproduction(tmp_path) + coordinate = {"filename": "candidate.whl", "sha256": "sha256:" + "a" * 64} + projection = build_public_projection( + result, + core_commit="a" * 40, + world_commit="b" * 40, + core_wheel=coordinate, + action_adapter_wheel=coordinate, + world_wheel=coordinate, + core_distribution_version="0.5.0", + action_adapter_distribution_version="0.1.0", + world_distribution_version="0.9.0", + ) + + assert projection["measured_result"] == { + "classification": "useful", + "matched_pair_count": 2, + "mean_effect": 1.0, + "uncertainty": None, + "limitations": result["evaluation"]["limitations"], + } + assert projection["governed_feedback"] == { + "proposed_action": "promote", + "live_effect": False, + "selectable": False, + "requires_human_review": True, + "applied": False, + "historical_replay": True, + "replay_reauthorized": False, + } + assert projection["claim_boundary"]["ace_0_6_complete"] is False + + effective = copy.deepcopy(result) + effective["proposal"]["live_effect"] = True + with pytest.raises(AssertionError, match="gained effective authority"): + build_public_projection( + effective, + core_commit="a" * 40, + world_commit="b" * 40, + core_wheel=coordinate, + action_adapter_wheel=coordinate, + world_wheel=coordinate, + core_distribution_version="0.5.0", + action_adapter_distribution_version="0.1.0", + world_distribution_version="0.9.0", + ) diff --git a/scripts/measured_intelligence_release_convergence.py b/scripts/measured_intelligence_release_convergence.py new file mode 100644 index 0000000..a086e8b --- /dev/null +++ b/scripts/measured_intelligence_release_convergence.py @@ -0,0 +1,255 @@ +#!/usr/bin/env python3 +"""Generate the bounded public World measured-intelligence convergence record.""" + +from __future__ import annotations + +import argparse +import asyncio +import hashlib +import importlib.metadata +import json +import re +from pathlib import Path +from typing import Any, Sequence + +import ace +import ace_reference_workspace_action + +from scripts.p2c10_independent_correction_reproduction import ( + run_independent_correction_reproduction, +) + +CONTRACT = "ace.world-intelligence.measured-intelligence-release-convergence/v1" +_COMMIT_RE = re.compile(r"^[0-9a-f]{40}$") +_EXPECTED_FIXTURE_DIGEST = "sha256:981183a2464f74f4421bd0a6470f0342a5abae8cfebc1b5a8da1562df26babb1" +_EXPECTED_ORIGINAL = "observation:faf25d26cc88802368cabf3e17538a7d" +_EXPECTED_CORRECTION = "observation:3a1351d6ac306374b8a5b472c192d2b9" + + +def _sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as stream: + for block in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(block) + return f"sha256:{digest.hexdigest()}" + + +def artifact_identity(path: Path) -> dict[str, str]: + resolved = path.resolve(strict=True) + if not resolved.is_file(): + raise ValueError(f"artifact is not a file: {resolved}") + return {"filename": resolved.name, "sha256": _sha256(resolved)} + + +def _validated_commit(value: str, *, label: str) -> str: + if not _COMMIT_RE.fullmatch(value): + raise ValueError(f"{label} must be a complete lowercase Git commit") + return value + + +def validate_core_runtime_outside_checkouts( + *, + module_path: Path, + forbidden_roots: Sequence[Path], +) -> None: + resolved_module = module_path.resolve(strict=True) + for root in forbidden_roots: + resolved_root = root.resolve(strict=True) + if resolved_module.is_relative_to(resolved_root): + raise RuntimeError( + "release convergence requires the built Core artifact; " + f"ace imported from forbidden checkout {resolved_root}" + ) + + +def _stable_source_coordinate(reference: dict[str, Any]) -> dict[str, str]: + return { + "record_key": reference["record_key"], + "material_hash": reference["material_hash"], + "payload_contract": reference["payload_contract"], + } + + +def _stable_artifact_projection(artifact: dict[str, Any]) -> dict[str, Any]: + return { + "artifact_key": artifact["artifact_key"], + "source_family": artifact["source_family"], + "source_release_id": artifact["source_release_id"], + "correction_record_id": artifact["correction_record_id"], + "correction_relation": artifact["correction_relation"], + "corrects_source_record_id": artifact["corrects_source_record_id"], + "displayed_statement": artifact["displayed_statement"], + "source_coverage_complete": artifact["source_coverage_complete"], + "correction_link_visible": artifact["correction_link_visible"], + "prior_record_preserved": artifact["prior_record_preserved"], + "limitations": artifact["limitations"], + } + + +def build_public_projection( + result: dict[str, Any], + *, + core_commit: str, + world_commit: str, + core_wheel: dict[str, str], + action_adapter_wheel: dict[str, str], + world_wheel: dict[str, str], + core_distribution_version: str, + action_adapter_distribution_version: str, + world_distribution_version: str, +) -> dict[str, Any]: + source_pair = result["source_pair"] + evaluation = result["evaluation"] + proposal = result["proposal"] + replay = result["replay"] + scope = result["scope"] + original = source_pair["original_observation"] + correction = source_pair["correction_observation"] + + if source_pair["fixture_digest"] != _EXPECTED_FIXTURE_DIGEST: + raise AssertionError("the frozen BLS fixture drifted") + if original["record_key"] != _EXPECTED_ORIGINAL or correction["record_key"] != _EXPECTED_CORRECTION: + raise AssertionError("the exact BLS source identities drifted") + if evaluation["classification"] != "useful" or evaluation["matched_pair_count"] != 2: + raise AssertionError("the frozen product criterion no longer produces the accepted useful result") + if evaluation["mean_effect"] != 1.0: + raise AssertionError("the frozen matched effect drifted") + if proposal["action"] != "promote": + raise AssertionError("the frozen useful-to-proposal mapping drifted") + if proposal["live_effect"] or proposal["selectable"] or not proposal["requires_human_review"]: + raise AssertionError("the measured-impact proposal gained effective authority") + if not replay["historical"] or not replay["no_reauthorization"]: + raise AssertionError("the exact historical replay contract drifted") + if scope["network_access"] or scope["proposal_applied"]: + raise AssertionError("the recorded convergence exceeded its authority boundary") + + treatment_scores = [item["correction_quality_score"] for item in result["observed_results"]["treatment"]] + control_scores = [item["correction_quality_score"] for item in result["observed_results"]["control"]] + if treatment_scores != [1.0, 1.0] or control_scores != [0.0, 0.0]: + raise AssertionError("the frozen treatment/control scores drifted") + + return { + "contract": CONTRACT, + "candidate_identity": { + "core_commit": _validated_commit(core_commit, label="core_commit"), + "world_commit": _validated_commit(world_commit, label="world_commit"), + "core_distribution_version": core_distribution_version, + "action_adapter_distribution_version": action_adapter_distribution_version, + "world_distribution_version": world_distribution_version, + "artifacts": { + "core_wheel": core_wheel, + "action_adapter_wheel": action_adapter_wheel, + "world_wheel": world_wheel, + }, + }, + "runtime": { + "core_import_mode": "installed_distribution_outside_core_checkout", + "candidate_contract_available": True, + "network_access": False, + }, + "public_source_pair": { + "fixture_id": source_pair["fixture_id"], + "fixture_digest": source_pair["fixture_digest"], + "source_policy": source_pair["source_policy"], + "original": _stable_source_coordinate(original), + "correction": _stable_source_coordinate(correction), + }, + "product_policy": result["review_policy"], + "matched_comparison": { + "treatment": _stable_artifact_projection(result["artifacts"]["treatment"]), + "control": _stable_artifact_projection(result["artifacts"]["control"]), + "treatment_scores": treatment_scores, + "control_scores": control_scores, + }, + "measured_result": { + "classification": evaluation["classification"], + "matched_pair_count": evaluation["matched_pair_count"], + "mean_effect": evaluation["mean_effect"], + "uncertainty": evaluation.get("uncertainty"), + "limitations": evaluation["limitations"], + }, + "governed_feedback": { + "proposed_action": proposal["action"], + "live_effect": proposal["live_effect"], + "selectable": proposal["selectable"], + "requires_human_review": proposal["requires_human_review"], + "applied": scope["proposal_applied"], + "historical_replay": replay["historical"], + "replay_reauthorized": not replay["no_reauthorization"], + }, + "claim_boundary": { + "recorded_replay_not_live_monitoring": True, + "association_not_causality": True, + "population_performance_claimed": scope["population_correction_performance_claimed"], + "human_benefit_claimed": scope["human_benefit_claimed"], + "si4_passed": False, + "ace_0_6_complete": False, + }, + } + + +async def generate( + *, + workspace_root: Path, + core_commit: str, + world_commit: str, + core_wheel_path: Path, + action_adapter_wheel_path: Path, + world_wheel_path: Path, + forbidden_core_roots: Sequence[Path], +) -> dict[str, Any]: + if ace.__file__ is None or ace_reference_workspace_action.__file__ is None: + raise RuntimeError("installed candidate distributions do not expose concrete module paths") + validate_core_runtime_outside_checkouts( + module_path=Path(ace.__file__), + forbidden_roots=forbidden_core_roots, + ) + result = await run_independent_correction_reproduction(workspace_root) + return build_public_projection( + result, + core_commit=core_commit, + world_commit=world_commit, + core_wheel=artifact_identity(core_wheel_path), + action_adapter_wheel=artifact_identity(action_adapter_wheel_path), + world_wheel=artifact_identity(world_wheel_path), + core_distribution_version=importlib.metadata.version("ace-core"), + action_adapter_distribution_version=importlib.metadata.version("ace-reference-workspace-action"), + world_distribution_version=importlib.metadata.version("ace-domain-world-intelligence"), + ) + + +def _canonical_json(value: dict[str, Any]) -> str: + return json.dumps(value, indent=2, sort_keys=True, ensure_ascii=False) + "\n" + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + parser.add_argument("--core-commit", required=True) + parser.add_argument("--world-commit", required=True) + parser.add_argument("--core-wheel", required=True, type=Path) + parser.add_argument("--action-adapter-wheel", required=True, type=Path) + parser.add_argument("--world-wheel", required=True, type=Path) + parser.add_argument("--forbid-core-root", action="append", default=[], type=Path) + parser.add_argument("--output", required=True, type=Path) + args = parser.parse_args() + + args.workspace_root.mkdir(parents=True, exist_ok=True) + projection = asyncio.run( + generate( + workspace_root=args.workspace_root, + core_commit=args.core_commit, + world_commit=args.world_commit, + core_wheel_path=args.core_wheel, + action_adapter_wheel_path=args.action_adapter_wheel, + world_wheel_path=args.world_wheel, + forbidden_core_roots=tuple(args.forbid_core_root), + ) + ) + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(_canonical_json(projection), encoding="utf-8") + print(f"Wrote {args.output}: {_sha256(args.output)}") + + +if __name__ == "__main__": + main() From c409c722c40411079bee5d0204c8ed529920817d Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 06:48:04 -0700 Subject: [PATCH 2/5] fix(world): bind the source adapter artifact --- ROADMAP.md | 7 ++++--- ...ed-intelligence-release-convergence-work-packet-v1.md | 2 +- .../test_measured_intelligence_release_convergence.py | 4 ++++ scripts/measured_intelligence_release_convergence.py | 9 +++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index a850102..ea4de4a 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -58,9 +58,10 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). bounded two-pair difference useful, and leaves the proposal non-effective and unapplied. - This is source-checkout evidence against stacked Core candidates, not a released World capability, human benefit finding, causal claim, network-freshness proof, or applied governance change. -- The additive convergence packet hashes built Core, reference-adapter, and World wheels, rejects - a Core checkout on the runtime path, and freezes a canonical machine-readable P2C10 result. It - remains candidate artifact evidence pending combined release gates and publication. +- The additive convergence packet hashes built Core, reference-action-adapter, World + source-adapter, and World wheels, rejects a Core checkout on the runtime path, and freezes a + canonical machine-readable P2C10 result. It remains candidate artifact evidence pending combined + release gates and publication. See the [P2C3 candidate work packet](docs/design/world-intelligence-p2c3-measured-feedback-work-packet-v1.md). The follow-on [P2C4 work packet](docs/design/world-intelligence-p2c4-reviewed-impact-disposition-work-packet-v1.md) diff --git a/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md b/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md index c3b98b5..f3f162d 100644 --- a/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md +++ b/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md @@ -26,7 +26,7 @@ recorded public BLS release + erratum The generator must: -1. hash the exact Core, separate reference action-adapter, and World wheels; +1. hash the exact Core, separate reference action-adapter, World source-adapter, and World wheels; 2. reject a runtime importing `ace` from any declared Core checkout; 3. rerun the complete P2C2-P2C10 append-only journey without network access; 4. freeze stable source, product-policy, comparison, classification, proposal, replay, and diff --git a/domain_packs/tests/test_measured_intelligence_release_convergence.py b/domain_packs/tests/test_measured_intelligence_release_convergence.py index 98cee61..866f7a8 100644 --- a/domain_packs/tests/test_measured_intelligence_release_convergence.py +++ b/domain_packs/tests/test_measured_intelligence_release_convergence.py @@ -58,9 +58,11 @@ async def test_public_projection_freezes_the_bounded_measured_result(tmp_path: P world_commit="b" * 40, core_wheel=coordinate, action_adapter_wheel=coordinate, + source_adapter_wheel=coordinate, world_wheel=coordinate, core_distribution_version="0.5.0", action_adapter_distribution_version="0.1.0", + source_adapter_distribution_version="0.2.0", world_distribution_version="0.9.0", ) @@ -91,8 +93,10 @@ async def test_public_projection_freezes_the_bounded_measured_result(tmp_path: P world_commit="b" * 40, core_wheel=coordinate, action_adapter_wheel=coordinate, + source_adapter_wheel=coordinate, world_wheel=coordinate, core_distribution_version="0.5.0", action_adapter_distribution_version="0.1.0", + source_adapter_distribution_version="0.2.0", world_distribution_version="0.9.0", ) diff --git a/scripts/measured_intelligence_release_convergence.py b/scripts/measured_intelligence_release_convergence.py index a086e8b..c2c9699 100644 --- a/scripts/measured_intelligence_release_convergence.py +++ b/scripts/measured_intelligence_release_convergence.py @@ -93,9 +93,11 @@ def build_public_projection( world_commit: str, core_wheel: dict[str, str], action_adapter_wheel: dict[str, str], + source_adapter_wheel: dict[str, str], world_wheel: dict[str, str], core_distribution_version: str, action_adapter_distribution_version: str, + source_adapter_distribution_version: str, world_distribution_version: str, ) -> dict[str, Any]: source_pair = result["source_pair"] @@ -135,10 +137,12 @@ def build_public_projection( "world_commit": _validated_commit(world_commit, label="world_commit"), "core_distribution_version": core_distribution_version, "action_adapter_distribution_version": action_adapter_distribution_version, + "source_adapter_distribution_version": source_adapter_distribution_version, "world_distribution_version": world_distribution_version, "artifacts": { "core_wheel": core_wheel, "action_adapter_wheel": action_adapter_wheel, + "source_adapter_wheel": source_adapter_wheel, "world_wheel": world_wheel, }, }, @@ -195,6 +199,7 @@ async def generate( world_commit: str, core_wheel_path: Path, action_adapter_wheel_path: Path, + source_adapter_wheel_path: Path, world_wheel_path: Path, forbidden_core_roots: Sequence[Path], ) -> dict[str, Any]: @@ -211,9 +216,11 @@ async def generate( world_commit=world_commit, core_wheel=artifact_identity(core_wheel_path), action_adapter_wheel=artifact_identity(action_adapter_wheel_path), + source_adapter_wheel=artifact_identity(source_adapter_wheel_path), world_wheel=artifact_identity(world_wheel_path), core_distribution_version=importlib.metadata.version("ace-core"), action_adapter_distribution_version=importlib.metadata.version("ace-reference-workspace-action"), + source_adapter_distribution_version=importlib.metadata.version("ace-ext-world-federal-register-source"), world_distribution_version=importlib.metadata.version("ace-domain-world-intelligence"), ) @@ -229,6 +236,7 @@ def main() -> None: parser.add_argument("--world-commit", required=True) parser.add_argument("--core-wheel", required=True, type=Path) parser.add_argument("--action-adapter-wheel", required=True, type=Path) + parser.add_argument("--source-adapter-wheel", required=True, type=Path) parser.add_argument("--world-wheel", required=True, type=Path) parser.add_argument("--forbid-core-root", action="append", default=[], type=Path) parser.add_argument("--output", required=True, type=Path) @@ -242,6 +250,7 @@ def main() -> None: world_commit=args.world_commit, core_wheel_path=args.core_wheel, action_adapter_wheel_path=args.action_adapter_wheel, + source_adapter_wheel_path=args.source_adapter_wheel, world_wheel_path=args.world_wheel, forbidden_core_roots=tuple(args.forbid_core_root), ) From 1013e24e9d6a3a002d7a99a47f29a8dee56c439f Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 06:50:24 -0700 Subject: [PATCH 3/5] fix(world): freeze portable convergence evidence --- ...ence-release-convergence-work-packet-v1.md | 4 ++-- ...asured_intelligence_release_convergence.py | 21 ++++++++++++++++++- ...asured_intelligence_release_convergence.py | 8 +++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md b/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md index f3f162d..aa483e6 100644 --- a/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md +++ b/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md @@ -29,8 +29,8 @@ The generator must: 1. hash the exact Core, separate reference action-adapter, World source-adapter, and World wheels; 2. reject a runtime importing `ace` from any declared Core checkout; 3. rerun the complete P2C2-P2C10 append-only journey without network access; -4. freeze stable source, product-policy, comparison, classification, proposal, replay, and - non-claim fields while excluding wall-clock-dependent record identities; +4. freeze stable source keys, product-policy version/rule, comparison, classification, proposal, + replay, and non-claim fields while excluding wall-clock-dependent record and material digests; 5. fail if the fixture, source identities, scores, matched effect, useful classification, proposal-only authority, or historical replay drifts; and 6. reproduce the committed JSON byte-for-byte from a fresh workspace. diff --git a/domain_packs/tests/test_measured_intelligence_release_convergence.py b/domain_packs/tests/test_measured_intelligence_release_convergence.py index 866f7a8..e97fe70 100644 --- a/domain_packs/tests/test_measured_intelligence_release_convergence.py +++ b/domain_packs/tests/test_measured_intelligence_release_convergence.py @@ -50,7 +50,11 @@ async def test_public_projection_freezes_the_bounded_measured_result(tmp_path: P run_independent_correction_reproduction, ) - result = await run_independent_correction_reproduction(tmp_path) + first_root = tmp_path / "first" + second_root = tmp_path / "second" + first_root.mkdir() + second_root.mkdir() + result = await run_independent_correction_reproduction(first_root) coordinate = {"filename": "candidate.whl", "sha256": "sha256:" + "a" * 64} projection = build_public_projection( result, @@ -84,6 +88,21 @@ async def test_public_projection_freezes_the_bounded_measured_result(tmp_path: P } assert projection["claim_boundary"]["ace_0_6_complete"] is False + repeated = build_public_projection( + await run_independent_correction_reproduction(second_root), + core_commit="a" * 40, + world_commit="b" * 40, + core_wheel=coordinate, + action_adapter_wheel=coordinate, + source_adapter_wheel=coordinate, + world_wheel=coordinate, + core_distribution_version="0.5.0", + action_adapter_distribution_version="0.1.0", + source_adapter_distribution_version="0.2.0", + world_distribution_version="0.9.0", + ) + assert repeated == projection + effective = copy.deepcopy(result) effective["proposal"]["live_effect"] = True with pytest.raises(AssertionError, match="gained effective authority"): diff --git a/scripts/measured_intelligence_release_convergence.py b/scripts/measured_intelligence_release_convergence.py index c2c9699..38acebb 100644 --- a/scripts/measured_intelligence_release_convergence.py +++ b/scripts/measured_intelligence_release_convergence.py @@ -65,7 +65,6 @@ def validate_core_runtime_outside_checkouts( def _stable_source_coordinate(reference: dict[str, Any]) -> dict[str, str]: return { "record_key": reference["record_key"], - "material_hash": reference["material_hash"], "payload_contract": reference["payload_contract"], } @@ -158,7 +157,12 @@ def build_public_projection( "original": _stable_source_coordinate(original), "correction": _stable_source_coordinate(correction), }, - "product_policy": result["review_policy"], + "product_policy": { + "policy_id": result["review_policy"]["policy_id"], + "policy_version": result["review_policy"]["policy_version"], + "reviewer_ref": result["review_policy"]["reviewer_ref"], + "score_rule": result["review_policy"]["score_rule"], + }, "matched_comparison": { "treatment": _stable_artifact_projection(result["artifacts"]["treatment"]), "control": _stable_artifact_projection(result["artifacts"]["control"]), From 7fec49b163fd4c50964576a45511c8645e856f3d Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 06:58:27 -0700 Subject: [PATCH 4/5] chore(world): reconcile release hygiene --- README.md | 4 +- .../adapter.py | 39 +++------- .../test_federal_register_source_adapter.py | 20 ++--- ...ence-release-convergence-work-packet-v1.md | 5 ++ .../tests/test_p2c2_governed_reality_brief.py | 4 +- .../tests/test_world_intelligence_p2a.py | 4 +- .../tests/test_world_intelligence_p2b.py | 16 ++-- ...orld_intelligence_p2b_status_case_brief.py | 3 +- ..._intelligence_p2c_federal_register_live.py | 16 +--- .../test_world_intelligence_public_demo.py | 8 +- .../conformance/p2a_manifest.json | 2 +- .../conformance/p2b_case_brief_manifest.json | 2 +- .../p2b_independent_case_brief_manifest.json | 2 +- .../p2b_prepared_replay_manifest.json | 2 +- .../p2b_status_case_brief_manifest.json | 4 +- .../p2b_supersession_impact_manifest.json | 2 +- scripts/__init__.py | 1 - ...asured_intelligence_release_convergence.py | 3 +- scripts/p2a_compile_acceptance.py | 21 ++---- scripts/p2b_case_brief.py | 31 ++------ scripts/p2b_independent_case_brief.py | 47 +++++------- scripts/p2b_prepared_replay.py | 35 +++------ scripts/p2b_scenario_acceptance.py | 0 scripts/p2b_status_case_brief.py | 32 +++----- scripts/p2b_supersession_impact.py | 42 +++-------- scripts/p2c2_federal_register_monitor.py | 34 ++------- scripts/p2c2_governed_reality_brief.py | 73 +++++-------------- .../p2c_federal_register_live_acceptance.py | 69 ++++-------------- scripts/public_demo.py | 47 ++++-------- 29 files changed, 163 insertions(+), 405 deletions(-) mode change 100644 => 100755 scripts/measured_intelligence_release_convergence.py mode change 100644 => 100755 scripts/p2a_compile_acceptance.py mode change 100644 => 100755 scripts/p2b_case_brief.py mode change 100644 => 100755 scripts/p2b_independent_case_brief.py mode change 100644 => 100755 scripts/p2b_prepared_replay.py mode change 100644 => 100755 scripts/p2b_scenario_acceptance.py mode change 100644 => 100755 scripts/p2b_status_case_brief.py mode change 100644 => 100755 scripts/p2b_supersession_impact.py mode change 100644 => 100755 scripts/public_demo.py diff --git a/README.md b/README.md index b4378ad..aaf5b71 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,7 @@ Resolve the pack data from the installed distribution: import json from importlib.resources import files -manifest = json.loads( - files("domain_packs.world_intelligence").joinpath("manifest.json").read_text(encoding="utf-8") -) +manifest = json.loads(files("domain_packs.world_intelligence").joinpath("manifest.json").read_text(encoding="utf-8")) print(manifest["metadata"]["pack_id"]) # world_intelligence ``` diff --git a/adapters/federal_register_source/src/ace_world_federal_register_source/adapter.py b/adapters/federal_register_source/src/ace_world_federal_register_source/adapter.py index 30c76c2..f0bc1fa 100644 --- a/adapters/federal_register_source/src/ace_world_federal_register_source/adapter.py +++ b/adapters/federal_register_source/src/ace_world_federal_register_source/adapter.py @@ -26,16 +26,12 @@ FEDERAL_REGISTER_SOURCE_TYPE = "federal_register_document" DOCUMENT_NUMBER = "2026-16197" -FEDERAL_REGISTER_DOCUMENT_URI = ( - "https://www.federalregister.gov/api/v1/documents/2026-16197.json" -) +FEDERAL_REGISTER_DOCUMENT_URI = "https://www.federalregister.gov/api/v1/documents/2026-16197.json" FEDERAL_REGISTER_HTML_URI = ( "https://www.federalregister.gov/documents/2026/08/07/2026-16197/" "protecting-against-national-security-threats-to-the-communications-supply-chain-through-the" ) -OFFICIAL_PDF_URI = ( - "https://www.govinfo.gov/content/pkg/FR-2026-08-07/pdf/2026-16197.pdf" -) +OFFICIAL_PDF_URI = "https://www.govinfo.gov/content/pkg/FR-2026-08-07/pdf/2026-16197.pdf" FEDERAL_REGISTER_LOCATOR = "json-pointer:/document_number" PUBLICATION_DATE = "2026-08-07" AGENCY_NAME = "Federal Communications Commission" @@ -46,9 +42,7 @@ ) LEGAL_STATUS_NOTICE = "FederalRegister.gov is not the official legal edition." -VERIFICATION_REFERENCE = ( - "The govinfo.gov PDF is the official-format verification reference." -) +VERIFICATION_REFERENCE = "The govinfo.gov PDF is the official-format verification reference." MAX_RESPONSE_BODY_CHARS = 32_768 MAX_TITLE_CHARS = 1_000 @@ -127,10 +121,7 @@ def _text(value: object, *, name: str, maximum: int) -> str: if type(value) is not str or not 1 <= len(value) <= maximum: raise _fail(f"{name} must be text with length 1..{maximum}") if any( - ord(character) < 0x20 - or ord(character) == 0x7F - or 0xD800 <= ord(character) <= 0xDFFF - for character in value + ord(character) < 0x20 or ord(character) == 0x7F or 0xD800 <= ord(character) <= 0xDFFF for character in value ): raise _fail(f"{name} contains controls, DEL, or a lone surrogate") return value @@ -186,13 +177,9 @@ def _canonical_document_payload( raise _fail("Federal Register response must be one JSON object") title = _text(payload.get("title"), name="title", maximum=MAX_TITLE_CHARS) - document_number = _text( - payload.get("document_number"), name="document_number", maximum=32 - ) + document_number = _text(payload.get("document_number"), name="document_number", maximum=32) document_type = _text(payload.get("type"), name="type", maximum=128) - publication_date = _text( - payload.get("publication_date"), name="publication_date", maximum=10 - ) + publication_date = _text(payload.get("publication_date"), name="publication_date", maximum=10) html_url = _text(payload.get("html_url"), name="html_url", maximum=2_048) official_pdf_url = _text(payload.get("pdf_url"), name="pdf_url", maximum=2_048) agencies = payload.get("agencies") @@ -234,11 +221,7 @@ def _validated_addresses(values: object, *, name: str) -> tuple[str, ...]: if type(values) is not tuple or not 1 <= len(values) <= 32: raise _fail(f"{name} must attest 1..32 addresses") try: - normalized = tuple( - validate_public_ip_literal(value, name=name) - for value in values - if type(value) is str - ) + normalized = tuple(validate_public_ip_literal(value, name=name) for value in values if type(value) is str) except ValueError as exc: raise _fail(f"{name} must contain globally routable unicast literals") from exc if len(normalized) != len(values) or len(set(normalized)) != len(normalized): @@ -280,9 +263,7 @@ async def capture( request: SourceAdapterCaptureRequestV1Alpha1, ) -> CapturedSourceMaterialV1Alpha1: try: - validated = SourceAdapterCaptureRequestV1Alpha1.model_validate( - request.model_dump(mode="python") - ) + validated = SourceAdapterCaptureRequestV1Alpha1.model_validate(request.model_dump(mode="python")) except (AttributeError, TypeError, ValueError) as exc: raise _fail("source-adapter request failed exact public-contract revalidation") from exc if validated.adapter_artifact != self.artifact_identity: @@ -338,9 +319,7 @@ async def capture( raise _fail("retrieval result must be exact HTTP 200 application/json material") resolved = _validated_addresses(result.resolved_ip_addresses, name="resolved_ip_addresses") - connected = _validated_addresses( - result.connected_ip_addresses, name="connected_ip_addresses" - ) + connected = _validated_addresses(result.connected_ip_addresses, name="connected_ip_addresses") if connected != resolved: raise _fail("every resolved and connected address must remain exactly attested") diff --git a/adapters/federal_register_source/tests/test_federal_register_source_adapter.py b/adapters/federal_register_source/tests/test_federal_register_source_adapter.py index 24a39f0..d33d073 100644 --- a/adapters/federal_register_source/tests/test_federal_register_source_adapter.py +++ b/adapters/federal_register_source/tests/test_federal_register_source_adapter.py @@ -127,9 +127,7 @@ async def test_exact_document_becomes_closed_canonical_inert_payload() -> None: "Protecting Against National Security Threats to the Communications " "Supply Chain Through the Equipment Authorization Program" ), - "verification_reference": ( - "The govinfo.gov PDF is the official-format verification reference." - ), + "verification_reference": ("The govinfo.gov PDF is the official-format verification reference."), } assert "abstract" not in payload assert capture.requested_uri == capture.effective_uri == FEDERAL_REGISTER_DOCUMENT_URI @@ -179,9 +177,7 @@ async def test_exact_document_becomes_closed_canonical_inert_payload() -> None: ({"observed_at": STARTED - timedelta(seconds=1)}, "observation/capture times"), ], ) -async def test_untrusted_transport_material_fails_closed( - changes: dict[str, object], message: str -) -> None: +async def test_untrusted_transport_material_fails_closed(changes: dict[str, object], message: str) -> None: adapter, _, request = _adapter_and_request(**changes) with pytest.raises(FederalRegisterSourceAdapterError, match=message): await adapter.capture(request) @@ -209,9 +205,7 @@ async def test_forged_artifact_and_different_uri_reject_before_transport() -> No adapter, transport, request = _adapter_and_request() forged_artifact = request.model_copy( update={ - "adapter_artifact": request.adapter_artifact.model_copy( - update={"artifact_digest": "sha256:" + "e" * 64} - ) + "adapter_artifact": request.adapter_artifact.model_copy(update={"artifact_digest": "sha256:" + "e" * 64}) } ) with pytest.raises(FederalRegisterSourceAdapterError, match="revalidation"): @@ -268,9 +262,7 @@ async def test_reviewed_multi_document_profile_preserves_exact_allowlist() -> No _, _, default_request = _adapter_and_request() request = SourceAdapterCaptureRequestV1Alpha1.model_validate( { - **default_request.model_dump( - mode="python", exclude={"request_id", "request_digest"} - ), + **default_request.model_dump(mode="python", exclude={"request_id", "request_digest"}), "requested_uri": prior_uri, "source_definition_ref": "source_definition:federal-register-2026-15932", "configuration_ref": "config:federal-register-2026-15932", @@ -286,9 +278,7 @@ async def test_reviewed_multi_document_profile_preserves_exact_allowlist() -> No outside_allowlist = SourceAdapterCaptureRequestV1Alpha1.model_validate( { - **request.model_dump( - mode="python", exclude={"request_id", "request_digest"} - ), + **request.model_dump(mode="python", exclude={"request_id", "request_digest"}), "requested_uri": FEDERAL_REGISTER_DOCUMENT_URI, } ) diff --git a/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md b/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md index aa483e6..89fb55f 100644 --- a/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md +++ b/docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md @@ -57,6 +57,11 @@ benefit. - `artifacts/measured-intelligence/convergence-v1.json` - this work packet, its audit, and restrained README/roadmap references +The release-hygiene subpacket may mechanically format the existing acceptance scripts/tests, mark +their shebang-bearing files executable, annotate the two intentional fail-closed broad catches, +use Python 3.12's native `Z` timestamp parsing, and refresh exact manifest hashes for changed bytes. +It may not alter a fixture, expected outcome, product rule, or public identity. + Rollback removes those additive files and references. No durable history or released artifact is rewritten. diff --git a/domain_packs/tests/test_p2c2_governed_reality_brief.py b/domain_packs/tests/test_p2c2_governed_reality_brief.py index 2f9cba1..d53b048 100644 --- a/domain_packs/tests/test_p2c2_governed_reality_brief.py +++ b/domain_packs/tests/test_p2c2_governed_reality_brief.py @@ -20,9 +20,7 @@ async def test_official_records_reach_reviewed_verified_promoted_export( tmp_path, ) -> None: if importlib.util.find_spec("ace_reference_workspace_action") is None: - pytest.skip( - "cross-repo acceptance requires the independently packaged Core reference adapter" - ) + pytest.skip("cross-repo acceptance requires the independently packaged Core reference adapter") from scripts.p2c2_governed_reality_brief import run_acceptance result = await run_acceptance(tmp_path) diff --git a/domain_packs/tests/test_world_intelligence_p2a.py b/domain_packs/tests/test_world_intelligence_p2a.py index 596e6ca..6515c17 100644 --- a/domain_packs/tests/test_world_intelligence_p2a.py +++ b/domain_packs/tests/test_world_intelligence_p2a.py @@ -80,9 +80,7 @@ def test_world_vocabulary_does_not_leak_into_core_or_intelligence(): "record_corrects_record", "world_intelligence", } - platform_source = "\n".join( - path.read_text(encoding="utf-8") for path in intelligence_root.rglob("*.py") - ) + platform_source = "\n".join(path.read_text(encoding="utf-8") for path in intelligence_root.rglob("*.py")) assert all(token not in platform_source for token in forbidden_platform_tokens) diff --git a/domain_packs/tests/test_world_intelligence_p2b.py b/domain_packs/tests/test_world_intelligence_p2b.py index 17f5d4d..3200cee 100644 --- a/domain_packs/tests/test_world_intelligence_p2b.py +++ b/domain_packs/tests/test_world_intelligence_p2b.py @@ -5,17 +5,17 @@ from datetime import datetime from pathlib import Path +import ace.intelligence from ace.intelligence.contracts.resources import ClaimGroundingKind from ace.intelligence.packs import compile_pack_document -import ace.intelligence -from scripts.p2b_case_brief import WORLD_EPISTEMIC_STATUSES from scripts.p2a_compile_acceptance import ( _encoded, _pack_material, _replace_resource, compile_world_pack, ) +from scripts.p2b_case_brief import WORLD_EPISTEMIC_STATUSES from scripts.p2b_scenario_acceptance import ( EPISTEMIC_STATUSES, SUPPORT_REQUIRED_STATUSES, @@ -313,7 +313,7 @@ def test_platform_gap_categorical_state_change_detection(): ], "shift_type": "claim_support_shift", "signal_type": "claim_conflict", - } + }, ] detection_module = next(item for item in manifest["modules"] if item["module_id"] == "world_detection") detection_module["contract"] = "ace.intelligence.detection/v1alpha2" @@ -341,17 +341,11 @@ def test_wi_cr_002_is_closed_by_a_domain_neutral_status_capability(): """ grounding_kinds = {member.value for member in ClaimGroundingKind} - assert grounding_kinds == {"cited", "inference"}, ( - "ACE must not learn World status vocabulary" - ) + assert grounding_kinds == {"cited", "inference"}, "ACE must not learn World status vocabulary" epistemic = _load(PACK_ROOT / "modules" / "epistemic_status.json") assert epistemic["contract"] == "ace.intelligence.epistemic-status/v1alpha1" - declared = { - status["status_id"] - for status_set in epistemic["status_sets"] - for status in status_set["statuses"] - } + declared = {status["status_id"] for status_set in epistemic["status_sets"] for status in status_set["statuses"]} assert declared == set(WORLD_EPISTEMIC_STATUSES) # The generic carrier exists in the platform and is per statement. diff --git a/domain_packs/tests/test_world_intelligence_p2b_status_case_brief.py b/domain_packs/tests/test_world_intelligence_p2b_status_case_brief.py index 96777ba..e89a711 100644 --- a/domain_packs/tests/test_world_intelligence_p2b_status_case_brief.py +++ b/domain_packs/tests/test_world_intelligence_p2b_status_case_brief.py @@ -84,8 +84,7 @@ def test_corroborated_does_not_claim_source_family_independence(): assert projection["proven"]["corroborated_proves_source_family_independence"] is False corroborated = [ - item for item in projection["status_projection"]["statuses_per_claim"] - if item["status_id"] == "corroborated" + item for item in projection["status_projection"]["statuses_per_claim"] if item["status_id"] == "corroborated" ] assert corroborated, "the frozen scenario must exercise the corroborated status" for item in corroborated: diff --git a/domain_packs/tests/test_world_intelligence_p2c_federal_register_live.py b/domain_packs/tests/test_world_intelligence_p2c_federal_register_live.py index b71ce2c..afb7140 100644 --- a/domain_packs/tests/test_world_intelligence_p2c_federal_register_live.py +++ b/domain_packs/tests/test_world_intelligence_p2c_federal_register_live.py @@ -70,12 +70,8 @@ async def test_official_format_reference_and_legal_status_survive_mapping() -> N projection, _, _ = await run_acceptance() attributes = projection["mapped_result"]["attributes"] - assert attributes["official_pdf_url"] == ( - "https://www.govinfo.gov/content/pkg/FR-2026-08-07/pdf/2026-16197.pdf" - ) - assert attributes["legal_status_notice"] == ( - "FederalRegister.gov is not the official legal edition." - ) + assert attributes["official_pdf_url"] == ("https://www.govinfo.gov/content/pkg/FR-2026-08-07/pdf/2026-16197.pdf") + assert attributes["legal_status_notice"] == ("FederalRegister.gov is not the official legal edition.") assert attributes["verification_reference"] == ( "The govinfo.gov PDF is the official-format verification reference." ) @@ -84,9 +80,7 @@ async def test_official_format_reference_and_legal_status_survive_mapping() -> N def test_additive_live_pack_compiles_without_mutating_frozen_world_pack() -> None: compiled = compile_live_pack() assert compiled.compiled_pack_id == "pack_ir:1847032fc5301bba9b6f85d3d091400d" - assert compiled.pack_digest == ( - "sha256:1847032fc5301bba9b6f85d3d091400dfc3e2679496e2932d4345bddfb799d1f" - ) + assert compiled.pack_digest == ("sha256:1847032fc5301bba9b6f85d3d091400dfc3e2679496e2932d4345bddfb799d1f") frozen = { "manifest.json": "3969f9215e0132f90628160b94b7a6638b243452a96a3cc9d15e910163253a97", @@ -103,8 +97,6 @@ def test_additive_pack_and_fixture_are_declarative_and_network_free() -> None: pack_root = REPO_ROOT / "domain_packs" / "world_intelligence_federal_register" suffixes = {path.suffix for path in pack_root.rglob("*") if path.is_file()} assert suffixes == {".json"} - fixture = json.loads( - (pack_root / "conformance" / "p2c_live_source_input.json").read_text() - ) + fixture = json.loads((pack_root / "conformance" / "p2c_live_source_input.json").read_text()) assert fixture["transport_fixture"]["fixture_only"] is True assert fixture["transport_fixture"]["network_access"] is False diff --git a/domain_packs/tests/test_world_intelligence_public_demo.py b/domain_packs/tests/test_world_intelligence_public_demo.py index b184fa0..73dc486 100644 --- a/domain_packs/tests/test_world_intelligence_public_demo.py +++ b/domain_packs/tests/test_world_intelligence_public_demo.py @@ -27,12 +27,8 @@ def test_demo_is_bound_to_the_exact_accepted_release_contract(demo_data): assert demo_data["identities"] == { "case_id": "case:412426eee708d56f6bda931ccf9e5d8b", "brief_id": "brief:25d8232c9bfa27050bdcb160fb75f06c", - "status_projection_id": ( - "brief_derivation_family_status_projection:3500889a2d75af7a5484a681afbee34c" - ), - "impact_projection_id": ( - "supersession_impact_projection:f3723de8e9ac5c4390c5c46137f3765e" - ), + "status_projection_id": ("brief_derivation_family_status_projection:3500889a2d75af7a5484a681afbee34c"), + "impact_projection_id": ("supersession_impact_projection:f3723de8e9ac5c4390c5c46137f3765e"), } diff --git a/domain_packs/world_intelligence/conformance/p2a_manifest.json b/domain_packs/world_intelligence/conformance/p2a_manifest.json index 9b4a1ad..41726e2 100644 --- a/domain_packs/world_intelligence/conformance/p2a_manifest.json +++ b/domain_packs/world_intelligence/conformance/p2a_manifest.json @@ -14,7 +14,7 @@ }, { "path": "scripts/p2a_compile_acceptance.py", - "sha256": "f2d861da1a413b1ba2a0af93fdc591426e184db7797d777f1c87a539d0691452" + "sha256": "dca04d750438aabe03c155d9aadd314bb1e897513010e5db78fd239ee87ec272" } ], "contract": "ace.world-intelligence.p2a-manifest/v1alpha1", diff --git a/domain_packs/world_intelligence/conformance/p2b_case_brief_manifest.json b/domain_packs/world_intelligence/conformance/p2b_case_brief_manifest.json index 72d03b2..830cd72 100644 --- a/domain_packs/world_intelligence/conformance/p2b_case_brief_manifest.json +++ b/domain_packs/world_intelligence/conformance/p2b_case_brief_manifest.json @@ -2,7 +2,7 @@ "artifacts": [ { "path": "scripts/p2b_case_brief.py", - "sha256": "46fe2bde6c1790c09161b21a6063d68133c4816067e1a774c458489fe5d7cb05" + "sha256": "3297af15f9b8d46e207829cb919798a92b0fe57fa13b4e0855e7c5c89b7af290" }, { "path": "domain_packs/world_intelligence/conformance/p2b_case_brief_expected.json", diff --git a/domain_packs/world_intelligence/conformance/p2b_independent_case_brief_manifest.json b/domain_packs/world_intelligence/conformance/p2b_independent_case_brief_manifest.json index 13cfe3c..9e7dfbb 100644 --- a/domain_packs/world_intelligence/conformance/p2b_independent_case_brief_manifest.json +++ b/domain_packs/world_intelligence/conformance/p2b_independent_case_brief_manifest.json @@ -2,7 +2,7 @@ "artifacts": [ { "path": "scripts/p2b_independent_case_brief.py", - "sha256": "f87c3bf8204b1668acb3662b92b02919ec4b0efce7fe3626e1cc0057b0cca4f8" + "sha256": "b9953081b4b0e7863c8af585bf46066e4e0e1526b9726f72d0d91461c2f2cf56" }, { "path": "domain_packs/world_intelligence/modules/epistemic_status_v2.json", diff --git a/domain_packs/world_intelligence/conformance/p2b_prepared_replay_manifest.json b/domain_packs/world_intelligence/conformance/p2b_prepared_replay_manifest.json index a7ea822..9d57e61 100644 --- a/domain_packs/world_intelligence/conformance/p2b_prepared_replay_manifest.json +++ b/domain_packs/world_intelligence/conformance/p2b_prepared_replay_manifest.json @@ -2,7 +2,7 @@ "artifacts": [ { "path": "scripts/p2b_prepared_replay.py", - "sha256": "8e0de9c8b1608fe5fa0a0c41c9acdd070ff11fbf1a40e575dd59cf9aa6b97125" + "sha256": "2882587014e9e68325a0aab491185bd7d96635e38028b6dba23beba3038de32e" }, { "path": "domain_packs/world_intelligence/conformance/p2b_prepared_replay_expected.json", diff --git a/domain_packs/world_intelligence/conformance/p2b_status_case_brief_manifest.json b/domain_packs/world_intelligence/conformance/p2b_status_case_brief_manifest.json index 25d25a4..2b7e147 100644 --- a/domain_packs/world_intelligence/conformance/p2b_status_case_brief_manifest.json +++ b/domain_packs/world_intelligence/conformance/p2b_status_case_brief_manifest.json @@ -2,7 +2,7 @@ "artifacts": [ { "path": "scripts/p2b_status_case_brief.py", - "sha256": "b71b7a2f6a2b1036491cd84821c0fc32a708c9a5df804dc4c5d581369e4214f4" + "sha256": "d79f2777162dce6db9f344774eb9ed5b7520170b735a76e931789209ea4d6a4e" }, { "path": "domain_packs/world_intelligence/modules/epistemic_status.json", @@ -14,7 +14,7 @@ }, { "path": "domain_packs/tests/test_world_intelligence_p2b_status_case_brief.py", - "sha256": "1d2ba2a7d4ad4d5cb3ce1b46f8f2d87209f39a139fe657f8d47f4f20e8efe0d6" + "sha256": "d4751f263cad930dd6c4e373bd1799cd67eac7636486be7c118f6b094959b36b" } ], "brief": { diff --git a/domain_packs/world_intelligence/conformance/p2b_supersession_impact_manifest.json b/domain_packs/world_intelligence/conformance/p2b_supersession_impact_manifest.json index bb58d2a..628a25e 100644 --- a/domain_packs/world_intelligence/conformance/p2b_supersession_impact_manifest.json +++ b/domain_packs/world_intelligence/conformance/p2b_supersession_impact_manifest.json @@ -2,7 +2,7 @@ "artifacts": [ { "path": "scripts/p2b_supersession_impact.py", - "sha256": "14c91c6954b9b29262e2337561254527b03904157a21f3dafcdd8f67e2eaf1da" + "sha256": "b0b4d151ffb530fcaf6ab0cd25ee2f492171cdf9d4f207f7d58a45848bb4c145" }, { "path": "domain_packs/world_intelligence/conformance/p2b_supersession_impact_expected.json", diff --git a/scripts/__init__.py b/scripts/__init__.py index 62a33e5..48e92ad 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -1,2 +1 @@ """Hermetic World Intelligence acceptance entry points.""" - diff --git a/scripts/measured_intelligence_release_convergence.py b/scripts/measured_intelligence_release_convergence.py old mode 100644 new mode 100755 index 38acebb..0959a00 --- a/scripts/measured_intelligence_release_convergence.py +++ b/scripts/measured_intelligence_release_convergence.py @@ -9,8 +9,9 @@ import importlib.metadata import json import re +from collections.abc import Sequence from pathlib import Path -from typing import Any, Sequence +from typing import Any import ace import ace_reference_workspace_action diff --git a/scripts/p2a_compile_acceptance.py b/scripts/p2a_compile_acceptance.py old mode 100644 new mode 100755 index f3c52ac..1efe274 --- a/scripts/p2a_compile_acceptance.py +++ b/scripts/p2a_compile_acceptance.py @@ -38,10 +38,7 @@ def _encoded(value: dict[str, Any]) -> bytes: def _pack_material() -> tuple[dict[str, Any], dict[str, bytes]]: manifest = _load(PACK_ROOT / "manifest.json") - resources = { - item["path"]: (PACK_ROOT / item["path"]).read_bytes() - for item in manifest["resources"] - } + resources = {item["path"]: (PACK_ROOT / item["path"]).read_bytes() for item in manifest["resources"]} return manifest, resources @@ -80,18 +77,12 @@ def run_positive() -> dict[str, Any]: "entity_type_count": len(ontology["entity_types"]), "relation_type_count": len(ontology["relation_types"]), "epistemic_status_count": len(epistemic["statuses"]), - "numeric_detector_ids": sorted( - item["detector_id"] for item in detection["numeric_delta_rules"] - ), + "numeric_detector_ids": sorted(item["detector_id"] for item in detection["numeric_delta_rules"]), "deferred_generic_detector_strategies": ["categorical", "semantic", "structural"], "persona_ids": sorted(item["persona_id"] for item in personas["personas"]), - "brief_template_ids": sorted( - item["template_id"] for item in synthesis["brief_templates"] - ), + "brief_template_ids": sorted(item["template_id"] for item in synthesis["brief_templates"]), "executable_pack_resources": 0, - "hidden_truth_score": epistemic["rules"][ - "publisher_has_hidden_universal_truth_score" - ], + "hidden_truth_score": epistemic["rules"]["publisher_has_hidden_universal_truth_score"], "political_targeting": False, "pack_schema_changed": False, } @@ -128,9 +119,7 @@ def run_negative_cases() -> dict[str, str]: manifest, resources = _pack_material() detection = _load(PACK_ROOT / "modules" / "detection.json") - detection["categorical_rules"] = [ - {"detector_id": "private_event_status", "strategy": "world_private_code"} - ] + detection["categorical_rules"] = [{"detector_id": "private_event_status", "strategy": "world_private_code"}] _replace_resource(manifest, resources, "modules/detection.json", detection) results["private_categorical_detector_fork"] = _rejected_code(manifest, resources) diff --git a/scripts/p2b_case_brief.py b/scripts/p2b_case_brief.py old mode 100644 new mode 100755 index 243cff4..8d353a0 --- a/scripts/p2b_case_brief.py +++ b/scripts/p2b_case_brief.py @@ -247,9 +247,7 @@ async def execute(self, request): observations = tuple( sorted(item.record_key for item in request.context_items if item.record_kind == "observation") ) - inferred = tuple( - sorted(item.record_key for item in request.context_items if item.record_kind != "observation") - ) + inferred = tuple(sorted(item.record_key for item in request.context_items if item.record_kind != "observation")) instruction = json.loads(request.instruction_json) section_ids = tuple(instruction["required_sections"]) self.sections = section_ids @@ -284,8 +282,7 @@ async def execute(self, request): support_refs=support, confidence=0.7, uncertainty=( - "The frozen prepared records do not establish anything beyond the " - "named exact resources." + "The frozen prepared records do not establish anything beyond the named exact resources." ), ), ) @@ -335,9 +332,7 @@ async def _admit_material(ledger, material, *, attention_at): admissions: dict[str, Any] = {} for key, derivation_key in ROUTED_DERIVATIONS: fresh = tuple( - item - for item in development_observations[key] - if str(item.resource_id) not in admitted_observation_ids + item for item in development_observations[key] if str(item.resource_id) not in admitted_observation_ids ) if not fresh: raise AssertionError(f"{key} would admit no new exact Observation") @@ -369,10 +364,7 @@ async def _admit_material(ledger, material, *, attention_at): *snapshot_pairs["claim_corroborated"], shifts["claim_corroborated"], ) - admitted_observation_ids.update( - str(item.resource_id) - for item in development_observations["claim_corroborated"] - ) + admitted_observation_ids.update(str(item.resource_id) for item in development_observations["claim_corroborated"]) await ledger.admit_resource_set( PreparedResourceSetAdmissionV1Alpha1( admission_key="resource-set:world-claim-corroboration", @@ -499,9 +491,7 @@ async def run_case_brief() -> dict[str, Any]: ("capability_state", capability_state_ref_for_artifact(APPEND_ARTIFACT)): _head( "capability_state", capability_state_ref_for_artifact(APPEND_ARTIFACT) ), - ("authority_grant", execution_binding.grant_ref): _head( - "authority_grant", execution_binding.grant_ref - ), + ("authority_grant", execution_binding.grant_ref): _head("authority_grant", execution_binding.grant_ref), ("authority_grant", append_binding.grant_ref): _head("authority_grant", append_binding.grant_ref), } activation_head = activation_store.heads[ @@ -609,14 +599,10 @@ async def run_case_brief() -> dict[str, Any]: }, "governance": { "atomic_records": len(admission.transaction_receipt.records), - "governed_state_preconditions": len( - admission.transaction_receipt.governed_state_preconditions - ), + "governed_state_preconditions": len(admission.transaction_receipt.governed_state_preconditions), "durable_brief_count": durable_brief_count, "deterministic_replay": bool( - replay.replayed - and replay.brief == admission.brief - and replay.synthesis_receipt == receipt + replay.replayed and replay.brief == admission.brief and replay.synthesis_receipt == receipt ), "provider_invocations": provider.calls, }, @@ -634,8 +620,7 @@ async def run_case_brief() -> dict[str, Any]: "request_id": "WI-CR-004", "boundary": "supersession_impact_projection", "finding": ( - "No public query enumerates the downstream resources affected by the admitted " - "record correction." + "No public query enumerates the downstream resources affected by the admitted record correction." ), }, ], diff --git a/scripts/p2b_independent_case_brief.py b/scripts/p2b_independent_case_brief.py old mode 100644 new mode 100755 index 0eff30c..5d49a1c --- a/scripts/p2b_independent_case_brief.py +++ b/scripts/p2b_independent_case_brief.py @@ -231,7 +231,12 @@ def independence_activation_revision(): #: all 28 selected context items are attributed exactly once. CLAIM_PLAN = ( ("what_happened", "admitted_record", "cited", ("record", "record:mwa_bulletin_214", "record:mwa_order_47")), - ("what_changed", "ace_inference", "inference", ("kind", ("case", 0), ("entity_snapshot", 0), ("entity_snapshot", 1))), + ( + "what_changed", + "ace_inference", + "inference", + ("kind", ("case", 0), ("entity_snapshot", 0), ("entity_snapshot", 1)), + ), ("established_records", "admitted_record", "cited", ("record", "record:assembly_transcript_0310")), ("attributed_claims", "attributed_claim", "cited", ("record", "record:ledger_correction_114")), ("where_sources_agree", "corroborated", "cited", ("corroboration",)), @@ -332,9 +337,7 @@ async def execute(self, request): attributed.update(supports) claim = BriefDraftClaimV1Alpha1( statement=STATEMENTS[status_id], - grounding_kind=( - ClaimGroundingKind.CITED if grounding == "cited" else ClaimGroundingKind.INFERENCE - ), + grounding_kind=(ClaimGroundingKind.CITED if grounding == "cited" else ClaimGroundingKind.INFERENCE), support_refs=supports, confidence=1.0 if grounding == "cited" else 0.7, uncertainty=None if grounding == "cited" else UNCERTAINTY, @@ -434,9 +437,7 @@ async def _environment(*, corroboration: tuple[str, ...], synthesis_key: str): ("capability_state", capability_state_ref_for_artifact(APPEND_ARTIFACT)): _head( "capability_state", capability_state_ref_for_artifact(APPEND_ARTIFACT) ), - ("authority_grant", execution_binding.grant_ref): _head( - "authority_grant", execution_binding.grant_ref - ), + ("authority_grant", execution_binding.grant_ref): _head("authority_grant", execution_binding.grant_ref), ("authority_grant", append_binding.grant_ref): _head("authority_grant", append_binding.grant_ref), } activation_head = activation_store.heads[ @@ -449,9 +450,7 @@ async def _environment(*, corroboration: tuple[str, ...], synthesis_key: str): for head in (*heads.values(), activation_head): store.set_governed_state_head(head) - observation_ids = { - record_id: str(item.resource_id) for record_id, item in material["observations"].items() - } + observation_ids = {record_id: str(item.resource_id) for record_id, item in material["observations"].items()} provider = _IndependenceProvider(observation_ids=observation_ids, corroboration=corroboration) reasoning = GovernedReasoningService( store=store, @@ -543,7 +542,7 @@ async def run_negative_corroboration_vectors() -> dict[str, Any]: ) try: await environment["service"].synthesize_with_status(environment["request"]) - except Exception as exc: # the exact public fail-closed error + except Exception as exc: # noqa: BLE001 - the probe records the exact public fail-closed error results[name] = { "rejected": True, "error_type": type(exc).__name__, @@ -625,32 +624,23 @@ async def run_independent_case_brief() -> dict[str, Any]: }, "independence": { "corroborated_claim_count": len(corroborated), - "corroborated_required_families": [ - item.required_distinct_derivation_families for item in corroborated - ], - "corroborated_distinct_families": [ - item.distinct_derivation_family_count for item in corroborated - ], + "corroborated_required_families": [item.required_distinct_derivation_families for item in corroborated], + "corroborated_distinct_families": [item.distinct_derivation_family_count for item in corroborated], "corroborated_roots_are_ledger_and_hydrology": all( sorted(item.derivation_family_roots) == sorted((ledger_root_id, hydrology_root_id)) for item in corroborated ), "syndicated_copies_are_inside_the_closure": syndication_ids <= {str(item.record.resource_id) for item in receipt.selected_context}, - "ledger_family_members": sorted(ledger_family.member_record_ids) - if ledger_family is not None - else [], - "ledger_family_member_count": len(ledger_family.member_record_ids) - if ledger_family is not None - else 0, + "ledger_family_members": sorted(ledger_family.member_record_ids) if ledger_family is not None else [], + "ledger_family_member_count": len(ledger_family.member_record_ids) if ledger_family is not None else 0, # The exact acceptance check: not merely "these are not roots", but # "these resolve specifically to the Ledger root family". "syndicated_copies_are_exact_members_of_the_ledger_family": ( ledger_family is not None and syndication_ids <= set(ledger_family.member_record_ids) ), "hydrology_is_a_separate_single_member_family": ( - hydrology_family is not None - and hydrology_family.member_record_ids == (hydrology_root_id,) + hydrology_family is not None and hydrology_family.member_record_ids == (hydrology_root_id,) ), "distinct_families_in_closure": len(projection.closure_families), "negative_vectors": dict(sorted(negatives.items())), @@ -658,9 +648,7 @@ async def run_independent_case_brief() -> dict[str, Any]: "governance": { "atomic_records": len(admission.transaction_receipt.records), "record_kinds": [item.record_kind for item in admission.transaction_receipt.records], - "governed_state_preconditions": len( - admission.transaction_receipt.governed_state_preconditions - ), + "governed_state_preconditions": len(admission.transaction_receipt.governed_state_preconditions), "durable_brief_count": durable_brief_count, "deterministic_replay": bool( replay.replayed @@ -682,8 +670,7 @@ async def run_independent_case_brief() -> dict[str, Any]: "request_id": "WI-CR-004", "boundary": "supersession_impact_projection", "finding": ( - "No public query enumerates the downstream resources affected by the admitted " - "record correction." + "No public query enumerates the downstream resources affected by the admitted record correction." ), } ], diff --git a/scripts/p2b_prepared_replay.py b/scripts/p2b_prepared_replay.py old mode 100644 new mode 100755 index 06cd72a..063f5d1 --- a/scripts/p2b_prepared_replay.py +++ b/scripts/p2b_prepared_replay.py @@ -34,6 +34,11 @@ route_categorical_shift_as_signal, route_shift_as_signal, ) +from ace.intelligence.contracts.resources import ( + LineageReferenceV1Alpha1, + LineageRelation, + LineageResourceKind, +) from ace.intelligence.packs import ( bind_prepared_activation, compile_overlay, @@ -41,11 +46,6 @@ prepare_activation_revision, prepare_domain_activation, ) -from ace.intelligence.contracts.resources import ( - LineageReferenceV1Alpha1, - LineageRelation, - LineageResourceKind, -) from scripts.p2a_compile_acceptance import _encoded, _pack_material, _replace_resource @@ -119,7 +119,7 @@ def _load(path: Path) -> dict[str, Any]: def _time(value: str) -> datetime: - return datetime.fromisoformat(value.replace("Z", "+00:00")) + return datetime.fromisoformat(value) def compile_replay_pack(): @@ -223,9 +223,7 @@ def _build_observations( progressed = False for record_id in sorted(pending): record = pending[record_id] - parent_ids = tuple( - record[field] for field in DERIVATION_FIELDS if field in record - ) + parent_ids = tuple(record[field] for field in DERIVATION_FIELDS if field in record) if any(parent not in built for parent in parent_ids): continue built[record_id] = _observation( @@ -236,9 +234,7 @@ def _build_observations( del pending[record_id] progressed = True if not progressed: - raise AssertionError( - f"scenario derivation lineage is not acyclic: {sorted(pending)}" - ) + raise AssertionError(f"scenario derivation lineage is not acyclic: {sorted(pending)}") return built @@ -630,10 +626,7 @@ def build_replay_material( activation_revision=binding.reference, as_of=case_as_of, lineage=( - *( - _development_lineage(item, LineageResourceKind.SIGNAL) - for item in signals.values() - ), + *(_development_lineage(item, LineageResourceKind.SIGNAL) for item in signals.values()), _development_lineage( shifts["claim_corroborated"], LineageResourceKind.SHIFT, @@ -642,9 +635,7 @@ def build_replay_material( case_type_ref="case_type:reality_change_window", title="Meridia reservoir release: 72-hour orientation case", purpose="Freeze the exact material developments needed for a governed Reality Brief.", - subject_refs=tuple( - sorted({subject for item in developments for subject in item.subject_refs}) - ), + subject_refs=tuple(sorted({subject for item in developments for subject in item.subject_refs})), assembled_at=case_assembled_at, ) all_snapshots = ( @@ -743,8 +734,7 @@ def run_positive() -> dict[str, Any]: "admission_digest": shift_only_admission.admission_digest, "resource_count": len(shift_only_admission.resources), "contains_signal": any( - reference.resource_kind.value == "signal" - for reference in shift_only_admission.processing_order + reference.resource_kind.value == "signal" for reference in shift_only_admission.processing_order ), }, "orientation_case": { @@ -760,8 +750,7 @@ def run_positive() -> dict[str, Any]: "admission_id": case_admission.admission_id, "admission_digest": case_admission.admission_digest, "resource_count": len(case_admission.resources), - "case_is_last": case_admission.processing_order[-1].resource_kind.value - == "case", + "case_is_last": case_admission.processing_order[-1].resource_kind.value == "case", }, "shift_ids": {key: value.resource_id for key, value in shifts.items()}, "signal_ids": {key: value.resource_id for key, value in signals.items()}, diff --git a/scripts/p2b_scenario_acceptance.py b/scripts/p2b_scenario_acceptance.py old mode 100644 new mode 100755 diff --git a/scripts/p2b_status_case_brief.py b/scripts/p2b_status_case_brief.py old mode 100644 new mode 100755 index c374d57..09de9c9 --- a/scripts/p2b_status_case_brief.py +++ b/scripts/p2b_status_case_brief.py @@ -45,10 +45,10 @@ GovernedOperationBindingV1Alpha1, GovernedReasoningService, GovernedStateHeadPreconditionV1Alpha1, - ReasoningExecutionBindingV1Alpha1, ProviderRouteV1Alpha1, ProviderStructuredOutputV1Alpha1, ProviderUsageV1Alpha1, + ReasoningExecutionBindingV1Alpha1, canonical_json, capability_state_ref_for_artifact, ) @@ -64,13 +64,13 @@ OrganizationOverlayV1, resource_reference, ) +from ace.intelligence.contracts.activation import ActivationState from ace.intelligence.packs import ( compile_overlay, compile_pack_document, prepare_activation_revision, prepare_domain_activation, ) -from ace.intelligence.contracts.activation import ActivationState from ace.testing import InMemoryImmutableRecordStore from scripts.p2a_compile_acceptance import _encoded, _pack_material, _replace_resource @@ -88,8 +88,8 @@ ) from scripts.p2b_prepared_replay import ( ACTIVATED_AT, - CATEGORICAL_RULES, ADDITIVE_ROUTES, + CATEGORICAL_RULES, PRODUCT_ID, build_replay_material, ) @@ -266,9 +266,7 @@ def _authority_bindings(): "scenario": "This is a conditional future state built only from the exact derived resources named.", } -UNCERTAINTY = ( - "The frozen prepared records do not establish anything beyond the named exact resources." -) +UNCERTAINTY = "The frozen prepared records do not establish anything beyond the named exact resources." class _StatusProvider: @@ -308,9 +306,7 @@ async def execute(self, request): attributed.update(supports) claim = BriefDraftClaimV1Alpha1( statement=STATEMENTS[status_id], - grounding_kind=( - ClaimGroundingKind.CITED if grounding == "cited" else ClaimGroundingKind.INFERENCE - ), + grounding_kind=(ClaimGroundingKind.CITED if grounding == "cited" else ClaimGroundingKind.INFERENCE), support_refs=supports, confidence=1.0 if grounding == "cited" else 0.7, uncertainty=None if grounding == "cited" else UNCERTAINTY, @@ -409,9 +405,7 @@ async def run_status_case_brief() -> dict[str, Any]: ("capability_state", capability_state_ref_for_artifact(APPEND_ARTIFACT)): _head( "capability_state", capability_state_ref_for_artifact(APPEND_ARTIFACT) ), - ("authority_grant", execution_binding.grant_ref): _head( - "authority_grant", execution_binding.grant_ref - ), + ("authority_grant", execution_binding.grant_ref): _head("authority_grant", execution_binding.grant_ref), ("authority_grant", append_binding.grant_ref): _head("authority_grant", append_binding.grant_ref), } activation_head = activation_store.heads[ @@ -531,12 +525,9 @@ async def run_status_case_brief() -> dict[str, Any]: for item in projection.claim_statuses ], "claims_per_status": dict(sorted(by_status.items())), - "binds_every_receipted_claim": tuple( - item.claim_id for item in projection.claim_statuses - ) + "binds_every_receipted_claim": tuple(item.claim_id for item in projection.claim_statuses) == tuple(item.claim_id for item in receipt.claim_supports), - "all_seven_required_statuses_present": sorted(declared) - == sorted(WORLD_EPISTEMIC_STATUSES), + "all_seven_required_statuses_present": sorted(declared) == sorted(WORLD_EPISTEMIC_STATUSES), "every_required_status_used": sorted(by_status) == sorted(WORLD_EPISTEMIC_STATUSES), "status_carrier": "brief_epistemic_status_projection.claim_statuses", "section_membership_is_validated_status": False, @@ -544,9 +535,7 @@ async def run_status_case_brief() -> dict[str, Any]: "governance": { "atomic_records": len(admission.transaction_receipt.records), "record_kinds": [item.record_kind for item in admission.transaction_receipt.records], - "governed_state_preconditions": len( - admission.transaction_receipt.governed_state_preconditions - ), + "governed_state_preconditions": len(admission.transaction_receipt.governed_state_preconditions), "durable_brief_count": durable_brief_count, "deterministic_replay": bool( replay.replayed @@ -577,8 +566,7 @@ async def run_status_case_brief() -> dict[str, Any]: "request_id": "WI-CR-004", "boundary": "supersession_impact_projection", "finding": ( - "No public query enumerates the downstream resources affected by the admitted " - "record correction." + "No public query enumerates the downstream resources affected by the admitted record correction." ), }, ], diff --git a/scripts/p2b_supersession_impact.py b/scripts/p2b_supersession_impact.py old mode 100644 new mode 100755 index bd6ac4f..3a0e2c2 --- a/scripts/p2b_supersession_impact.py +++ b/scripts/p2b_supersession_impact.py @@ -198,9 +198,7 @@ async def _build_world() -> dict[str, Any]: ("capability_state", capability_state_ref_for_artifact(APPEND_ARTIFACT)): _head( "capability_state", capability_state_ref_for_artifact(APPEND_ARTIFACT) ), - ("authority_grant", execution_binding.grant_ref): _head( - "authority_grant", execution_binding.grant_ref - ), + ("authority_grant", execution_binding.grant_ref): _head("authority_grant", execution_binding.grant_ref), ("authority_grant", append_binding.grant_ref): _head("authority_grant", append_binding.grant_ref), } activation_head = activation_store.heads[ @@ -213,9 +211,7 @@ async def _build_world() -> dict[str, Any]: for head in (*heads.values(), activation_head): store.set_governed_state_head(head) - observation_ids = { - record_id: str(item.resource_id) for record_id, item in material["observations"].items() - } + observation_ids = {record_id: str(item.resource_id) for record_id, item in material["observations"].items()} provider = _IndependenceProvider( observation_ids=observation_ids, corroboration=CORROBORATION_VECTORS["independent_roots"], @@ -291,9 +287,7 @@ async def _build_world() -> dict[str, Any]: activation_revision=binding.prepared_binding.reference, pack=binding.prepared_binding.revision.spec.pack, resources=tuple(assertions[key] for key, _ in SUPERSESSION_VECTORS), - processing_order=deterministic_resource_order( - tuple(assertions[key] for key, _ in SUPERSESSION_VECTORS) - ), + processing_order=deterministic_resource_order(tuple(assertions[key] for key, _ in SUPERSESSION_VECTORS)), admitted_at=correction_at, ) ) @@ -428,22 +422,12 @@ async def run_supersession_impact() -> dict[str, Any]: "max_depth": max((item.depth for item in projection.impacted), default=0), "unaffected_count": len(projection.unaffected_resource_ids), "impacted_claim_count": len(projection.claim_impacts), - "fully_impacted_claim_count": sum( - 1 for item in projection.claim_impacts if item.fully_impacted - ), - "partially_impacted_claim_count": sum( - 1 for item in projection.claim_impacts if not item.fully_impacted - ), - "case_is_impacted": any( - item.resource_kind.value == "case" for item in projection.impacted - ), - "durable_replay_is_exact": bool( - replayed.replayed and replayed.projection == appended.projection - ), + "fully_impacted_claim_count": sum(1 for item in projection.claim_impacts if item.fully_impacted), + "partially_impacted_claim_count": sum(1 for item in projection.claim_impacts if not item.fully_impacted), + "case_is_impacted": any(item.resource_kind.value == "case" for item in projection.impacted), + "durable_replay_is_exact": bool(replayed.replayed and replayed.projection == appended.projection), "atomic_records": len(appended.transaction_receipt.records), - "governed_state_preconditions": len( - appended.transaction_receipt.governed_state_preconditions - ), + "governed_state_preconditions": len(appended.transaction_receipt.governed_state_preconditions), } negatives = await run_negative_vectors(world) @@ -496,13 +480,9 @@ async def _historical_view(world) -> dict[str, Any]: "brief_id_unchanged": str(replay.brief.resource_id) == str(admission.brief.resource_id), "brief_replays_identically": replay.brief == admission.brief, "receipt_replays_identically": replay.synthesis_receipt == admission.synthesis_receipt, - "status_projection_replays_identically": ( - replay.status_projection == admission.status_projection - ), + "status_projection_replays_identically": (replay.status_projection == admission.status_projection), "replay_used_no_new_reasoning": world["provider"].calls == 1, - "brief_cutoff_precedes_the_correction": ( - admission.brief.generated_at < world["correction_at"] - ), + "brief_cutoff_precedes_the_correction": (admission.brief.generated_at < world["correction_at"]), } @@ -548,7 +528,7 @@ async def run_negative_vectors(world) -> dict[str, Any]: generated_at=world["correction_at"] + timedelta(hours=1), as_of=admission.brief.as_of, ) - except Exception as exc: + except Exception as exc: # noqa: BLE001 - the probe records fail-closed error types results[name] = {"rejected": True, "error_type": type(exc).__name__} else: results[name] = {"rejected": False} diff --git a/scripts/p2c2_federal_register_monitor.py b/scripts/p2c2_federal_register_monitor.py index 89b00fa..6d48f16 100644 --- a/scripts/p2c2_federal_register_monitor.py +++ b/scripts/p2c2_federal_register_monitor.py @@ -81,10 +81,7 @@ def compile_monitor_pack(): manifest = json.loads(manifest_bytes) return compile_pack_document( manifest_bytes, - { - item["path"]: (PACK_ROOT / item["path"]).read_bytes() - for item in manifest["resources"] - }, + {item["path"]: (PACK_ROOT / item["path"]).read_bytes() for item in manifest["resources"]}, ) @@ -102,13 +99,9 @@ def _head(*, kind: str, product_id: str, state_id: str, material: dict[str, Any] class ExactSourceDefinitions: def __init__(self, definitions: tuple[ResolvedSourceDefinitionV1Alpha1, ...]) -> None: - self.definitions = { - item.source_definition_ref: item for item in definitions - } + self.definitions = {item.source_definition_ref: item for item in definitions} - async def resolve_source_definition( - self, *, product_id, source_definition_ref, resolved_at - ): + async def resolve_source_definition(self, *, product_id, source_definition_ref, resolved_at): del resolved_at definition = self.definitions.get(source_definition_ref) if definition is None or definition.product_id != product_id: @@ -277,9 +270,7 @@ async def build_environment() -> MonitorEnvironment: subject_binding_id=fixture["subject_binding_id"], entity_type_id=fixture["entity_type_id"], entity_ref=fixture["entity_ref"], - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - source_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(source_head), ) ) requests.append( @@ -345,9 +336,7 @@ async def build_environment() -> MonitorEnvironment: grant_head=grant_head, ) store = InMemoryImmutableRecordStore() - activation_head = activation_store.heads[ - ("domain_activation", product_id, committed.revision.activation_id) - ] + activation_head = activation_store.heads[("domain_activation", product_id, committed.revision.activation_id)] for head in (activation_head, capability_head, grant_head, *source_heads): store.set_governed_state_head(head) return MonitorEnvironment( @@ -369,9 +358,7 @@ async def build_environment() -> MonitorEnvironment: async def admit_snapshots(environment: MonitorEnvironment): admissions = [] - for document, request in zip( - environment.fixture["documents"], environment.requests, strict=True - ): + for document, request in zip(environment.fixture["documents"], environment.requests, strict=True): service = environment.ingress( SequenceClock( _time(document["capture_started_at"]), @@ -446,15 +433,10 @@ def source_projection(admissions) -> dict[str, Any]: return { "baseline": admissions[0].entity_snapshot.attributes.parsed_value(), "current": admissions[1].entity_snapshot.attributes.parsed_value(), - "entity_ref_stable": ( - admissions[0].entity_snapshot.entity_ref - == admissions[1].entity_snapshot.entity_ref - ), + "entity_ref_stable": (admissions[0].entity_snapshot.entity_ref == admissions[1].entity_snapshot.entity_ref), "observation_modes": [item.observation.mode.value for item in admissions], } if __name__ == "__main__": - raise SystemExit( - "This packet is composed by the governed Reality Brief acceptance harness." - ) + raise SystemExit("This packet is composed by the governed Reality Brief acceptance harness.") diff --git a/scripts/p2c2_governed_reality_brief.py b/scripts/p2c2_governed_reality_brief.py index 3e46e93..3f8e9a6 100644 --- a/scripts/p2c2_governed_reality_brief.py +++ b/scripts/p2c2_governed_reality_brief.py @@ -192,19 +192,9 @@ async def execute(self, request): self.calls += 1 instruction = json.loads(request.instruction_json) observations = tuple( - sorted( - item.record_key - for item in request.context_items - if item.record_kind == "observation" - ) - ) - inferred = tuple( - sorted( - item.record_key - for item in request.context_items - if item.record_kind != "observation" - ) + sorted(item.record_key for item in request.context_items if item.record_kind == "observation") ) + inferred = tuple(sorted(item.record_key for item in request.context_items if item.record_kind != "observation")) statements = { "what_changed": ( f"The monitored FCC publication changed from Federal Register document " @@ -219,9 +209,7 @@ async def execute(self, request): "These records alone do not establish the proposal's eventual disposition, " "implementation, or practical impact." ), - "watchpoints": ( - "Watch for later official notices, rules, corrections, or linked docket material." - ), + "watchpoints": ("Watch for later official notices, rules, corrections, or linked docket material."), "limitations": ( "This proof uses two exact recorded Federal Register API responses and does not " "claim live network freshness beyond their stated publication dates." @@ -252,9 +240,7 @@ async def execute(self, request): "when additional official evidence is admitted." ), ) - sections.append( - BriefDraftSectionV1Alpha1(section_id=section_id, claims=(claim,)) - ) + sections.append(BriefDraftSectionV1Alpha1(section_id=section_id, claims=(claim,))) draft = BriefSynthesisDraftV1Alpha1( brief_type=instruction["brief_type"], persona_ids=tuple(item["persona_id"] for item in instruction["personas"]), @@ -275,9 +261,7 @@ async def execute(self, request): duration_ms=2, ), structured_json=canonical_json(draft.model_dump(mode="json")), - referenced_context_ids=tuple( - str(item.context_id) for item in request.context_items - ), + referenced_context_ids=tuple(str(item.context_id) for item in request.context_items), ) @@ -286,8 +270,7 @@ def _context(base: AuthenticatedRuntimeContextV1Alpha1, actor_ref: str): product_id=base.product_id, actor_ref=actor_ref, authentication_receipt_ref=f"authentication_receipt:{actor_ref.split(':')[-1]}", - authentication_receipt_digest="sha256:" - + hashlib.sha256(actor_ref.encode()).hexdigest(), + authentication_receipt_digest="sha256:" + hashlib.sha256(actor_ref.encode()).hexdigest(), authenticated_at=base.authenticated_at, expires_at=base.expires_at, ) @@ -319,9 +302,7 @@ def _bindings(environment, clock): configuration_ref=execution_head.state_id, authority="reason", grant_ref="authority_grant:world-official-record-reason", - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - execution_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(execution_head), ) append = GovernedOperationBindingV1Alpha1( product_id=product_id, @@ -329,9 +310,7 @@ def _bindings(environment, clock): configuration_ref=append_head.state_id, authority="append_immutable_records", grant_ref="authority_grant:world-live-append", - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - append_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(append_head), ) action = GovernedOperationBindingV1Alpha1( product_id=product_id, @@ -339,17 +318,10 @@ def _bindings(environment, clock): configuration_ref=action_head.state_id, authority="execute_action", grant_ref="authority_grant:world-reviewed-export", - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - action_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(action_head), ) - heads = { - (item.state_kind, item.state_id): item - for item in (execution_head, append_head, action_head) - } - for index, artifact in enumerate( - (REASONING_ARTIFACT, APPEND_ARTIFACT, ADAPTER_ARTIFACT), start=20 - ): + heads = {(item.state_kind, item.state_id): item for item in (execution_head, append_head, action_head)} + for index, artifact in enumerate((REASONING_ARTIFACT, APPEND_ARTIFACT, ADAPTER_ARTIFACT), start=20): state_id = capability_state_ref_for_artifact(artifact) item = _head(product_id, "capability_state", state_id, index) heads[item.state_kind, item.state_id] = item @@ -379,9 +351,7 @@ def _activation_precondition(environment): ) -async def _record_decision( - *, environment, reasoning, append_binding, brief_admission, decided_at -): +async def _record_decision(*, environment, reasoning, append_binding, brief_admission, decided_at): brief_record = brief_admission.transaction_receipt.records[0] intent = DecisionIntentV1Alpha1( product_id=environment.fixture["product_id"], @@ -392,9 +362,7 @@ async def _record_decision( disposition=DecisionDisposition.ACCEPT, action_disposition=DecisionActionDisposition.AUTHORIZE_ACTION, action_type=ACTION_TYPE, - rationale=( - "Approve export of the exact cited Reality Brief to the bounded review workspace." - ), + rationale=("Approve export of the exact cited Reality Brief to the bounded review workspace."), decided_at=decided_at, ) authorization = await reasoning.authorize_action( @@ -450,9 +418,7 @@ async def run_acceptance( binding = environment.committed_activation prepared_binding = environment.pack clock = MutableClock(_time("2026-08-07T18:01:03Z")) - execution_binding, append_binding, action_binding, runtime = _bindings( - environment, clock - ) + execution_binding, append_binding, action_binding, runtime = _bindings(environment, clock) baseline_data = baseline.entity_snapshot.attributes.parsed_value() current_data = current.entity_snapshot.attributes.parsed_value() provider = OfficialRecordBriefProvider( @@ -465,9 +431,7 @@ async def run_acceptance( provider=provider, clock=clock, ) - activation_binding = bind_committed_activation( - pack=prepared_binding, committed=binding - ) + activation_binding = bind_committed_activation(pack=prepared_binding, committed=binding) derivation_fixture = environment.fixture["derivation"] baseline_ref = resource_reference(baseline.entity_snapshot).model_copy( update={ @@ -497,9 +461,7 @@ async def run_acceptance( baseline=baseline_ref, current=current_ref, detected_at=_time(derivation_fixture["detected_at"]), - attention_evaluated_at=_time( - derivation_fixture["attention_evaluated_at"] - ), + attention_evaluated_at=_time(derivation_fixture["attention_evaluated_at"]), requested_at=_time(derivation_fixture["requested_at"]), ) bridge = LiveIntelligenceBridgeService( @@ -644,8 +606,7 @@ async def run_acceptance( "disposition": outcome.result.disposition.value, "replayed_without_second_effect": action_replay.replayed, "export_path": str(target), - "export_digest": "sha256:" - + hashlib.sha256(written.encode("utf-8")).hexdigest(), + "export_digest": "sha256:" + hashlib.sha256(written.encode("utf-8")).hexdigest(), }, "scope": { "official_public_records": True, diff --git a/scripts/p2c_federal_register_live_acceptance.py b/scripts/p2c_federal_register_live_acceptance.py index 3a19b7c..1af6d19 100755 --- a/scripts/p2c_federal_register_live_acceptance.py +++ b/scripts/p2c_federal_register_live_acceptance.py @@ -65,11 +65,7 @@ def _pack_file(name: str) -> bytes: return candidate.read_bytes() except (ModuleNotFoundError, NotADirectoryError, TypeError): pass - root = ( - Path(__file__).resolve().parents[1] - / "domain_packs" - / "world_intelligence_federal_register" - ) + root = Path(__file__).resolve().parents[1] / "domain_packs" / "world_intelligence_federal_register" return root.joinpath(name).read_bytes() @@ -82,10 +78,7 @@ def compile_live_pack(): manifest = json.loads(manifest_bytes) return compile_pack_document( manifest_bytes, - { - resource["path"]: _pack_file(resource["path"]) - for resource in manifest["resources"] - }, + {resource["path"]: _pack_file(resource["path"]) for resource in manifest["resources"]}, ) @@ -192,15 +185,10 @@ def __init__(self, definition: ResolvedSourceDefinitionV1Alpha1) -> None: self.definition = definition self.calls = 0 - async def resolve_source_definition( - self, *, product_id, source_definition_ref, resolved_at - ): + async def resolve_source_definition(self, *, product_id, source_definition_ref, resolved_at): del resolved_at self.calls += 1 - if ( - product_id != self.definition.product_id - or source_definition_ref != self.definition.source_definition_ref - ): + if product_id != self.definition.product_id or source_definition_ref != self.definition.source_definition_ref: raise ValueError("unknown exact source definition") return self.definition @@ -261,9 +249,7 @@ async def resolve_capability_use( configuration_ref=configuration_ref, evaluated_at=evaluated_at, resolved_at=evaluated_at, - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - self.capability_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(self.capability_head), ) async def resolve_authority_use( @@ -297,9 +283,7 @@ async def resolve_authority_use( grant_hash=self.grant_hash, evaluated_at=evaluated_at, expires_at=self.grant_expires_at, - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - self.grant_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(self.grant_head), ) @@ -344,9 +328,7 @@ def service(self, *, clock: SequenceClock | None = None) -> LiveSourceIngressSer def install_current_heads(self) -> None: activation_id = self.committed_activation.revision.activation_id - activation_head = self.activation_store.heads[ - ("domain_activation", self.request.product_id, activation_id) - ] + activation_head = self.activation_store.heads[("domain_activation", self.request.product_id, activation_id)] source_head = self.source_definitions.definition.state_head_precondition source = GovernedStateHeadV1( **source_head.model_dump(mode="python", exclude={"contract"}), @@ -477,9 +459,7 @@ async def build_environment() -> LiveEnvironment: subject_binding_id=scenario["subject_binding_id"], entity_type_id=scenario["entity_type_id"], entity_ref=scenario["entity_ref"], - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - source_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(source_head), ) runtime_use = ExactRuntimeUseResolver( context=context, @@ -504,9 +484,7 @@ async def build_environment() -> LiveEnvironment: redirect_chain=tuple(transport_fixture["redirect_chain"]), resolved_ip_addresses=tuple(transport_fixture["resolved_ip_addresses"]), connected_ip_addresses=tuple(transport_fixture["connected_ip_addresses"]), - dns_rebinding_protection_applied=transport_fixture[ - "dns_rebinding_protection_applied" - ], + dns_rebinding_protection_applied=transport_fixture["dns_rebinding_protection_applied"], credentials_used=transport_fixture["credentials_used"], locator=transport_fixture["locator"], observed_at=_time(scenario["observed_at"]), @@ -580,9 +558,7 @@ def identity_projection(environment: LiveEnvironment, admission) -> dict[str, An "receipt_digest": admission.acquisition_receipt.receipt_digest, "captured_payload_digest": admission.acquisition_receipt.captured_payload_digest, "locator": admission.acquisition_receipt.locator, - "resolved_ip_addresses": list( - admission.acquisition_receipt.resolved_ip_addresses - ), + "resolved_ip_addresses": list(admission.acquisition_receipt.resolved_ip_addresses), }, "live_records": { "record_space": transaction.record_space, @@ -609,12 +585,8 @@ def identity_projection(environment: LiveEnvironment, admission) -> dict[str, An "captured_payload_json": admission.source_snapshot.captured_payload_json, }, "scope": { - "transport_fixture_only": environment.fixture["transport_fixture"][ - "fixture_only" - ], - "network_access": environment.fixture["transport_fixture"][ - "network_access" - ], + "transport_fixture_only": environment.fixture["transport_fixture"]["fixture_only"], + "network_access": environment.fixture["transport_fixture"]["network_access"], "capture_calls": environment.adapter.capture_calls, "transport_calls": environment.transport.calls, "exact_record_order": [item.record_kind for item in transaction.records], @@ -628,9 +600,7 @@ def identity_projection(environment: LiveEnvironment, admission) -> dict[str, An async def run_acceptance(*, assert_expected: bool = True): environment = await build_environment() - restarted = environment.service( - clock=SequenceClock(_time(environment.fixture["scenario"]["admitted_at"])) - ) + restarted = environment.service(clock=SequenceClock(_time(environment.fixture["scenario"]["admitted_at"]))) conformance = await exercise_live_source_ingress_restart( first_service=environment.service(), restarted_service=restarted, @@ -639,14 +609,9 @@ async def run_acceptance(*, assert_expected: bool = True): ) if environment.adapter.capture_calls != 1 or environment.transport.calls != 1: raise AssertionError("exact replay reacquired source material") - if conformance.first.entity_snapshot.attributes.parsed_value() != environment.fixture[ - "expected_attributes" - ]: + if conformance.first.entity_snapshot.attributes.parsed_value() != environment.fixture["expected_attributes"]: raise AssertionError("LIVE entity attributes did not match the exact mapping") - if ( - len(environment.immutable_store.records) != 5 - or len(environment.immutable_store.receipts) != 1 - ): + if len(environment.immutable_store.records) != 5 or len(environment.immutable_store.receipts) != 1: raise AssertionError("LIVE ingress was not one atomic five-record transaction") projection = identity_projection(environment, conformance.first) if projection["scope"]["exact_record_order"] != [ @@ -670,9 +635,7 @@ def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("--emit-projection", action="store_true") args = parser.parse_args() - projection, _, _ = asyncio.run( - run_acceptance(assert_expected=not args.emit_projection) - ) + projection, _, _ = asyncio.run(run_acceptance(assert_expected=not args.emit_projection)) print(json.dumps(projection, indent=2, sort_keys=True)) diff --git a/scripts/public_demo.py b/scripts/public_demo.py old mode 100644 new mode 100755 index fbef1da..2cf5c9b --- a/scripts/public_demo.py +++ b/scripts/public_demo.py @@ -13,9 +13,10 @@ import asyncio import html import json +from collections.abc import Sequence from pathlib import Path from string import Template -from typing import Any, Sequence +from typing import Any try: from scripts.p2b_independent_case_brief import ( @@ -45,12 +46,8 @@ "scenario_id": "meridia_reservoir_release_72h", "case_id": "case:412426eee708d56f6bda931ccf9e5d8b", "brief_id": "brief:25d8232c9bfa27050bdcb160fb75f06c", - "status_projection_id": ( - "brief_derivation_family_status_projection:3500889a2d75af7a5484a681afbee34c" - ), - "impact_projection_id": ( - "supersession_impact_projection:f3723de8e9ac5c4390c5c46137f3765e" - ), + "status_projection_id": ("brief_derivation_family_status_projection:3500889a2d75af7a5484a681afbee34c"), + "impact_projection_id": ("supersession_impact_projection:f3723de8e9ac5c4390c5c46137f3765e"), "impacted_resources": 11, "impacted_claims": 9, "direct": 6, @@ -109,12 +106,8 @@ async def collect_demo_data() -> dict[str, Any]: admission = world["admission"] brief = admission.brief status_projection = admission.status_projection - status_by_claim = { - str(item.claim_id): item for item in status_projection.claim_statuses - } - citation_sources = { - str(item.citation_id): str(item.source_ref) for item in brief.citations - } + status_by_claim = {str(item.claim_id): item for item in status_projection.claim_statuses} + citation_sources = {str(item.citation_id): str(item.source_ref) for item in brief.citations} claims: list[dict[str, Any]] = [] for section, claim in zip(SECTION_TITLES, brief.claims, strict=True): @@ -127,9 +120,7 @@ async def collect_demo_data() -> dict[str, Any]: "status": status.status_id, "grounding_kind": claim.grounding_kind.value, "confidence": claim.confidence, - "cited_sources": [ - citation_sources[str(citation_id)] for citation_id in claim.citation_ids - ], + "cited_sources": [citation_sources[str(citation_id)] for citation_id in claim.citation_ids], "support_record_ids": list(status.support_record_ids), "distinct_derivation_families": status.distinct_derivation_family_count, "required_derivation_families": status.required_distinct_derivation_families, @@ -188,9 +179,7 @@ async def collect_demo_data() -> dict[str, Any]: } }, "corroboration": { - "claim_id": next( - item["claim_id"] for item in claims if item["status"] == "corroborated" - ), + "claim_id": next(item["claim_id"] for item in claims if item["status"] == "corroborated"), "required_distinct_roots": 2, "observed_distinct_roots": 2, "publisher_count_is_independence": False, @@ -216,9 +205,7 @@ async def collect_demo_data() -> dict[str, Any]: "unaffected": ledger["unaffected_count"], "max_depth": ledger["max_depth"], "closure_size": ledger["closure_size"], - "impact_means_dependency_not_falsehood": impact["proven"][ - "impact_is_dependency_not_falsehood" - ], + "impact_means_dependency_not_falsehood": impact["proven"]["impact_is_dependency_not_falsehood"], }, "historical_integrity": impact["historical_integrity"], "governance": { @@ -271,11 +258,11 @@ def _claim_rows(data: dict[str, Any]) -> str: "scenario": "uncertain", }.get(claim["status"], "neutral") rows.append( - "
" - f"
{_e(claim['status'].replace('_', ' '))}" - f"{_e(claim['section'])}
" + '
' + f'
{_e(claim["status"].replace("_", " "))}' + f'
' f"

{_e(claim['statement'])}

" - f"{_e(source_text)}" + f'{_e(source_text)}' "
" ) return "".join(rows) @@ -289,8 +276,8 @@ def _identity_rows(data: dict[str, Any]) -> str: ("IMPACT", "impact_projection_id"), ) return "".join( - f"
{label}" - f"{_e(_short(data['identities'][key], 22, 9))}
" + f'
{label}' + f'{_e(_short(data["identities"][key], 22, 9))}
' for label, key in labels ) @@ -403,9 +390,7 @@ async def write_demo(output_dir: Path) -> tuple[Path, Path, dict[str, Any]]: def _parser() -> argparse.ArgumentParser: - parser = argparse.ArgumentParser( - description="Generate the frozen ACE World Intelligence public proof surface." - ) + parser = argparse.ArgumentParser(description="Generate the frozen ACE World Intelligence public proof surface.") parser.add_argument( "--output-dir", type=Path, From 68c5bfe16a43113a123c173080c25b5692c467c4 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 07:01:19 -0700 Subject: [PATCH 5/5] docs(world): freeze artifact convergence evidence --- README.md | 3 + .../measured-intelligence/convergence-v1.json | 139 ++++++++++++++++++ ...lligence-release-convergence-2026-08-11.md | 90 ++++++++++++ 3 files changed, 232 insertions(+) create mode 100644 artifacts/measured-intelligence/convergence-v1.json create mode 100644 docs/audits/world-measured-intelligence-release-convergence-2026-08-11.md diff --git a/README.md b/README.md index aaf5b71..f1bc0cc 100644 --- a/README.md +++ b/README.md @@ -416,6 +416,9 @@ The bounded installed-Core artifact convergence packet is frozen in [`docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md`](docs/design/world-measured-intelligence-release-convergence-work-packet-v1.md). It generates one canonical machine-readable P2C10 result without importing Core from a checkout; it is candidate evidence, not a release or SI4 pass. +The point-in-time [convergence audit](docs/audits/world-measured-intelligence-release-convergence-2026-08-11.md) +binds the exact built-artifact hashes and byte-reproducible +[`convergence-v1.json`](artifacts/measured-intelligence/convergence-v1.json). Release-level scope and evidence are recorded in [`docs/releases/world-intelligence-p2c2-v0.9.0.md`](docs/releases/world-intelligence-p2c2-v0.9.0.md), diff --git a/artifacts/measured-intelligence/convergence-v1.json b/artifacts/measured-intelligence/convergence-v1.json new file mode 100644 index 0000000..cec945b --- /dev/null +++ b/artifacts/measured-intelligence/convergence-v1.json @@ -0,0 +1,139 @@ +{ + "candidate_identity": { + "action_adapter_distribution_version": "0.1.0", + "artifacts": { + "action_adapter_wheel": { + "filename": "ace_reference_workspace_action-0.1.0-py3-none-any.whl", + "sha256": "sha256:9c600d4b3e0d19525f1e04629bd231d8d6913d2ad11bc63fa2858e7da396f8f1" + }, + "core_wheel": { + "filename": "ace_core-0.5.0-py3-none-any.whl", + "sha256": "sha256:29752aa751570286794ff2abd1071a43f622883d4778e161687e10363f76f6c3" + }, + "source_adapter_wheel": { + "filename": "ace_ext_world_federal_register_source-0.2.0-py3-none-any.whl", + "sha256": "sha256:bee0161c6a02b2d82b698d72365e401e7c58af633c8f0e774e513619866a90d6" + }, + "world_wheel": { + "filename": "ace_domain_world_intelligence-0.9.0-py3-none-any.whl", + "sha256": "sha256:61abbd08bfedb2dc23cdd0eab8b9a0454b7d7a911ba150e4308e12d9e1cfa534" + } + }, + "core_commit": "433e3d16c5458c975557dcd1552824fb959d4d12", + "core_distribution_version": "0.5.0", + "source_adapter_distribution_version": "0.2.0", + "world_commit": "7fec49b163fd4c50964576a45511c8645e856f3d", + "world_distribution_version": "0.9.0" + }, + "claim_boundary": { + "ace_0_6_complete": false, + "association_not_causality": true, + "human_benefit_claimed": false, + "population_performance_claimed": false, + "recorded_replay_not_live_monitoring": true, + "si4_passed": false + }, + "contract": "ace.world-intelligence.measured-intelligence-release-convergence/v1", + "governed_feedback": { + "applied": false, + "historical_replay": true, + "live_effect": false, + "proposed_action": "promote", + "replay_reauthorized": false, + "requires_human_review": true, + "selectable": false + }, + "matched_comparison": { + "control": { + "artifact_key": "bls-jolts-correction:control:USDL-25-1087", + "correction_link_visible": true, + "correction_record_id": "bls-errata-2025-07-01-jolts", + "correction_relation": "corrects", + "corrects_source_record_id": "USDL-25-1087", + "displayed_statement": "The number of job openings decreased in federal government (39,000).", + "limitations": [ + "historical_original_form_derived_from_public_erratum", + "one_recorded_bls_correction_not_population_performance", + "recorded_replay_not_live_monitoring", + "statement_quality_not_statistical_validity_or_human_benefit" + ], + "prior_record_preserved": true, + "source_coverage_complete": true, + "source_family": "bls_public_errata", + "source_release_id": "USDL-25-1087" + }, + "control_scores": [ + 0.0, + 0.0 + ], + "treatment": { + "artifact_key": "bls-jolts-correction:treatment:USDL-25-1087", + "correction_link_visible": true, + "correction_record_id": "bls-errata-2025-07-01-jolts", + "correction_relation": "corrects", + "corrects_source_record_id": "USDL-25-1087", + "displayed_statement": "The number of job openings decreased in federal government (−39,000).", + "limitations": [ + "historical_original_form_derived_from_public_erratum", + "one_recorded_bls_correction_not_population_performance", + "recorded_replay_not_live_monitoring", + "statement_quality_not_statistical_validity_or_human_benefit" + ], + "prior_record_preserved": true, + "source_coverage_complete": true, + "source_family": "bls_public_errata", + "source_release_id": "USDL-25-1087" + }, + "treatment_scores": [ + 1.0, + 1.0 + ] + }, + "measured_result": { + "classification": "useful", + "limitations": [ + "classification_is_bounded_to_the_exact_target_control_criterion_and_cutoff", + "historical_original_form_derived_from_public_erratum", + "one_recorded_bls_correction_not_population_performance", + "paired_association_under_product_defined_conditions_does_not_by_itself_establish_causality", + "proposal_requires_separate_human_review_and_has_no_live_effect", + "recorded_replay_not_live_monitoring", + "statement_quality_not_statistical_validity_or_human_benefit" + ], + "matched_pair_count": 2, + "mean_effect": 1.0, + "uncertainty": null + }, + "product_policy": { + "policy_id": "world_independent_official_correction_statement_quality", + "policy_version": "candidate-1", + "reviewer_ref": "principal:world-independent-correction-reviewer", + "score_rule": "1 only when exact source coverage, correction linkage, prior-record preservation, corrected statement, and stale-form removal all pass; otherwise 0" + }, + "public_source_pair": { + "correction": { + "payload_contract": "ace.intelligence.observation/v1alpha1", + "record_key": "observation:3a1351d6ac306374b8a5b472c192d2b9" + }, + "fixture_digest": "sha256:981183a2464f74f4421bd0a6470f0342a5abae8cfebc1b5a8da1562df26babb1", + "fixture_id": "bls-jolts-may-2025-minus-sign-correction", + "original": { + "payload_contract": "ace.intelligence.observation/v1alpha1", + "record_key": "observation:faf25d26cc88802368cabf3e17538a7d" + }, + "source_policy": { + "errata_uri": "https://www.bls.gov/errata/", + "historical_original_form_derived_from_erratum": true, + "publisher": "U.S. Bureau of Labor Statistics", + "recorded_replay": true, + "release_uri": "https://www.bls.gov/news.release/archives/jolts_07012025.htm", + "source_family": "bls_public_errata", + "statistical_validity_claimed": false + } + }, + "runtime": { + "candidate_contract_available": true, + "core_import_mode": "installed_distribution_outside_core_checkout", + "network_access": false + } +} diff --git a/docs/audits/world-measured-intelligence-release-convergence-2026-08-11.md b/docs/audits/world-measured-intelligence-release-convergence-2026-08-11.md new file mode 100644 index 0000000..86e8478 --- /dev/null +++ b/docs/audits/world-measured-intelligence-release-convergence-2026-08-11.md @@ -0,0 +1,90 @@ +# World measured-intelligence release-convergence audit — 2026-08-11 + +**Status:** bounded candidate artifact evidence. This is not a World or Core release, an SI4 pass, +ACE 0.6.0 completion, live-monitoring evidence, or an applied governance change. + +## Source and artifact identity + +- Core source: `433e3d16c5458c975557dcd1552824fb959d4d12` +- World generator and release-hygiene source: `7fec49b163fd4c50964576a45511c8645e856f3d` +- World branch: `codex/world-measured-intelligence-release-convergence` +- Canonical record: + `artifacts/measured-intelligence/convergence-v1.json` +- Canonical record SHA-256: + `c91359485418be85c6740462bce3c2afd5c8eca6250c7288669c0cdff07a4da9` + +The candidate wheels were built with `SOURCE_DATE_EPOCH` set to their exact source-commit time: + +| Artifact | Version | SHA-256 | +|---|---:|---| +| `ace_core-0.5.0-py3-none-any.whl` | 0.5.0 candidate | `29752aa751570286794ff2abd1071a43f622883d4778e161687e10363f76f6c3` | +| `ace_reference_workspace_action-0.1.0-py3-none-any.whl` | 0.1.0 | `9c600d4b3e0d19525f1e04629bd231d8d6913d2ad11bc63fa2858e7da396f8f1` | +| `ace_ext_world_federal_register_source-0.2.0-py3-none-any.whl` | 0.2.0 | `bee0161c6a02b2d82b698d72365e401e7c58af633c8f0e774e513619866a90d6` | +| `ace_domain_world_intelligence-0.9.0-py3-none-any.whl` | 0.9.0 candidate | `61abbd08bfedb2dc23cdd0eab8b9a0454b7d7a911ba150e4308e12d9e1cfa534` | + +No version was advanced and no artifact was published. The Core candidate intentionally still +reports 0.5.0; its full source commit and wheel hash distinguish it from the released 0.5.0 wheel. + +## Installed-artifact reproduction + +A fresh Python 3.12 environment installed all four local wheels plus their public dependencies. In +that environment, `ace`, the reference action adapter, and the Federal Register source adapter all +imported from `site-packages`. The generator declared both Core worktrees and the primary Core +workspace forbidden; it would fail if `ace` resolved beneath any of them. + +The installed candidate reran the complete append-only P2C2-P2C10 World journey twice from fresh +workspace roots. Both runs emitted byte-identical canonical JSON: + +```text +sha256:c91359485418be85c6740462bce3c2afd5c8eca6250c7288669c0cdff07a4da9 +``` + +The record preserves the exact public BLS fixture digest and stable Observation keys, product +policy version and scoring rule, matched treatment/control statements and scores, `useful` +classification, two matched pairs, mean effect `1.0`, proposal-only `promote`, and historical +replay without reauthorization. It deliberately excludes runtime availability/material digests +that change across honest fresh hosts. + +## Verification + +```text +# P2C3-P2C10 plus convergence controls +33 passed in 13.95s + +# complete World domain suite after release-hygiene reconciliation +116 passed in 35.57s + +# separately packaged Federal Register source adapter +26 passed in 0.37s + +# unchanged 0.9.0 package/release contract +7 passed in 0.05s + +ruff 0.16.2 check --no-cache . +All checks passed! + +ruff 0.16.2 format --check --no-cache . +84 files already formatted + +git diff --check +PASS +``` + +The repository-wide gate began with 17 lint findings and 20 formatting targets inherited from the +P2C10 parent. The mechanical hygiene commit sorted imports, marked shebang-bearing scripts +executable, documented two intentional fail-closed broad catches, used Python 3.12 native `Z` +parsing, applied the locked formatter, and refreshed only exact hashes whose pinned bytes changed. +The full suite proves that no expected outcome or public identity changed. + +## Claim boundary and remaining release work + +This result is a deterministic association under one frozen World correction rule. It is not +causality, population correction performance, JOLTS statistical validation, live freshness, +general source independence, general SI4 completion, or human benefit. The `promote` proposal is +non-effective, non-selectable, unapplied, and still requires separate Core authority. + +The independent Market candidate exists at +`cd1f2f2c862e5665344e47885f594a77c5aaa59b`, but it remains separately reviewed candidate evidence. +Core combined verification, security review, merge-order review, final release artifacts, and +publication remain open. Core issue #49 F1, F3, and F5 are open 0.6 release gates; this packet does +not waive, defer, resolve, or re-date them.