From 6f474a28cd7728f9f47742bd581ba22db90f958c Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Mon, 10 Aug 2026 14:26:19 -0700 Subject: [PATCH 01/17] feat: prove measured feedback over World journey --- README.md | 25 +- ROADMAP.md | 13 + ...gence-p2c3-measured-feedback-2026-08-10.md | 103 +++ ...e-p2c3-measured-feedback-work-packet-v1.md | 104 +++ .../tests/test_p2c3_measured_feedback.py | 54 ++ scripts/p2c2_governed_reality_brief.py | 28 +- scripts/p2c3_measured_feedback.py | 766 ++++++++++++++++++ 7 files changed, 1088 insertions(+), 5 deletions(-) create mode 100644 docs/audits/world-intelligence-p2c3-measured-feedback-2026-08-10.md create mode 100644 docs/design/world-intelligence-p2c3-measured-feedback-work-packet-v1.md create mode 100644 domain_packs/tests/test_p2c3_measured_feedback.py create mode 100644 scripts/p2c3_measured_feedback.py diff --git a/README.md b/README.md index af23433..414d410 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,19 @@ action authority; the export is provided by Core's separately packaged reference source responses are exact official public records under recorded transport, so P2C2 proves the complete deterministic product journey but still does not claim network freshness at test time. +P2C3 is a source-checkout candidate over that unchanged public journey. It compares two exact +reviewed exports of the cited Brief with two reviewed exports of a World-owned source-only control. +The frozen product measure is the fraction of the two required admitted Observation identities +preserved in each exported artifact: treatment scores `1.0, 1.0`; control scores `0.0, 0.0`. Under +the declared minimum of two matched pairs and useful-effect threshold of `0.5`, Core + Intelligence +classifies the exact result as `useful` and appends a `promote` proposal that is non-effective, +non-selectable, and requires separate human review. Historical replay performs no reauthorization. + +That measure is structural citation coverage. It is not a human-benefit measure, causal estimate, +general Brief-quality score, or network-freshness proof. The proposal is not applied. P2C3 depends +on the unreleased Core candidate in [PR #88](https://github.com/augmented-cognition-engine/core/pull/88), +so World 0.9.0 and its `ace-core>=0.5.0,<0.6` release contract remain unchanged. + ## What the public World proof demonstrates Generate a self-contained visual Reality Brief and its exact machine-readable backing data: @@ -294,6 +307,9 @@ $PY -m scripts.ai_command_center_live_acceptance # Complete official-record -> Shift -> Signal -> Brief -> reviewed export journey WORKSPACE=$(mktemp -d) $PY -m scripts.p2c2_governed_reality_brief "$WORKSPACE" + +# Candidate measured Outcome -> governed-feedback extension (requires Core PR #88 source) +$PY -m scripts.p2c3_measured_feedback "$WORKSPACE" ``` The released 0.9.0 gates are reproducible through the locked environment, as CI does. The @@ -333,6 +349,8 @@ The complete governed product-journey evidence is recorded in [`docs/audits/world-intelligence-p2c2-governed-reality-brief-2026-08-10.md`](docs/audits/world-intelligence-p2c2-governed-reality-brief-2026-08-10.md). The two-lineage LIVE Shift → Signal → Case → cited Brief proof is recorded in [`docs/audits/world-intelligence-ai-command-center-live-2026-08-10.md`](docs/audits/world-intelligence-ai-command-center-live-2026-08-10.md). +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). 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), @@ -363,9 +381,10 @@ publishing, delivery, persuasion, or other external-action authority. The [World Intelligence roadmap](ROADMAP.md) owns current domain direction. Detailed packet history remains in [`docs/world-intelligence-roadmap-status-2026-08-06.md`](docs/world-intelligence-roadmap-status-2026-08-06.md), -and release history is in [`CHANGELOG.md`](CHANGELOG.md). The next bounded work is P2D -multi-source conflict/correction with LIVE inputs. It may not add autonomous publishing, delivery, -persuasion, or action authority to a Domain Pack. +and release history is in [`CHANGELOG.md`](CHANGELOG.md). The next bounded work is a separately +reviewed disposition of the P2C3 non-effective proposal plus a separately reviewed opt-in network +transport and P2D multi-source conflict/correction with LIVE inputs. None of these steps may add +autonomous publishing, delivery, persuasion, or action authority to a Domain Pack. ## Community and security diff --git a/ROADMAP.md b/ROADMAP.md index 67bbf9c..90772b8 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -16,6 +16,19 @@ source code into the platform. See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). +## Candidate — P2C3 measured feedback over the public journey + +- 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. +- Exact material-use receipts, Decisions, reviewed Actions, terminal results, observed Outcomes, + conditions, and cutoff feed the domain-neutral Core + Intelligence measured-impact contract. +- The candidate classifies the bounded result as useful and appends only a non-effective, + non-selectable promote proposal; exact replay performs no reauthorization. +- This is source-checkout evidence against Core PR #88, not a released World capability, human + benefit finding, causal claim, network-freshness proof, or applied governance change. + +See the [P2C3 candidate work packet](docs/design/world-intelligence-p2c3-measured-feedback-work-packet-v1.md). + ## Next — trustworthy live orientation - Add a separately reviewed, opt-in production transport without bundling it into the Domain Pack. diff --git a/docs/audits/world-intelligence-p2c3-measured-feedback-2026-08-10.md b/docs/audits/world-intelligence-p2c3-measured-feedback-2026-08-10.md new file mode 100644 index 0000000..26a4f36 --- /dev/null +++ b/docs/audits/world-intelligence-p2c3-measured-feedback-2026-08-10.md @@ -0,0 +1,103 @@ +# World Intelligence P2C3 measured-feedback candidate audit — 2026-08-10 + +Status: **candidate evidence only; not a release or applied governance change** + +## Source identity + +- World base: `0a2c0829923aabd0cf69e51c16293b534f41dab6` +- World branch: `codex/measured-intelligence-world-journey` +- Core dependency: PR [#88](https://github.com/augmented-cognition-engine/core/pull/88), commit + `9078018` +- Released World identity intentionally unchanged: `ace-domain-world-intelligence==0.9.0`, + `ace-core>=0.5.0,<0.6` + +## Exact acceptance result + +One candidate run reproduced the exact P2C2 target Brief +`brief:c98524e788bc6bcccbc354e7d81fcdb5` from Federal Register documents `2026-15932` and +`2026-16197`. Its two required admitted Observation keys were: + +- `observation:0ddeed52469da44bac7c94598e4b8fa7` +- `observation:66de839538acfb032dd4b0a84155c909` + +Two treatment reviewed exports retained both keys and scored `1.0, 1.0`. Two matched reviewed +exports of the exact source-only control retained neither and scored `0.0, 0.0`. Under criterion +`impact_criterion:world-official-observation-citation-coverage` version `candidate-1`, the result +was: + +```text +classification: useful +matched pairs: 2 +treatment mean: 1.0 +control mean: 0.0 +mean effect: 1.0 +95% deterministic interval: [1.0, 1.0] +proposal: promote +proposal live_effect: false +proposal selectable: false +proposal requires_human_review: true +historical replay: true +replay reauthorization: false +``` + +The run appended the evaluation and proposal as one exact measured-impact transaction. A fresh +service reopened it with an authorizer that raises on use, so the successful replay did not +reclassify evidence or obtain new authority. + +## Verification + +Source-checkout verification with Core PR #88 and the separately packaged reference action adapter: + +```text +python -B -m pytest domain_packs/tests/test_p2c3_measured_feedback.py -q --tb=short +2 passed in 0.55s + +python -B -m pytest -q --tb=short +85 passed in 14.81s + +python -B -m pytest adapters/federal_register_source/tests -q --tb=short +26 passed in 0.26s + +python -B -m pytest tests/test_release_contract.py -q --tb=short +7 passed in 0.03s + +ruff check scripts/p2c2_governed_reality_brief.py \ + scripts/p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c3_measured_feedback.py +PASS + +ruff format --check scripts/p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c3_measured_feedback.py +PASS + +git diff --check +PASS +``` + +Locked public-compatibility verification resolved `ace-core==0.5.0` without a Core checkout. The +focused candidate tests skipped explicitly because the unreleased contract was absent, and the +complete public-boundary suite stayed green: + +```text +P2C3 focused: 2 skipped +complete World: 82 passed, 3 skipped in 14.37s +``` + +The other skipped test is the existing P2C2 cross-repository acceptance, whose independently +packaged reference adapter is intentionally absent from the root lock. The source-checkout run +above executes that test and both P2C3 tests. + +`uv build` produced exactly the unchanged 0.9.0 source distribution and wheel in a temporary +directory. The release-contract suite confirms the wheel mapping remains inert JSON Domain Pack +material and excludes candidate scripts, tests, adapters, and audit documentation. + +## Claim boundary + +This record proves one product-defined structural comparison over exact official-public-data +lineage, reviewed actions, observed Outcomes, and governed feedback machinery. It does not prove +human benefit, causality, citation correctness, legal effect, general Brief quality, live network +freshness, autonomous publication, or effective promotion. The source-only control is deliberately +bounded and the two pairs are deterministic fixtures. The proposal was not applied. + +The next packet is a separately authorized human disposition of this exact proposal. Broader World +measurement and live transport remain independent work. diff --git a/docs/design/world-intelligence-p2c3-measured-feedback-work-packet-v1.md b/docs/design/world-intelligence-p2c3-measured-feedback-work-packet-v1.md new file mode 100644 index 0000000..107cd4e --- /dev/null +++ b/docs/design/world-intelligence-p2c3-measured-feedback-work-packet-v1.md @@ -0,0 +1,104 @@ +# P2C3 — measured feedback over the official-record Reality Brief + +Status: **source-checkout candidate; not released and not applied** + +Frozen: 2026-08-10 from World `main` at +`0a2c0829923aabd0cf69e51c16293b534f41dab6` and Core PR +[#88](https://github.com/augmented-cognition-engine/core/pull/88) at +`9078018`. + +## Objective + +Extend the already released P2C2 public-data path through one bounded observed Outcome and governed +feedback result without changing the Domain Pack, released package identity, or layer boundary: + +```text +official records -> Observation -> Shift -> Signal -> Brief -> Decision + -> reviewed Action -> observed Outcome -> measured evaluation + -> non-effective governance proposal +``` + +This packet proves that a World-owned criterion and control can drive the unchanged domain-neutral +Core + Intelligence measured-impact contracts. It does not complete ACE 0.6.0 or promote World +Intelligence beyond 0.9.0. + +## Frozen scenario, criterion, and control + +The target is the exact LIVE Reality Brief already derived from Federal Register documents +`2026-15932` and `2026-16197`. The control is a separately persisted World artifact that names the +same two source documents but intentionally omits routed context, interpretive claims, exact +admitted Observation identities, and citation linkage. + +World owns the structural measure `official_observation_citation_coverage`: the fraction of the two +required exact admitted Observation record keys present in a reviewed exported artifact. The +criterion is frozen before the measured actions, uses higher-is-better direction, requires two +matched pairs, and maps an interval whose lower bound is at least `0.5` to a non-effective promote +proposal. Harm at `-0.5` maps to rollback. Unproven maps to no proposal. + +Each pair shares exact route, task, observation window, recorded-transport status, and required +Observation count. Treatment and control use distinct material-use receipts, Decisions, reviews, +Action admissions, terminals, and Outcomes. In the frozen fixture, treatment scores are `1.0, 1.0` +and control scores are `0.0, 0.0`. + +## Ownership boundary + +| Layer | Owns here | Does not own here | +|---|---|---| +| Core | immutable coordinates and append, governed authority, Decision, reviewed Action, terminal result, Outcome, exact replay | Federal Register, citation-coverage meaning, World thresholds or control policy | +| Intelligence | neutral conditions, evidence, useful/harmful/unproven evaluation, uncertainty and non-effective proposal | World nouns, sources, product claims or proposal application | +| World product | public scenario, structural measure, matched control, thresholds, limitations and evidence | storage, hidden execution, authority resolution or silent promotion | + +The shipped JSON Domain Pack remains unchanged and inert. Source acquisition and the create-only +workspace effect remain separately packaged adapters. + +## Acceptance gates + +1. Reproduce the released P2C2 Observation through reviewed Action journey from the two exact + recorded official-public source responses. +2. Persist the exact target and source-only control and create two distinct reviewed export pairs. +3. Bind every variant to exact material-use attribution, Decision, review, admission, terminal + result, observed Outcome, conditions, criterion head, and cutoff. +4. Measure structural coverage from the reviewed artifact itself rather than accepting a caller + label. +5. Classify the two matched pairs as useful with treatment mean `1.0`, control mean `0.0`, and + effect interval `[1.0, 1.0]` under the frozen criterion. +6. Append only a non-effective, non-selectable promote proposal that requires human review. +7. Reopen the exact evaluation and proposal through a fresh service whose authorizer fails if + called, proving historical replay rather than reclassification. +8. Keep human benefit, causality, network freshness, autonomous publication, and proposal + application explicitly false. +9. Pass focused P2C2/P2C3, complete World, connector, release-contract, lint, and diff checks. + +## Explicit limits and non-claims + +- The source responses are exact official public records under recorded transport; the test does + not make a live network request or prove freshness. +- Exact Observation identifiers in an export establish structural citation coverage, not citation + correctness, contradiction recall, calibration, attention value, customer value, or practical + benefit. +- Two deterministic matched fixture pairs are a product-rule demonstration, not a population + estimate or causal study. +- Action success does not imply a useful Outcome; the separate exact Outcome records carry the + declared measure. +- The promote proposal has no live effect and cannot make the Brief selectable. P2C2's earlier + action-promotion receipt concerns adoption of that exact action result, not this measured-impact + proposal. +- No 0.6 package, schema, release window, tag, wheel, or public capability is claimed. + +## Files and rollback + +This packet owns the P2C3 harness/test, the additive P2C2 acceptance-state handoff, this work packet, +its audit record, and restrained README/roadmap references. It does not edit shipped pack material, +connectors, version metadata, lock state, or release records. + +Rollback removes those additive files/references and the optional state handoff. Durable evaluation +and proposal records, if produced by a host, remain immutable non-effective audit history. + +## Remaining public journey + +The next bounded packet must submit the exact non-effective proposal to a separate human/Core +authority path and record an explicit accept or reject disposition without self-certification. A +later outcome packet must add independently reviewed product measures such as citation correctness, +contradiction coverage, correction quality, detection delay, or false-alert rate before making any +broader usefulness claim. Opt-in network transport and P2D multi-source correction remain separate +work and must not be smuggled into this packet. diff --git a/domain_packs/tests/test_p2c3_measured_feedback.py b/domain_packs/tests/test_p2c3_measured_feedback.py new file mode 100644 index 0000000..e78bd99 --- /dev/null +++ b/domain_packs/tests/test_p2c3_measured_feedback.py @@ -0,0 +1,54 @@ +from __future__ import annotations + +import importlib.util + +import pytest + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact") is None: + pytest.skip("P2C3 candidate requires the ACE Core measured-impact contract from PR #88") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("P2C3 candidate requires the separately packaged Core reference adapter") + + +@pytest.mark.asyncio +async def test_official_record_brief_reaches_measured_proposal_only_feedback(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c3_measured_feedback import run_measured_feedback + + result = await run_measured_feedback(tmp_path) + + assert result["journey"]["intelligence"]["shift_type"] == "official_publication_change" + assert result["journey"]["intelligence"]["signal_type"] == "official_publication" + assert result["journey"]["intelligence"]["citation_count"] == 2 + assert result["controls"]["treatment_scores"] == (1.0, 1.0) + assert result["controls"]["control_scores"] == (0.0, 0.0) + assert result["evaluation"]["classification"] == "useful" + assert result["evaluation"]["matched_pair_count"] == 2 + assert result["evaluation"]["mean_effect"] == 1.0 + assert result["proposal"]["action"] == "promote" + assert result["proposal"]["live_effect"] is False + assert result["proposal"]["selectable"] is False + assert result["proposal"]["requires_human_review"] is True + assert result["replay"]["historical"] is True + assert result["replay"]["no_reauthorization"] is True + + +@pytest.mark.asyncio +async def test_measured_world_journey_keeps_its_claim_boundary_explicit(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c3_measured_feedback import run_measured_feedback + + result = await run_measured_feedback(tmp_path) + + assert result["scope"] == { + "official_public_records": True, + "recorded_transport": True, + "network_freshness_claimed": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + } + assert "structural" in " ".join(result["evaluation"]["limitations"]) diff --git a/scripts/p2c2_governed_reality_brief.py b/scripts/p2c2_governed_reality_brief.py index bffcc72..3e46e93 100644 --- a/scripts/p2c2_governed_reality_brief.py +++ b/scripts/p2c2_governed_reality_brief.py @@ -439,7 +439,11 @@ async def _record_decision( return decision, record.reference(), receipt -async def run_acceptance(workspace_root: Path) -> dict[str, Any]: +async def run_acceptance( + workspace_root: Path, + *, + state_sink: dict[str, Any] | None = None, +) -> dict[str, Any]: environment = await build_environment() admissions = await admit_snapshots(environment) baseline, current = admissions @@ -608,7 +612,7 @@ async def run_acceptance(workspace_root: Path) -> dict[str, Any]: if not action_replay.replayed: raise AssertionError("reviewed action did not reopen without a second effect") - return { + result = { "contract": "ace.world-intelligence.governed-reality-brief-action/v1alpha1", "source": source_projection(admissions), "intelligence": { @@ -652,6 +656,26 @@ async def run_acceptance(workspace_root: Path) -> dict[str, Any]: "political_persuasion": False, }, } + if state_sink is not None: + state_sink.update( + { + "environment": environment, + "admissions": admissions, + "runtime": runtime, + "reasoning": reasoning, + "append_binding": append_binding, + "action_binding": action_binding, + "clock": clock, + "brief_admission": brief, + "decision": decision, + "decision_ref": decision_ref, + "review": review, + "action_outcome": outcome, + "review_service": review_service, + "written": written, + } + ) + return result def main() -> None: diff --git a/scripts/p2c3_measured_feedback.py b/scripts/p2c3_measured_feedback.py new file mode 100644 index 0000000..35d7eb9 --- /dev/null +++ b/scripts/p2c3_measured_feedback.py @@ -0,0 +1,766 @@ +"""Measured feedback over the exact P2C2 public-record Reality Brief journey.""" + +from __future__ import annotations + +import asyncio +import json +from dataclasses import dataclass +from datetime import datetime, timedelta +from pathlib import Path +from typing import Any + +from ace.application import MeasuredImpactService +from ace.core import ( + ActionIntentV1Alpha1, + ActionReviewDisposition, + ActionVerificationDisposition, + AppendOnlyTransactionRequestV1, + CapabilityArtifactIdentityV1Alpha1, + ContextBindingV1Alpha1, + ContextUseReceiptV1Alpha1, + DecisionActionDisposition, + DecisionDisposition, + DecisionIntentV1Alpha1, + DecisionV1Alpha1, + GovernedActionAuthorizationRequestV1Alpha1, + GovernedOperationBindingV1Alpha1, + GovernedStateHeadPreconditionV1Alpha1, + ImmutableRecordReferenceV1, + ImmutableRecordV1, + OutcomeIntentV1Alpha1, + OutcomeV1Alpha1, + canonical_hash, + canonical_json, + capability_state_ref_for_artifact, +) +from ace.intelligence import ( + ImpactClassification, + ImpactConditionsV1Alpha1, + ImpactCriterionV1Alpha1, + ImpactEvaluationRequestV1Alpha1, + ImpactEvidenceV1Alpha1, + ImpactGovernanceAction, + ImpactMetricDirection, + ImpactOutcomeMeasuresV1Alpha1, + ImpactTargetKind, +) +from ace_reference_workspace_action import ACTION_TYPE + +from scripts.p2c2_federal_register_monitor import _time +from scripts.p2c2_governed_reality_brief import ( + _activation_precondition, + _context, + _head, + run_acceptance, +) + +IMPACT_ARTIFACT = CapabilityArtifactIdentityV1Alpha1( + capability="measured_impact_evaluation", + contract="ace.application.measured-impact-service/v1alpha1", + implementation_id="world_measured_feedback_candidate", + implementation_version="0.1.0", + artifact_digest="sha256:" + "c" * 64, +) +OUTCOME_TYPE = "review_artifact_quality" +MEASURE_ID = "official_observation_citation_coverage" +CRITERION_ID = "impact_criterion:world-official-observation-citation-coverage" +CRITERION_FROZEN_AT = _time("2026-08-07T18:01:08Z") + + +@dataclass(frozen=True, slots=True) +class ReviewedExport: + decision: DecisionV1Alpha1 + decision_ref: ImmutableRecordReferenceV1 + intent: ActionIntentV1Alpha1 + review_ref: ImmutableRecordReferenceV1 + admission_ref: ImmutableRecordReferenceV1 + terminal_ref: ImmutableRecordReferenceV1 + terminal: Any + content: str + relative_path: str + + +@dataclass(frozen=True, slots=True) +class MeasuredVariant: + export: ReviewedExport + attribution_ref: ImmutableRecordReferenceV1 + outcome_ref: ImmutableRecordReferenceV1 + score: float + + +class _ReplayMustNotAuthorize: + async def authorize_action(self, request): + raise AssertionError(f"historical replay attempted new authorization: {request.authorization_key}") + + +def _digest(material: Any) -> str: + return f"sha256:{canonical_hash(material)}" + + +def _record_reference(store, *, kind: str, key: str) -> ImmutableRecordReferenceV1: + matches = [ + record.reference() + for record in store.records.values() + if record.record_kind == kind and record.record_key == key + ] + if len(matches) != 1: + raise AssertionError(f"expected one exact {kind} record for {key}, found {len(matches)}") + return matches[0] + + +async def _authorize_append( + state: dict[str, Any], + *, + context, + authorization_key: str, + subject_ref: str, + subject_digest: str, + requested_at: datetime, +): + environment = state["environment"] + append_binding = state["append_binding"] + return await state["reasoning"].authorize_action( + GovernedActionAuthorizationRequestV1Alpha1( + authorization_key=authorization_key, + product_id=environment.fixture["product_id"], + authenticated_context=context, + execution_binding=append_binding, + operation="append_immutable_records", + subject_ref=subject_ref, + subject_digest=subject_digest, + requested_at=requested_at, + required_state_preconditions=( + _activation_precondition(environment), + append_binding.state_head_precondition, + ), + ) + ) + + +async def _append_value( + state: dict[str, Any], + *, + value, + record_kind: str, + record_key: str, + transaction_key: str, + as_of: datetime, + authorization, +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + record = ImmutableRecordV1( + product_id=environment.fixture["product_id"], + record_space="world_intelligence", + record_kind=record_kind, + record_key=record_key, + payload_contract=value.contract, + payload=value.model_dump(mode="python"), + as_of=as_of, + available_at=authorization.authorized_at, + processing_order=0, + ) + append = AppendOnlyTransactionRequestV1( + product_id=record.product_id, + record_space=record.record_space, + transaction_key=transaction_key, + records=(record,), + submitted_at=record.available_at, + governed_state_preconditions=authorization.state_preconditions, + ) + receipt = await environment.store.append(append) + if receipt != append.receipt(): + raise AssertionError(f"{record_kind} append returned divergent receipt material") + return record.reference() + + +async def _append_control_artifact(state: dict[str, Any]) -> tuple[ImmutableRecordReferenceV1, str]: + environment = state["environment"] + brief_ref = state["brief_admission"].transaction_receipt.records[0] + content = ( + "# Official Record Review Baseline\n\n" + "Two Federal Communications Commission Federal Register items were admitted for review.\n\n" + "This source-only control intentionally omits exact admitted Observation identities, routed " + "context, interpretive claims, and citation linkage.\n" + ) + payload = { + "control_type": "source_only_review_artifact", + "content_markdown": content, + "document_numbers": ["2026-15932", "2026-16197"], + "limitations": [ + "recorded_transport_not_network_freshness", + "control_is_structural_not_a_human-benefit_baseline", + ], + } + requested_at = state["clock"]() + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key="append:world-source-only-control", + subject_ref="world_source_only_control:2026-15932:2026-16197", + subject_digest=_digest(payload), + requested_at=requested_at, + ) + record = ImmutableRecordV1( + product_id=environment.fixture["product_id"], + record_space="world_intelligence", + record_kind="brief_control", + record_key="brief_control:fcc-publication-change:2026-08-07", + payload_contract="ace.world-intelligence.source-only-control/v1alpha1", + payload=payload, + as_of=brief_ref.as_of, + available_at=authorization.authorized_at, + processing_order=0, + ) + append = AppendOnlyTransactionRequestV1( + product_id=record.product_id, + record_space=record.record_space, + transaction_key="world-source-only-control:2026-08-07", + records=(record,), + submitted_at=record.available_at, + governed_state_preconditions=authorization.state_preconditions, + ) + receipt = await environment.store.append(append) + if receipt != append.receipt(): + raise AssertionError("source-only control append returned divergent receipt material") + return record.reference(), content + + +async def _record_decision( + state: dict[str, Any], + *, + subject: ImmutableRecordReferenceV1, + pair_index: int, + variant: str, +) -> tuple[DecisionV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + decided_at = state["clock"]() + intent = DecisionIntentV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + subject=subject, + actor_role_ref="persona:public-researcher", + decision_type="matched_review_export", + disposition=DecisionDisposition.ACCEPT, + action_disposition=DecisionActionDisposition.AUTHORIZE_ACTION, + action_type=ACTION_TYPE, + rationale=( + f"Approve the exact {variant} review artifact for matched citation-coverage pair " + f"{pair_index}; this Decision does not judge beneficial impact." + ), + decided_at=decided_at, + ) + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"decision:measured-feedback:{pair_index}:{variant}", + subject_ref=str(intent.intent_id), + subject_digest=str(intent.intent_digest), + requested_at=decided_at, + ) + decision = DecisionV1Alpha1(intent=intent, authorization=authorization) + reference = await _append_value( + state, + value=decision, + record_kind="decision", + record_key=str(decision.decision_id), + transaction_key=f"decision:{decision.decision_id}", + as_of=decided_at, + authorization=authorization, + ) + return decision, reference + + +async def _run_reviewed_export( + state: dict[str, Any], + *, + subject: ImmutableRecordReferenceV1, + content: str, + pair_index: int, + variant: str, +) -> ReviewedExport: + environment = state["environment"] + decision, decision_ref = await _record_decision( + state, + subject=subject, + pair_index=pair_index, + variant=variant, + ) + relative_path = f"measured-feedback-pair-{pair_index}-{variant}.md" + intent = ActionIntentV1Alpha1( + action_key=f"action:world-measured-feedback:{pair_index}:{variant}", + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + decision=decision_ref, + action_type=ACTION_TYPE, + parameters_json=canonical_json( + { + "relative_path": relative_path, + "content": content, + } + ), + requested_at=decision_ref.available_at, + ) + service = state["review_service"] + prepared = await service.prepare_for_review(intent) + review = await service.review( + prepared, + review_key=f"review:world-measured-feedback:{pair_index}:{variant}", + reviewer_context=_context(environment.context, "principal:world-impact-reviewer"), + disposition=ActionReviewDisposition.APPROVE, + rationale=( + "The exact create-only path, content digest, and matched evaluation role are approved; " + "this review does not classify impact." + ), + ) + outcome = await service.execute_reviewed(review) + target = Path(state["workspace_root"]) / relative_path + written = target.read_text(encoding="utf-8") + if written != content: + raise AssertionError("matched review export differs from exact reviewed content") + await service.verify( + review, + outcome, + verification_key=f"verification:world-measured-feedback:{pair_index}:{variant}", + verifier_context=_context(environment.context, "principal:world-impact-verifier"), + disposition=ActionVerificationDisposition.VERIFIED, + rationale="The created file exists and exactly matches the reviewed artifact.", + ) + replay = await service.execute_reviewed(review) + if not replay.replayed: + raise AssertionError("matched reviewed action did not reopen without a second effect") + return ReviewedExport( + decision=decision, + decision_ref=decision_ref, + intent=intent, + review_ref=_record_reference( + environment.store, + kind="action_review", + key=str(review.receipt_id), + ), + admission_ref=outcome.admission_transaction.records[0], + terminal_ref=outcome.terminal_transaction.records[0], + terminal=outcome.terminal, + content=written, + relative_path=relative_path, + ) + + +def _existing_treatment_export(state: dict[str, Any]) -> ReviewedExport: + environment = state["environment"] + review = state["review"] + outcome = state["action_outcome"] + return ReviewedExport( + decision=state["decision"], + decision_ref=state["decision_ref"], + intent=review.intent, + review_ref=_record_reference( + environment.store, + kind="action_review", + key=str(review.receipt_id), + ), + admission_ref=outcome.admission_transaction.records[0], + terminal_ref=outcome.terminal_transaction.records[0], + terminal=outcome.terminal, + content=state["written"], + relative_path="world-reality-brief-2026-16197.md", + ) + + +async def _record_attribution( + state: dict[str, Any], + *, + export: ReviewedExport, + subject: ImmutableRecordReferenceV1, + pair_index: int, + variant: str, +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + recorded_at = state["clock"]() + use = ContextUseReceiptV1Alpha1( + product_id=environment.fixture["product_id"], + request_id=str(export.decision.intent.intent_id), + request_digest=str(export.decision.intent.intent_digest), + result_id=str(export.terminal.result.result_id), + result_digest=str(export.terminal.result.result_digest), + context=ContextBindingV1Alpha1( + context_id=f"context:world-measured-feedback:{pair_index}:{variant}", + context_digest=_digest( + { + "pair_index": pair_index, + "variant": variant, + "subject": subject.model_dump(mode="json"), + } + ), + storage_id=subject.storage_id, + material_digest=subject.material_hash, + as_of=subject.as_of, + available_at=subject.available_at, + ), + output_referenced=True, + recorded_at=recorded_at, + ) + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"attribution:world-measured-feedback:{pair_index}:{variant}", + subject_ref=str(use.receipt_id), + subject_digest=str(use.receipt_digest), + requested_at=recorded_at, + ) + return await _append_value( + state, + value=use, + record_kind="context_use", + record_key=str(use.receipt_id), + transaction_key=f"context-use:{use.receipt_id}", + as_of=recorded_at, + authorization=authorization, + ) + + +async def _record_outcome( + state: dict[str, Any], + *, + export: ReviewedExport, + observation_keys: tuple[str, ...], + pair_index: int, + variant: str, +) -> tuple[ImmutableRecordReferenceV1, float]: + environment = state["environment"] + score = sum(key in export.content for key in observation_keys) / len(observation_keys) + completed_at = export.terminal.result.completed_at + latency_ms = max( + 0, + int((completed_at - export.intent.requested_at).total_seconds() * 1_000), + ) + measures = ImpactOutcomeMeasuresV1Alpha1( + primary_value=float(score), + latency_ms=latency_ms, + cost_usd=0.0, + failure_count=0 if export.terminal.result.disposition.value == "succeeded" else 1, + degraded=False, + limitations=( + "citation_coverage_is_structural_not_a_human-benefit_measure", + "official_records_use_recorded_transport_not_network_freshness", + ), + ) + recorded_at = state["clock"]() + observer = _context(environment.context, "principal:world-outcome-observer") + intent = OutcomeIntentV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=observer, + decision=export.decision_ref, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + value_json=canonical_json(measures.model_dump(mode="json")), + observed_at=completed_at, + recorded_at=recorded_at, + ) + authorization = await _authorize_append( + state, + context=observer, + authorization_key=f"outcome:world-measured-feedback:{pair_index}:{variant}", + subject_ref=str(intent.intent_id), + subject_digest=str(intent.intent_digest), + requested_at=recorded_at, + ) + outcome = OutcomeV1Alpha1(intent=intent, authorization=authorization) + reference = await _append_value( + state, + value=outcome, + record_kind="outcome", + record_key=str(outcome.outcome_id), + transaction_key=f"outcome:{outcome.outcome_id}", + as_of=completed_at, + authorization=authorization, + ) + return reference, float(score) + + +async def _measure_variant( + state: dict[str, Any], + *, + export: ReviewedExport, + subject: ImmutableRecordReferenceV1, + observation_keys: tuple[str, ...], + pair_index: int, + variant: str, +) -> MeasuredVariant: + attribution_ref = await _record_attribution( + state, + export=export, + subject=subject, + pair_index=pair_index, + variant=variant, + ) + outcome_ref, score = await _record_outcome( + state, + export=export, + observation_keys=observation_keys, + pair_index=pair_index, + variant=variant, + ) + return MeasuredVariant( + export=export, + attribution_ref=attribution_ref, + outcome_ref=outcome_ref, + score=score, + ) + + +def _install_impact_policy(state: dict[str, Any]): + environment = state["environment"] + runtime = state["runtime"] + product_id = environment.fixture["product_id"] + criterion_head = _head(product_id, "impact_criterion", CRITERION_ID, 40) + operation_head = _head( + product_id, + "governed_operation_configuration", + "governed_operation_configuration:world-measured-feedback", + 41, + ) + impact_binding = GovernedOperationBindingV1Alpha1( + product_id=product_id, + artifact=IMPACT_ARTIFACT, + configuration_ref=operation_head.state_id, + authority="append_measured_impact", + grant_ref="authority_grant:world-measured-feedback", + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(operation_head), + ) + capability_head = _head( + product_id, + "capability_state", + capability_state_ref_for_artifact(IMPACT_ARTIFACT), + 42, + ) + authority_head = _head( + product_id, + "authority_grant", + impact_binding.grant_ref, + 43, + ) + for head in (criterion_head, operation_head, capability_head, authority_head): + environment.store.set_governed_state_head(head) + runtime.heads[head.state_kind, head.state_id] = head + runtime.bindings = (*runtime.bindings, impact_binding) + return criterion_head, impact_binding + + +async def run_measured_feedback(workspace_root: Path) -> dict[str, Any]: + """Run official records through matched Outcomes and proposal-only feedback.""" + + state: dict[str, Any] = {"workspace_root": workspace_root} + prior = await run_acceptance(workspace_root, state_sink=state) + environment = state["environment"] + target_ref = state["brief_admission"].transaction_receipt.records[0] + control_ref, control_content = await _append_control_artifact(state) + criterion_head, impact_binding = _install_impact_policy(state) + observation_refs = tuple( + record + for admission in state["admissions"] + for record in admission.transaction_receipt.records + if record.record_kind == "observation" + ) + observation_keys = tuple(sorted(item.record_key for item in observation_refs)) + if len(observation_keys) != 2: + raise AssertionError("measured World packet requires the two exact admitted Observations") + + treatment_exports = ( + _existing_treatment_export(state), + await _run_reviewed_export( + state, + subject=target_ref, + content=state["brief_admission"].brief.body_markdown, + pair_index=2, + variant="treatment", + ), + ) + control_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=control_ref, + content=control_content, + pair_index=index, + variant="control", + ) + for index in (1, 2) + ] + ) + treatments = tuple( + [ + await _measure_variant( + state, + export=export, + subject=target_ref, + observation_keys=observation_keys, + pair_index=index, + variant="treatment", + ) + for index, export in enumerate(treatment_exports, start=1) + ] + ) + controls = tuple( + [ + await _measure_variant( + state, + export=export, + subject=control_ref, + observation_keys=observation_keys, + pair_index=index, + variant="control", + ) + for index, export in enumerate(control_exports, start=1) + ] + ) + latest_observed_at = max( + *(item.export.terminal.result.completed_at for item in treatments), + *(item.export.terminal.result.completed_at for item in controls), + ) + window_end = latest_observed_at + timedelta(minutes=1) + evidence = [] + for index, (treatment, control) in enumerate(zip(treatments, controls, strict=True), start=1): + conditions = ImpactConditionsV1Alpha1( + product_id=environment.fixture["product_id"], + condition_key=f"world-official-record-review-pair:{index}", + route_id="world:fcc-official-publication-reviewed-export", + context_json=canonical_json( + { + "pair_index": index, + "recorded_transport": True, + "required_observation_count": len(observation_keys), + "task": "create_only_review_export", + } + ), + observation_window_start=CRITERION_FROZEN_AT + timedelta(seconds=1), + observation_window_end=window_end, + frozen_at=CRITERION_FROZEN_AT, + ) + evidence.append( + ImpactEvidenceV1Alpha1( + product_id=environment.fixture["product_id"], + evidence_key=f"world-measured-feedback:{index}", + treatment_attribution=treatment.attribution_ref, + control_attribution=control.attribution_ref, + treatment_decision=treatment.export.decision_ref, + control_decision=control.export.decision_ref, + treatment_action_review=treatment.export.review_ref, + treatment_action_admission=treatment.export.admission_ref, + treatment_action_terminal=treatment.export.terminal_ref, + control_action_review=control.export.review_ref, + control_action_admission=control.export.admission_ref, + control_action_terminal=control.export.terminal_ref, + treatment_outcome=treatment.outcome_ref, + control_outcome=control.outcome_ref, + treatment_conditions=conditions, + control_conditions=conditions, + ) + ) + criterion = ImpactCriterionV1Alpha1( + product_id=environment.fixture["product_id"], + criterion_id=CRITERION_ID, + criterion_version="candidate-1", + target_kind=ImpactTargetKind.INTELLIGENCE_ARTIFACT, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + metric_direction=ImpactMetricDirection.HIGHER_IS_BETTER, + useful_effect_threshold=0.5, + harmful_effect_threshold=0.5, + minimum_matched_pairs=2, + harmful_action=ImpactGovernanceAction.ROLLBACK, + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(criterion_head), + frozen_at=CRITERION_FROZEN_AT, + ) + cutoff_at = state["clock"]() + request = ImpactEvaluationRequestV1Alpha1( + evaluation_key="world-measured-feedback:fcc-publication-change:2026-08-07", + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + criterion=criterion, + target=target_ref, + control=control_ref, + evidence=tuple(evidence), + cutoff_at=cutoff_at, + requested_at=state["clock"](), + ) + service = MeasuredImpactService( + store=environment.store, + authorizer=state["reasoning"], + operation_binding=impact_binding, + ) + admission = await service.evaluate(request) + replay = await MeasuredImpactService( + store=environment.store, + authorizer=_ReplayMustNotAuthorize(), + operation_binding=impact_binding, + ).evaluate(request) + if ( + admission.replayed + or not replay.replayed + or replay + != admission.__class__( + evaluation=admission.evaluation, + proposal=admission.proposal, + transaction_receipt=admission.transaction_receipt, + replayed=True, + ) + ): + raise AssertionError("World measured feedback did not reopen exact historical material") + if admission.evaluation.classification is not ImpactClassification.USEFUL: + raise AssertionError("frozen World citation-coverage criterion did not classify useful") + if admission.proposal is None or admission.proposal.action is not ImpactGovernanceAction.PROMOTE: + raise AssertionError("useful World evaluation did not emit the product-mapped proposal") + + return { + "contract": "ace.world-intelligence.measured-feedback/v1alpha1", + "journey": prior, + "criterion": { + "criterion_id": criterion.criterion_id, + "criterion_digest": criterion.criterion_digest, + "measure_id": criterion.measure_id, + "minimum_matched_pairs": criterion.minimum_matched_pairs, + "useful_effect_threshold": criterion.useful_effect_threshold, + }, + "controls": { + "target": target_ref.model_dump(mode="json"), + "control": control_ref.model_dump(mode="json"), + "observation_keys": observation_keys, + "treatment_scores": tuple(item.score for item in treatments), + "control_scores": tuple(item.score for item in controls), + }, + "evaluation": admission.evaluation.model_dump(mode="json"), + "proposal": admission.proposal.model_dump(mode="json"), + "replay": { + "historical": replay.replayed, + "transaction_receipt_id": str(replay.transaction_receipt.receipt_id), + "no_reauthorization": True, + }, + "scope": { + "official_public_records": True, + "recorded_transport": True, + "network_freshness_claimed": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + }, + } + + +def main() -> None: + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + args = parser.parse_args() + print( + json.dumps( + asyncio.run(run_measured_feedback(args.workspace_root)), + indent=2, + sort_keys=True, + ) + ) + + +if __name__ == "__main__": + main() From 42ee03b7b998784d8c2a200bc08434dd8c9c0c20 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Mon, 10 Aug 2026 15:06:06 -0700 Subject: [PATCH 02/17] feat: prove reviewed impact disposition --- README.md | 21 ++- ROADMAP.md | 7 +- ...-reviewed-impact-disposition-2026-08-10.md | 103 +++++++++++ ...iewed-impact-disposition-work-packet-v1.md | 77 ++++++++ .../test_p2c4_reviewed_impact_disposition.py | 50 ++++++ scripts/p2c3_measured_feedback.py | 19 +- scripts/p2c4_reviewed_impact_disposition.py | 169 ++++++++++++++++++ 7 files changed, 439 insertions(+), 7 deletions(-) create mode 100644 docs/audits/world-intelligence-p2c4-reviewed-impact-disposition-2026-08-10.md create mode 100644 docs/design/world-intelligence-p2c4-reviewed-impact-disposition-work-packet-v1.md create mode 100644 domain_packs/tests/test_p2c4_reviewed_impact_disposition.py create mode 100644 scripts/p2c4_reviewed_impact_disposition.py diff --git a/README.md b/README.md index 414d410..ae45a47 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,13 @@ general Brief-quality score, or network-freshness proof. The proposal is not app on the unreleased Core candidate in [PR #88](https://github.com/augmented-cognition-engine/core/pull/88), so World 0.9.0 and its `ace-core>=0.5.0,<0.6` release contract remain unchanged. +P2C4 submits that exact proposal to a separate governed review path. A named, authenticated World +reviewer records `reject` with `no_action`: the bounded `useful` classification and `promote` +proposal remain immutable, and no governed head changes. The rationale rejects broader promotion +because structural coverage does not establish citation correctness, general Brief quality, human +benefit, causality, or live freshness. Exact replay returns the historical Decision without new +authorization. This is explicit disposition, not reclassification or proposal application. + ## What the public World proof demonstrates Generate a self-contained visual Reality Brief and its exact machine-readable backing data: @@ -310,6 +317,9 @@ $PY -m scripts.p2c2_governed_reality_brief "$WORKSPACE" # Candidate measured Outcome -> governed-feedback extension (requires Core PR #88 source) $PY -m scripts.p2c3_measured_feedback "$WORKSPACE" + +# Stacked candidate: explicit reject/no-action review of the exact proposal +$PY -m scripts.p2c4_reviewed_impact_disposition "$WORKSPACE" ``` The released 0.9.0 gates are reproducible through the locked environment, as CI does. The @@ -381,10 +391,13 @@ publishing, delivery, persuasion, or other external-action authority. The [World Intelligence roadmap](ROADMAP.md) owns current domain direction. Detailed packet history remains in [`docs/world-intelligence-roadmap-status-2026-08-06.md`](docs/world-intelligence-roadmap-status-2026-08-06.md), -and release history is in [`CHANGELOG.md`](CHANGELOG.md). The next bounded work is a separately -reviewed disposition of the P2C3 non-effective proposal plus a separately reviewed opt-in network -transport and P2D multi-source conflict/correction with LIVE inputs. None of these steps may add -autonomous publishing, delivery, persuasion, or action authority to a Domain Pack. +and release history is in [`CHANGELOG.md`](CHANGELOG.md). P2C4 now demonstrates a separately +authorized reject/no-action disposition of the P2C3 proposal without effective state change. The +next bounded measurement work is an independently reviewed product outcome such as citation +correctness, contradiction coverage, correction quality, detection delay, or false-alert rate. +Separately reviewed opt-in network transport and P2D multi-source conflict/correction with LIVE +inputs remain independent work. None of these steps may add autonomous publishing, delivery, +persuasion, or action authority to a Domain Pack. ## Community and security diff --git a/ROADMAP.md b/ROADMAP.md index 90772b8..c674e21 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 measured feedback over the public journey +## Candidate — P2C3/P2C4 measured feedback and reviewed disposition - 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. @@ -24,10 +24,15 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). conditions, and cutoff feed the domain-neutral Core + Intelligence measured-impact contract. - The candidate classifies the bounded result as useful and appends only a non-effective, non-selectable promote proposal; exact replay performs no reauthorization. +- A separate authenticated and authorized World reviewer rejects broader promotion with an exact + `no_action` Core Decision. The useful evaluation and promote proposal remain unchanged, and no + effective governed-state head changes. - This is source-checkout evidence against Core PR #88, not a released World capability, human benefit finding, causal claim, network-freshness proof, or applied governance change. 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) +freezes the exact proposal-disposition boundary. ## Next — trustworthy live orientation diff --git a/docs/audits/world-intelligence-p2c4-reviewed-impact-disposition-2026-08-10.md b/docs/audits/world-intelligence-p2c4-reviewed-impact-disposition-2026-08-10.md new file mode 100644 index 0000000..7ae5288 --- /dev/null +++ b/docs/audits/world-intelligence-p2c4-reviewed-impact-disposition-2026-08-10.md @@ -0,0 +1,103 @@ +# World Intelligence P2C4 reviewed impact disposition audit — 2026-08-10 + +Status: **stacked candidate evidence only; not a release or applied governance change** + +## Source identity + +- World base: P2C3 commit `c712b2ca9bf67381a9862f07eb780f5c13e2f379` +- World branch: `codex/measured-impact-world-disposition` +- Core base: measured-impact kickoff commit `9078018a5fd3c310011b6c9efbfe5255e0e36887` +- Core dependency: stacked `codex/measured-impact-disposition` candidate +- Released identity intentionally unchanged: `ace-domain-world-intelligence==0.9.0`, + `ace-core>=0.5.0,<0.6` + +## Exact point-in-time result + +One candidate run retained the P2C3 `useful` classification and non-effective `promote` proposal, +then recorded a separately authorized Core Decision whose subject was that exact proposal: + +```text +evaluation: impact_evaluation:8c133e576587fae76927828ab882210d +evaluation material: sha256:68808bb0f0d462035fb297e0c14825910a5fe4e1510fd8994cc20d1a704d4f59 +proposal: impact_governance_proposal:c8021b5d1798ef9c61ab90abacccbddf +proposal material: sha256:7eddbeb2485db19ac19ee6c5540925bd7a6dc89d3b50ec521a3ed7226785730d +decision: decision:5e0ca6230ab92ed3702a5363264ff098 +decision material: sha256:ef4027ba44b9a25569b0071dd27a22fc81256c44787c7cf8040c304be2e5a840 +measured classification: useful +proposal action: promote +reviewer disposition: reject +Decision action disposition: no_action +proposal applied: false +effective governed state changed: false +historical replay: true +replay reauthorization: false +``` + +The rationale rejected broader promotion because the exact criterion measured only structural +coverage of two required admitted Observation identities in reviewed exports. The Decision did not +reclassify the evaluation or replace the proposal. + +## Verification + +Stacked source-checkout verification with the Core disposition candidate and the separately +packaged reference action adapter: + +```text +python -B -m pytest domain_packs/tests/test_p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py -q --tb=short +4 passed in 0.88s + +ruff check scripts/p2c3_measured_feedback.py \ + scripts/p2c4_reviewed_impact_disposition.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py +PASS + +ruff format --check scripts/p2c3_measured_feedback.py \ + scripts/p2c4_reviewed_impact_disposition.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py +PASS + +python -B -m pytest -q --tb=short +87 passed in 17.00s + +python -B -m pytest adapters/federal_register_source/tests -q --tb=short +26 passed in 0.26s + +python -B -m pytest tests/test_release_contract.py -q --tb=short +7 passed in 0.04s + +# Locked environment with public ace-core==0.5.0 and no candidate source checkout. +python -B -m pytest -q --tb=short -rs +82 passed, 5 skipped in 15.38s + +uv build --out-dir +Successfully built unchanged 0.9.0 source distribution and inert data-only wheel + +git diff --check +PASS +``` + +The five locked-environment skips are explicit boundaries: one P2C2 test requires the separately +packaged reference adapter, two P2C3 tests require the unreleased measured-impact contract, and two +P2C4 tests require the stacked proposal-disposition contract. The public 0.5 dependency range and +0.9.0 artifact therefore remain coherent. The built wheel contains only inert Domain Pack data and +no candidate script, test, adapter, or audit Python. + +## Claim boundary + +The named World principal and governed role/grant prove that the fixture followed explicit product +review policy; this neutral contract does not independently prove biological personhood. Recorded +official source responses preserve exact public provenance but do not prove a live network request +or test-time freshness. The useful result remains a deterministic two-pair structural rule, not a +causal estimate, population result, correctness score, or human-benefit finding. + +P2C4 proves that ACE can retain a measured result, retain its proposed governance action, and +record a contrary authorized disposition without silently applying or rewriting either. It does +not publish 0.6, pass SI4, update the Domain Pack release, or create effective state. + +## Remaining work + +The next measurement packet needs independently reviewed product-quality evidence such as citation +correctness, contradiction coverage, correction quality, detection delay, or false-alert rate. +Market reproduction, public Core artifacts, compatibility/security/release gates, opt-in live +transport, and any separately authorized proposal application remain outside this candidate. diff --git a/docs/design/world-intelligence-p2c4-reviewed-impact-disposition-work-packet-v1.md b/docs/design/world-intelligence-p2c4-reviewed-impact-disposition-work-packet-v1.md new file mode 100644 index 0000000..91c7852 --- /dev/null +++ b/docs/design/world-intelligence-p2c4-reviewed-impact-disposition-work-packet-v1.md @@ -0,0 +1,77 @@ +# World Intelligence P2C4 reviewed impact disposition work packet (v1) + +**Status:** stacked source-checkout candidate; this packet does not release World Intelligence, +apply a governance proposal, close ACE Core issue #38, or complete ACE 0.6.0. + +**Frozen:** 2026-08-10 from World P2C3 commit +`c712b2ca9bf67381a9862f07eb780f5c13e2f379`, stacked on the Core measured-impact disposition +candidate. + +## Objective + +Extend the recorded official-public-data journey through one explicit governed feedback decision: + +```text +Observation -> Shift -> Signal -> Brief -> Decision -> reviewed Action + -> observed Outcome -> useful evaluation -> promote proposal + -> authorized reject/no-action Decision +``` + +The packet must preserve both judgments. The frozen structural citation-coverage criterion remains +`useful` and continues to propose `promote`; a separately authenticated and authorized World +reviewer rejects broader promotion because that measure does not establish citation correctness, +general Brief quality, human benefit, causality, or live network freshness. + +## Product-owned policy and Core boundary + +World owns the reviewer role, disposition-operation binding, authority grant, and rationale. The +fixture uses the named principal `principal:world-impact-governor` and role +`role:world-impact-governor`. Core owns authentication, exact authority closure, generic Decision, +immutable persistence, and replay. Intelligence owns the unchanged domain-neutral evaluation and +proposal contracts. + +The fixture's named role and grant make the product's human-review policy explicit; they are not a +universal identity-verification or biological-personhood claim. The Domain Pack remains inert JSON +and gains no executable behavior or authority. + +## Exact acceptance + +P2C4 must: + +1. rerun the P2C3 official-record journey through the exact Brief, treatment/control Actions, + Outcomes, `useful` evaluation, and non-effective `promote` proposal; +2. install a separate disposition operation/capability/authority closure in the acceptance host; +3. submit the exact evaluation and proposal references to Core's disposition service; +4. record `reject` with `no_action` and the exact proposal as Decision subject; +5. preserve the evaluation classification and proposal action without mutation; +6. prove the governed-state head map is identical before and after disposition; +7. replay the exact Decision through a fresh service whose authorizer raises if invoked; and +8. keep proposal application, human benefit, causality, network freshness, and autonomous + publishing explicitly false. + +## Files and rollback + +This packet owns: + +- `scripts/p2c4_reviewed_impact_disposition.py`; +- `domain_packs/tests/test_p2c4_reviewed_impact_disposition.py`; +- the additive P2C3 state handoff used only by composed acceptance; +- this work packet, its audit record, and restrained README/roadmap references. + +It does not edit the shipped Domain Pack, connector, version metadata, dependency range, lockfile, +release record, or public artifacts. Rollback removes the additive harness, tests, state handoff, +and candidate documentation. Any Decision already persisted by a host remains immutable history. + +## Non-claims and next packet + +P2C4 proves an explicit authorized rejection of one non-effective proposal over deterministic +recorded official-public-data fixtures. It does not prove a live network request, citation +correctness, contradiction recall, calibration, correction quality, detection delay, false-alert +rate, general usefulness, customer value, causality, or human benefit. The Decision does not apply +the proposal and creates no effective policy or subject state. + +The next bounded measurement packet should add one independently reviewed product outcome—such as +citation correctness, contradiction coverage, correction quality, detection delay, or false-alert +rate—under frozen controls. Opt-in network transport and P2D multi-source correction remain +separate. Actual proposal application is a later Core-authorized packet only if product policy +justifies changing effective state. diff --git a/domain_packs/tests/test_p2c4_reviewed_impact_disposition.py b/domain_packs/tests/test_p2c4_reviewed_impact_disposition.py new file mode 100644 index 0000000..d7e2ad5 --- /dev/null +++ b/domain_packs/tests/test_p2c4_reviewed_impact_disposition.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +import importlib.util + +import pytest + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact_disposition") is None: + pytest.skip("P2C4 candidate requires the stacked ACE Core proposal-disposition contract") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("P2C4 candidate requires the separately packaged Core reference adapter") + + +@pytest.mark.asyncio +async def test_structurally_useful_result_reaches_exact_reject_no_action_disposition(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c4_reviewed_impact_disposition import run_reviewed_disposition + + result = await run_reviewed_disposition(tmp_path) + + assert result["measured_feedback"]["evaluation"]["classification"] == "useful" + assert result["measured_feedback"]["proposal"]["action"] == "promote" + assert result["disposition"]["decision"]["intent"]["subject"] == result["disposition"]["proposal_reference"] + assert result["disposition"]["decision"]["intent"]["disposition"] == "reject" + assert result["disposition"]["decision"]["intent"]["action_disposition"] == "no_action" + assert result["disposition"]["effective_state_changed"] is False + assert result["disposition"]["replayed"] is True + assert result["disposition"]["no_reauthorization"] is True + + +@pytest.mark.asyncio +async def test_reviewed_disposition_preserves_the_public_claim_boundary(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c4_reviewed_impact_disposition import run_reviewed_disposition + + result = await run_reviewed_disposition(tmp_path) + + assert result["scope"] == { + "measured_classification_preserved": "useful", + "proposal_action_preserved": "promote", + "proposal_disposition": "reject", + "proposal_applied": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "network_freshness_claimed": False, + "autonomous_publication": False, + } + rationale = result["disposition"]["decision"]["intent"]["rationale"] + assert "does not establish" in rationale diff --git a/scripts/p2c3_measured_feedback.py b/scripts/p2c3_measured_feedback.py index 35d7eb9..6890b95 100644 --- a/scripts/p2c3_measured_feedback.py +++ b/scripts/p2c3_measured_feedback.py @@ -546,7 +546,11 @@ def _install_impact_policy(state: dict[str, Any]): return criterion_head, impact_binding -async def run_measured_feedback(workspace_root: Path) -> dict[str, Any]: +async def run_measured_feedback( + workspace_root: Path, + *, + state_sink: dict[str, Any] | None = None, +) -> dict[str, Any]: """Run official records through matched Outcomes and proposal-only feedback.""" state: dict[str, Any] = {"workspace_root": workspace_root} @@ -711,7 +715,7 @@ async def run_measured_feedback(workspace_root: Path) -> dict[str, Any]: if admission.proposal is None or admission.proposal.action is not ImpactGovernanceAction.PROMOTE: raise AssertionError("useful World evaluation did not emit the product-mapped proposal") - return { + result = { "contract": "ace.world-intelligence.measured-feedback/v1alpha1", "journey": prior, "criterion": { @@ -745,6 +749,17 @@ async def run_measured_feedback(workspace_root: Path) -> dict[str, Any]: "autonomous_publication": False, }, } + if state_sink is not None: + state_sink.update(state) + state_sink.update( + { + "impact_binding": impact_binding, + "impact_criterion": criterion, + "impact_request": request, + "impact_admission": admission, + } + ) + return result def main() -> None: diff --git a/scripts/p2c4_reviewed_impact_disposition.py b/scripts/p2c4_reviewed_impact_disposition.py new file mode 100644 index 0000000..6d28b5b --- /dev/null +++ b/scripts/p2c4_reviewed_impact_disposition.py @@ -0,0 +1,169 @@ +"""Explicitly reject broader promotion of the exact P2C3 structural result.""" + +from __future__ import annotations + +import asyncio +import json +from pathlib import Path +from typing import Any + +from ace.application import ( + MeasuredImpactDispositionRequestV1Alpha1, + MeasuredImpactDispositionService, +) +from ace.core import ( + CapabilityArtifactIdentityV1Alpha1, + DecisionActionDisposition, + DecisionDisposition, + GovernedOperationBindingV1Alpha1, + GovernedStateHeadPreconditionV1Alpha1, + capability_state_ref_for_artifact, +) + +from scripts.p2c2_governed_reality_brief import _context, _head +from scripts.p2c3_measured_feedback import run_measured_feedback + +DISPOSITION_ARTIFACT = CapabilityArtifactIdentityV1Alpha1( + capability="measured_impact_proposal_disposition", + contract="ace.application.measured-impact-disposition-service/v1alpha1", + implementation_id="world_measured_impact_disposition_candidate", + implementation_version="0.1.0", + artifact_digest="sha256:" + "d" * 64, +) + + +class _ReplayMustNotAuthorize: + async def authorize_action(self, request): + raise AssertionError(f"historical disposition requested new authority: {request.authorization_key}") + + +def _install_disposition_policy(state: dict[str, Any]) -> GovernedOperationBindingV1Alpha1: + environment = state["environment"] + runtime = state["runtime"] + product_id = environment.fixture["product_id"] + operation_head = _head( + product_id, + "governed_operation_configuration", + "governed_operation_configuration:world-measured-impact-disposition", + 50, + ) + binding = GovernedOperationBindingV1Alpha1( + product_id=product_id, + artifact=DISPOSITION_ARTIFACT, + configuration_ref=operation_head.state_id, + authority="append_measured_impact_disposition", + grant_ref="authority_grant:world-measured-impact-disposition", + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(operation_head), + ) + capability_head = _head( + product_id, + "capability_state", + capability_state_ref_for_artifact(DISPOSITION_ARTIFACT), + 51, + ) + authority_head = _head( + product_id, + "authority_grant", + binding.grant_ref, + 52, + ) + for head in (operation_head, capability_head, authority_head): + environment.store.set_governed_state_head(head) + runtime.heads[head.state_kind, head.state_id] = head + runtime.bindings = (*runtime.bindings, binding) + return binding + + +async def run_reviewed_disposition(workspace_root: Path) -> dict[str, Any]: + """Run P2C3, then record one exact reject/no-action human Decision.""" + + state: dict[str, Any] = {} + measured = await run_measured_feedback(workspace_root, state_sink=state) + environment = state["environment"] + binding = _install_disposition_policy(state) + evaluation_ref, proposal_ref = state["impact_admission"].transaction_receipt.records + context = _context(environment.context, "principal:world-impact-governor") + request = MeasuredImpactDispositionRequestV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=context, + evaluation=evaluation_ref, + proposal=proposal_ref, + reviewer_role_ref="role:world-impact-governor", + disposition=DecisionDisposition.REJECT, + rationale=( + "Reject broader promotion of the Reality Brief. The exact useful result establishes " + "structural citation coverage under one frozen fixture criterion, but does not establish " + "citation correctness, general Brief quality, human benefit, causality, or live freshness." + ), + decided_at=state["clock"](), + ) + heads_before = dict(environment.store.governed_state_heads) + admission = await MeasuredImpactDispositionService( + store=environment.store, + authorizer=state["reasoning"], + operation_binding=binding, + ).decide(request) + heads_after = dict(environment.store.governed_state_heads) + replay = await MeasuredImpactDispositionService( + store=environment.store, + authorizer=_ReplayMustNotAuthorize(), + operation_binding=binding, + ).decide(request) + if ( + admission.replayed + or not replay.replayed + or admission.decision != replay.decision + or admission.transaction_receipt != replay.transaction_receipt + ): + raise AssertionError("reviewed impact disposition did not replay exact historical material") + if ( + admission.decision.intent.disposition is not DecisionDisposition.REJECT + or admission.decision.intent.action_disposition is not DecisionActionDisposition.NO_ACTION + or admission.decision.intent.subject != proposal_ref + ): + raise AssertionError("reviewed impact disposition crossed the exact reject/no-action boundary") + if heads_after != heads_before: + raise AssertionError("reviewed proposal disposition mutated effective governed state") + + return { + "contract": "ace.world-intelligence.reviewed-impact-disposition/v1alpha1", + "measured_feedback": measured, + "disposition": { + "decision": admission.decision.model_dump(mode="json"), + "decision_reference": admission.decision_reference.model_dump(mode="json"), + "proposal_reference": proposal_ref.model_dump(mode="json"), + "evaluation_reference": evaluation_ref.model_dump(mode="json"), + "replayed": replay.replayed, + "no_reauthorization": True, + "effective_state_changed": False, + }, + "scope": { + "measured_classification_preserved": measured["evaluation"]["classification"], + "proposal_action_preserved": measured["proposal"]["action"], + "proposal_disposition": admission.decision.intent.disposition.value, + "proposal_applied": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "network_freshness_claimed": False, + "autonomous_publication": False, + }, + } + + +def main() -> None: + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + args = parser.parse_args() + print( + json.dumps( + asyncio.run(run_reviewed_disposition(args.workspace_root)), + indent=2, + sort_keys=True, + ) + ) + + +if __name__ == "__main__": + main() From b5c9269ec895760ec1d0a1c59b54cc0fd8e05f25 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Mon, 10 Aug 2026 15:36:37 -0700 Subject: [PATCH 03/17] Measure World citation correctness --- README.md | 23 +- ROADMAP.md | 12 +- ...citation-correctness-outcome-2026-08-10.md | 123 +++ ...tion-correctness-outcome-work-packet-v1.md | 99 +++ .../test_p2c5_citation_correctness_outcome.py | 71 ++ scripts/p2c3_measured_feedback.py | 4 + scripts/p2c4_reviewed_impact_disposition.py | 18 +- scripts/p2c5_citation_correctness_outcome.py | 705 ++++++++++++++++++ 8 files changed, 1046 insertions(+), 9 deletions(-) create mode 100644 docs/audits/world-intelligence-p2c5-citation-correctness-outcome-2026-08-10.md create mode 100644 docs/design/world-intelligence-p2c5-citation-correctness-outcome-work-packet-v1.md create mode 100644 domain_packs/tests/test_p2c5_citation_correctness_outcome.py create mode 100644 scripts/p2c5_citation_correctness_outcome.py diff --git a/README.md b/README.md index ae45a47..95b3541 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,20 @@ because structural coverage does not establish citation correctness, general Bri benefit, causality, or live freshness. Exact replay returns the historical Decision without new authorization. This is explicit disposition, not reclassification or proposal application. +P2C5 adds a distinct product-owned outcome rather than broadening the structural score. The named +principal `principal:world-citation-correctness-reviewer` records an exact immutable review over +the Brief, its one cited claim, the exact two citation identities, and the two admitted official +Observation references. Each Core Outcome names that exact result. A matched negative control +retains both citation identities but swaps the two publication dates in the claim: treatment and +control both have `1.0` coverage, while correctness is `1.0` and `0.0` respectively across two +pairs. The domain-neutral evaluator classifies that bounded difference as useful and still emits +only a non-effective proposal requiring separate review. + +This candidate establishes exact review provenance and sensitivity to one semantic corruption. It +does not establish reviewer infallibility, current network freshness, source independence, general +Brief quality, causal impact, or human benefit. Citation review vocabulary and policy remain in +World; Core and Intelligence receive only the exact immutable observed-result coordinate. + ## What the public World proof demonstrates Generate a self-contained visual Reality Brief and its exact machine-readable backing data: @@ -391,10 +405,11 @@ publishing, delivery, persuasion, or other external-action authority. The [World Intelligence roadmap](ROADMAP.md) owns current domain direction. Detailed packet history remains in [`docs/world-intelligence-roadmap-status-2026-08-06.md`](docs/world-intelligence-roadmap-status-2026-08-06.md), -and release history is in [`CHANGELOG.md`](CHANGELOG.md). P2C4 now demonstrates a separately -authorized reject/no-action disposition of the P2C3 proposal without effective state change. The -next bounded measurement work is an independently reviewed product outcome such as citation -correctness, contradiction coverage, correction quality, detection delay, or false-alert rate. +and release history is in [`CHANGELOG.md`](CHANGELOG.md). P2C4 demonstrates a separately +authorized reject/no-action disposition of the P2C3 proposal without effective state change. P2C5 +adds an independently reviewed citation-correctness Outcome and a citation-preserving semantic +negative control. The next bounded measurement work is contradiction/correction coverage, +detection delay, false-alert rate, or independent Market reproduction. Separately reviewed opt-in network transport and P2D multi-source conflict/correction with LIVE inputs remain independent work. None of these steps may add autonomous publishing, delivery, persuasion, or action authority to a Domain Pack. diff --git a/ROADMAP.md b/ROADMAP.md index c674e21..b181808 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/P2C4 measured feedback and reviewed disposition +## Candidate — P2C3–P2C5 measured feedback, disposition, and citation correctness - 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. @@ -27,12 +27,18 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). - A separate authenticated and authorized World reviewer rejects broader promotion with an exact `no_action` Core Decision. The useful evaluation and promote proposal remain unchanged, and no effective governed-state head changes. -- This is source-checkout evidence against Core PR #88, not a released World capability, human +- A second frozen criterion requires exact independent review provenance behind every Outcome + score. A citation-preserving date-swap control retains `1.0` citation coverage while correctness + falls from `1.0` to `0.0` over two matched pairs; the bounded evaluation again emits only a + non-effective proposal. +- 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. 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) -freezes the exact proposal-disposition boundary. +freezes the exact proposal-disposition boundary. The stacked +[P2C5 work packet](docs/design/world-intelligence-p2c5-citation-correctness-outcome-work-packet-v1.md) +freezes independently reviewed citation correctness and its citation-preserving negative control. ## Next — trustworthy live orientation diff --git a/docs/audits/world-intelligence-p2c5-citation-correctness-outcome-2026-08-10.md b/docs/audits/world-intelligence-p2c5-citation-correctness-outcome-2026-08-10.md new file mode 100644 index 0000000..befc791 --- /dev/null +++ b/docs/audits/world-intelligence-p2c5-citation-correctness-outcome-2026-08-10.md @@ -0,0 +1,123 @@ +# World Intelligence P2C5 citation-correctness outcome audit — 2026-08-10 + +Status: **stacked candidate evidence only; not a release, SI4 pass, or applied governance change** + +## Source identity + +- World base: P2C4 commit `189c81be1812ee32ffc28148fb63539c66417661` +- World branch: `codex/world-citation-correctness` +- Core base: measured-impact disposition commit + `3c920bb5c411bd9d91a5e2a6c96d4014e9b66763` +- Core dependency: stacked `codex/measured-impact-observed-result` candidate +- Released identity intentionally unchanged: `ace-domain-world-intelligence==0.9.0`, + `ace-core>=0.5.0,<0.6` + +## Exact point-in-time result + +One source-checkout run recorded two independent treatment reviews and two independent control +reviews under product policy +`sha256:ab9b609d9bba9edc4163cdccdbe8761d8494b2bf52789a92f3124b5d3324750c`: + +```text +treatment review 1: citation_correctness_review:27b875cf41e4f417cec5715aebeca73b +treatment review 2: citation_correctness_review:d4c7f54c69289eb258c84d65ad7c996b +control review 1: citation_correctness_review:b1c980ee2df061ab00caa6e3a46d6e7c +control review 2: citation_correctness_review:a2122102390c938dd3edf5104f63f415 +treatment citation coverage: 1.0, 1.0 +control citation coverage: 1.0, 1.0 +treatment correctness: 1.0, 1.0 +control correctness: 0.0, 0.0 +matched pairs: 2 +mean effect: 1.0 +classification: useful +proposal action: promote +proposal live effect: false +historical replay: true +replay reauthorization: false +``` + +The exact evaluation was +`impact_evaluation:eef78b8febd33d4b6121d6f8ce6e1335` with material +`sha256:eef78b8febd33d4b6121d6f8ce6e13354dcb09ef743c5de61940021473595d3a`. +The exact non-effective proposal was +`impact_governance_proposal:d928a69adc1984ff89b1225ed87d93fa` with material +`sha256:d928a69adc1984ff89b1225ed87d93fa0881c3e6f981233d08d9e7756a6c8b80`. + +The negative control preserved both exact citation identities but changed the cited statement from +the admitted publication dates to `2026-15932 published 2026-08-07` and `2026-16197 published +2026-08-06`. It therefore falsifies the structural-coverage proxy without requiring a different +source set. + +## Verification + +Stacked source-checkout verification with the Core observed-result candidate and separately +packaged reference action adapter: + +```text +python -B -m pytest domain_packs/tests/test_p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py \ + domain_packs/tests/test_p2c5_citation_correctness_outcome.py -q --tb=short +6 passed in 1.16s + +ruff check scripts/p2c3_measured_feedback.py \ + scripts/p2c4_reviewed_impact_disposition.py \ + scripts/p2c5_citation_correctness_outcome.py \ + domain_packs/tests/test_p2c5_citation_correctness_outcome.py +PASS + +ruff format --check +PASS + +python -B -m pytest -q --tb=short +89 passed in 15.40s + +python -B -m pytest adapters/federal_register_source/tests -q --tb=short +26 passed in 0.23s + +python -B -m pytest tests/test_release_contract.py -q --tb=short +7 passed in 0.04s + +# Isolated environment with the built World wheel, public ace-core==0.5.0, +# and the separately installed Federal Register source adapter; no Core checkout. +python -B -m pytest -q --tb=short -rs +82 passed, 7 skipped in 15.04s + +ruff check . +PASS + +uv build --out-dir +Successfully built unchanged 0.9.0 source distribution and inert data-only wheel + +git diff --check +PASS +``` + +The seven isolated-environment skips are explicit candidate boundaries: one P2C2 test requires +the separately packaged Core reference action adapter, and two tests each require the unreleased +P2C3, P2C4, and P2C5 Core candidates. The released dependency range and 0.9.0 artifact remain +coherent. Wheel inspection contains only inert Domain Pack JSON and distribution metadata; no +candidate script, test, adapter, or audit Python is shipped. + +Repository-wide `ruff format --check .` reports 19 pre-existing files outside this packet that do +not match the Core candidate environment's formatter version. The four changed Python files pass +the scoped formatting gate and the complete repository passes `ruff check .`; this packet does not +rewrite unrelated World history. + +## Claim boundary + +The World reviewer exact-loads both admitted Observation envelopes and derives the expected +document/date statement from their canonical payloads. Its exact result makes reviewer, source +Observations, policy, claim, citations, verdict, score, time, and limitations inspectable. The Core +Outcome points to that exact result and the evaluator refuses missing or future result provenance +when the criterion requires it. + +This demonstrates deterministic product-policy sensitivity over two recorded official public +records. It does not prove a live request, current freshness, legal truth, reviewer infallibility, +source independence, correction handling, population performance, general Brief quality, causal +impact, or human benefit. The resulting proposal remains non-effective and unapplied. + +## Remaining work + +Contradiction/correction coverage, detection delay, false-alert rate, revision stability, a +materially different Market journey, public artifacts, compatibility/security/release checks, +opt-in live transport, and any explicit proposal application remain future bounded packets. diff --git a/docs/design/world-intelligence-p2c5-citation-correctness-outcome-work-packet-v1.md b/docs/design/world-intelligence-p2c5-citation-correctness-outcome-work-packet-v1.md new file mode 100644 index 0000000..564ccca --- /dev/null +++ b/docs/design/world-intelligence-p2c5-citation-correctness-outcome-work-packet-v1.md @@ -0,0 +1,99 @@ +# World Intelligence P2C5 citation-correctness outcome work packet (v1) + +**Status:** stacked source-checkout candidate; this packet does not release World Intelligence, +apply a governance proposal, close ACE Core issue #38, pass SI4, or complete ACE 0.6.0. + +**Frozen:** 2026-08-10 from World P2C4 commit +`189c81be1812ee32ffc28148fb63539c66417661`, stacked on the Core exact observed-result +provenance candidate. + +## Objective + +Replace P2C3's structural coverage-only outcome with one independently recorded product-quality +result while preserving the full governed journey: + +```text +Observation -> Shift -> Signal -> Brief -> Decision -> reviewed Action + -> exact independent citation review -> observed Outcome + -> useful / harmful / unproven evaluation -> proposal only +``` + +The packet must distinguish presence from correctness. Its negative control retains the exact two +citation identities used by the Brief but swaps the two official publication dates in the cited +claim. Treatment and control therefore both have `1.0` citation coverage while correctness is +`1.0` for the admitted Brief and `0.0` for the semantic-corruption control. + +## Product-owned review policy + +World owns `world_official_record_citation_correctness` version `candidate-1`. The frozen rule +reviews cited claims only, requires the exact two Brief citation identities, exact-loads the two +admitted Observation envelopes, derives the expected document/date statement from their canonical +payloads, and compares the cited statement to those exact recorded facts. Score is supported cited +claims divided by reviewed cited claims. + +The exact review record names: + +- the reviewed Brief or control immutable reference; +- the authenticated reviewer `principal:world-citation-correctness-reviewer`; +- the policy identity, version, and material digest; +- the two exact source Observation references; +- each claim identity, statement, exact citation set, verdict, and rationale; +- coverage, correctness score, limitations, review time, and derived review identity/digest. + +Core and Intelligence see only the result's generic immutable reference from the Outcome measures. +Federal Register, citation, reviewer, and source-policy nouns remain in World. + +## Exact acceptance + +P2C5 must: + +1. rerun P2C2 through P2C4 and preserve the earlier structural result and reject/no-action + disposition as immutable history; +2. append one exact citation-preserving corrupted control artifact; +3. create two distinct reviewed treatment/control Action pairs under matched task conditions; +4. append four independently authenticated review records over the exact subjects and source + Observations; +5. record four Core Outcomes whose measures name the exact review records that produced their + scalar scores; +6. require exact observed-result provenance under a frozen correctness criterion; +7. show treatment/control coverage `1.0/1.0` but correctness `1.0/0.0` in both pairs; +8. classify the bounded result `useful`, emit only a non-effective `promote` proposal, and perform + no proposal application; +9. replay the evaluation without reauthorization; and +10. retain explicit non-claims for network freshness, causality, general Brief quality, human + benefit, and autonomous publication. + +## Negative and failure controls + +The citation-preserving date swap is the primary product negative control: an identifier/string +coverage scorer cannot distinguish it, while the frozen correctness review must. Core's stacked +tests separately require missing observed-result provenance to become unproven, reject cross- +product result coordinates, and exclude post-cutoff result material without loading its payload. +Earlier missing attribution, condition mismatch, Outcome unavailability, duplicate/replay, +interruption, restart, and denied-authority controls remain required. + +## Files and rollback + +This packet owns: + +- `scripts/p2c5_citation_correctness_outcome.py`; +- `domain_packs/tests/test_p2c5_citation_correctness_outcome.py`; +- additive P2C3/P2C4 acceptance-state handoffs; +- this work packet, its audit, and restrained README/roadmap references. + +It changes no shipped Domain Pack, connector, package version, dependency range, lockfile, release +record, or public artifact. Rollback removes the harness, tests, state handoffs, and candidate +documentation. Product review and Outcome records already persisted by a host remain immutable +history. + +## Non-claims and next packet + +The result covers one cited claim, two recorded official records, two matched pairs, and one exact +product rule. It does not validate inference claims, source independence, corrections, live +network freshness, human usefulness, general Brief quality, or causal benefit. The synthetic +control establishes criterion sensitivity, not a population estimate. + +The next bounded outcome packet should measure contradiction/correction coverage or detection +delay over additional public records. Independent Market reproduction, public Core artifacts, +compatibility/security/release gates, opt-in live transport, and any separately authorized proposal +application remain separate work. diff --git a/domain_packs/tests/test_p2c5_citation_correctness_outcome.py b/domain_packs/tests/test_p2c5_citation_correctness_outcome.py new file mode 100644 index 0000000..a82fb2c --- /dev/null +++ b/domain_packs/tests/test_p2c5_citation_correctness_outcome.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +import importlib.util + +import pytest + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact") is None: + pytest.skip("P2C5 requires the stacked ACE Core measured-impact candidate") + from ace.intelligence import ImpactOutcomeMeasuresV1Alpha1 + + if "observed_result" not in ImpactOutcomeMeasuresV1Alpha1.model_fields: + pytest.skip("P2C5 requires exact observed-result provenance from the stacked Core candidate") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("P2C5 requires the separately packaged Core reference adapter") + + +@pytest.mark.asyncio +async def test_independent_citation_review_becomes_an_exact_measured_outcome(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c5_citation_correctness_outcome import run_citation_correctness_outcome + + result = await run_citation_correctness_outcome(tmp_path) + + assert result["review_policy"]["reviewer_ref"] == "principal:world-citation-correctness-reviewer" + assert result["evaluation"]["criterion"]["requires_observed_result"] is True + assert result["evaluation"]["classification"] == "useful" + assert result["evaluation"]["matched_pair_count"] == 2 + assert result["evaluation"]["mean_effect"] == 1.0 + assert result["proposal"]["action"] == "promote" + assert result["proposal"]["live_effect"] is False + assert result["proposal"]["selectable"] is False + assert result["proposal"]["requires_human_review"] is True + assert result["replay"] == { + "historical": True, + "no_reauthorization": True, + "transaction_receipt_id": result["replay"]["transaction_receipt_id"], + } + reviews = (*result["observed_results"]["treatment"], *result["observed_results"]["control"]) + assert {item["contract"] for item in reviews} == {"ace.world-intelligence.citation-correctness-review/v1alpha1"} + assert {item["reviewer_context"]["actor_ref"] for item in reviews} == { + "principal:world-citation-correctness-reviewer" + } + assert {len(item["source_observations"]) for item in reviews} == {2} + + +@pytest.mark.asyncio +async def test_citation_preserving_negative_control_separates_coverage_from_correctness(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c5_citation_correctness_outcome import run_citation_correctness_outcome + + result = await run_citation_correctness_outcome(tmp_path) + control = result["negative_control"] + + assert len(control["citation_ids_preserved"]) == 2 + assert control["treatment_citation_coverage"] == (1.0, 1.0) + assert control["control_citation_coverage"] == (1.0, 1.0) + assert control["treatment_correctness"] == (1.0, 1.0) + assert control["control_correctness"] == (0.0, 0.0) + assert "2026-15932 published 2026-08-07" in control["corrupted_statement"] + assert result["scope"] == { + "independent_exact_review": True, + "recorded_official_sources": True, + "network_freshness_claimed": False, + "general_brief_quality_claimed": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + } diff --git a/scripts/p2c3_measured_feedback.py b/scripts/p2c3_measured_feedback.py index 6890b95..1fc3d9f 100644 --- a/scripts/p2c3_measured_feedback.py +++ b/scripts/p2c3_measured_feedback.py @@ -753,6 +753,10 @@ async def run_measured_feedback( state_sink.update(state) state_sink.update( { + "impact_target_ref": target_ref, + "impact_control_ref": control_ref, + "measured_treatments": treatments, + "measured_controls": controls, "impact_binding": impact_binding, "impact_criterion": criterion, "impact_request": request, diff --git a/scripts/p2c4_reviewed_impact_disposition.py b/scripts/p2c4_reviewed_impact_disposition.py index 6d28b5b..3ef554f 100644 --- a/scripts/p2c4_reviewed_impact_disposition.py +++ b/scripts/p2c4_reviewed_impact_disposition.py @@ -74,7 +74,11 @@ def _install_disposition_policy(state: dict[str, Any]) -> GovernedOperationBindi return binding -async def run_reviewed_disposition(workspace_root: Path) -> dict[str, Any]: +async def run_reviewed_disposition( + workspace_root: Path, + *, + state_sink: dict[str, Any] | None = None, +) -> dict[str, Any]: """Run P2C3, then record one exact reject/no-action human Decision.""" state: dict[str, Any] = {} @@ -125,7 +129,7 @@ async def run_reviewed_disposition(workspace_root: Path) -> dict[str, Any]: if heads_after != heads_before: raise AssertionError("reviewed proposal disposition mutated effective governed state") - return { + result = { "contract": "ace.world-intelligence.reviewed-impact-disposition/v1alpha1", "measured_feedback": measured, "disposition": { @@ -148,6 +152,16 @@ async def run_reviewed_disposition(workspace_root: Path) -> dict[str, Any]: "autonomous_publication": False, }, } + if state_sink is not None: + state_sink.update(state) + state_sink.update( + { + "impact_disposition_binding": binding, + "impact_disposition_request": request, + "impact_disposition_admission": admission, + } + ) + return result def main() -> None: diff --git a/scripts/p2c5_citation_correctness_outcome.py b/scripts/p2c5_citation_correctness_outcome.py new file mode 100644 index 0000000..88b1e1a --- /dev/null +++ b/scripts/p2c5_citation_correctness_outcome.py @@ -0,0 +1,705 @@ +"""Independently review exact citation correctness and measure its impact.""" + +from __future__ import annotations + +import asyncio +import json +from datetime import datetime, timedelta +from pathlib import Path +from typing import Any, Literal, Self + +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator + +from ace.application import MeasuredImpactService +from ace.core import ( + AppendOnlyTransactionRequestV1, + AuthenticatedRuntimeContextV1Alpha1, + CapabilityArtifactIdentityV1Alpha1, + GovernedOperationBindingV1Alpha1, + GovernedStateHeadPreconditionV1Alpha1, + ImmutableRecordReferenceV1, + ImmutableRecordV1, + OutcomeIntentV1Alpha1, + OutcomeV1Alpha1, + canonical_hash, + canonical_json, + capability_state_ref_for_artifact, +) +from ace.intelligence import ( + ImpactClassification, + ImpactConditionsV1Alpha1, + ImpactCriterionV1Alpha1, + ImpactEvaluationRequestV1Alpha1, + ImpactEvidenceV1Alpha1, + ImpactGovernanceAction, + ImpactMetricDirection, + ImpactOutcomeMeasuresV1Alpha1, + ImpactTargetKind, +) + +from scripts.p2c2_federal_register_monitor import _time +from scripts.p2c2_governed_reality_brief import _context, _head +from scripts.p2c3_measured_feedback import ( + ReviewedExport, + _append_value, + _authorize_append, + _digest, + _record_attribution, + _run_reviewed_export, +) +from scripts.p2c4_reviewed_impact_disposition import run_reviewed_disposition + +OUTCOME_TYPE = "independent_artifact_review" +MEASURE_ID = "official_citation_correctness" +CRITERION_ID = "impact_criterion:world-official-citation-correctness" +CRITERION_FROZEN_AT = _time("2026-08-07T18:01:08Z") +REVIEW_POLICY_ID = "world_official_record_citation_correctness" +REVIEW_POLICY_VERSION = "candidate-1" + +IMPACT_ARTIFACT = CapabilityArtifactIdentityV1Alpha1( + capability="measured_impact_evaluation", + contract="ace.application.measured-impact-service/v1alpha1", + implementation_id="world_citation_correctness_candidate", + implementation_version="0.1.0", + artifact_digest="sha256:" + "e" * 64, +) + + +class _FrozenModel(BaseModel): + model_config = ConfigDict(extra="forbid", frozen=True) + + +def _derive_identity(value: _FrozenModel, *, prefix: str, id_field: str, digest_field: str) -> None: + material = value.model_dump(mode="json", exclude={id_field, digest_field}) + digest = canonical_hash(material) + expected_id = f"{prefix}:{digest[:32]}" + expected_digest = f"sha256:{digest}" + supplied_id = getattr(value, id_field) + supplied_digest = getattr(value, digest_field) + if supplied_id is not None and supplied_id != expected_id: + raise ValueError(f"{id_field} does not match exact review material") + if supplied_digest is not None and supplied_digest != expected_digest: + raise ValueError(f"{digest_field} does not match exact review material") + object.__setattr__(value, id_field, expected_id) + object.__setattr__(value, digest_field, expected_digest) + + +class CitationClaimAssessmentV1Alpha1(_FrozenModel): + """Product-owned correctness judgment for one exact cited claim.""" + + contract: Literal["ace.world-intelligence.citation-claim-assessment/v1alpha1"] = ( + "ace.world-intelligence.citation-claim-assessment/v1alpha1" + ) + claim_id: str + statement: str + citation_ids: tuple[str, ...] = Field(min_length=1, max_length=16) + verdict: Literal["supported", "unsupported"] + rationale: str + assessment_id: str | None = None + assessment_digest: str | None = None + + @field_validator("citation_ids") + @classmethod + def canonicalize_citations(cls, value: tuple[str, ...]) -> tuple[str, ...]: + ordered = tuple(sorted(value)) + if len(ordered) != len(set(ordered)): + raise ValueError("citation assessment cannot amplify duplicate citation identities") + return ordered + + @model_validator(mode="after") + def derive_identity(self) -> Self: + _derive_identity( + self, + prefix="citation_claim_assessment", + id_field="assessment_id", + digest_field="assessment_digest", + ) + return self + + +class CitationCorrectnessReviewV1Alpha1(_FrozenModel): + """Exact independent review result later named by a Core Outcome.""" + + contract: Literal["ace.world-intelligence.citation-correctness-review/v1alpha1"] = ( + "ace.world-intelligence.citation-correctness-review/v1alpha1" + ) + product_id: str + review_key: str + reviewed_subject: ImmutableRecordReferenceV1 + reviewer_context: AuthenticatedRuntimeContextV1Alpha1 + policy_id: str + policy_version: str + policy_digest: str + source_observations: tuple[ImmutableRecordReferenceV1, ...] = Field(min_length=1, max_length=16) + assessments: tuple[CitationClaimAssessmentV1Alpha1, ...] = Field(min_length=1, max_length=16) + citation_coverage: float = Field(ge=0.0, le=1.0) + correctness_score: float = Field(ge=0.0, le=1.0) + limitations: tuple[str, ...] + reviewed_at: datetime + review_id: str | None = None + review_digest: str | None = None + + @field_validator("source_observations") + @classmethod + def canonicalize_observations( + cls, value: tuple[ImmutableRecordReferenceV1, ...] + ) -> tuple[ImmutableRecordReferenceV1, ...]: + ordered = tuple(sorted(value, key=lambda item: item.storage_id)) + identities = tuple(item.storage_id for item in ordered) + if len(identities) != len(set(identities)): + raise ValueError("citation review cannot amplify duplicate Observation identities") + return ordered + + @model_validator(mode="after") + def validate_scope_scores_and_identity(self) -> Self: + if ( + self.reviewed_subject.product_id != self.product_id + or self.reviewer_context.product_id != self.product_id + or any(item.product_id != self.product_id for item in self.source_observations) + ): + raise ValueError("citation correctness review crossed exact product scope") + if len({item.assessment_id for item in self.assessments}) != len(self.assessments): + raise ValueError("citation correctness review duplicated an assessment identity") + expected_score = sum(item.verdict == "supported" for item in self.assessments) / len(self.assessments) + if self.correctness_score != expected_score: + raise ValueError("citation correctness score differs from exact assessments") + _derive_identity( + self, + prefix="citation_correctness_review", + id_field="review_id", + digest_field="review_digest", + ) + return self + + +class _ReplayMustNotAuthorize: + async def authorize_action(self, request): + raise AssertionError(f"historical citation evaluation requested new authority: {request.authorization_key}") + + +def _install_policy(state: dict[str, Any]): + environment = state["environment"] + runtime = state["runtime"] + product_id = environment.fixture["product_id"] + criterion_head = _head(product_id, "impact_criterion", CRITERION_ID, 60) + operation_head = _head( + product_id, + "governed_operation_configuration", + "governed_operation_configuration:world-citation-correctness", + 61, + ) + binding = GovernedOperationBindingV1Alpha1( + product_id=product_id, + artifact=IMPACT_ARTIFACT, + configuration_ref=operation_head.state_id, + authority="append_measured_impact", + grant_ref="authority_grant:world-citation-correctness", + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(operation_head), + ) + capability_head = _head(product_id, "capability_state", capability_state_ref_for_artifact(IMPACT_ARTIFACT), 62) + authority_head = _head(product_id, "authority_grant", binding.grant_ref, 63) + for head in (criterion_head, operation_head, capability_head, authority_head): + environment.store.set_governed_state_head(head) + runtime.heads[head.state_kind, head.state_id] = head + runtime.bindings = (*runtime.bindings, binding) + return criterion_head, binding + + +async def _append_corrupted_control( + state: dict[str, Any], + *, + citation_ids: tuple[str, ...], + observation_refs: tuple[ImmutableRecordReferenceV1, ...], + corrupted_statement: str, +) -> tuple[ImmutableRecordReferenceV1, str, tuple[dict[str, Any], ...]]: + environment = state["environment"] + content = ( + "# Citation-Preserving Correctness Control\n\n" + f"{corrupted_statement}\n\n" + f"Exact citation identities retained: {', '.join(citation_ids)}.\n\n" + "Exact admitted Observation identities retained: " + f"{', '.join(item.record_key for item in observation_refs)}.\n" + ) + claims = ( + { + "claim_id": f"corrupted_claim:{canonical_hash([corrupted_statement, citation_ids])[:32]}", + "grounding_kind": "cited", + "statement": corrupted_statement, + "citation_ids": citation_ids, + }, + ) + payload = { + "control_type": "citation_preserving_semantic_corruption", + "content_markdown": content, + "claims": claims, + "citation_ids": citation_ids, + "observation_references": [item.model_dump(mode="json") for item in observation_refs], + "limitations": ["synthetic_negative_control_over_exact_recorded_public_sources"], + } + requested_at = state["clock"]() + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key="append:world-citation-preserving-control", + subject_ref="world_citation_preserving_control:2026-08-07", + subject_digest=_digest(payload), + requested_at=requested_at, + ) + record = ImmutableRecordV1( + product_id=environment.fixture["product_id"], + record_space="world_intelligence", + record_kind="brief_control", + record_key="brief_control:citation-preserving-corruption:2026-08-07", + payload_contract="ace.world-intelligence.citation-preserving-control/v1alpha1", + payload=payload, + as_of=state["impact_target_ref"].as_of, + available_at=authorization.authorized_at, + processing_order=0, + ) + append = AppendOnlyTransactionRequestV1( + product_id=record.product_id, + record_space=record.record_space, + transaction_key="world-citation-preserving-control:2026-08-07", + records=(record,), + submitted_at=record.available_at, + governed_state_preconditions=authorization.state_preconditions, + ) + if await environment.store.append(append) != append.receipt(): + raise AssertionError("citation-preserving control append returned divergent material") + return record.reference(), content, claims + + +def _policy_digest( + *, + expected_statement: str, + citation_ids: tuple[str, ...], + observation_refs: tuple[ImmutableRecordReferenceV1, ...], +) -> str: + return _digest( + { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "expected_statement": expected_statement, + "expected_citation_ids": citation_ids, + "source_observations": [item.model_dump(mode="json") for item in observation_refs], + "score": "supported_cited_claims / reviewed_cited_claims", + } + ) + + +async def _statements_from_observations( + state: dict[str, Any], observation_refs: tuple[ImmutableRecordReferenceV1, ...] +) -> tuple[str, str]: + """Derive the positive and date-swapped claims from exact admitted records.""" + + facts: list[tuple[str, str]] = [] + for reference in observation_refs: + record = await state["environment"].store.load_record( + reference.storage_id, + product_id=reference.product_id, + record_space=reference.record_space, + record_kind=reference.record_kind, + ) + if ( + record is None + or record.reference() != reference + or record.payload_contract != "ace.intelligence.observation/v1alpha1" + ): + raise AssertionError("citation review source Observation is unavailable or changed") + try: + value = json.loads(record.payload["payload"]["value_json"]) + facts.append((value["document_number"], value["publication_date"])) + except (KeyError, TypeError, json.JSONDecodeError): + raise AssertionError("citation review Observation lost required official record facts") from None + facts.sort() + if len(facts) != 2 or len({number for number, _ in facts}) != 2: + raise AssertionError("citation review requires two distinct exact official records") + first, second = facts + expected = ( + f"The admitted official records are {first[0]} published {first[1]} and {second[0]} published {second[1]}." + ) + corrupted = ( + f"The admitted official records are {first[0]} published {second[1]} and {second[0]} published {first[1]}." + ) + return expected, corrupted + + +async def _review_artifact( + state: dict[str, Any], + *, + subject: ImmutableRecordReferenceV1, + claims: tuple[dict[str, Any], ...], + citation_ids: tuple[str, ...], + observation_refs: tuple[ImmutableRecordReferenceV1, ...], + expected_statement: str, + pair_index: int, + variant: str, +) -> tuple[CitationCorrectnessReviewV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + cited_claims = tuple(item for item in claims if item["grounding_kind"] == "cited") + if not cited_claims: + raise AssertionError("citation correctness review requires an exact cited claim") + expected_ids = tuple(sorted(citation_ids)) + assessments = tuple( + CitationClaimAssessmentV1Alpha1( + claim_id=item["claim_id"], + statement=item["statement"], + citation_ids=tuple(item["citation_ids"]), + verdict=( + "supported" + if item["statement"] == expected_statement and tuple(sorted(item["citation_ids"])) == expected_ids + else "unsupported" + ), + rationale=( + "The exact cited statement matches the product-frozen facts and exact citation set." + if item["statement"] == expected_statement and tuple(sorted(item["citation_ids"])) == expected_ids + else "Citation identities are present, but the statement contradicts the product-frozen publication dates." + ), + ) + for item in cited_claims + ) + present_ids = {citation_id for item in cited_claims for citation_id in item["citation_ids"]} + coverage = len(present_ids & set(expected_ids)) / len(expected_ids) + reviewed_at = state["clock"]() + reviewer = _context(environment.context, "principal:world-citation-correctness-reviewer") + review = CitationCorrectnessReviewV1Alpha1( + product_id=environment.fixture["product_id"], + review_key=f"citation-correctness-review:{pair_index}:{variant}", + reviewed_subject=subject, + reviewer_context=reviewer, + policy_id=REVIEW_POLICY_ID, + policy_version=REVIEW_POLICY_VERSION, + policy_digest=_policy_digest( + expected_statement=expected_statement, + citation_ids=expected_ids, + observation_refs=observation_refs, + ), + source_observations=observation_refs, + assessments=assessments, + citation_coverage=coverage, + correctness_score=sum(item.verdict == "supported" for item in assessments) / len(assessments), + limitations=( + "bounded_to_one_exact_cited_claim_and_two_recorded_official_sources", + "does_not_establish_general_brief_quality_or_human_benefit", + ), + reviewed_at=reviewed_at, + ) + authorization = await _authorize_append( + state, + context=reviewer, + authorization_key=f"citation-correctness-review:{pair_index}:{variant}", + subject_ref=str(review.review_id), + subject_digest=str(review.review_digest), + requested_at=reviewed_at, + ) + reference = await _append_value( + state, + value=review, + record_kind="citation_correctness_review", + record_key=str(review.review_id), + transaction_key=f"citation-correctness-review:{review.review_id}", + as_of=reviewed_at, + authorization=authorization, + ) + return review, reference + + +async def _record_review_outcome( + state: dict[str, Any], + *, + export: ReviewedExport, + review: CitationCorrectnessReviewV1Alpha1, + review_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: str, +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + measures = ImpactOutcomeMeasuresV1Alpha1( + primary_value=review.correctness_score, + observed_result=review_ref, + latency_ms=max(0, int((review.reviewed_at - export.intent.requested_at).total_seconds() * 1_000)), + cost_usd=0.0, + failure_count=0, + degraded=False, + limitations=review.limitations, + ) + recorded_at = state["clock"]() + observer = _context(environment.context, "principal:world-citation-outcome-observer") + intent = OutcomeIntentV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=observer, + decision=export.decision_ref, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + value_json=canonical_json(measures.model_dump(mode="json")), + observed_at=review.reviewed_at, + recorded_at=recorded_at, + ) + authorization = await _authorize_append( + state, + context=observer, + authorization_key=f"citation-correctness-outcome:{pair_index}:{variant}", + subject_ref=str(intent.intent_id), + subject_digest=str(intent.intent_digest), + requested_at=recorded_at, + ) + outcome = OutcomeV1Alpha1(intent=intent, authorization=authorization) + return await _append_value( + state, + value=outcome, + record_kind="outcome", + record_key=str(outcome.outcome_id), + transaction_key=f"outcome:{outcome.outcome_id}", + as_of=review.reviewed_at, + authorization=authorization, + ) + + +async def run_citation_correctness_outcome(workspace_root: Path) -> dict[str, Any]: + """Run the P2C4 journey through exact independent citation review Outcomes.""" + + state: dict[str, Any] = {} + prior = await run_reviewed_disposition(workspace_root, state_sink=state) + environment = state["environment"] + target_ref = state["impact_target_ref"] + treatment_exports = tuple(item.export for item in state["measured_treatments"]) + brief = state["brief_admission"].brief + observation_refs = tuple( + record + for admission in state["admissions"] + for record in admission.transaction_receipt.records + if record.record_kind == "observation" + ) + citation_ids = tuple(sorted(item.citation_id for item in brief.citations)) + treatment_claims = tuple(item.model_dump(mode="json") for item in brief.claims) + expected_statement, corrupted_statement = await _statements_from_observations(state, observation_refs) + control_ref, control_content, control_claims = await _append_corrupted_control( + state, + citation_ids=citation_ids, + observation_refs=observation_refs, + corrupted_statement=corrupted_statement, + ) + control_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=control_ref, + content=control_content, + pair_index=index, + variant="citation-control", + ) + for index in (1, 2) + ] + ) + criterion_head, impact_binding = _install_policy(state) + criterion = ImpactCriterionV1Alpha1( + product_id=environment.fixture["product_id"], + criterion_id=CRITERION_ID, + criterion_version="candidate-1", + target_kind=ImpactTargetKind.INTELLIGENCE_ARTIFACT, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + metric_direction=ImpactMetricDirection.HIGHER_IS_BETTER, + useful_effect_threshold=0.5, + harmful_effect_threshold=0.5, + minimum_matched_pairs=2, + requires_observed_result=True, + harmful_action=ImpactGovernanceAction.ROLLBACK, + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(criterion_head), + frozen_at=CRITERION_FROZEN_AT, + ) + + evidence: list[ImpactEvidenceV1Alpha1] = [] + treatment_reviews: list[CitationCorrectnessReviewV1Alpha1] = [] + control_reviews: list[CitationCorrectnessReviewV1Alpha1] = [] + observed_times: list[datetime] = [] + for index, (treatment_export, control_export) in enumerate( + zip(treatment_exports, control_exports, strict=True), start=1 + ): + treatment_attribution = await _record_attribution( + state, + export=treatment_export, + subject=target_ref, + pair_index=index, + variant="citation-treatment", + ) + control_attribution = await _record_attribution( + state, + export=control_export, + subject=control_ref, + pair_index=index, + variant="citation-control", + ) + treatment_review, treatment_review_ref = await _review_artifact( + state, + subject=target_ref, + claims=treatment_claims, + citation_ids=citation_ids, + observation_refs=observation_refs, + expected_statement=expected_statement, + pair_index=index, + variant="treatment", + ) + control_review, control_review_ref = await _review_artifact( + state, + subject=control_ref, + claims=control_claims, + citation_ids=citation_ids, + observation_refs=observation_refs, + expected_statement=expected_statement, + pair_index=index, + variant="control", + ) + treatment_outcome = await _record_review_outcome( + state, + export=treatment_export, + review=treatment_review, + review_ref=treatment_review_ref, + pair_index=index, + variant="treatment", + ) + control_outcome = await _record_review_outcome( + state, + export=control_export, + review=control_review, + review_ref=control_review_ref, + pair_index=index, + variant="control", + ) + treatment_reviews.append(treatment_review) + control_reviews.append(control_review) + observed_times.extend((treatment_review.reviewed_at, control_review.reviewed_at)) + conditions = ImpactConditionsV1Alpha1( + product_id=environment.fixture["product_id"], + condition_key=f"world-citation-correctness-pair:{index}", + route_id="world:fcc-independent-citation-review", + context_json=canonical_json( + { + "citation_count": len(citation_ids), + "pair_index": index, + "recorded_transport": True, + "review_policy_digest": treatment_review.policy_digest, + "task": "independent_exact_citation_correctness_review", + } + ), + observation_window_start=CRITERION_FROZEN_AT + timedelta(seconds=1), + observation_window_end=max(observed_times) + timedelta(minutes=1), + frozen_at=CRITERION_FROZEN_AT, + ) + evidence.append( + ImpactEvidenceV1Alpha1( + product_id=environment.fixture["product_id"], + evidence_key=f"world-citation-correctness:{index}", + treatment_attribution=treatment_attribution, + control_attribution=control_attribution, + treatment_decision=treatment_export.decision_ref, + control_decision=control_export.decision_ref, + treatment_action_review=treatment_export.review_ref, + treatment_action_admission=treatment_export.admission_ref, + treatment_action_terminal=treatment_export.terminal_ref, + control_action_review=control_export.review_ref, + control_action_admission=control_export.admission_ref, + control_action_terminal=control_export.terminal_ref, + treatment_outcome=treatment_outcome, + control_outcome=control_outcome, + treatment_conditions=conditions, + control_conditions=conditions, + ) + ) + + cutoff_at = state["clock"]() + request = ImpactEvaluationRequestV1Alpha1( + evaluation_key="world-citation-correctness:fcc-publication-change:2026-08-07", + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + criterion=criterion, + target=target_ref, + control=control_ref, + evidence=tuple(evidence), + cutoff_at=cutoff_at, + requested_at=state["clock"](), + ) + service = MeasuredImpactService( + store=environment.store, + authorizer=state["reasoning"], + operation_binding=impact_binding, + ) + admission = await service.evaluate(request) + replay = await MeasuredImpactService( + store=environment.store, + authorizer=_ReplayMustNotAuthorize(), + operation_binding=impact_binding, + ).evaluate(request) + if admission.replayed or not replay.replayed or replay.evaluation != admission.evaluation: + raise AssertionError("citation correctness evaluation did not replay exact historical material") + if admission.evaluation.classification is not ImpactClassification.USEFUL: + raise AssertionError("frozen citation correctness criterion did not classify useful") + if admission.proposal is None or admission.proposal.action is not ImpactGovernanceAction.PROMOTE: + raise AssertionError("citation correctness result did not emit its proposal-only mapping") + if any(item.citation_coverage != 1.0 for item in (*treatment_reviews, *control_reviews)): + raise AssertionError("citation-preserving control lost an exact citation identity") + if {item.correctness_score for item in treatment_reviews} != {1.0}: + raise AssertionError("supported treatment citation did not score correct") + if {item.correctness_score for item in control_reviews} != {0.0}: + raise AssertionError("semantic-corruption control did not score incorrect") + + return { + "contract": "ace.world-intelligence.citation-correctness-outcome/v1alpha1", + "prior_reviewed_disposition": prior, + "review_policy": { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "policy_digest": treatment_reviews[0].policy_digest, + "reviewer_ref": treatment_reviews[0].reviewer_context.actor_ref, + "expected_statement": expected_statement, + }, + "negative_control": { + "control_reference": control_ref.model_dump(mode="json"), + "corrupted_statement": corrupted_statement, + "citation_ids_preserved": citation_ids, + "treatment_citation_coverage": tuple(item.citation_coverage for item in treatment_reviews), + "control_citation_coverage": tuple(item.citation_coverage for item in control_reviews), + "treatment_correctness": tuple(item.correctness_score for item in treatment_reviews), + "control_correctness": tuple(item.correctness_score for item in control_reviews), + }, + "observed_results": { + "treatment": tuple(item.model_dump(mode="json") for item in treatment_reviews), + "control": tuple(item.model_dump(mode="json") for item in control_reviews), + }, + "evaluation": admission.evaluation.model_dump(mode="json"), + "proposal": admission.proposal.model_dump(mode="json"), + "replay": { + "historical": replay.replayed, + "no_reauthorization": True, + "transaction_receipt_id": str(replay.transaction_receipt.receipt_id), + }, + "scope": { + "independent_exact_review": True, + "recorded_official_sources": True, + "network_freshness_claimed": False, + "general_brief_quality_claimed": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + }, + } + + +def main() -> None: + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + args = parser.parse_args() + print( + json.dumps( + asyncio.run(run_citation_correctness_outcome(args.workspace_root)), + indent=2, + sort_keys=True, + ) + ) + + +if __name__ == "__main__": + main() From 2f0ebab0ca13fa3f71784d5c4862f833c46c8a22 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Mon, 10 Aug 2026 16:02:39 -0700 Subject: [PATCH 04/17] Measure World contradiction attention --- README.md | 22 +- ROADMAP.md | 11 +- ...tradiction-attention-outcome-2026-08-10.md | 139 +++ ...iction-attention-outcome-work-packet-v1.md | 112 +++ ...st_p2c6_contradiction_attention_outcome.py | 137 +++ scripts/p2c5_citation_correctness_outcome.py | 11 +- .../p2c6_contradiction_attention_outcome.py | 879 ++++++++++++++++++ 7 files changed, 1304 insertions(+), 7 deletions(-) create mode 100644 docs/audits/world-intelligence-p2c6-contradiction-attention-outcome-2026-08-10.md create mode 100644 docs/design/world-intelligence-p2c6-contradiction-attention-outcome-work-packet-v1.md create mode 100644 domain_packs/tests/test_p2c6_contradiction_attention_outcome.py create mode 100644 scripts/p2c6_contradiction_attention_outcome.py diff --git a/README.md b/README.md index 95b3541..8627bdc 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,18 @@ does not establish reviewer infallibility, current network freshness, source ind Brief quality, causal impact, or human benefit. Citation review vocabulary and policy remain in World; Core and Intelligence receive only the exact immutable observed-result coordinate. +P2C6 adds an exact contradiction-attention outcome over the same recorded official sources. One +candidate states the admitted document/date facts exactly and one swaps the dates. Treatment +alerts only on the contradiction; an inverted-routing control alerts only on the valid comparator. +Both emit exactly one alert, so raw alert volume cannot explain the `1.0` treatment/control quality +difference. The independently recorded review exposes contradiction recall, false-alert rate, one +valid silence, confusion counts, exact Brief/Observation provenance, policy identity, and limits. + +This source-checkout candidate demonstrates one frozen challenge, not a live observed public +conflict or a population false-alert rate. It does not establish autonomous discovery, network +freshness, correction quality, general Brief quality, causality, or human benefit. The resulting +proposal remains non-effective and unapplied. + ## What the public World proof demonstrates Generate a self-contained visual Reality Brief and its exact machine-readable backing data: @@ -334,6 +346,10 @@ $PY -m scripts.p2c3_measured_feedback "$WORKSPACE" # Stacked candidate: explicit reject/no-action review of the exact proposal $PY -m scripts.p2c4_reviewed_impact_disposition "$WORKSPACE" + +# Stacked candidates: exact citation correctness, then contradiction recall/false-alert outcome +$PY -m scripts.p2c5_citation_correctness_outcome "$WORKSPACE" +$PY -m scripts.p2c6_contradiction_attention_outcome "$WORKSPACE" ``` The released 0.9.0 gates are reproducible through the locked environment, as CI does. The @@ -408,8 +424,10 @@ remains in [`docs/world-intelligence-roadmap-status-2026-08-06.md`](docs/world-i and release history is in [`CHANGELOG.md`](CHANGELOG.md). P2C4 demonstrates a separately authorized reject/no-action disposition of the P2C3 proposal without effective state change. P2C5 adds an independently reviewed citation-correctness Outcome and a citation-preserving semantic -negative control. The next bounded measurement work is contradiction/correction coverage, -detection delay, false-alert rate, or independent Market reproduction. +negative control. P2C6 adds exact contradiction recall, false-alert rate, equal alert-volume +control, and valid silence under one frozen recorded-source challenge. The next bounded +measurement work is correction handling, detection delay, calibration/revision stability, or +independent Market reproduction. Separately reviewed opt-in network transport and P2D multi-source conflict/correction with LIVE inputs remain independent work. None of these steps may add autonomous publishing, delivery, persuasion, or action authority to a Domain Pack. diff --git a/ROADMAP.md b/ROADMAP.md index b181808..7cbb7d3 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–P2C5 measured feedback, disposition, and citation correctness +## Candidate — P2C3–P2C6 measured feedback and product-owned outcomes - 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. @@ -31,6 +31,11 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). score. A citation-preserving date-swap control retains `1.0` citation coverage while correctness falls from `1.0` to `0.0` over two matched pairs; the bounded evaluation again emits only a non-effective proposal. +- A third frozen criterion reviews two exact statement candidates derived from the same admitted + records. Treatment and inverted control each emit one alert, but treatment recalls the + contradiction, produces no false alert, and preserves silence on the valid comparator while the + control does the opposite. The exact result records recall, false-alert rate, confusion counts, + valid silence, policy, reviewer, Brief, and Observation provenance. - 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. @@ -39,6 +44,10 @@ The follow-on [P2C4 work packet](docs/design/world-intelligence-p2c4-reviewed-im freezes the exact proposal-disposition boundary. The stacked [P2C5 work packet](docs/design/world-intelligence-p2c5-citation-correctness-outcome-work-packet-v1.md) freezes independently reviewed citation correctness and its citation-preserving negative control. +The stacked +[P2C6 work packet](docs/design/world-intelligence-p2c6-contradiction-attention-outcome-work-packet-v1.md) +freezes contradiction recall, false-alert rate, equal alert volume, and valid silence without +claiming live conflict detection or population performance. ## Next — trustworthy live orientation diff --git a/docs/audits/world-intelligence-p2c6-contradiction-attention-outcome-2026-08-10.md b/docs/audits/world-intelligence-p2c6-contradiction-attention-outcome-2026-08-10.md new file mode 100644 index 0000000..02049b5 --- /dev/null +++ b/docs/audits/world-intelligence-p2c6-contradiction-attention-outcome-2026-08-10.md @@ -0,0 +1,139 @@ +# World Intelligence P2C6 contradiction-attention outcome audit — 2026-08-10 + +Status: **stacked candidate evidence only; not a release, SI4 pass, live-conflict proof, or applied +governance change** + +## Source identity + +- World base: P2C5 commit `e43fc5e88ba1d79e01d1d9bddf2c1c0ae052b9ac` +- World branch: `codex/world-contradiction-recall` +- Core dependency: exact observed-result candidate commit + `433e3d16c5458c975557dcd1552824fb959d4d12` +- Released identity intentionally unchanged: `ace-domain-world-intelligence==0.9.0`, + `ace-core>=0.5.0,<0.6` + +## Exact point-in-time result + +One source-checkout run recorded two treatment reviews and two inverted-control reviews under +product policy +`sha256:94ad25bb2d3e2c153365659cf90c909fdb02ead9a188bff71d450dffe4a4832f`: + +```text +treatment artifact: contradiction_attention_artifact:5650baf1ebe06831aa476390c243502e +control artifact: contradiction_attention_artifact:8a941d93bef7413c57068380b75019bb +treatment review 1: contradiction_attention_review:55c06985ebb527a7b113014069ee3249 +treatment review 2: contradiction_attention_review:2266b1f5af3392dcd79b2b324ea7a480 +control review 1: contradiction_attention_review:68e6426d78aa72ffb028d4285a02915c +control review 2: contradiction_attention_review:5e4ea73f1c08bee985aec0135ba80d63 +treatment alert volume: 1, 1 +control alert volume: 1, 1 +treatment contradiction recall: 1.0, 1.0 +control contradiction recall: 0.0, 0.0 +treatment false-alert rate: 0.0, 0.0 +control false-alert rate: 1.0, 1.0 +treatment valid silence count: 1, 1 +control valid silence count: 0, 0 +treatment quality score: 1.0, 1.0 +control quality score: 0.0, 0.0 +matched pairs: 2 +mean effect: 1.0 +classification: useful +proposal action: promote +proposal live effect: false +historical replay: true +replay reauthorization: false +``` + +The exact evaluation was `impact_evaluation:c88c9ae913307d93d46650339c103624` with material +`sha256:c88c9ae913307d93d46650339c103624311bf856e4e4b9fee0572f6f2fbfd927`. +The exact non-effective proposal was +`impact_governance_proposal:6a42a1a57040983e8f323176ca2f09f8` with material +`sha256:6a42a1a57040983e8f323176ca2f09f8a441715795d1c9618db14888742a50e5`. + +The frozen candidate set was: + +```text +valid comparator: + contradiction_candidate:00890df1781c09df7c01b67cef19252b + 2026-15932 published 2026-08-06; 2026-16197 published 2026-08-07 + +contradiction: + contradiction_candidate:1e1388a5652933a8b18f42d704e684d1 + 2026-15932 published 2026-08-07; 2026-16197 published 2026-08-06 +``` + +Treatment alerts only on the contradiction. Control reverses both decisions. Equal alert volume +therefore makes raw ingestion or alert count incapable of explaining the measured difference, and +the treatment's true negative makes silence an explicit valid result. + +## Verification + +The exact locked World environment (`uv.lock`, Ruff `0.16.2`) plus the stacked Core candidate and +separately packaged reference action adapter produced: + +```text +python -B -m pytest domain_packs/tests/test_p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py \ + domain_packs/tests/test_p2c5_citation_correctness_outcome.py \ + domain_packs/tests/test_p2c6_contradiction_attention_outcome.py -q --tb=short +10 passed in 2.62s + +python -B -m pytest -q --tb=short +93 passed in 17.05s + +python -B -m pytest adapters/federal_register_source/tests -q --tb=short +26 passed in 0.31s + +python -B -m pytest tests/test_release_contract.py -q --tb=short +7 passed in 0.05s + +# Installed public ace-core==0.5.0; no Core source checkout or reference action adapter. +python -B -m pytest -q --tb=short -rs +82 passed, 11 skipped in 14.66s + +ruff check --no-cache +PASS + +ruff format --check --no-cache +4 files already formatted + +uv build --out-dir +Successfully built unchanged 0.9.0 source distribution and inert data-only wheel + +git diff --check +PASS +``` + +The eleven public-Core skips are explicit boundaries: one P2C2 test requires the separately +packaged Core reference action adapter; P2C3–P2C6 require unreleased stacked Core candidate +contracts. The wheel contains 45 inert Domain Pack JSON/metadata files, no Python or entry points, +and retains `ace-core>=0.5.0,<0.6`. + +Repository-wide Ruff is an inherited release-hygiene blocker, not made green by this packet. Under +the exact locked Ruff, the P2C5 parent reports 16 lint findings and this candidate reports 15 after +the touched P2C5 import block is normalized; no P2C6 file adds a finding. Broad format checking also +reports existing drift outside the scoped Python files. P2C6 does not rewrite that unrelated +history, but release closeout must reconcile the repository-wide gate before publication. + +## Claim boundary + +The World reviewer exact-loads the treatment or control attention artifact and verifies its exact +Brief, Observation, candidate, decision, and policy material. It records every confusion class and +derives recall, false-alert rate, valid silence, alert volume, and quality score from those exact +assessments. The Core Outcome points to that exact review record. Replay returns historical +evaluation material without new authority, and fresh hosts reproduce the classification and +metrics. + +This demonstrates one product-policy challenge over two recorded official public records. The +contradiction is a deterministic semantic negative control, not evidence that the public sources +contradicted each other or that ACE discovered a live conflict. Two candidates do not establish a +population false-alert rate, calibration, correction quality, detection delay, source +independence, general Brief quality, causality, or human benefit. The proposal remains +non-effective and unapplied. + +## Remaining work + +Detection delay, actual correction handling, calibration, revision stability, a materially +different Market journey, combined-main review/CI, public artifacts, security/release checks, and +opt-in live transport remain future bounded work. Core issue #49 F1, F3, and F5 still require +explicit 0.6 release-owner disposition; this World packet neither implements nor re-dates them. diff --git a/docs/design/world-intelligence-p2c6-contradiction-attention-outcome-work-packet-v1.md b/docs/design/world-intelligence-p2c6-contradiction-attention-outcome-work-packet-v1.md new file mode 100644 index 0000000..3b384c7 --- /dev/null +++ b/docs/design/world-intelligence-p2c6-contradiction-attention-outcome-work-packet-v1.md @@ -0,0 +1,112 @@ +# World Intelligence P2C6 contradiction-attention outcome work packet (v1) + +**Status:** stacked source-checkout candidate; this packet does not release World Intelligence, +apply a governance proposal, close ACE Core issue #38, pass SI4, or complete ACE 0.6.0. + +**Frozen:** 2026-08-10 from World P2C5 commit +`e43fc5e88ba1d79e01d1d9bddf2c1c0ae052b9ac`, stacked on the Core exact observed-result +provenance candidate `433e3d16c5458c975557dcd1552824fb959d4d12`. + +## Objective + +Measure whether one exact World attention artifact identifies a contradiction without rewarding +raw alert volume or treating silence as failure. The packet preserves the governed journey: + +```text +Observation -> Shift -> Signal -> Brief -> contradiction-attention artifact + -> Decision -> reviewed Action -> exact independent review -> observed Outcome + -> useful / harmful / unproven evaluation -> proposal only +``` + +The challenge derives two statements from the same exact two admitted official-record +Observations. One states their recorded document/date facts exactly; the other swaps the two dates +while preserving both document identities. Treatment alerts on the contradiction and remains +silent on the valid comparator. The deterministic inverted-routing control remains silent on the +contradiction and alerts on the valid comparator. Each emits exactly one alert. + +## Product-owned review policy + +World owns `world_official_record_contradiction_attention` version `candidate-1`. Its exact frozen +candidate set, expected dispositions, source Brief, source Observations, score formula, and policy +digest are inspectable. The score is: + +```text +(contradiction_recall + (1 - false_alert_rate)) / 2 +``` + +The exact review record names: + +- the reviewed attention artifact, source Brief, and two source Observation references; +- the authenticated reviewer `principal:world-contradiction-attention-reviewer`; +- the policy identity, version, and material digest; +- each candidate statement, expected and actual disposition, confusion class, and rationale; +- true-positive, false-negative, false-positive, true-negative, valid-silence, and alert counts; +- contradiction recall, false-alert rate, quality score, limitations, review time, and derived + review identity/digest. + +Core and Intelligence see only the generic exact observed-result coordinate and scalar outcome. +Federal Register, contradiction, attention, reviewer, alert, and source-policy nouns remain in +World. + +## Exact acceptance + +P2C6 must: + +1. rerun P2C2 through P2C5 and preserve all prior evaluations, proposals, and reviewed disposition + as immutable history; +2. derive one valid statement and one contradiction from the exact admitted Observation payloads; +3. append exact treatment and inverted-control attention artifacts bound to the same Brief, + Observations, and candidate set; +4. prove treatment and control each emit exactly one alert, preventing raw alert or ingestion + volume from explaining the result; +5. create two distinct reviewed treatment/control Action pairs under matched task conditions; +6. append four independently authenticated review records and four Core Outcomes naming those + exact review records; +7. show treatment recall `1.0`, false-alert rate `0.0`, one valid silence, and score `1.0`, while + control recall is `0.0`, false-alert rate `1.0`, and score `0.0` in both pairs; +8. classify the bounded difference `useful`, emit only a non-effective `promote` proposal, and + perform no proposal application; +9. replay the evaluation without reauthorization and reproduce the classification and metrics + across fresh hosts; and +10. retain explicit non-claims for live public conflict, population false-alert rate, network + freshness, causality, general Brief quality, human benefit, and autonomous publication. + +## Negative and failure controls + +The inverted-routing artifact is the primary product negative control: it has the same sources, +candidate coverage, reviewed workflow, matched conditions, and alert count as treatment, but puts +the alert on the valid statement and silence on the contradiction. Duplicate candidate identities, +inconsistent confusion labels, invented aggregate counts, and invented scores fail model +validation. Exact review loading rejects unavailable, changed, relabelled, cross-product, or +incomplete artifact material. The stacked Core tests remain authoritative for missing +attribution/result provenance, condition mismatch, cutoff leakage, unavailable Outcomes, +duplicate/replayed evidence, interruption, restart, and denied authority. + +## Files and rollback + +This packet owns: + +- `scripts/p2c6_contradiction_attention_outcome.py`; +- `domain_packs/tests/test_p2c6_contradiction_attention_outcome.py`; +- the additive P2C5 acceptance-state handoff; +- this work packet, its audit, and restrained README/roadmap references. + +It changes no shipped Domain Pack, connector, package version, dependency range, lockfile, release +record, Core contract, or public artifact. Rollback removes the P2C6 harness, tests, state handoff, +and candidate documentation. Product attention, review, Outcome, evaluation, and proposal records +already persisted by a host remain immutable history. + +## Non-claims and next packet + +This is one two-statement challenge over two recorded official public records and two replicated +matched pairs. It establishes criterion sensitivity, exact attribution, equal-volume alert +discrimination, and valid silence under one frozen product rule. It does not establish that a live +public-source conflict occurred, that the candidate was discovered autonomously, a population +false-alert rate, correction quality, detection delay, calibration, revision stability, source +independence, general Brief quality, causal benefit, or human usefulness. + +The next bounded outcome packet should measure detection delay and correction handling over +additional recorded public events, or freeze the remaining revision-stability/calibration +contract. Independent Market reproduction, public Core artifacts, compatibility/security/release +gates, opt-in live transport, issue #49 disposition, and any separately authorized proposal +application remain separate work. diff --git a/domain_packs/tests/test_p2c6_contradiction_attention_outcome.py b/domain_packs/tests/test_p2c6_contradiction_attention_outcome.py new file mode 100644 index 0000000..d8a5997 --- /dev/null +++ b/domain_packs/tests/test_p2c6_contradiction_attention_outcome.py @@ -0,0 +1,137 @@ +from __future__ import annotations + +import copy +import importlib.util +import json + +import pytest +from pydantic import ValidationError + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact") is None: + pytest.skip("P2C6 requires the stacked ACE Core measured-impact candidate") + from ace.intelligence import ImpactOutcomeMeasuresV1Alpha1 + + if "observed_result" not in ImpactOutcomeMeasuresV1Alpha1.model_fields: + pytest.skip("P2C6 requires exact observed-result provenance from the stacked Core candidate") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("P2C6 requires the separately packaged Core reference adapter") + + +@pytest.mark.asyncio +async def test_exact_contradiction_attention_review_becomes_a_measured_outcome(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c6_contradiction_attention_outcome import run_contradiction_attention_outcome + + result = await run_contradiction_attention_outcome(tmp_path) + + assert result["review_policy"]["reviewer_ref"] == "principal:world-contradiction-attention-reviewer" + assert result["evaluation"]["criterion"]["requires_observed_result"] is True + assert result["evaluation"]["classification"] == "useful" + assert result["evaluation"]["matched_pair_count"] == 2 + assert result["evaluation"]["mean_effect"] == 1.0 + assert result["proposal"]["action"] == "promote" + assert result["proposal"]["live_effect"] is False + assert result["proposal"]["selectable"] is False + assert result["proposal"]["requires_human_review"] is True + assert result["replay"]["historical"] is True + assert result["replay"]["no_reauthorization"] is True + reviews = (*result["observed_results"]["treatment"], *result["observed_results"]["control"]) + assert {item["contract"] for item in reviews} == {"ace.world-intelligence.contradiction-attention-review/v1alpha1"} + assert {len(item["source_observations"]) for item in reviews} == {2} + + +@pytest.mark.asyncio +async def test_equal_alert_volume_separates_recall_false_alerts_and_valid_silence(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c6_contradiction_attention_outcome import run_contradiction_attention_outcome + + result = await run_contradiction_attention_outcome(tmp_path) + challenge = result["challenge"] + treatments = result["observed_results"]["treatment"] + controls = result["observed_results"]["control"] + + assert challenge["treatment_alert_volume"] == challenge["control_alert_volume"] == 1 + assert challenge["contradiction_candidate_id"] != challenge["valid_comparator_id"] + assert {item["contradiction_recall"] for item in treatments} == {1.0} + assert {item["false_alert_rate"] for item in treatments} == {0.0} + assert {item["quality_score"] for item in treatments} == {1.0} + assert {item["valid_silence_count"] for item in treatments} == {1} + assert {item["true_positive_count"] for item in treatments} == {1} + assert {item["true_negative_count"] for item in treatments} == {1} + assert {item["contradiction_recall"] for item in controls} == {0.0} + assert {item["false_alert_rate"] for item in controls} == {1.0} + assert {item["quality_score"] for item in controls} == {0.0} + assert {item["false_negative_count"] for item in controls} == {1} + assert {item["false_positive_count"] for item in controls} == {1} + assert result["scope"]["equal_alert_volume_control"] is True + assert result["scope"]["valid_silence_measured"] is True + assert result["scope"]["live_public_conflict_claimed"] is False + assert result["scope"]["population_false_alert_rate_claimed"] is False + + +@pytest.mark.asyncio +async def test_duplicate_candidates_and_invented_scores_fail_closed(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c6_contradiction_attention_outcome import ( + ContradictionAttentionArtifactV1Alpha1, + ContradictionAttentionReviewV1Alpha1, + run_contradiction_attention_outcome, + ) + + result = await run_contradiction_attention_outcome(tmp_path) + artifact = copy.deepcopy(result["artifacts"]["treatment"]) + artifact["decisions"] = [artifact["decisions"][0], artifact["decisions"][0]] + artifact["artifact_id"] = None + artifact["artifact_digest"] = None + with pytest.raises(ValidationError, match="duplicated a candidate identity"): + ContradictionAttentionArtifactV1Alpha1.model_validate(artifact) + + review = copy.deepcopy(result["observed_results"]["treatment"][0]) + review["quality_score"] = 0.5 + review["review_id"] = None + review["review_digest"] = None + with pytest.raises(ValidationError, match="quality score differs"): + ContradictionAttentionReviewV1Alpha1.model_validate_json(json.dumps(review)) + + +@pytest.mark.asyncio +async def test_packet_classification_is_deterministic_across_fresh_hosts(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c6_contradiction_attention_outcome import run_contradiction_attention_outcome + + first_root = tmp_path / "first" + second_root = tmp_path / "second" + first_root.mkdir() + second_root.mkdir() + first = await run_contradiction_attention_outcome(first_root) + second = await run_contradiction_attention_outcome(second_root) + + assert first["challenge"] == second["challenge"] + for variant in ("treatment", "control"): + assert first["artifacts"][variant]["decisions"] == second["artifacts"][variant]["decisions"] + assert first["artifacts"][variant]["emitted_alert_count"] == second["artifacts"][variant]["emitted_alert_count"] + first_metrics = [ + ( + item["contradiction_recall"], + item["false_alert_rate"], + item["quality_score"], + item["valid_silence_count"], + ) + for item in first["observed_results"][variant] + ] + second_metrics = [ + ( + item["contradiction_recall"], + item["false_alert_rate"], + item["quality_score"], + item["valid_silence_count"], + ) + for item in second["observed_results"][variant] + ] + assert first_metrics == second_metrics + for field in ("classification", "matched_pair_count", "mean_effect"): + assert first["evaluation"][field] == second["evaluation"][field] + for field in ("action", "live_effect", "selectable", "requires_human_review"): + assert first["proposal"][field] == second["proposal"][field] diff --git a/scripts/p2c5_citation_correctness_outcome.py b/scripts/p2c5_citation_correctness_outcome.py index 88b1e1a..a570ca3 100644 --- a/scripts/p2c5_citation_correctness_outcome.py +++ b/scripts/p2c5_citation_correctness_outcome.py @@ -8,8 +8,6 @@ from pathlib import Path from typing import Any, Literal, Self -from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator - from ace.application import MeasuredImpactService from ace.core import ( AppendOnlyTransactionRequestV1, @@ -36,6 +34,7 @@ ImpactOutcomeMeasuresV1Alpha1, ImpactTargetKind, ) +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator from scripts.p2c2_federal_register_monitor import _time from scripts.p2c2_governed_reality_brief import _context, _head @@ -455,10 +454,14 @@ async def _record_review_outcome( ) -async def run_citation_correctness_outcome(workspace_root: Path) -> dict[str, Any]: +async def run_citation_correctness_outcome( + workspace_root: Path, + *, + state_sink: dict[str, Any] | None = None, +) -> dict[str, Any]: """Run the P2C4 journey through exact independent citation review Outcomes.""" - state: dict[str, Any] = {} + state: dict[str, Any] = {} if state_sink is None else state_sink prior = await run_reviewed_disposition(workspace_root, state_sink=state) environment = state["environment"] target_ref = state["impact_target_ref"] diff --git a/scripts/p2c6_contradiction_attention_outcome.py b/scripts/p2c6_contradiction_attention_outcome.py new file mode 100644 index 0000000..2001537 --- /dev/null +++ b/scripts/p2c6_contradiction_attention_outcome.py @@ -0,0 +1,879 @@ +"""Measure contradiction attention without rewarding raw alert volume.""" + +from __future__ import annotations + +import asyncio +import json +from datetime import datetime, timedelta +from pathlib import Path +from typing import Any, Literal, Self + +from ace.application import MeasuredImpactService +from ace.core import ( + AuthenticatedRuntimeContextV1Alpha1, + CapabilityArtifactIdentityV1Alpha1, + GovernedOperationBindingV1Alpha1, + GovernedStateHeadPreconditionV1Alpha1, + ImmutableRecordReferenceV1, + OutcomeIntentV1Alpha1, + OutcomeV1Alpha1, + canonical_hash, + canonical_json, + capability_state_ref_for_artifact, +) +from ace.intelligence import ( + ImpactClassification, + ImpactConditionsV1Alpha1, + ImpactCriterionV1Alpha1, + ImpactEvaluationRequestV1Alpha1, + ImpactEvidenceV1Alpha1, + ImpactGovernanceAction, + ImpactMetricDirection, + ImpactOutcomeMeasuresV1Alpha1, + ImpactTargetKind, +) +from pydantic import Field, field_validator, model_validator + +from scripts.p2c2_federal_register_monitor import _time +from scripts.p2c2_governed_reality_brief import _context, _head +from scripts.p2c3_measured_feedback import ( + ReviewedExport, + _append_value, + _authorize_append, + _digest, + _record_attribution, + _run_reviewed_export, +) +from scripts.p2c5_citation_correctness_outcome import ( + _derive_identity, + _FrozenModel, + _statements_from_observations, + run_citation_correctness_outcome, +) + +OUTCOME_TYPE = "independent_artifact_review" +MEASURE_ID = "contradiction_attention_quality" +CRITERION_ID = "impact_criterion:world-contradiction-attention-quality" +CRITERION_FROZEN_AT = _time("2026-08-07T18:01:20Z") +REVIEW_POLICY_ID = "world_official_record_contradiction_attention" +REVIEW_POLICY_VERSION = "candidate-1" + +IMPACT_ARTIFACT = CapabilityArtifactIdentityV1Alpha1( + capability="measured_impact_evaluation", + contract="ace.application.measured-impact-service/v1alpha1", + implementation_id="world_contradiction_attention_candidate", + implementation_version="0.1.0", + artifact_digest="sha256:" + "f" * 64, +) + + +class ContradictionAttentionDecisionV1Alpha1(_FrozenModel): + """One World-owned alert-or-silence decision over an exact candidate statement.""" + + contract: Literal["ace.world-intelligence.contradiction-attention-decision/v1alpha1"] = ( + "ace.world-intelligence.contradiction-attention-decision/v1alpha1" + ) + candidate_id: str + statement: str + disposition: Literal["alert", "silence"] + rationale: str + decision_id: str | None = None + decision_digest: str | None = None + + @model_validator(mode="after") + def derive_identity(self) -> Self: + _derive_identity( + self, + prefix="contradiction_attention_decision", + id_field="decision_id", + digest_field="decision_digest", + ) + return self + + +class ContradictionAttentionArtifactV1Alpha1(_FrozenModel): + """Exact product response to one contradiction and one valid comparator.""" + + contract: Literal["ace.world-intelligence.contradiction-attention-artifact/v1alpha1"] = ( + "ace.world-intelligence.contradiction-attention-artifact/v1alpha1" + ) + product_id: str + artifact_key: str + source_brief: ImmutableRecordReferenceV1 + source_observations: tuple[ImmutableRecordReferenceV1, ...] = Field(min_length=2, max_length=2) + decisions: tuple[ContradictionAttentionDecisionV1Alpha1, ...] = Field(min_length=2, max_length=2) + emitted_alert_count: int = Field(ge=0, le=2) + limitations: tuple[str, ...] + generated_at: datetime + artifact_id: str | None = None + artifact_digest: str | None = None + + @field_validator("source_observations") + @classmethod + def canonicalize_observations( + cls, value: tuple[ImmutableRecordReferenceV1, ...] + ) -> tuple[ImmutableRecordReferenceV1, ...]: + ordered = tuple(sorted(value, key=lambda item: item.storage_id)) + if len({item.storage_id for item in ordered}) != len(ordered): + raise ValueError("contradiction artifact duplicated an Observation identity") + return ordered + + @field_validator("decisions") + @classmethod + def canonicalize_decisions( + cls, value: tuple[ContradictionAttentionDecisionV1Alpha1, ...] + ) -> tuple[ContradictionAttentionDecisionV1Alpha1, ...]: + ordered = tuple(sorted(value, key=lambda item: item.candidate_id)) + if len({item.candidate_id for item in ordered}) != len(ordered): + raise ValueError("contradiction artifact duplicated a candidate identity") + return ordered + + @model_validator(mode="after") + def validate_scope_volume_and_identity(self) -> Self: + if self.source_brief.product_id != self.product_id or any( + item.product_id != self.product_id for item in self.source_observations + ): + raise ValueError("contradiction artifact crossed exact product scope") + expected_alert_count = sum(item.disposition == "alert" for item in self.decisions) + if self.emitted_alert_count != expected_alert_count: + raise ValueError("contradiction artifact alert count differs from exact decisions") + _derive_identity( + self, + prefix="contradiction_attention_artifact", + id_field="artifact_id", + digest_field="artifact_digest", + ) + return self + + +class ContradictionAttentionAssessmentV1Alpha1(_FrozenModel): + """Independent comparison of one exact decision with frozen World policy.""" + + contract: Literal["ace.world-intelligence.contradiction-attention-assessment/v1alpha1"] = ( + "ace.world-intelligence.contradiction-attention-assessment/v1alpha1" + ) + candidate_id: str + statement: str + expected_disposition: Literal["alert", "silence"] + actual_disposition: Literal["alert", "silence"] + confusion: Literal["true_positive", "false_negative", "false_positive", "true_negative"] + rationale: str + assessment_id: str | None = None + assessment_digest: str | None = None + + @model_validator(mode="after") + def validate_confusion_and_derive_identity(self) -> Self: + expected = { + ("alert", "alert"): "true_positive", + ("alert", "silence"): "false_negative", + ("silence", "alert"): "false_positive", + ("silence", "silence"): "true_negative", + }[(self.expected_disposition, self.actual_disposition)] + if self.confusion != expected: + raise ValueError("contradiction assessment confusion label is inconsistent") + _derive_identity( + self, + prefix="contradiction_attention_assessment", + id_field="assessment_id", + digest_field="assessment_digest", + ) + return self + + +class ContradictionAttentionReviewV1Alpha1(_FrozenModel): + """Exact independent review later named by a Core Outcome.""" + + contract: Literal["ace.world-intelligence.contradiction-attention-review/v1alpha1"] = ( + "ace.world-intelligence.contradiction-attention-review/v1alpha1" + ) + product_id: str + review_key: str + reviewed_subject: ImmutableRecordReferenceV1 + source_brief: ImmutableRecordReferenceV1 + source_observations: tuple[ImmutableRecordReferenceV1, ...] = Field(min_length=2, max_length=2) + reviewer_context: AuthenticatedRuntimeContextV1Alpha1 + policy_id: str + policy_version: str + policy_digest: str + assessments: tuple[ContradictionAttentionAssessmentV1Alpha1, ...] = Field(min_length=2, max_length=2) + emitted_alert_count: int = Field(ge=0, le=2) + true_positive_count: int = Field(ge=0, le=2) + false_negative_count: int = Field(ge=0, le=2) + false_positive_count: int = Field(ge=0, le=2) + true_negative_count: int = Field(ge=0, le=2) + contradiction_recall: float = Field(ge=0.0, le=1.0) + false_alert_rate: float = Field(ge=0.0, le=1.0) + quality_score: float = Field(ge=0.0, le=1.0) + valid_silence_count: int = Field(ge=0, le=2) + limitations: tuple[str, ...] + reviewed_at: datetime + review_id: str | None = None + review_digest: str | None = None + + @field_validator("source_observations") + @classmethod + def canonicalize_observations( + cls, value: tuple[ImmutableRecordReferenceV1, ...] + ) -> tuple[ImmutableRecordReferenceV1, ...]: + ordered = tuple(sorted(value, key=lambda item: item.storage_id)) + if len({item.storage_id for item in ordered}) != len(ordered): + raise ValueError("contradiction review duplicated an Observation identity") + return ordered + + @field_validator("assessments") + @classmethod + def canonicalize_assessments( + cls, value: tuple[ContradictionAttentionAssessmentV1Alpha1, ...] + ) -> tuple[ContradictionAttentionAssessmentV1Alpha1, ...]: + ordered = tuple(sorted(value, key=lambda item: item.candidate_id)) + if len({item.candidate_id for item in ordered}) != len(ordered): + raise ValueError("contradiction review duplicated a candidate identity") + return ordered + + @model_validator(mode="after") + def validate_scope_metrics_and_identity(self) -> Self: + if ( + self.reviewed_subject.product_id != self.product_id + or self.source_brief.product_id != self.product_id + or self.reviewer_context.product_id != self.product_id + or any(item.product_id != self.product_id for item in self.source_observations) + ): + raise ValueError("contradiction review crossed exact product scope") + counts = { + name: sum(item.confusion == name for item in self.assessments) + for name in ("true_positive", "false_negative", "false_positive", "true_negative") + } + supplied = { + "true_positive": self.true_positive_count, + "false_negative": self.false_negative_count, + "false_positive": self.false_positive_count, + "true_negative": self.true_negative_count, + } + if counts != supplied: + raise ValueError("contradiction review counts differ from exact assessments") + actual_alerts = counts["true_positive"] + counts["false_positive"] + if self.emitted_alert_count != actual_alerts: + raise ValueError("contradiction review alert count differs from exact assessments") + positives = counts["true_positive"] + counts["false_negative"] + negatives = counts["false_positive"] + counts["true_negative"] + recall = counts["true_positive"] / positives if positives else 0.0 + false_alert_rate = counts["false_positive"] / negatives if negatives else 0.0 + quality = (recall + (1.0 - false_alert_rate)) / 2.0 + if self.contradiction_recall != recall: + raise ValueError("contradiction recall differs from exact assessments") + if self.false_alert_rate != false_alert_rate: + raise ValueError("false-alert rate differs from exact assessments") + if self.quality_score != quality: + raise ValueError("contradiction quality score differs from frozen product rule") + if self.valid_silence_count != counts["true_negative"]: + raise ValueError("valid-silence count differs from exact assessments") + _derive_identity( + self, + prefix="contradiction_attention_review", + id_field="review_id", + digest_field="review_digest", + ) + return self + + +class _ReplayMustNotAuthorize: + async def authorize_action(self, request): + raise AssertionError( + f"historical contradiction evaluation requested new authority: {request.authorization_key}" + ) + + +def _candidate_id( + *, + candidate_kind: str, + statement: str, + observation_refs: tuple[ImmutableRecordReferenceV1, ...], +) -> str: + digest = canonical_hash( + { + "candidate_kind": candidate_kind, + "statement": statement, + "source_observations": [item.model_dump(mode="json") for item in observation_refs], + } + ) + return f"contradiction_candidate:{digest[:32]}" + + +def _install_policy(state: dict[str, Any]): + environment = state["environment"] + runtime = state["runtime"] + product_id = environment.fixture["product_id"] + criterion_head = _head(product_id, "impact_criterion", CRITERION_ID, 70) + operation_head = _head( + product_id, + "governed_operation_configuration", + "governed_operation_configuration:world-contradiction-attention", + 71, + ) + binding = GovernedOperationBindingV1Alpha1( + product_id=product_id, + artifact=IMPACT_ARTIFACT, + configuration_ref=operation_head.state_id, + authority="append_measured_impact", + grant_ref="authority_grant:world-contradiction-attention", + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(operation_head), + ) + capability_head = _head(product_id, "capability_state", capability_state_ref_for_artifact(IMPACT_ARTIFACT), 72) + authority_head = _head(product_id, "authority_grant", binding.grant_ref, 73) + for head in (criterion_head, operation_head, capability_head, authority_head): + environment.store.set_governed_state_head(head) + runtime.heads[head.state_kind, head.state_id] = head + runtime.bindings = (*runtime.bindings, binding) + return criterion_head, binding + + +def _policy_digest( + *, + source_brief: ImmutableRecordReferenceV1, + observation_refs: tuple[ImmutableRecordReferenceV1, ...], + expected_dispositions: dict[str, str], + statements: dict[str, str], +) -> str: + return _digest( + { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "source_brief": source_brief.model_dump(mode="json"), + "source_observations": [item.model_dump(mode="json") for item in observation_refs], + "expected_dispositions": dict(sorted(expected_dispositions.items())), + "statements": dict(sorted(statements.items())), + "score": "(contradiction_recall + (1 - false_alert_rate)) / 2", + } + ) + + +async def _append_attention_artifact( + state: dict[str, Any], + *, + source_brief: ImmutableRecordReferenceV1, + observation_refs: tuple[ImmutableRecordReferenceV1, ...], + decisions: tuple[ContradictionAttentionDecisionV1Alpha1, ...], + variant: str, +) -> tuple[ContradictionAttentionArtifactV1Alpha1, ImmutableRecordReferenceV1, str]: + environment = state["environment"] + generated_at = state["clock"]() + artifact = ContradictionAttentionArtifactV1Alpha1( + product_id=environment.fixture["product_id"], + artifact_key=f"contradiction-attention:{variant}:2026-08-07", + source_brief=source_brief, + source_observations=observation_refs, + decisions=decisions, + emitted_alert_count=sum(item.disposition == "alert" for item in decisions), + limitations=( + "bounded_to_one_contradiction_and_one_valid_comparator", + "recorded_official_sources_not_network_freshness", + "challenge_response_not_population_alert_performance", + ), + generated_at=generated_at, + ) + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"append:world-contradiction-attention:{variant}", + subject_ref=str(artifact.artifact_id), + subject_digest=str(artifact.artifact_digest), + requested_at=generated_at, + ) + reference = await _append_value( + state, + value=artifact, + record_kind="contradiction_attention_artifact", + record_key=str(artifact.artifact_id), + transaction_key=f"contradiction-attention-artifact:{artifact.artifact_id}", + as_of=generated_at, + authorization=authorization, + ) + lines = [ + "# Contradiction Attention Artifact", + "", + f"Exact source Brief: {source_brief.storage_id}", + f"Emitted alert count: {artifact.emitted_alert_count}", + "", + ] + lines.extend(f"- {item.disposition.upper()}: {item.statement} ({item.candidate_id})" for item in artifact.decisions) + return artifact, reference, "\n".join(lines) + "\n" + + +async def _load_exact_artifact( + state: dict[str, Any], reference: ImmutableRecordReferenceV1 +) -> ContradictionAttentionArtifactV1Alpha1: + record = await state["environment"].store.load_record( + reference.storage_id, + product_id=reference.product_id, + record_space=reference.record_space, + record_kind=reference.record_kind, + ) + if ( + record is None + or record.reference() != reference + or record.payload_contract != "ace.world-intelligence.contradiction-attention-artifact/v1alpha1" + ): + raise AssertionError("contradiction review subject is unavailable or changed") + return ContradictionAttentionArtifactV1Alpha1.model_validate(record.payload) + + +async def _review_artifact( + state: dict[str, Any], + *, + subject: ImmutableRecordReferenceV1, + source_brief: ImmutableRecordReferenceV1, + observation_refs: tuple[ImmutableRecordReferenceV1, ...], + expected_dispositions: dict[str, str], + statements: dict[str, str], + pair_index: int, + variant: str, +) -> tuple[ContradictionAttentionReviewV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + artifact = await _load_exact_artifact(state, subject) + if artifact.source_brief != source_brief or artifact.source_observations != observation_refs: + raise AssertionError("contradiction artifact lost its exact Brief or Observation provenance") + decisions = {item.candidate_id: item for item in artifact.decisions} + if set(decisions) != set(expected_dispositions): + raise AssertionError("contradiction artifact did not cover the exact frozen candidate set") + assessments: list[ContradictionAttentionAssessmentV1Alpha1] = [] + for candidate_id in sorted(expected_dispositions): + decision = decisions[candidate_id] + expected = expected_dispositions[candidate_id] + if decision.statement != statements[candidate_id]: + raise AssertionError("contradiction candidate identity was relabelled with different material") + confusion = { + ("alert", "alert"): "true_positive", + ("alert", "silence"): "false_negative", + ("silence", "alert"): "false_positive", + ("silence", "silence"): "true_negative", + }[(expected, decision.disposition)] + assessments.append( + ContradictionAttentionAssessmentV1Alpha1( + candidate_id=candidate_id, + statement=decision.statement, + expected_disposition=expected, + actual_disposition=decision.disposition, + confusion=confusion, + rationale=( + "The exact decision matches the frozen contradiction-attention policy." + if expected == decision.disposition + else "The exact decision conflicts with the frozen contradiction-attention policy." + ), + ) + ) + counts = { + name: sum(item.confusion == name for item in assessments) + for name in ("true_positive", "false_negative", "false_positive", "true_negative") + } + positives = counts["true_positive"] + counts["false_negative"] + negatives = counts["false_positive"] + counts["true_negative"] + recall = counts["true_positive"] / positives + false_alert_rate = counts["false_positive"] / negatives + reviewed_at = state["clock"]() + reviewer = _context(environment.context, "principal:world-contradiction-attention-reviewer") + review = ContradictionAttentionReviewV1Alpha1( + product_id=environment.fixture["product_id"], + review_key=f"contradiction-attention-review:{pair_index}:{variant}", + reviewed_subject=subject, + source_brief=source_brief, + source_observations=observation_refs, + reviewer_context=reviewer, + policy_id=REVIEW_POLICY_ID, + policy_version=REVIEW_POLICY_VERSION, + policy_digest=_policy_digest( + source_brief=source_brief, + observation_refs=observation_refs, + expected_dispositions=expected_dispositions, + statements=statements, + ), + assessments=tuple(assessments), + emitted_alert_count=artifact.emitted_alert_count, + true_positive_count=counts["true_positive"], + false_negative_count=counts["false_negative"], + false_positive_count=counts["false_positive"], + true_negative_count=counts["true_negative"], + contradiction_recall=recall, + false_alert_rate=false_alert_rate, + quality_score=(recall + (1.0 - false_alert_rate)) / 2.0, + valid_silence_count=counts["true_negative"], + limitations=artifact.limitations, + reviewed_at=reviewed_at, + ) + authorization = await _authorize_append( + state, + context=reviewer, + authorization_key=f"contradiction-attention-review:{pair_index}:{variant}", + subject_ref=str(review.review_id), + subject_digest=str(review.review_digest), + requested_at=reviewed_at, + ) + reference = await _append_value( + state, + value=review, + record_kind="contradiction_attention_review", + record_key=str(review.review_id), + transaction_key=f"contradiction-attention-review:{review.review_id}", + as_of=reviewed_at, + authorization=authorization, + ) + return review, reference + + +async def _record_review_outcome( + state: dict[str, Any], + *, + export: ReviewedExport, + review: ContradictionAttentionReviewV1Alpha1, + review_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: str, +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + measures = ImpactOutcomeMeasuresV1Alpha1( + primary_value=review.quality_score, + observed_result=review_ref, + latency_ms=max(0, int((review.reviewed_at - export.intent.requested_at).total_seconds() * 1_000)), + cost_usd=0.0, + failure_count=0, + degraded=False, + limitations=review.limitations, + ) + recorded_at = state["clock"]() + observer = _context(environment.context, "principal:world-contradiction-outcome-observer") + intent = OutcomeIntentV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=observer, + decision=export.decision_ref, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + value_json=canonical_json(measures.model_dump(mode="json")), + observed_at=review.reviewed_at, + recorded_at=recorded_at, + ) + authorization = await _authorize_append( + state, + context=observer, + authorization_key=f"contradiction-attention-outcome:{pair_index}:{variant}", + subject_ref=str(intent.intent_id), + subject_digest=str(intent.intent_digest), + requested_at=recorded_at, + ) + outcome = OutcomeV1Alpha1(intent=intent, authorization=authorization) + return await _append_value( + state, + value=outcome, + record_kind="outcome", + record_key=str(outcome.outcome_id), + transaction_key=f"outcome:{outcome.outcome_id}", + as_of=review.reviewed_at, + authorization=authorization, + ) + + +async def run_contradiction_attention_outcome(workspace_root: Path) -> dict[str, Any]: + """Run the recorded World journey through exact contradiction-attention Outcomes.""" + + state: dict[str, Any] = {} + prior = await run_citation_correctness_outcome(workspace_root, state_sink=state) + environment = state["environment"] + source_brief = state["impact_target_ref"] + observation_refs = tuple( + record + for admission in state["admissions"] + for record in admission.transaction_receipt.records + if record.record_kind == "observation" + ) + expected_statement, corrupted_statement = await _statements_from_observations(state, observation_refs) + valid_id = _candidate_id( + candidate_kind="valid_comparator", + statement=expected_statement, + observation_refs=observation_refs, + ) + contradiction_id = _candidate_id( + candidate_kind="contradiction", + statement=corrupted_statement, + observation_refs=observation_refs, + ) + statements = {valid_id: expected_statement, contradiction_id: corrupted_statement} + expected_dispositions = {valid_id: "silence", contradiction_id: "alert"} + + treatment_decisions = tuple( + ContradictionAttentionDecisionV1Alpha1( + candidate_id=candidate_id, + statement=statements[candidate_id], + disposition=expected_dispositions[candidate_id], + rationale="Apply the exact frozen World contradiction-attention rule.", + ) + for candidate_id in sorted(statements) + ) + control_decisions = tuple( + ContradictionAttentionDecisionV1Alpha1( + candidate_id=candidate_id, + statement=statements[candidate_id], + disposition="silence" if expected_dispositions[candidate_id] == "alert" else "alert", + rationale="Deterministic inverted-routing negative control with equal alert volume.", + ) + for candidate_id in sorted(statements) + ) + treatment_artifact, treatment_ref, treatment_content = await _append_attention_artifact( + state, + source_brief=source_brief, + observation_refs=observation_refs, + decisions=treatment_decisions, + variant="treatment", + ) + control_artifact, control_ref, control_content = await _append_attention_artifact( + state, + source_brief=source_brief, + observation_refs=observation_refs, + decisions=control_decisions, + variant="inverted-control", + ) + treatment_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=treatment_ref, + content=treatment_content, + pair_index=index, + variant="contradiction-treatment", + ) + for index in (1, 2) + ] + ) + control_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=control_ref, + content=control_content, + pair_index=index, + variant="contradiction-control", + ) + for index in (1, 2) + ] + ) + criterion_head, impact_binding = _install_policy(state) + criterion = ImpactCriterionV1Alpha1( + product_id=environment.fixture["product_id"], + criterion_id=CRITERION_ID, + criterion_version="candidate-1", + target_kind=ImpactTargetKind.INTELLIGENCE_ARTIFACT, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + metric_direction=ImpactMetricDirection.HIGHER_IS_BETTER, + useful_effect_threshold=0.75, + harmful_effect_threshold=0.75, + minimum_matched_pairs=2, + requires_observed_result=True, + harmful_action=ImpactGovernanceAction.ROLLBACK, + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(criterion_head), + frozen_at=CRITERION_FROZEN_AT, + ) + + evidence: list[ImpactEvidenceV1Alpha1] = [] + treatment_reviews: list[ContradictionAttentionReviewV1Alpha1] = [] + control_reviews: list[ContradictionAttentionReviewV1Alpha1] = [] + observed_times: list[datetime] = [] + for index, (treatment_export, control_export) in enumerate( + zip(treatment_exports, control_exports, strict=True), start=1 + ): + treatment_attribution = await _record_attribution( + state, + export=treatment_export, + subject=treatment_ref, + pair_index=index, + variant="contradiction-treatment", + ) + control_attribution = await _record_attribution( + state, + export=control_export, + subject=control_ref, + pair_index=index, + variant="contradiction-control", + ) + treatment_review, treatment_review_ref = await _review_artifact( + state, + subject=treatment_ref, + source_brief=source_brief, + observation_refs=observation_refs, + expected_dispositions=expected_dispositions, + statements=statements, + pair_index=index, + variant="treatment", + ) + control_review, control_review_ref = await _review_artifact( + state, + subject=control_ref, + source_brief=source_brief, + observation_refs=observation_refs, + expected_dispositions=expected_dispositions, + statements=statements, + pair_index=index, + variant="control", + ) + treatment_outcome = await _record_review_outcome( + state, + export=treatment_export, + review=treatment_review, + review_ref=treatment_review_ref, + pair_index=index, + variant="treatment", + ) + control_outcome = await _record_review_outcome( + state, + export=control_export, + review=control_review, + review_ref=control_review_ref, + pair_index=index, + variant="control", + ) + treatment_reviews.append(treatment_review) + control_reviews.append(control_review) + observed_times.extend((treatment_review.reviewed_at, control_review.reviewed_at)) + conditions = ImpactConditionsV1Alpha1( + product_id=environment.fixture["product_id"], + condition_key=f"world-contradiction-attention-pair:{index}", + route_id="world:fcc-contradiction-attention-review", + context_json=canonical_json( + { + "alert_budget": 1, + "candidate_count": 2, + "pair_index": index, + "recorded_transport": True, + "review_policy_digest": treatment_review.policy_digest, + "task": "exact_contradiction_attention_with_valid_silence", + } + ), + observation_window_start=CRITERION_FROZEN_AT + timedelta(seconds=1), + observation_window_end=max(observed_times) + timedelta(minutes=1), + frozen_at=CRITERION_FROZEN_AT, + ) + evidence.append( + ImpactEvidenceV1Alpha1( + product_id=environment.fixture["product_id"], + evidence_key=f"world-contradiction-attention:{index}", + treatment_attribution=treatment_attribution, + control_attribution=control_attribution, + treatment_decision=treatment_export.decision_ref, + control_decision=control_export.decision_ref, + treatment_action_review=treatment_export.review_ref, + treatment_action_admission=treatment_export.admission_ref, + treatment_action_terminal=treatment_export.terminal_ref, + control_action_review=control_export.review_ref, + control_action_admission=control_export.admission_ref, + control_action_terminal=control_export.terminal_ref, + treatment_outcome=treatment_outcome, + control_outcome=control_outcome, + treatment_conditions=conditions, + control_conditions=conditions, + ) + ) + + request = ImpactEvaluationRequestV1Alpha1( + evaluation_key="world-contradiction-attention:fcc-publication-change:2026-08-07", + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + criterion=criterion, + target=treatment_ref, + control=control_ref, + evidence=tuple(evidence), + cutoff_at=state["clock"](), + requested_at=state["clock"](), + ) + service = MeasuredImpactService( + store=environment.store, + authorizer=state["reasoning"], + operation_binding=impact_binding, + ) + admission = await service.evaluate(request) + replay = await MeasuredImpactService( + store=environment.store, + authorizer=_ReplayMustNotAuthorize(), + operation_binding=impact_binding, + ).evaluate(request) + if admission.replayed or not replay.replayed or replay.evaluation != admission.evaluation: + raise AssertionError("contradiction evaluation did not replay exact historical material") + if admission.evaluation.classification is not ImpactClassification.USEFUL: + raise AssertionError("frozen contradiction-attention criterion did not classify useful") + if admission.proposal is None or admission.proposal.action is not ImpactGovernanceAction.PROMOTE: + raise AssertionError("contradiction result did not emit its proposal-only mapping") + if treatment_artifact.emitted_alert_count != control_artifact.emitted_alert_count: + raise AssertionError("contradiction control changed raw alert volume") + if {item.contradiction_recall for item in treatment_reviews} != {1.0}: + raise AssertionError("treatment did not recall the exact contradiction") + if {item.false_alert_rate for item in treatment_reviews} != {0.0}: + raise AssertionError("treatment emitted an alert for the valid comparator") + if {item.valid_silence_count for item in treatment_reviews} != {1}: + raise AssertionError("treatment did not preserve silence for the valid comparator") + if {item.quality_score for item in control_reviews} != {0.0}: + raise AssertionError("inverted control unexpectedly satisfied the frozen product rule") + + return { + "contract": "ace.world-intelligence.contradiction-attention-outcome/v1alpha1", + "prior_citation_correctness": prior, + "review_policy": { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "policy_digest": treatment_reviews[0].policy_digest, + "reviewer_ref": treatment_reviews[0].reviewer_context.actor_ref, + "score": "(contradiction_recall + (1 - false_alert_rate)) / 2", + }, + "challenge": { + "candidate_ids": tuple(sorted(statements)), + "contradiction_candidate_id": contradiction_id, + "valid_comparator_id": valid_id, + "contradictory_statement": corrupted_statement, + "valid_statement": expected_statement, + "treatment_alert_volume": treatment_artifact.emitted_alert_count, + "control_alert_volume": control_artifact.emitted_alert_count, + }, + "artifacts": { + "treatment": treatment_artifact.model_dump(mode="json"), + "control": control_artifact.model_dump(mode="json"), + }, + "observed_results": { + "treatment": tuple(item.model_dump(mode="json") for item in treatment_reviews), + "control": tuple(item.model_dump(mode="json") for item in control_reviews), + }, + "evaluation": admission.evaluation.model_dump(mode="json"), + "proposal": admission.proposal.model_dump(mode="json"), + "replay": { + "historical": replay.replayed, + "no_reauthorization": True, + "transaction_receipt_id": str(replay.transaction_receipt.receipt_id), + }, + "scope": { + "exact_brief_and_observation_provenance": True, + "equal_alert_volume_control": True, + "valid_silence_measured": True, + "recorded_official_sources": True, + "network_freshness_claimed": False, + "live_public_conflict_claimed": False, + "population_false_alert_rate_claimed": False, + "general_brief_quality_claimed": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + }, + } + + +def main() -> None: + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + args = parser.parse_args() + print( + json.dumps( + asyncio.run(run_contradiction_attention_outcome(args.workspace_root)), + indent=2, + sort_keys=True, + ) + ) + + +if __name__ == "__main__": + main() From d2b051a864b83213ae8d2cfa0555cb99e5d62ec5 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Mon, 10 Aug 2026 16:45:32 -0700 Subject: [PATCH 05/17] Measure World correction detection delay --- README.md | 22 +- ROADMAP.md | 15 +- ...tion-detection-delay-outcome-2026-08-10.md | 168 ++++ ...-detection-delay-outcome-work-packet-v1.md | 122 +++ .../fixtures/p2c7_fcc_correction_pair.json | 45 + ...p2c7_correction_detection_delay_outcome.py | 150 ++++ .../p2c6_contradiction_attention_outcome.py | 8 +- ...p2c7_correction_detection_delay_outcome.py | 818 ++++++++++++++++++ 8 files changed, 1339 insertions(+), 9 deletions(-) create mode 100644 docs/audits/world-intelligence-p2c7-correction-detection-delay-outcome-2026-08-10.md create mode 100644 docs/design/world-intelligence-p2c7-correction-detection-delay-outcome-work-packet-v1.md create mode 100644 domain_packs/tests/fixtures/p2c7_fcc_correction_pair.json create mode 100644 domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py create mode 100644 scripts/p2c7_correction_detection_delay_outcome.py diff --git a/README.md b/README.md index 8627bdc..e7dff88 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,17 @@ conflict or a population false-alert rate. It does not establish autonomous disc freshness, correction quality, general Brief quality, causality, or human benefit. The resulting proposal remains non-effective and unapplied. +P2C7 uses an actual explicit FCC correction pair under recorded replay. Document `2021-10670` +names and corrects `2020-28779`; treatment and delayed control preserve that same exact linkage, +corrected instruction, original immutable Observation, and reviewed workflow. Against a frozen +600-second World target, treatment delay is 300 seconds and control delay is 21600 seconds. Exact +independent reviews become Core Outcomes, and the bounded two-pair difference is useful while the +proposal remains non-effective and unapplied. + +The recorded availability and detection instants are test coordinates. The suite performs no +network access and does not establish live monitoring, network-arrival latency, population delay +performance, legal truth, calibration, general Brief quality, causality, or human benefit. + ## What the public World proof demonstrates Generate a self-contained visual Reality Brief and its exact machine-readable backing data: @@ -347,9 +358,10 @@ $PY -m scripts.p2c3_measured_feedback "$WORKSPACE" # Stacked candidate: explicit reject/no-action review of the exact proposal $PY -m scripts.p2c4_reviewed_impact_disposition "$WORKSPACE" -# Stacked candidates: exact citation correctness, then contradiction recall/false-alert outcome +# Stacked candidates: exact citation correctness, contradiction attention, and correction delay $PY -m scripts.p2c5_citation_correctness_outcome "$WORKSPACE" $PY -m scripts.p2c6_contradiction_attention_outcome "$WORKSPACE" +$PY -m scripts.p2c7_correction_detection_delay_outcome "$WORKSPACE" ``` The released 0.9.0 gates are reproducible through the locked environment, as CI does. The @@ -425,9 +437,11 @@ and release history is in [`CHANGELOG.md`](CHANGELOG.md). P2C4 demonstrates a se authorized reject/no-action disposition of the P2C3 proposal without effective state change. P2C5 adds an independently reviewed citation-correctness Outcome and a citation-preserving semantic negative control. P2C6 adds exact contradiction recall, false-alert rate, equal alert-volume -control, and valid silence under one frozen recorded-source challenge. The next bounded -measurement work is correction handling, detection delay, calibration/revision stability, or -independent Market reproduction. +control, and valid silence under one frozen recorded-source challenge. P2C7 adds exact handling of +one explicit recorded correction pair, preserves the prior record, and measures frozen-replay +detection delay against a product target. The next bounded measurement work is +calibration/revision stability, another independently sourced correction event, or independent +Market reproduction. Separately reviewed opt-in network transport and P2D multi-source conflict/correction with LIVE inputs remain independent work. None of these steps may add autonomous publishing, delivery, persuasion, or action authority to a Domain Pack. diff --git a/ROADMAP.md b/ROADMAP.md index 7cbb7d3..59c5f92 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–P2C6 measured feedback and product-owned outcomes +## Candidate — P2C3–P2C7 measured feedback and product-owned outcomes - 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. @@ -36,6 +36,11 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). contradiction, produces no false alert, and preserves silence on the valid comparator while the control does the opposite. The exact result records recall, false-alert rate, confusion counts, valid silence, policy, reviewer, Brief, and Observation provenance. +- A fourth frozen criterion uses one explicit recorded FCC correction pair. Treatment and delayed + control preserve the same exact correction linkage, instruction, prior immutable record, and + reviewed workflow, but their replay delays are 300 and 21600 seconds against a product-owned + 600-second target. Exact reviews and Outcomes expose the source pair, rule, delay, score, and + limitations without claiming live network-arrival performance. - 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. @@ -47,12 +52,16 @@ freezes independently reviewed citation correctness and its citation-preserving The stacked [P2C6 work packet](docs/design/world-intelligence-p2c6-contradiction-attention-outcome-work-packet-v1.md) freezes contradiction recall, false-alert rate, equal alert volume, and valid silence without -claiming live conflict detection or population performance. +claiming live conflict detection or population performance. The stacked +[P2C7 work packet](docs/design/world-intelligence-p2c7-correction-detection-delay-outcome-work-packet-v1.md) +freezes exact correction linkage, prior-record preservation, and recorded-replay detection delay +without claiming live monitoring or network-arrival latency. ## Next — trustworthy live orientation - Add a separately reviewed, opt-in production transport without bundling it into the Domain Pack. -- Exercise multi-source conflict, correction, and supersession against LIVE admitted records. +- Exercise multi-source conflict, correction, and supersession against LIVE admitted records, + including network-observed correction arrival rather than frozen replay times. - Turn one-shot governed sensing into explicit user-owned monitors and subscriptions. - Preserve source independence, per-claim epistemic status, exact citations, correction visibility, and PREPARED/LIVE separation. diff --git a/docs/audits/world-intelligence-p2c7-correction-detection-delay-outcome-2026-08-10.md b/docs/audits/world-intelligence-p2c7-correction-detection-delay-outcome-2026-08-10.md new file mode 100644 index 0000000..f389bfa --- /dev/null +++ b/docs/audits/world-intelligence-p2c7-correction-detection-delay-outcome-2026-08-10.md @@ -0,0 +1,168 @@ +# World Intelligence P2C7 correction-detection-delay outcome audit — 2026-08-10 + +Status: **stacked candidate evidence only; not a release, SI4 pass, live-monitoring proof, or +applied governance change** + +## Source identity + +- World base: P2C6 commit `590cf9bb640681ab5095d3abd451092f72f8d929` +- World branch: `codex/world-correction-detection-delay` +- Core dependency: exact observed-result candidate commit + `433e3d16c5458c975557dcd1552824fb959d4d12` +- Released identity intentionally unchanged: `ace-domain-world-intelligence==0.9.0`, + `ace-core>=0.5.0,<0.6` + +## Frozen source pair and source policy + +The immutable recorded fixture digest is +`sha256:2b81d3950cbfd127408eec227ec5cd249677a189120d6ca7b603d85d01074543`. +It names: + +```text +original: 2020-28779, published 2020-12-29, 85 FR 85524 +correction: 2021-10670, published 2021-05-20, 86 FR 27275 +correction relationship: 2021-10670 corrects 2020-28779 +corrected page: 85530 +corrected instruction: + Remove instruction 20a and redesignate instructions 20b and 20c as instructions 20a and 20b. +original Observation: observation:f1768d6f4191a86e245846a9a1e33768 +correction Observation: observation:fced5d3bbc3802c0285021142b332e29 +``` + +The display pages are FederalRegister.gov and the corresponding official-format PDF references +are govinfo.gov: + +- original display: +- original official-format PDF: +- correction display: +- correction official-format PDF: + +FederalRegister.gov is not represented as the official legal edition. The fixture retains the +govinfo PDFs as verification references and explicitly claims neither legal truth nor network +access. + +## Exact point-in-time result + +One source-checkout run recorded two treatment and two delayed-control reviews under product +policy `world_recorded_official_correction_detection` version `candidate-1`, material +`sha256:7a68f95458908479ad714b2f7815734edbdef06fc4898ce32f06c73bb8a6b37f`: + +```text +frozen replay availability: 2021-05-20T00:00:00Z +product target: 600 seconds + +treatment artifact: + correction_handling_artifact:aa69e85159cf8a7499fced4863cd76af + sha256:aa69e85159cf8a7499fced4863cd76af746b0db0b1bad7a6fcaa124b7d06dcac +control artifact: + correction_handling_artifact:cbd406f42315f3c4f64921ca21b4f46f + sha256:cbd406f42315f3c4f64921ca21b4f46f61d200b53c0a0111ae65c830ca0f22fe + +treatment delay: 300, 300 seconds +control delay: 21600, 21600 seconds +treatment linkage/instruction/prior preserved: true, true, true +control linkage/instruction/prior preserved: true, true, true +treatment score: 1.0, 1.0 +control score: 0.0, 0.0 +matched pairs: 2 +mean effect: 1.0 +classification: useful +proposal action: promote +proposal live effect: false +historical replay: true +replay reauthorization: false +``` + +The exact review identities were: + +```text +treatment 1: correction_detection_review:3b3de3ca793a3a199d824c05e0dddd65 +treatment 2: correction_detection_review:dd481d3fc071d11419bdebab971ada2c +control 1: correction_detection_review:b48c8126b27b85816cb78f5b5edf55a7 +control 2: correction_detection_review:e96a3ab662b0603734b63bb05cb5d89d +``` + +The exact evaluation was `impact_evaluation:5c743a57ca27f4a818ef18980d421764` with material +`sha256:5c743a57ca27f4a818ef18980d42176459ce8deef1f6a3693f46ad6276d17888`. +The exact non-effective proposal was +`impact_governance_proposal:443218f00acca01bee0e565f60841b61` with material +`sha256:443218f00acca01bee0e565f60841b61a43bcf5a19ceff7367f03506a2e5b7e2`. + +## Verification + +The frozen World dependency versions (`pydantic==2.13.4`, `pytest==9.1.1`, +`pytest-asyncio==1.4.0`, Ruff `0.16.2`) plus the stacked Core candidate and separately packaged +reference action adapter produced: + +```text +python -B -m pytest domain_packs/tests/test_p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py \ + domain_packs/tests/test_p2c5_citation_correctness_outcome.py \ + domain_packs/tests/test_p2c6_contradiction_attention_outcome.py \ + domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py -q --tb=short +15 passed in 4.16s + +python -B -m pytest -q --tb=short +98 passed in 18.43s + +python -B -m pytest adapters/federal_register_source/tests -q --tb=short +26 passed in 0.27s + +python -B -m pytest tests/test_release_contract.py -q --tb=short +7 passed in 0.05s + +# Installed public ace-core==0.5.0; no Core source checkout or reference action adapter. +python -B -m pytest -q --tb=short -rs +82 passed, 16 skipped in 14.15s + +ruff check --no-cache +PASS + +ruff format --check --no-cache +3 files already formatted + +uv build --out-dir +Successfully built unchanged 0.9.0 source distribution and inert data-only wheel + +git diff --check +PASS +``` + +The sixteen public-Core skips are explicit boundaries: one P2C2 test requires the separately +packaged Core reference action adapter; P2C3-P2C7 require unreleased stacked Core candidate +contracts. The wheel contains 45 inert Domain Pack JSON/metadata files, no Python or entry points, +and retains `ace-core>=0.5.0,<0.6`. + +An attempt to create another isolated locked environment was interrupted twice by the local Codex +permission review timeout before `uv sync` could start. Verification therefore reused the existing +environment with versions checked against `uv.lock`; its editable parent-checkout namespace hook +was excluded from the full-suite process so only this isolated worktree supplied World code. The +package build independently resolved its declared build requirement and completed successfully. + +Repository-wide Ruff remains an inherited release-hygiene blocker, not made green by this packet. +The exact locked check reports the same 15 lint findings as P2C6 and broad format checking reports +20 existing files that would be reformatted. Scoped P2C7 checks and `git diff --check` are green. +P2C7 does not rewrite unrelated history, but release closeout must reconcile the repository-wide +gate before publication. + +## Claim boundary + +The World reviewer exact-loads the correction artifact and its two immutable Observations, then +derives linkage, instruction correctness, prior-record preservation, target disposition, and score +from the frozen policy. The Core Outcome points to that exact review record and carries the delay +as generic latency. Replay returns historical evaluation material without new authority, and +fresh hosts reproduce the fixture, classification, delays, scores, and proposal disposition. + +This demonstrates one explicit official correction pair under recorded replay. The availability +and detection times are frozen test coordinates, not observed network-arrival times. Two replicated +workflows over one event do not establish live discovery, a population delay distribution, +calibration, revision stability, source independence, general Brief quality, causality, legal +truth, or human benefit. The proposal remains non-effective and unapplied. + +## Remaining work + +Calibration, revision stability, another independently sourced correction event, a materially +different Market journey, combined-main review/CI, public artifacts, repository-wide lint/format +reconciliation, security/release checks, and opt-in live transport remain future bounded work. +Core issue #49 F1, F3, and F5 still require explicit 0.6 release-owner disposition; this World +packet neither implements nor re-dates them. diff --git a/docs/design/world-intelligence-p2c7-correction-detection-delay-outcome-work-packet-v1.md b/docs/design/world-intelligence-p2c7-correction-detection-delay-outcome-work-packet-v1.md new file mode 100644 index 0000000..fd5e876 --- /dev/null +++ b/docs/design/world-intelligence-p2c7-correction-detection-delay-outcome-work-packet-v1.md @@ -0,0 +1,122 @@ +# World Intelligence P2C7 correction-detection-delay outcome work packet (v1) + +**Status:** stacked source-checkout candidate; this packet does not release World Intelligence, +apply a governance proposal, close ACE Core issue #38, pass SI4, or complete ACE 0.6.0. + +**Frozen:** 2026-08-10 from World P2C6 commit +`590cf9bb640681ab5095d3abd451092f72f8d929`, stacked on the Core exact observed-result +provenance candidate `433e3d16c5458c975557dcd1552824fb959d4d12`. + +## Objective + +Measure whether one exact World correction-handling artifact links an official correction to the +record it corrects, preserves the prior immutable record, and detects the correction within an +explicit product-owned replay target. The packet preserves the governed journey: + +```text +recorded original Observation + recorded correction Observation + -> correction-handling artifact -> Decision -> reviewed Action + -> exact independent correction review -> observed Outcome + -> useful / harmful / unproven evaluation -> proposal only +``` + +The frozen pair is FCC Federal Register document `2020-28779`, published 2020-12-29 at +`85 FR 85524`, and its explicit correction `2021-10670`, published 2021-05-20 at `86 FR 27275`. +The correction names the earlier document and changes the instruction on page 85530: remove +instruction 20a and redesignate 20b and 20c as 20a and 20b. FederalRegister.gov is retained as a +display reference and the corresponding govinfo.gov PDFs as official-format verification +references. The fixture does not claim to be the official legal edition or determine legal truth. + +## Product-owned review policy + +World owns `world_recorded_official_correction_detection` version `candidate-1`. Its fixture, +exact original/correction Observation references, target, rule, reviewer, and policy digest are +inspectable. The recorded-replay availability instant is frozen at `2021-05-20T00:00:00Z`; this is +a test coordinate, not a measured network-arrival timestamp. The product target is 600 seconds. + +Treatment detects at `00:05:00Z` and the delayed control at `06:00:00Z`. Both carry the same exact +correction relationship and instruction, both preserve the prior Observation, and both traverse +matched reviewed export workflows. The score is: + +```text +1 if linkage, instruction, and prior-record preservation are correct and delay <= 600 seconds +0 otherwise +``` + +The exact review record names: + +- the reviewed correction-handling artifact and exact original/correction Observations; +- authenticated reviewer `principal:world-correction-delay-reviewer`; +- product policy identity, version, digest, and source-fixture digest; +- exact linkage, corrected instruction, prior-record preservation, availability, detection time, + delay, target disposition, score, limitations, review time, and derived identity/digest. + +Core and Intelligence see only the generic exact observed-result coordinate, latency, and scalar +outcome. FCC, Federal Register, correction, document, page, instruction, replay policy, and review +vocabulary remain in World. + +## Exact acceptance + +P2C7 must: + +1. rerun P2C2 through P2C6 and preserve all prior evaluations, proposals, and reviewed + dispositions as immutable history; +2. admit the exact original and correction as distinct PREPARED recorded-replay Observations with + exact acquisition/source digests and explicit source-policy limits; +3. append treatment and delayed-control correction artifacts that name both exact source records, + the correction relationship and instruction, and preserve rather than replace the original; +4. create two distinct reviewed treatment/control Action pairs under matched task conditions; +5. append four independently authenticated review records and four Core Outcomes naming those + exact review records; +6. show exact linkage, instruction, and prior-record preservation for both variants, treatment + delay `300` seconds and score `1.0`, and control delay `21600` seconds and score `0.0`; +7. classify the bounded two-pair difference `useful`, emit only a non-effective `promote` + proposal, and perform no proposal application; +8. replay the evaluation without reauthorization and reproduce its classification and substantive + metrics across fresh hosts; +9. reject pre-availability detection and caller-invented review scores; and +10. retain explicit non-claims for live monitoring, network-arrival delay, population detection + performance, legal truth, causality, general Brief quality, human benefit, and autonomous + publication. + +## Negative and failure controls + +The delayed-control artifact is the primary product negative control: it has the same exact source +pair, correction semantics, reviewed workflow, and matched conditions as treatment, but detects +the correction after the declared target. A detection time before the correction's frozen replay +availability and a score inconsistent with the exact rule fail model validation. Exact review +loading rejects unavailable, changed, relabelled, cross-product, or incomplete artifact/source +material. The stacked Core tests remain authoritative for missing attribution/result provenance, +condition mismatch, cutoff leakage, unavailable Outcomes, duplicate/replayed evidence, +interruption, restart, and denied authority. + +## Files and rollback + +This packet owns: + +- `domain_packs/tests/fixtures/p2c7_fcc_correction_pair.json`; +- `scripts/p2c7_correction_detection_delay_outcome.py`; +- `domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py`; +- the additive P2C6 acceptance-state handoff; +- this work packet, its audit, and restrained README/roadmap references. + +It changes no shipped Domain Pack, connector, package version, dependency range, lockfile, release +record, Core contract, or public artifact. Rollback removes the P2C7 fixture, harness, tests, state +handoff, and candidate documentation. Product correction, review, Outcome, evaluation, and +proposal records already persisted by a host remain immutable history. + +## Non-claims and next packet + +This is one recorded official correction pair replayed through two replicated matched workflows. +The availability instant and treatment/control detection times are frozen test coordinates; the +test suite performs no network access. It establishes exact linkage, append-only correction +visibility, criterion sensitivity, latency provenance, and proposal-only governance under one +product rule. It does not establish live correction discovery, actual network-arrival latency, a +population delay distribution, source independence, calibration, revision stability, general +Brief quality, causal benefit, legal truth, or human usefulness. + +The next bounded outcome packet should freeze calibration or revision stability, or exercise the +same correction contract over an additional source/event without changing Core + Intelligence. +Independent Market reproduction, public Core artifacts, combined-main review/CI, compatibility, +security and release gates, opt-in live transport, issue #49 disposition, and any separately +authorized proposal application remain separate work. diff --git a/domain_packs/tests/fixtures/p2c7_fcc_correction_pair.json b/domain_packs/tests/fixtures/p2c7_fcc_correction_pair.json new file mode 100644 index 0000000..244802a --- /dev/null +++ b/domain_packs/tests/fixtures/p2c7_fcc_correction_pair.json @@ -0,0 +1,45 @@ +{ + "contract": "ace.world-intelligence.recorded-federal-register-correction-pair/v1alpha1", + "fixture_id": "fcc_elicensing_correction_2021_10670", + "recorded_at": "2026-08-10T23:10:00Z", + "network_access": false, + "source_policy": { + "display_source": "FederalRegister.gov", + "display_source_is_official_legal_edition": false, + "official_format_source": "govinfo.gov", + "legal_truth_claimed": false + }, + "original": { + "document_number": "2020-28779", + "publication_date": "2020-12-29", + "federal_register_citation": "85 FR 85524", + "agency": "Federal Communications Commission", + "docket": "WT Docket No. 19-212; FCC 20-126; FRS 17235", + "action": "Final rule.", + "title": "Completing the Transition to Electronic Filing, Licenses and Authorizations, and Correspondence in the Wireless Radio Services", + "html_uri": "https://www.federalregister.gov/documents/2020/12/29/2020-28779/completing-the-transition-to-electronic-filing-licenses-and-authorizations-and-correspondence-in-the", + "official_pdf_uri": "https://www.govinfo.gov/content/pkg/FR-2020-12-29/pdf/2020-28779.pdf" + }, + "correction": { + "document_number": "2021-10670", + "publication_date": "2021-05-20", + "filed_date": "2021-05-19", + "federal_register_citation": "86 FR 27275", + "agency": "Federal Communications Commission", + "docket": "WT Docket No. 19-212; FCC 20-126; FRS 27277", + "action": "Final rule; correction.", + "title": "Completing the Transition to Electronic Filing, Licenses and Authorizations, and Correspondence in the Wireless Radio Services", + "html_uri": "https://www.federalregister.gov/documents/2021/05/20/2021-10670/completing-the-transition-to-electronic-filing-licenses-and-authorizations-and-correspondence-in-the", + "official_pdf_uri": "https://www.govinfo.gov/content/pkg/FR-2021-05-20/pdf/2021-10670.pdf", + "corrects_document_number": "2020-28779", + "corrects_federal_register_page": 85524, + "corrected_page": 85530, + "corrected_instruction": "Remove instruction 20a and redesignate instructions 20b and 20c as instructions 20a and 20b." + }, + "recorded_replay": { + "correction_available_at": "2021-05-20T00:00:00Z", + "treatment_detected_at": "2021-05-20T00:05:00Z", + "control_detected_at": "2021-05-20T06:00:00Z", + "target_detection_delay_seconds": 600 + } +} diff --git a/domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py b/domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py new file mode 100644 index 0000000..3788f01 --- /dev/null +++ b/domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py @@ -0,0 +1,150 @@ +from __future__ import annotations + +import copy +import importlib.util +import json + +import pytest +from pydantic import ValidationError + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact") is None: + pytest.skip("P2C7 requires the stacked ACE Core measured-impact candidate") + from ace.intelligence import ImpactOutcomeMeasuresV1Alpha1 + + if "observed_result" not in ImpactOutcomeMeasuresV1Alpha1.model_fields: + pytest.skip("P2C7 requires exact observed-result provenance from the stacked Core candidate") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("P2C7 requires the separately packaged Core reference adapter") + + +def test_recorded_correction_fixture_names_one_exact_official_pair() -> None: + _require_candidate_contracts() + from scripts.p2c7_correction_detection_delay_outcome import correction_fixture_digest, load_correction_fixture + + fixture = load_correction_fixture() + + assert fixture["network_access"] is False + assert fixture["original"]["document_number"] == "2020-28779" + assert fixture["correction"]["document_number"] == "2021-10670" + assert fixture["correction"]["corrects_document_number"] == fixture["original"]["document_number"] + assert fixture["correction"]["corrected_page"] == 85530 + assert fixture["recorded_replay"] == { + "correction_available_at": "2021-05-20T00:00:00Z", + "treatment_detected_at": "2021-05-20T00:05:00Z", + "control_detected_at": "2021-05-20T06:00:00Z", + "target_detection_delay_seconds": 600, + } + assert fixture["source_policy"] == { + "display_source": "FederalRegister.gov", + "display_source_is_official_legal_edition": False, + "official_format_source": "govinfo.gov", + "legal_truth_claimed": False, + } + assert ( + correction_fixture_digest(fixture) == "sha256:2b81d3950cbfd127408eec227ec5cd249677a189120d6ca7b603d85d01074543" + ) + + +@pytest.mark.asyncio +async def test_exact_correction_review_becomes_a_measured_detection_delay_outcome(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c7_correction_detection_delay_outcome import run_correction_detection_delay_outcome + + result = await run_correction_detection_delay_outcome(tmp_path) + + assert result["review_policy"]["reviewer_ref"] == "principal:world-correction-delay-reviewer" + assert result["review_policy"]["target_detection_delay_seconds"] == 600 + assert result["evaluation"]["criterion"]["requires_observed_result"] is True + assert result["evaluation"]["classification"] == "useful" + assert result["evaluation"]["matched_pair_count"] == 2 + assert result["evaluation"]["mean_effect"] == 1.0 + assert result["proposal"]["action"] == "promote" + assert result["proposal"]["live_effect"] is False + assert result["proposal"]["selectable"] is False + assert result["proposal"]["requires_human_review"] is True + assert result["replay"]["historical"] is True + assert result["replay"]["no_reauthorization"] is True + assert result["source_pair"]["original"]["document_number"] == "2020-28779" + assert result["source_pair"]["correction"]["corrects_document_number"] == "2020-28779" + + +@pytest.mark.asyncio +async def test_matched_replay_separates_correction_semantics_from_detection_timeliness(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c7_correction_detection_delay_outcome import run_correction_detection_delay_outcome + + result = await run_correction_detection_delay_outcome(tmp_path) + treatments = result["observed_results"]["treatment"] + controls = result["observed_results"]["control"] + + for reviews in (treatments, controls): + assert {item["linkage_correct"] for item in reviews} == {True} + assert {item["instruction_correct"] for item in reviews} == {True} + assert {item["prior_record_preserved"] for item in reviews} == {True} + assert {item["detection_delay_seconds"] for item in treatments} == {300} + assert {item["within_target"] for item in treatments} == {True} + assert {item["timeliness_score"] for item in treatments} == {1.0} + assert {item["detection_delay_seconds"] for item in controls} == {21_600} + assert {item["within_target"] for item in controls} == {False} + assert {item["timeliness_score"] for item in controls} == {0.0} + assert result["scope"]["prior_record_preserved"] is True + assert result["scope"]["live_monitoring_claimed"] is False + assert result["scope"]["network_arrival_delay_claimed"] is False + assert result["scope"]["population_detection_performance_claimed"] is False + + +@pytest.mark.asyncio +async def test_preavailability_detection_and_invented_review_score_fail_closed(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c7_correction_detection_delay_outcome import ( + CorrectionDetectionReviewV1Alpha1, + CorrectionHandlingArtifactV1Alpha1, + run_correction_detection_delay_outcome, + ) + + result = await run_correction_detection_delay_outcome(tmp_path) + artifact = copy.deepcopy(result["artifacts"]["treatment"]) + artifact["detected_at"] = "2021-05-19T23:59:59Z" + artifact["detection_delay_seconds"] = 0 + artifact["artifact_id"] = None + artifact["artifact_digest"] = None + with pytest.raises(ValidationError, match="cannot precede correction availability"): + CorrectionHandlingArtifactV1Alpha1.model_validate_json(json.dumps(artifact)) + + review = copy.deepcopy(result["observed_results"]["treatment"][0]) + review["timeliness_score"] = 0.0 + review["review_id"] = None + review["review_digest"] = None + with pytest.raises(ValidationError, match="score differs from frozen product rule"): + CorrectionDetectionReviewV1Alpha1.model_validate_json(json.dumps(review)) + + +@pytest.mark.asyncio +async def test_packet_classification_is_deterministic_across_fresh_hosts(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c7_correction_detection_delay_outcome import run_correction_detection_delay_outcome + + first_root = tmp_path / "first" + second_root = tmp_path / "second" + first_root.mkdir() + second_root.mkdir() + first = await run_correction_detection_delay_outcome(first_root) + second = await run_correction_detection_delay_outcome(second_root) + + assert first["source_pair"]["fixture_digest"] == second["source_pair"]["fixture_digest"] + assert first["review_policy"]["policy_id"] == second["review_policy"]["policy_id"] + assert first["review_policy"]["policy_version"] == second["review_policy"]["policy_version"] + for variant in ("treatment", "control"): + assert ( + first["artifacts"][variant]["detection_delay_seconds"] + == second["artifacts"][variant]["detection_delay_seconds"] + ) + first_scores = [item["timeliness_score"] for item in first["observed_results"][variant]] + second_scores = [item["timeliness_score"] for item in second["observed_results"][variant]] + assert first_scores == second_scores + for field in ("classification", "matched_pair_count", "mean_effect"): + assert first["evaluation"][field] == second["evaluation"][field] + for field in ("action", "live_effect", "selectable", "requires_human_review"): + assert first["proposal"][field] == second["proposal"][field] diff --git a/scripts/p2c6_contradiction_attention_outcome.py b/scripts/p2c6_contradiction_attention_outcome.py index 2001537..92331ff 100644 --- a/scripts/p2c6_contradiction_attention_outcome.py +++ b/scripts/p2c6_contradiction_attention_outcome.py @@ -570,10 +570,14 @@ async def _record_review_outcome( ) -async def run_contradiction_attention_outcome(workspace_root: Path) -> dict[str, Any]: +async def run_contradiction_attention_outcome( + workspace_root: Path, + *, + state_sink: dict[str, Any] | None = None, +) -> dict[str, Any]: """Run the recorded World journey through exact contradiction-attention Outcomes.""" - state: dict[str, Any] = {} + state: dict[str, Any] = {} if state_sink is None else state_sink prior = await run_citation_correctness_outcome(workspace_root, state_sink=state) environment = state["environment"] source_brief = state["impact_target_ref"] diff --git a/scripts/p2c7_correction_detection_delay_outcome.py b/scripts/p2c7_correction_detection_delay_outcome.py new file mode 100644 index 0000000..3cf2fb5 --- /dev/null +++ b/scripts/p2c7_correction_detection_delay_outcome.py @@ -0,0 +1,818 @@ +"""Measure recorded-replay correction handling and detection delay.""" + +from __future__ import annotations + +import asyncio +import json +from datetime import datetime +from pathlib import Path +from typing import Any, Literal, Self + +from ace.application import MeasuredImpactService +from ace.core import ( + AuthenticatedRuntimeContextV1Alpha1, + CapabilityArtifactIdentityV1Alpha1, + GovernedOperationBindingV1Alpha1, + GovernedStateHeadPreconditionV1Alpha1, + ImmutableRecordReferenceV1, + OutcomeIntentV1Alpha1, + OutcomeV1Alpha1, + canonical_hash, + canonical_json, + capability_state_ref_for_artifact, +) +from ace.intelligence import ( + CanonicalJsonValueV1Alpha1, + EvidenceAcquisitionMode, + ImpactClassification, + ImpactConditionsV1Alpha1, + ImpactCriterionV1Alpha1, + ImpactEvaluationRequestV1Alpha1, + ImpactEvidenceV1Alpha1, + ImpactGovernanceAction, + ImpactMetricDirection, + ImpactOutcomeMeasuresV1Alpha1, + ImpactTargetKind, + IntelligenceResourceMode, + ObservationV1Alpha1, +) +from pydantic import Field, model_validator + +from scripts.p2c2_federal_register_monitor import _time +from scripts.p2c2_governed_reality_brief import _context, _head +from scripts.p2c3_measured_feedback import ( + ReviewedExport, + _append_value, + _authorize_append, + _digest, + _record_attribution, + _run_reviewed_export, +) +from scripts.p2c5_citation_correctness_outcome import _derive_identity, _FrozenModel +from scripts.p2c6_contradiction_attention_outcome import run_contradiction_attention_outcome + +FIXTURE_PATH = ( + Path(__file__).resolve().parents[1] / "domain_packs" / "tests" / "fixtures" / "p2c7_fcc_correction_pair.json" +) +OUTCOME_TYPE = "independent_artifact_review" +MEASURE_ID = "recorded_correction_detection_timeliness" +CRITERION_ID = "impact_criterion:world-recorded-correction-detection-timeliness" +CRITERION_FROZEN_AT = _time("2026-08-10T23:09:00Z") +REVIEW_POLICY_ID = "world_recorded_official_correction_detection" +REVIEW_POLICY_VERSION = "candidate-1" + +IMPACT_ARTIFACT = CapabilityArtifactIdentityV1Alpha1( + capability="measured_impact_evaluation", + contract="ace.application.measured-impact-service/v1alpha1", + implementation_id="world_recorded_correction_delay_candidate", + implementation_version="0.1.0", + artifact_digest="sha256:" + "a" * 64, +) + + +class CorrectionHandlingArtifactV1Alpha1(_FrozenModel): + """One exact correction link and its recorded-replay detection time.""" + + contract: Literal["ace.world-intelligence.correction-handling-artifact/v1alpha1"] = ( + "ace.world-intelligence.correction-handling-artifact/v1alpha1" + ) + product_id: str + artifact_key: str + original_observation: ImmutableRecordReferenceV1 + correction_observation: ImmutableRecordReferenceV1 + correction_relation: Literal["corrects"] = "corrects" + correction_document_number: str + corrects_document_number: str + corrected_instruction: str + correction_available_at: datetime + detected_at: datetime + detection_delay_seconds: int = Field(ge=0) + prior_record_preserved: Literal[True] = True + limitations: tuple[str, ...] + generated_at: datetime + artifact_id: str | None = None + artifact_digest: str | None = None + + @model_validator(mode="after") + def validate_scope_delay_and_identity(self) -> Self: + if ( + self.original_observation.product_id != self.product_id + or self.correction_observation.product_id != self.product_id + ): + raise ValueError("correction artifact crossed exact product scope") + if self.original_observation.storage_id == self.correction_observation.storage_id: + raise ValueError("correction artifact requires distinct original and correction records") + if self.detected_at < self.correction_available_at: + raise ValueError("correction detection cannot precede correction availability") + expected_delay = int((self.detected_at - self.correction_available_at).total_seconds()) + if self.detection_delay_seconds != expected_delay: + raise ValueError("correction delay differs from exact event times") + _derive_identity( + self, + prefix="correction_handling_artifact", + id_field="artifact_id", + digest_field="artifact_digest", + ) + return self + + +class CorrectionDetectionReviewV1Alpha1(_FrozenModel): + """Product-owned correction and timeliness review named by a Core Outcome.""" + + contract: Literal["ace.world-intelligence.correction-detection-review/v1alpha1"] = ( + "ace.world-intelligence.correction-detection-review/v1alpha1" + ) + product_id: str + review_key: str + reviewed_subject: ImmutableRecordReferenceV1 + original_observation: ImmutableRecordReferenceV1 + correction_observation: ImmutableRecordReferenceV1 + reviewer_context: AuthenticatedRuntimeContextV1Alpha1 + policy_id: str + policy_version: str + policy_digest: str + source_fixture_digest: str + linkage_correct: bool + instruction_correct: bool + prior_record_preserved: bool + detection_delay_seconds: int = Field(ge=0) + target_detection_delay_seconds: int = Field(gt=0) + within_target: bool + timeliness_score: float = Field(ge=0.0, le=1.0) + limitations: tuple[str, ...] + reviewed_at: datetime + review_id: str | None = None + review_digest: str | None = None + + @model_validator(mode="after") + def validate_scope_score_and_identity(self) -> Self: + if ( + self.reviewed_subject.product_id != self.product_id + or self.original_observation.product_id != self.product_id + or self.correction_observation.product_id != self.product_id + or self.reviewer_context.product_id != self.product_id + ): + raise ValueError("correction review crossed exact product scope") + if self.original_observation.storage_id == self.correction_observation.storage_id: + raise ValueError("correction review requires distinct source records") + within_target = self.detection_delay_seconds <= self.target_detection_delay_seconds + if self.within_target != within_target: + raise ValueError("correction review target disposition differs from exact delay") + expected_score = float( + self.linkage_correct and self.instruction_correct and self.prior_record_preserved and within_target + ) + if self.timeliness_score != expected_score: + raise ValueError("correction timeliness score differs from frozen product rule") + _derive_identity( + self, + prefix="correction_detection_review", + id_field="review_id", + digest_field="review_digest", + ) + return self + + +class _ReplayMustNotAuthorize: + async def authorize_action(self, request): + raise AssertionError(f"historical correction evaluation requested new authority: {request.authorization_key}") + + +def load_correction_fixture() -> dict[str, Any]: + fixture = json.loads(FIXTURE_PATH.read_text(encoding="utf-8")) + if fixture["network_access"] is not False: + raise AssertionError("recorded correction fixture must remain network-free") + if fixture["source_policy"] != { + "display_source": "FederalRegister.gov", + "display_source_is_official_legal_edition": False, + "official_format_source": "govinfo.gov", + "legal_truth_claimed": False, + }: + raise AssertionError("recorded correction fixture changed its exact source-policy boundary") + original = fixture["original"] + correction = fixture["correction"] + if correction["corrects_document_number"] != original["document_number"]: + raise AssertionError("recorded correction no longer names the exact original document") + if not original["official_pdf_uri"].startswith("https://www.govinfo.gov/") or not correction[ + "official_pdf_uri" + ].startswith("https://www.govinfo.gov/"): + raise AssertionError("recorded correction pair lost its govinfo verification references") + return fixture + + +def correction_fixture_digest(fixture: dict[str, Any]) -> str: + return f"sha256:{canonical_hash(fixture)}" + + +def _install_policy(state: dict[str, Any]): + environment = state["environment"] + runtime = state["runtime"] + product_id = environment.fixture["product_id"] + criterion_head = _head(product_id, "impact_criterion", CRITERION_ID, 80) + operation_head = _head( + product_id, + "governed_operation_configuration", + "governed_operation_configuration:world-recorded-correction-delay", + 81, + ) + binding = GovernedOperationBindingV1Alpha1( + product_id=product_id, + artifact=IMPACT_ARTIFACT, + configuration_ref=operation_head.state_id, + authority="append_measured_impact", + grant_ref="authority_grant:world-recorded-correction-delay", + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(operation_head), + ) + capability_head = _head(product_id, "capability_state", capability_state_ref_for_artifact(IMPACT_ARTIFACT), 82) + authority_head = _head(product_id, "authority_grant", binding.grant_ref, 83) + for head in (criterion_head, operation_head, capability_head, authority_head): + environment.store.set_governed_state_head(head) + runtime.heads[head.state_kind, head.state_id] = head + runtime.bindings = (*runtime.bindings, binding) + return criterion_head, binding + + +async def _append_source_observation( + state: dict[str, Any], + *, + fixture: dict[str, Any], + role: Literal["original", "correction"], +) -> tuple[ObservationV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + source = fixture[role] + fixture_digest = correction_fixture_digest(fixture) + published_at = _time(f"{source['publication_date']}T00:00:00Z") + ingested_at = _time(fixture["recorded_at"]) + payload = { + "fixture_id": fixture["fixture_id"], + "fixture_digest": fixture_digest, + "record_role": role, + "source_policy": fixture["source_policy"], + "record": source, + } + observation = ObservationV1Alpha1( + product_id=environment.fixture["product_id"], + mode=IntelligenceResourceMode.PREPARED, + activation_revision=state["brief_admission"].brief.activation_revision, + as_of=ingested_at, + source_ref=f"federal_register_document:{source['document_number']}", + source_digest=_digest(source), + acquisition_mode=EvidenceAcquisitionMode.RECORDED_REPLAY, + acquisition_receipt_ref=f"recorded_replay_acquisition:{source['document_number']}", + acquisition_receipt_digest=_digest( + { + "fixture_digest": fixture_digest, + "document_number": source["document_number"], + "network_access": False, + } + ), + source_published_at=published_at, + event_effective_at=None, + observed_at=published_at, + ingested_at=ingested_at, + subject_refs=("fcc_docket:wt-19-212",), + payload=CanonicalJsonValueV1Alpha1(value_json=canonical_json(payload)), + confidence=1.0, + ) + requested_at = state["clock"]() + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"append:world-recorded-correction-observation:{role}", + subject_ref=str(observation.resource_id), + subject_digest=str(observation.resource_digest), + requested_at=requested_at, + ) + reference = await _append_value( + state, + value=observation, + record_kind="observation", + record_key=str(observation.resource_id), + transaction_key=f"recorded-correction-observation:{observation.resource_id}", + as_of=observation.as_of, + authorization=authorization, + ) + return observation, reference + + +async def _append_correction_artifact( + state: dict[str, Any], + *, + fixture: dict[str, Any], + original_ref: ImmutableRecordReferenceV1, + correction_ref: ImmutableRecordReferenceV1, + detected_at: datetime, + variant: str, +) -> tuple[CorrectionHandlingArtifactV1Alpha1, ImmutableRecordReferenceV1, str]: + environment = state["environment"] + correction = fixture["correction"] + available_at = _time(fixture["recorded_replay"]["correction_available_at"]) + generated_at = state["clock"]() + artifact = CorrectionHandlingArtifactV1Alpha1( + product_id=environment.fixture["product_id"], + artifact_key=f"recorded-correction-handling:{variant}:2021-10670", + original_observation=original_ref, + correction_observation=correction_ref, + correction_document_number=correction["document_number"], + corrects_document_number=correction["corrects_document_number"], + corrected_instruction=correction["corrected_instruction"], + correction_available_at=available_at, + detected_at=detected_at, + detection_delay_seconds=int((detected_at - available_at).total_seconds()), + limitations=( + "recorded_replay_not_live_monitoring", + "bounded_to_one_explicit_federal_register_correction_pair", + "source_publication_time_is_not_network_arrival_time", + ), + generated_at=generated_at, + ) + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"append:world-recorded-correction-artifact:{variant}", + subject_ref=str(artifact.artifact_id), + subject_digest=str(artifact.artifact_digest), + requested_at=generated_at, + ) + reference = await _append_value( + state, + value=artifact, + record_kind="correction_handling_artifact", + record_key=str(artifact.artifact_id), + transaction_key=f"correction-handling-artifact:{artifact.artifact_id}", + as_of=generated_at, + authorization=authorization, + ) + content = ( + "# Recorded Correction Handling Artifact\n\n" + f"Correction: {correction['document_number']}\n\n" + f"Corrects: {correction['corrects_document_number']}\n\n" + f"Instruction: {correction['corrected_instruction']}\n\n" + f"Recorded-replay detection delay: {artifact.detection_delay_seconds} seconds\n\n" + f"Original immutable Observation preserved: {original_ref.storage_id}\n" + ) + return artifact, reference, content + + +async def _load_observation(state: dict[str, Any], reference: ImmutableRecordReferenceV1) -> ObservationV1Alpha1: + record = await state["environment"].store.load_record( + reference.storage_id, + product_id=reference.product_id, + record_space=reference.record_space, + record_kind=reference.record_kind, + ) + if ( + record is None + or record.reference() != reference + or record.payload_contract != "ace.intelligence.observation/v1alpha1" + ): + raise AssertionError("recorded correction Observation is unavailable or changed") + return ObservationV1Alpha1.model_validate(record.payload) + + +async def _load_artifact( + state: dict[str, Any], reference: ImmutableRecordReferenceV1 +) -> CorrectionHandlingArtifactV1Alpha1: + record = await state["environment"].store.load_record( + reference.storage_id, + product_id=reference.product_id, + record_space=reference.record_space, + record_kind=reference.record_kind, + ) + if ( + record is None + or record.reference() != reference + or record.payload_contract != "ace.world-intelligence.correction-handling-artifact/v1alpha1" + ): + raise AssertionError("recorded correction artifact is unavailable or changed") + return CorrectionHandlingArtifactV1Alpha1.model_validate(record.payload) + + +def _policy_digest( + *, + fixture_digest: str, + original_ref: ImmutableRecordReferenceV1, + correction_ref: ImmutableRecordReferenceV1, + target_delay_seconds: int, +) -> str: + return _digest( + { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "fixture_digest": fixture_digest, + "original_observation": original_ref.model_dump(mode="json"), + "correction_observation": correction_ref.model_dump(mode="json"), + "target_detection_delay_seconds": target_delay_seconds, + "score": "1 if exact correction linkage and instruction are preserved within target else 0", + } + ) + + +async def _review_artifact( + state: dict[str, Any], + *, + fixture: dict[str, Any], + subject: ImmutableRecordReferenceV1, + original_ref: ImmutableRecordReferenceV1, + correction_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: str, +) -> tuple[CorrectionDetectionReviewV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + artifact = await _load_artifact(state, subject) + original = await _load_observation(state, original_ref) + correction = await _load_observation(state, correction_ref) + original_payload = original.payload.parsed_value()["record"] + correction_payload = correction.payload.parsed_value()["record"] + fixture_digest = correction_fixture_digest(fixture) + if ( + original.payload.parsed_value()["fixture_digest"] != fixture_digest + or correction.payload.parsed_value()["fixture_digest"] != fixture_digest + ): + raise AssertionError("recorded correction Observations lost their exact fixture identity") + linkage_correct = bool( + artifact.original_observation == original_ref + and artifact.correction_observation == correction_ref + and artifact.correction_relation == "corrects" + and artifact.correction_document_number == correction_payload["document_number"] + and artifact.corrects_document_number == original_payload["document_number"] + and correction_payload["corrects_document_number"] == original_payload["document_number"] + ) + instruction_correct = bool( + artifact.corrected_instruction == correction_payload["corrected_instruction"] + and correction_payload["corrects_federal_register_page"] == 85524 + and correction_payload["corrected_page"] == 85530 + ) + target_delay_seconds = fixture["recorded_replay"]["target_detection_delay_seconds"] + within_target = artifact.detection_delay_seconds <= target_delay_seconds + score = float(linkage_correct and instruction_correct and artifact.prior_record_preserved and within_target) + reviewed_at = state["clock"]() + reviewer = _context(environment.context, "principal:world-correction-delay-reviewer") + review = CorrectionDetectionReviewV1Alpha1( + product_id=environment.fixture["product_id"], + review_key=f"recorded-correction-delay-review:{pair_index}:{variant}", + reviewed_subject=subject, + original_observation=original_ref, + correction_observation=correction_ref, + reviewer_context=reviewer, + policy_id=REVIEW_POLICY_ID, + policy_version=REVIEW_POLICY_VERSION, + policy_digest=_policy_digest( + fixture_digest=fixture_digest, + original_ref=original_ref, + correction_ref=correction_ref, + target_delay_seconds=target_delay_seconds, + ), + source_fixture_digest=fixture_digest, + linkage_correct=linkage_correct, + instruction_correct=instruction_correct, + prior_record_preserved=artifact.prior_record_preserved, + detection_delay_seconds=artifact.detection_delay_seconds, + target_detection_delay_seconds=target_delay_seconds, + within_target=within_target, + timeliness_score=score, + limitations=artifact.limitations, + reviewed_at=reviewed_at, + ) + authorization = await _authorize_append( + state, + context=reviewer, + authorization_key=f"recorded-correction-delay-review:{pair_index}:{variant}", + subject_ref=str(review.review_id), + subject_digest=str(review.review_digest), + requested_at=reviewed_at, + ) + reference = await _append_value( + state, + value=review, + record_kind="correction_detection_review", + record_key=str(review.review_id), + transaction_key=f"correction-detection-review:{review.review_id}", + as_of=reviewed_at, + authorization=authorization, + ) + return review, reference + + +async def _record_review_outcome( + state: dict[str, Any], + *, + export: ReviewedExport, + review: CorrectionDetectionReviewV1Alpha1, + review_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: str, +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + measures = ImpactOutcomeMeasuresV1Alpha1( + primary_value=review.timeliness_score, + observed_result=review_ref, + latency_ms=review.detection_delay_seconds * 1_000, + cost_usd=0.0, + failure_count=0, + degraded=False, + limitations=review.limitations, + ) + recorded_at = state["clock"]() + observer = _context(environment.context, "principal:world-correction-delay-outcome-observer") + intent = OutcomeIntentV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=observer, + decision=export.decision_ref, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + value_json=canonical_json(measures.model_dump(mode="json")), + observed_at=review.reviewed_at, + recorded_at=recorded_at, + ) + authorization = await _authorize_append( + state, + context=observer, + authorization_key=f"recorded-correction-delay-outcome:{pair_index}:{variant}", + subject_ref=str(intent.intent_id), + subject_digest=str(intent.intent_digest), + requested_at=recorded_at, + ) + outcome = OutcomeV1Alpha1(intent=intent, authorization=authorization) + return await _append_value( + state, + value=outcome, + record_kind="outcome", + record_key=str(outcome.outcome_id), + transaction_key=f"outcome:{outcome.outcome_id}", + as_of=review.reviewed_at, + authorization=authorization, + ) + + +async def run_correction_detection_delay_outcome(workspace_root: Path) -> dict[str, Any]: + """Run P2C7 over an exact recorded official correction pair.""" + + state: dict[str, Any] = {} + prior = await run_contradiction_attention_outcome(workspace_root, state_sink=state) + environment = state["environment"] + fixture = load_correction_fixture() + original, original_ref = await _append_source_observation(state, fixture=fixture, role="original") + correction, correction_ref = await _append_source_observation(state, fixture=fixture, role="correction") + replay = fixture["recorded_replay"] + treatment_artifact, treatment_ref, treatment_content = await _append_correction_artifact( + state, + fixture=fixture, + original_ref=original_ref, + correction_ref=correction_ref, + detected_at=_time(replay["treatment_detected_at"]), + variant="treatment", + ) + control_artifact, control_ref, control_content = await _append_correction_artifact( + state, + fixture=fixture, + original_ref=original_ref, + correction_ref=correction_ref, + detected_at=_time(replay["control_detected_at"]), + variant="delayed-control", + ) + treatment_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=treatment_ref, + content=treatment_content, + pair_index=index, + variant="correction-delay-treatment", + ) + for index in (1, 2) + ] + ) + control_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=control_ref, + content=control_content, + pair_index=index, + variant="correction-delay-control", + ) + for index in (1, 2) + ] + ) + criterion_head, impact_binding = _install_policy(state) + criterion = ImpactCriterionV1Alpha1( + product_id=environment.fixture["product_id"], + criterion_id=CRITERION_ID, + criterion_version="candidate-1", + target_kind=ImpactTargetKind.INTELLIGENCE_ARTIFACT, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + metric_direction=ImpactMetricDirection.HIGHER_IS_BETTER, + useful_effect_threshold=0.75, + harmful_effect_threshold=0.75, + minimum_matched_pairs=2, + requires_observed_result=True, + harmful_action=ImpactGovernanceAction.ROLLBACK, + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(criterion_head), + frozen_at=CRITERION_FROZEN_AT, + ) + + evidence: list[ImpactEvidenceV1Alpha1] = [] + treatment_reviews: list[CorrectionDetectionReviewV1Alpha1] = [] + control_reviews: list[CorrectionDetectionReviewV1Alpha1] = [] + observed_times: list[datetime] = [] + for index, (treatment_export, control_export) in enumerate( + zip(treatment_exports, control_exports, strict=True), start=1 + ): + treatment_attribution = await _record_attribution( + state, + export=treatment_export, + subject=treatment_ref, + pair_index=index, + variant="correction-delay-treatment", + ) + control_attribution = await _record_attribution( + state, + export=control_export, + subject=control_ref, + pair_index=index, + variant="correction-delay-control", + ) + treatment_review, treatment_review_ref = await _review_artifact( + state, + fixture=fixture, + subject=treatment_ref, + original_ref=original_ref, + correction_ref=correction_ref, + pair_index=index, + variant="treatment", + ) + control_review, control_review_ref = await _review_artifact( + state, + fixture=fixture, + subject=control_ref, + original_ref=original_ref, + correction_ref=correction_ref, + pair_index=index, + variant="control", + ) + treatment_outcome = await _record_review_outcome( + state, + export=treatment_export, + review=treatment_review, + review_ref=treatment_review_ref, + pair_index=index, + variant="treatment", + ) + control_outcome = await _record_review_outcome( + state, + export=control_export, + review=control_review, + review_ref=control_review_ref, + pair_index=index, + variant="control", + ) + treatment_reviews.append(treatment_review) + control_reviews.append(control_review) + observed_times.extend((treatment_review.reviewed_at, control_review.reviewed_at)) + conditions = ImpactConditionsV1Alpha1( + product_id=environment.fixture["product_id"], + condition_key=f"world-recorded-correction-delay-pair:{index}", + route_id="world:fcc-recorded-correction-delay-review", + context_json=canonical_json( + { + "fixture_digest": correction_fixture_digest(fixture), + "pair_index": index, + "recorded_transport": True, + "review_policy_digest": treatment_review.policy_digest, + "target_detection_delay_seconds": replay["target_detection_delay_seconds"], + "task": "exact_recorded_correction_linkage_and_detection_delay", + } + ), + observation_window_start=CRITERION_FROZEN_AT, + observation_window_end=max(observed_times), + frozen_at=CRITERION_FROZEN_AT, + ) + evidence.append( + ImpactEvidenceV1Alpha1( + product_id=environment.fixture["product_id"], + evidence_key=f"world-recorded-correction-delay:{index}", + treatment_attribution=treatment_attribution, + control_attribution=control_attribution, + treatment_decision=treatment_export.decision_ref, + control_decision=control_export.decision_ref, + treatment_action_review=treatment_export.review_ref, + treatment_action_admission=treatment_export.admission_ref, + treatment_action_terminal=treatment_export.terminal_ref, + control_action_review=control_export.review_ref, + control_action_admission=control_export.admission_ref, + control_action_terminal=control_export.terminal_ref, + treatment_outcome=treatment_outcome, + control_outcome=control_outcome, + treatment_conditions=conditions, + control_conditions=conditions, + ) + ) + + request = ImpactEvaluationRequestV1Alpha1( + evaluation_key="world-recorded-correction-delay:fcc-2021-10670", + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + criterion=criterion, + target=treatment_ref, + control=control_ref, + evidence=tuple(evidence), + cutoff_at=state["clock"](), + requested_at=state["clock"](), + ) + service = MeasuredImpactService( + store=environment.store, + authorizer=state["reasoning"], + operation_binding=impact_binding, + ) + admission = await service.evaluate(request) + historical = await MeasuredImpactService( + store=environment.store, + authorizer=_ReplayMustNotAuthorize(), + operation_binding=impact_binding, + ).evaluate(request) + if admission.replayed or not historical.replayed or historical.evaluation != admission.evaluation: + raise AssertionError("correction-delay evaluation did not replay exact historical material") + if admission.evaluation.classification is not ImpactClassification.USEFUL: + raise AssertionError("frozen correction-delay criterion did not classify useful") + if admission.proposal is None or admission.proposal.action is not ImpactGovernanceAction.PROMOTE: + raise AssertionError("correction-delay result did not emit its proposal-only mapping") + if {item.linkage_correct for item in (*treatment_reviews, *control_reviews)} != {True}: + raise AssertionError("recorded correction linkage was not preserved in every review") + if {item.prior_record_preserved for item in (*treatment_reviews, *control_reviews)} != {True}: + raise AssertionError("recorded correction handling rewrote or lost the original record") + if {item.detection_delay_seconds for item in treatment_reviews} != {300}: + raise AssertionError("treatment did not preserve the exact five-minute replay delay") + if {item.detection_delay_seconds for item in control_reviews} != {21_600}: + raise AssertionError("control did not preserve the exact six-hour replay delay") + + return { + "contract": "ace.world-intelligence.correction-detection-delay-outcome/v1alpha1", + "prior_contradiction_attention": prior, + "source_pair": { + "fixture_id": fixture["fixture_id"], + "fixture_digest": correction_fixture_digest(fixture), + "network_access": fixture["network_access"], + "source_policy": fixture["source_policy"], + "original": fixture["original"], + "correction": fixture["correction"], + "original_observation_id": str(original.resource_id), + "correction_observation_id": str(correction.resource_id), + }, + "review_policy": { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "policy_digest": treatment_reviews[0].policy_digest, + "reviewer_ref": treatment_reviews[0].reviewer_context.actor_ref, + "target_detection_delay_seconds": replay["target_detection_delay_seconds"], + }, + "artifacts": { + "treatment": treatment_artifact.model_dump(mode="json"), + "control": control_artifact.model_dump(mode="json"), + }, + "observed_results": { + "treatment": tuple(item.model_dump(mode="json") for item in treatment_reviews), + "control": tuple(item.model_dump(mode="json") for item in control_reviews), + }, + "evaluation": admission.evaluation.model_dump(mode="json"), + "proposal": admission.proposal.model_dump(mode="json"), + "replay": { + "historical": historical.replayed, + "no_reauthorization": True, + "transaction_receipt_id": str(historical.transaction_receipt.receipt_id), + }, + "scope": { + "exact_recorded_official_correction_pair": True, + "exact_correction_linkage_reviewed": True, + "prior_record_preserved": True, + "network_access": False, + "live_monitoring_claimed": False, + "network_arrival_delay_claimed": False, + "population_detection_performance_claimed": False, + "legal_truth_claimed": False, + "general_brief_quality_claimed": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + }, + } + + +def main() -> None: + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + args = parser.parse_args() + print( + json.dumps( + asyncio.run(run_correction_detection_delay_outcome(args.workspace_root)), + indent=2, + sort_keys=True, + ) + ) + + +if __name__ == "__main__": + main() From 3682eb3c677742e241fba62b564dcb39f7cab373 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Mon, 10 Aug 2026 19:53:39 -0700 Subject: [PATCH 06/17] Measure World correction revision stability --- README.md | 20 +- ROADMAP.md | 12 +- ...n-revision-stability-outcome-2026-08-10.md | 154 ++++ ...vision-stability-outcome-work-packet-v1.md | 110 +++ ...8_correction_revision_stability_outcome.py | 157 ++++ ...p2c7_correction_detection_delay_outcome.py | 22 +- ...8_correction_revision_stability_outcome.py | 844 ++++++++++++++++++ 7 files changed, 1311 insertions(+), 8 deletions(-) create mode 100644 docs/audits/world-intelligence-p2c8-correction-revision-stability-outcome-2026-08-10.md create mode 100644 docs/design/world-intelligence-p2c8-correction-revision-stability-outcome-work-packet-v1.md create mode 100644 domain_packs/tests/test_p2c8_correction_revision_stability_outcome.py create mode 100644 scripts/p2c8_correction_revision_stability_outcome.py diff --git a/README.md b/README.md index e7dff88..6aa5a37 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,16 @@ The recorded availability and detection instants are test coordinates. The suite network access and does not establish live monitoring, network-arrival latency, population delay performance, legal truth, calibration, general Brief quality, causality, or human benefit. +P2C8 creates actual prior, treatment, and control `BriefV1Alpha1` records over that same source +pair. Both revisions remove the stale instruction claim, add the same exact correction claim, +retain three claims, and cite the same original/correction sources. Treatment preserves the exact +identities of both unaffected claims; the paraphrase-drift control preserves neither. Independent +reviews record every expected, preserved, drifted, and unexpected claim identity, producing scores +of `1.0` and `0.0` across two matched pairs and another non-effective proposal. + +This freezes a World product rule over one recorded pair. It is not live revision, a general +semantic-equivalence engine, population stability, calibration, causality, or human benefit. + ## What the public World proof demonstrates Generate a self-contained visual Reality Brief and its exact machine-readable backing data: @@ -358,10 +368,11 @@ $PY -m scripts.p2c3_measured_feedback "$WORKSPACE" # Stacked candidate: explicit reject/no-action review of the exact proposal $PY -m scripts.p2c4_reviewed_impact_disposition "$WORKSPACE" -# Stacked candidates: exact citation correctness, contradiction attention, and correction delay +# Stacked candidates: correctness, attention, correction delay, and revision stability $PY -m scripts.p2c5_citation_correctness_outcome "$WORKSPACE" $PY -m scripts.p2c6_contradiction_attention_outcome "$WORKSPACE" $PY -m scripts.p2c7_correction_detection_delay_outcome "$WORKSPACE" +$PY -m scripts.p2c8_correction_revision_stability_outcome "$WORKSPACE" ``` The released 0.9.0 gates are reproducible through the locked environment, as CI does. The @@ -439,9 +450,10 @@ adds an independently reviewed citation-correctness Outcome and a citation-prese negative control. P2C6 adds exact contradiction recall, false-alert rate, equal alert-volume control, and valid silence under one frozen recorded-source challenge. P2C7 adds exact handling of one explicit recorded correction pair, preserves the prior record, and measures frozen-replay -detection delay against a product target. The next bounded measurement work is -calibration/revision stability, another independently sourced correction event, or independent -Market reproduction. +detection delay against a product target. P2C8 measures exact unaffected-claim identity +preservation across real Brief contracts while holding correction semantics, source coverage, and +claim count constant. The next bounded measurement work is calibration, another independently +sourced correction event, or independent Market reproduction. Separately reviewed opt-in network transport and P2D multi-source conflict/correction with LIVE inputs remain independent work. None of these steps may add autonomous publishing, delivery, persuasion, or action authority to a Domain Pack. diff --git a/ROADMAP.md b/ROADMAP.md index 59c5f92..70ca3f4 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–P2C7 measured feedback and product-owned outcomes +## Candidate — P2C3–P2C8 measured feedback and product-owned outcomes - 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. @@ -41,6 +41,11 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). reviewed workflow, but their replay delays are 300 and 21600 seconds against a product-owned 600-second target. Exact reviews and Outcomes expose the source pair, rule, delay, score, and limitations without claiming live network-arrival performance. +- A fifth frozen criterion creates actual prior and revised Brief contracts over that correction. + Treatment and control have the same exact sources, replacement claim, claim count, and reviewed + workflow, but treatment preserves both unaffected claim identities while the paraphrase-drift + control preserves neither. Exact reviews expose the affected, replacement, stable, preserved, + drifted, and unexpected claim sets without claiming general semantic equivalence. - 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. @@ -55,7 +60,10 @@ freezes contradiction recall, false-alert rate, equal alert volume, and valid si claiming live conflict detection or population performance. The stacked [P2C7 work packet](docs/design/world-intelligence-p2c7-correction-detection-delay-outcome-work-packet-v1.md) freezes exact correction linkage, prior-record preservation, and recorded-replay detection delay -without claiming live monitoring or network-arrival latency. +without claiming live monitoring or network-arrival latency. The stacked +[P2C8 work packet](docs/design/world-intelligence-p2c8-correction-revision-stability-outcome-work-packet-v1.md) +freezes correction-induced Brief revision stability without claiming live revision, population +performance, or a general semantic-equivalence engine. ## Next — trustworthy live orientation diff --git a/docs/audits/world-intelligence-p2c8-correction-revision-stability-outcome-2026-08-10.md b/docs/audits/world-intelligence-p2c8-correction-revision-stability-outcome-2026-08-10.md new file mode 100644 index 0000000..22ca9ce --- /dev/null +++ b/docs/audits/world-intelligence-p2c8-correction-revision-stability-outcome-2026-08-10.md @@ -0,0 +1,154 @@ +# World Intelligence P2C8 correction-revision-stability outcome audit — 2026-08-10 + +Status: **stacked candidate evidence only; not a release, SI4 pass, live-revision proof, or applied +governance change** + +## Source identity + +- World base: P2C7 commit `216a37a1fdcb4f0baf9ac148ab9e525559141c22` +- World branch: `codex/world-correction-revision-stability` +- Core dependency: exact observed-result candidate commit + `433e3d16c5458c975557dcd1552824fb959d4d12` +- Released identity intentionally unchanged: `ace-domain-world-intelligence==0.9.0`, + `ace-core>=0.5.0,<0.6` + +## Exact point-in-time result + +The source fixture remains +`sha256:2b81d3950cbfd127408eec227ec5cd249677a189120d6ca7b603d85d01074543`, +with original Observation `observation:f1768d6f4191a86e245846a9a1e33768` and correction +Observation `observation:fced5d3bbc3802c0285021142b332e29`. + +One source-checkout run recorded actual prior, treatment, and control `BriefV1Alpha1` resources: + +```text +prior Brief: + brief:b0911c340cc4a39cd7a908f7884d71bd + sha256:b0911c340cc4a39cd7a908f7884d71bd6348b6202b9d8f521d4339e708273250 +treatment Brief: + brief:d1dafb5352ebfd99bc35c1044bc627ac + sha256:d1dafb5352ebfd99bc35c1044bc627ac3e30846b8092561ec28bfca4ae4921c3 +control Brief: + brief:f86f101516ea496108557498e5950672 + sha256:f86f101516ea496108557498e5950672660ead2c1a01949a46776250cbf3f075 + +affected prior claim: + grounded_claim:fddf5435d53f01312739f8f8ff355eb6 +replacement correction claim: + grounded_claim:ff1683b3155f734bcf942c0cab9ed7e4 +stable claims: + grounded_claim:7c6c683cae2dabeb050d5542405e992a + grounded_claim:8fab51672b58cdd0c45734ea637d7aaf +control-only paraphrase identities: + grounded_claim:82b05b5ec627f03a43e76c76eff27fde + grounded_claim:ec5fc4e83b25519dc44f2878ed69588b + +original citation: citation:0cb9a00ce581b4d09a0ab14f755caf05 +correction citation: citation:13ae2675d1ce8f512389eda12e4b6632 +``` + +Treatment and control both have three claims, both remove the affected prior claim, both add the +same replacement, and both cite the same original and correction sources. Treatment preserves both +stable claim identities. Control preserves neither and introduces the two frozen paraphrase +identities. + +The reviews used product policy `world_recorded_correction_revision_stability` version +`candidate-1`, material +`sha256:0145cc35244c21b84f3ba346ccb16192b825fd91d1bcff950e3f0a8005ac932b`: + +```text +treatment review 1: brief_revision_stability_review:3b50050e155af3d3eb4391e232a178d0 +treatment review 2: brief_revision_stability_review:9f0544d7c79b9a6601760d98133db156 +control review 1: brief_revision_stability_review:ac1422dde272aed347045d671e2c6276 +control review 2: brief_revision_stability_review:1a4d0d821b3752a47d15a3d6a1746bc7 +treatment preserved stable claims: 2, 2 +control preserved stable claims: 0, 0 +treatment drifted stable claims: 0, 0 +control drifted stable claims: 2, 2 +treatment score: 1.0, 1.0 +control score: 0.0, 0.0 +matched pairs: 2 +mean effect: 1.0 +classification: useful +proposal action: promote +proposal live effect: false +historical replay: true +replay reauthorization: false +``` + +The exact evaluation was `impact_evaluation:d0ba0242b75dd5ec63ba27aa223a0225` with material +`sha256:d0ba0242b75dd5ec63ba27aa223a0225ff83239a40398a8cbd50d54cea1a3a0a`. +The exact non-effective proposal was +`impact_governance_proposal:9e5a4eab5ea3c147310f6e6f8011c7cd` with material +`sha256:9e5a4eab5ea3c147310f6e6f8011c7cd56682933711e3be8924fbe294426b40d`. + +## Verification + +The frozen World dependency versions plus the stacked Core candidate and separately packaged +reference action adapter produced: + +```text +python -B -m pytest domain_packs/tests/test_p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py \ + domain_packs/tests/test_p2c5_citation_correctness_outcome.py \ + domain_packs/tests/test_p2c6_contradiction_attention_outcome.py \ + domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py \ + domain_packs/tests/test_p2c8_correction_revision_stability_outcome.py -q --tb=short +20 passed in 6.50s + +python -B -m pytest -q --tb=short +103 passed in 20.04s + +python -B -m pytest adapters/federal_register_source/tests -q --tb=short +26 passed in 0.26s + +python -B -m pytest tests/test_release_contract.py -q --tb=short +7 passed in 0.05s + +# Installed public ace-core==0.5.0; no Core source checkout or reference action adapter. +python -B -m pytest -q --tb=short -rs +82 passed, 21 skipped in 14.24s + +ruff check --no-cache +PASS + +ruff format --check --no-cache +3 files already formatted + +uv build --out-dir +Successfully built unchanged 0.9.0 source distribution and inert data-only wheel + +git diff --check +PASS +``` + +The twenty-one public-Core skips are explicit boundaries: one P2C2 test requires the separately +packaged Core reference action adapter; P2C3-P2C8 require unreleased stacked Core candidate +contracts. The wheel contains 45 inert Domain Pack JSON/metadata files, no Python or entry points, +and retains `ace-core>=0.5.0,<0.6`. + +Repository-wide Ruff remains an inherited release-hygiene blocker. The exact locked check reports +the same 15 lint findings and 20 format targets as the P2C7 parent. Scoped P2C8 checks and +`git diff --check` are green. P2C8 does not rewrite unrelated history, but release closeout must +reconcile the repository-wide gate before publication. + +## Claim boundary + +The World reviewer exact-loads the prior and revised Briefs, then derives affected-update +correctness, correction visibility, complete source coverage, claim-count preservation, and the +exact stable-claim partition. The Core Outcome points to that review record. Historical replay +requires no new authority, and fresh hosts reproduce the exact Brief identities, claim sets, +classification, metrics, and proposal disposition. + +The paraphrase control is a frozen World policy fixture, not a general semantic-equivalence engine. +One correction and two replicated workflows do not establish live revision, a population stability +rate, calibration, source independence, general Brief quality, causality, legal truth, or human +benefit. The proposal remains non-effective and unapplied. + +## Remaining work + +Calibration, another independently sourced correction event, a materially different Market +journey, combined-main review/CI, public artifacts, repository-wide lint/format reconciliation, +security/release checks, and opt-in live transport remain future bounded work. Core issue #49 F1, +F3, and F5 still require explicit 0.6 release-owner disposition; this World packet neither +implements nor re-dates them. diff --git a/docs/design/world-intelligence-p2c8-correction-revision-stability-outcome-work-packet-v1.md b/docs/design/world-intelligence-p2c8-correction-revision-stability-outcome-work-packet-v1.md new file mode 100644 index 0000000..28d2642 --- /dev/null +++ b/docs/design/world-intelligence-p2c8-correction-revision-stability-outcome-work-packet-v1.md @@ -0,0 +1,110 @@ +# World Intelligence P2C8 correction-revision-stability outcome work packet (v1) + +**Status:** stacked source-checkout candidate; this packet does not release World Intelligence, +apply a governance proposal, close ACE Core issue #38, pass SI4, or complete ACE 0.6.0. + +**Frozen:** 2026-08-10 from World P2C7 commit +`216a37a1fdcb4f0baf9ac148ab9e525559141c22`, stacked on the Core exact observed-result +provenance candidate `433e3d16c5458c975557dcd1552824fb959d4d12`. + +## Objective + +Measure whether a correction-induced Brief revision changes the claim it should while preserving +the exact identities of claims the correction does not affect. The packet extends the governed +recorded-data journey: + +```text +original Observation + correction Observation -> prior Brief + -> treatment revision / unrelated-drift control + -> Decision -> reviewed Action -> exact independent revision review + -> observed Outcome -> useful / harmful / unproven evaluation -> proposal only +``` + +The source pair remains FCC Federal Register document `2020-28779` and its explicit correction +`2021-10670`. P2C8 creates actual domain-neutral `BriefV1Alpha1` records rather than a weaker +World-only summary shape. The prior Brief has one affected instruction claim and two stable facts. +Both revised Briefs replace the affected claim with the exact correction instruction, retain the +same two source citations, and keep the claim count at three. Treatment reuses the exact two stable +claim identities; the control paraphrases both stable facts and therefore changes their content +identities despite unchanged correction semantics and source coverage. + +## Product-owned review policy + +World owns `world_recorded_correction_revision_stability` version `candidate-1`. Its source fixture, +prior Brief, affected claim, replacement claim, stable claim set, reviewer, formula, and policy +digest are inspectable. The score is the unaffected-claim preservation rate, but only when all four +gates pass: + +1. the exact replacement claim is present and the stale affected claim is absent; +2. the correction citation and exact correction/prior lineage are visible; +3. original and correction source coverage is complete; and +4. the prior and revised claim counts match. + +If any gate fails, the score is `0`. Treatment scores `1.0`; the unrelated-drift control scores +`0.0`. Core and Intelligence see only exact Brief/result coordinates and a scalar outcome. FCC, +Federal Register, correction, affected/unaffected claim policy, paraphrase classification, and +review vocabulary remain in World. + +## Exact acceptance + +P2C8 must: + +1. rerun P2C2 through P2C7 and preserve every prior immutable record, evaluation, proposal, and + reviewed disposition; +2. append an exact prior `BriefV1Alpha1` citing the original Observation; +3. append treatment and control `BriefV1Alpha1` revisions with exact prior, original, and + correction lineage; +4. prove both revisions remove the stale affected claim, add the same exact replacement claim, + cite the same original/correction sources, and retain the same claim count; +5. prove treatment preserves both stable claim identities while control preserves neither and + introduces exactly two unrelated content identities; +6. create two distinct reviewed treatment/control Action pairs under matched task conditions; +7. append four independently authenticated review records and four Core Outcomes naming those + exact review records; +8. classify the bounded two-pair difference `useful`, emit only a non-effective `promote` + proposal, and perform no proposal application; +9. replay without reauthorization and reproduce Brief identities, claim sets, classification, and + substantive metrics across fresh hosts; and +10. reject duplicate claims, incomplete stable-claim partitions, missing correction visibility + paired with a positive score, and caller-invented aggregate scores. + +## Negative and failure controls + +The unrelated-drift Brief is the primary product negative control. It has the same exact prior, +source Observations, citations, claim count, replacement claim, reviewed workflow, and matched +conditions as treatment. Only the two unaffected claims are paraphrased, changing their content +identities. This is a frozen fixture classification, not a general semantic-equivalence engine. + +`BriefV1Alpha1` rejects duplicate claim identities. The review contract requires the preserved and +drifted sets to partition the expected stable claims exactly and derives its rate and score from +that partition plus the four gates. Exact review loading rejects unavailable, changed, relabelled, +cross-product, or incomplete Brief material. Stacked Core tests remain authoritative for missing +attribution/result provenance, condition mismatch, cutoff leakage, unavailable Outcomes, +duplicate/replayed evidence, interruption, restart, and denied authority. + +## Files and rollback + +This packet owns: + +- `scripts/p2c8_correction_revision_stability_outcome.py`; +- `domain_packs/tests/test_p2c8_correction_revision_stability_outcome.py`; +- the additive P2C7 state handoff; +- this work packet, its audit, and restrained README/roadmap references. + +It changes no shipped Domain Pack, connector, fixture source policy, package version, dependency +range, lockfile, release record, Core contract, or public artifact. Rollback removes the P2C8 +harness, tests, state handoff, and candidate documentation. Brief, review, Outcome, evaluation, +and proposal records already persisted by a host remain immutable history. + +## Non-claims and next packet + +This is one recorded correction pair and two replicated matched workflows. It establishes exact +claim-identity preservation and criterion sensitivity under one frozen World rule. It does not +establish live revision, general semantic equivalence, a population stability rate, calibration, +source independence, general Brief quality, causal benefit, legal truth, or human usefulness. + +The next bounded outcome packet should freeze calibration under a declared forecast/observed-result +rule or repeat the unchanged correction/revision contracts over a materially different source. +Independent Market reproduction, public Core artifacts, combined-main review/CI, compatibility, +security and release gates, opt-in live transport, issue #49 disposition, repository-wide hygiene, +and any separately authorized proposal application remain separate work. diff --git a/domain_packs/tests/test_p2c8_correction_revision_stability_outcome.py b/domain_packs/tests/test_p2c8_correction_revision_stability_outcome.py new file mode 100644 index 0000000..1abfd10 --- /dev/null +++ b/domain_packs/tests/test_p2c8_correction_revision_stability_outcome.py @@ -0,0 +1,157 @@ +from __future__ import annotations + +import copy +import importlib.util +import json + +import pytest +from pydantic import ValidationError + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact") is None: + pytest.skip("P2C8 requires the stacked ACE Core measured-impact candidate") + from ace.intelligence import ImpactOutcomeMeasuresV1Alpha1 + + if "observed_result" not in ImpactOutcomeMeasuresV1Alpha1.model_fields: + pytest.skip("P2C8 requires exact observed-result provenance from the stacked Core candidate") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("P2C8 requires the separately packaged Core reference adapter") + + +@pytest.mark.asyncio +async def test_exact_brief_revision_review_becomes_a_measured_outcome(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c8_correction_revision_stability_outcome import run_correction_revision_stability_outcome + + result = await run_correction_revision_stability_outcome(tmp_path) + + assert result["review_policy"]["reviewer_ref"] == "principal:world-revision-stability-reviewer" + assert result["evaluation"]["criterion"]["requires_observed_result"] is True + assert result["evaluation"]["classification"] == "useful" + assert result["evaluation"]["matched_pair_count"] == 2 + assert result["evaluation"]["mean_effect"] == 1.0 + assert result["proposal"]["action"] == "promote" + assert result["proposal"]["live_effect"] is False + assert result["proposal"]["selectable"] is False + assert result["proposal"]["requires_human_review"] is True + assert result["replay"]["historical"] is True + assert result["replay"]["no_reauthorization"] is True + assert {item["contract"] for item in result["briefs"].values()} == {"ace.intelligence.brief/v1alpha1"} + + +@pytest.mark.asyncio +async def test_equal_coverage_control_isolates_unaffected_claim_identity_stability(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c8_correction_revision_stability_outcome import run_correction_revision_stability_outcome + + result = await run_correction_revision_stability_outcome(tmp_path) + prior = result["briefs"]["prior"] + treatment = result["briefs"]["treatment"] + control = result["briefs"]["control"] + expected = result["expected_revision"] + treatment_reviews = result["observed_results"]["treatment"] + control_reviews = result["observed_results"]["control"] + + assert len(prior["claims"]) == len(treatment["claims"]) == len(control["claims"]) == 3 + assert len(treatment["citations"]) == len(control["citations"]) == 2 + assert {item["affected_update_correct"] for item in (*treatment_reviews, *control_reviews)} == {True} + assert {item["correction_visible"] for item in (*treatment_reviews, *control_reviews)} == {True} + assert {item["source_coverage_complete"] for item in (*treatment_reviews, *control_reviews)} == {True} + assert {item["claim_count_preserved"] for item in (*treatment_reviews, *control_reviews)} == {True} + assert {tuple(item["preserved_stable_claim_ids"]) for item in treatment_reviews} == { + tuple(expected["stable_claim_ids"]) + } + assert {tuple(item["drifted_stable_claim_ids"]) for item in treatment_reviews} == {()} + assert {tuple(item["preserved_stable_claim_ids"]) for item in control_reviews} == {()} + assert {tuple(item["drifted_stable_claim_ids"]) for item in control_reviews} == { + tuple(expected["stable_claim_ids"]) + } + assert {item["revision_stability_score"] for item in treatment_reviews} == {1.0} + assert {item["revision_stability_score"] for item in control_reviews} == {0.0} + + +@pytest.mark.asyncio +async def test_revised_briefs_name_the_prior_and_exact_correction_without_rewriting_history(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c8_correction_revision_stability_outcome import run_correction_revision_stability_outcome + + result = await run_correction_revision_stability_outcome(tmp_path) + prior = result["briefs"]["prior"] + expected = result["expected_revision"] + source_pair = result["source_pair"] + + for variant in ("treatment", "control"): + revised = result["briefs"][variant] + lineage_ids = {item["resource_id"] for item in revised["lineage"]} + claim_ids = {item["claim_id"] for item in revised["claims"]} + assert prior["resource_id"] in lineage_ids + assert source_pair["original_observation_id"] in lineage_ids + assert source_pair["correction_observation_id"] in lineage_ids + assert expected["affected_claim_id"] not in claim_ids + assert expected["replacement_claim_id"] in claim_ids + assert result["scope"]["actual_brief_contracts"] is True + assert result["scope"]["unaffected_claim_identity_preservation_reviewed"] is True + assert result["scope"]["live_revision_claimed"] is False + assert result["scope"]["semantic_equivalence_engine_claimed"] is False + assert result["scope"]["proposal_applied"] is False + + +@pytest.mark.asyncio +async def test_duplicate_claims_missing_correction_visibility_and_invented_scores_fail_closed(tmp_path) -> None: + _require_candidate_contracts() + from ace.intelligence import BriefV1Alpha1 + + from scripts.p2c8_correction_revision_stability_outcome import ( + BriefRevisionStabilityReviewV1Alpha1, + run_correction_revision_stability_outcome, + ) + + result = await run_correction_revision_stability_outcome(tmp_path) + duplicate = copy.deepcopy(result["briefs"]["treatment"]) + duplicate["claims"] = [duplicate["claims"][0], duplicate["claims"][0], duplicate["claims"][2]] + duplicate["resource_id"] = None + duplicate["resource_digest"] = None + with pytest.raises(ValidationError, match="unique content identities"): + BriefV1Alpha1.model_validate_json(json.dumps(duplicate)) + + review = copy.deepcopy(result["observed_results"]["treatment"][0]) + review["correction_visible"] = False + review["review_id"] = None + review["review_digest"] = None + with pytest.raises(ValidationError, match="score differs from frozen product rule"): + BriefRevisionStabilityReviewV1Alpha1.model_validate_json(json.dumps(review)) + + review = copy.deepcopy(result["observed_results"]["treatment"][0]) + review["preserved_stable_claim_ids"] = review["preserved_stable_claim_ids"][:1] + review["review_id"] = None + review["review_digest"] = None + with pytest.raises(ValidationError, match="exactly partition stable claims"): + BriefRevisionStabilityReviewV1Alpha1.model_validate_json(json.dumps(review)) + + +@pytest.mark.asyncio +async def test_packet_briefs_and_classification_are_deterministic_across_fresh_hosts(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c8_correction_revision_stability_outcome import run_correction_revision_stability_outcome + + first_root = tmp_path / "first" + second_root = tmp_path / "second" + first_root.mkdir() + second_root.mkdir() + first = await run_correction_revision_stability_outcome(first_root) + second = await run_correction_revision_stability_outcome(second_root) + + assert first["source_pair"] == second["source_pair"] + assert first["expected_revision"] == second["expected_revision"] + for variant in ("prior", "treatment", "control"): + assert first["briefs"][variant]["resource_id"] == second["briefs"][variant]["resource_id"] + assert first["briefs"][variant]["resource_digest"] == second["briefs"][variant]["resource_digest"] + for variant in ("treatment", "control"): + first_scores = [item["revision_stability_score"] for item in first["observed_results"][variant]] + second_scores = [item["revision_stability_score"] for item in second["observed_results"][variant]] + assert first_scores == second_scores + for field in ("classification", "matched_pair_count", "mean_effect"): + assert first["evaluation"][field] == second["evaluation"][field] + for field in ("action", "live_effect", "selectable", "requires_human_review"): + assert first["proposal"][field] == second["proposal"][field] diff --git a/scripts/p2c7_correction_detection_delay_outcome.py b/scripts/p2c7_correction_detection_delay_outcome.py index 3cf2fb5..3c99b27 100644 --- a/scripts/p2c7_correction_detection_delay_outcome.py +++ b/scripts/p2c7_correction_detection_delay_outcome.py @@ -544,10 +544,14 @@ async def _record_review_outcome( ) -async def run_correction_detection_delay_outcome(workspace_root: Path) -> dict[str, Any]: +async def run_correction_detection_delay_outcome( + workspace_root: Path, + *, + state_sink: dict[str, Any] | None = None, +) -> dict[str, Any]: """Run P2C7 over an exact recorded official correction pair.""" - state: dict[str, Any] = {} + state: dict[str, Any] = {} if state_sink is None else state_sink prior = await run_contradiction_attention_outcome(workspace_root, state_sink=state) environment = state["environment"] fixture = load_correction_fixture() @@ -746,6 +750,20 @@ async def run_correction_detection_delay_outcome(workspace_root: Path) -> dict[s if {item.detection_delay_seconds for item in control_reviews} != {21_600}: raise AssertionError("control did not preserve the exact six-hour replay delay") + state.update( + { + "p2c7_fixture": fixture, + "p2c7_original_observation": original, + "p2c7_original_observation_ref": original_ref, + "p2c7_correction_observation": correction, + "p2c7_correction_observation_ref": correction_ref, + "p2c7_treatment_artifact": treatment_artifact, + "p2c7_treatment_artifact_ref": treatment_ref, + "p2c7_control_artifact": control_artifact, + "p2c7_control_artifact_ref": control_ref, + } + ) + return { "contract": "ace.world-intelligence.correction-detection-delay-outcome/v1alpha1", "prior_contradiction_attention": prior, diff --git a/scripts/p2c8_correction_revision_stability_outcome.py b/scripts/p2c8_correction_revision_stability_outcome.py new file mode 100644 index 0000000..90a2e32 --- /dev/null +++ b/scripts/p2c8_correction_revision_stability_outcome.py @@ -0,0 +1,844 @@ +"""Measure bounded correction-induced Brief revision stability.""" + +from __future__ import annotations + +import asyncio +import json +from datetime import datetime +from pathlib import Path +from typing import Any, Literal, Self + +from ace.application import MeasuredImpactService +from ace.core import ( + AuthenticatedRuntimeContextV1Alpha1, + CapabilityArtifactIdentityV1Alpha1, + GovernedOperationBindingV1Alpha1, + GovernedStateHeadPreconditionV1Alpha1, + ImmutableRecordReferenceV1, + OutcomeIntentV1Alpha1, + OutcomeV1Alpha1, + canonical_json, + capability_state_ref_for_artifact, +) +from ace.intelligence import ( + BriefV1Alpha1, + CitationV1Alpha1, + ClaimGroundingKind, + GroundedClaimV1Alpha1, + ImpactClassification, + ImpactConditionsV1Alpha1, + ImpactCriterionV1Alpha1, + ImpactEvaluationRequestV1Alpha1, + ImpactEvidenceV1Alpha1, + ImpactGovernanceAction, + ImpactMetricDirection, + ImpactOutcomeMeasuresV1Alpha1, + ImpactTargetKind, + IntelligenceResourceMode, + LineageReferenceV1Alpha1, + LineageRelation, + LineageResourceKind, + ObservationV1Alpha1, +) +from pydantic import Field, model_validator + +from scripts.p2c2_federal_register_monitor import _time +from scripts.p2c2_governed_reality_brief import _context, _head +from scripts.p2c3_measured_feedback import ( + ReviewedExport, + _append_value, + _authorize_append, + _digest, + _record_attribution, + _run_reviewed_export, +) +from scripts.p2c5_citation_correctness_outcome import _derive_identity, _FrozenModel +from scripts.p2c7_correction_detection_delay_outcome import ( + correction_fixture_digest, + run_correction_detection_delay_outcome, +) + +OUTCOME_TYPE = "independent_artifact_review" +MEASURE_ID = "recorded_correction_revision_stability" +CRITERION_ID = "impact_criterion:world-recorded-correction-revision-stability" +PRIOR_BRIEF_AT = _time("2026-08-10T23:14:00Z") +REVISED_BRIEF_AT = _time("2026-08-10T23:15:00Z") +CRITERION_FROZEN_AT = _time("2026-08-10T23:16:00Z") +REVIEW_POLICY_ID = "world_recorded_correction_revision_stability" +REVIEW_POLICY_VERSION = "candidate-1" + +IMPACT_ARTIFACT = CapabilityArtifactIdentityV1Alpha1( + capability="measured_impact_evaluation", + contract="ace.application.measured-impact-service/v1alpha1", + implementation_id="world_recorded_correction_revision_stability_candidate", + implementation_version="0.1.0", + artifact_digest="sha256:" + "b" * 64, +) + + +class BriefRevisionStabilityReviewV1Alpha1(_FrozenModel): + """Exact product review of one prior/revised Brief pair.""" + + contract: Literal["ace.world-intelligence.brief-revision-stability-review/v1alpha1"] = ( + "ace.world-intelligence.brief-revision-stability-review/v1alpha1" + ) + product_id: str + review_key: str + prior_brief: ImmutableRecordReferenceV1 + revised_brief: ImmutableRecordReferenceV1 + original_observation: ImmutableRecordReferenceV1 + correction_observation: ImmutableRecordReferenceV1 + reviewer_context: AuthenticatedRuntimeContextV1Alpha1 + policy_id: str + policy_version: str + policy_digest: str + source_fixture_digest: str + expected_affected_claim_id: str + expected_replacement_claim_id: str + expected_stable_claim_ids: tuple[str, ...] = Field(min_length=1) + preserved_stable_claim_ids: tuple[str, ...] + drifted_stable_claim_ids: tuple[str, ...] + unexpected_claim_ids: tuple[str, ...] + prior_claim_count: int = Field(gt=0) + revised_claim_count: int = Field(gt=0) + replacement_claim_present: bool + stale_affected_claim_present: bool + affected_update_correct: bool + correction_visible: bool + source_coverage_complete: bool + claim_count_preserved: bool + unaffected_preservation_rate: float = Field(ge=0.0, le=1.0) + revision_stability_score: float = Field(ge=0.0, le=1.0) + limitations: tuple[str, ...] + reviewed_at: datetime + review_id: str | None = None + review_digest: str | None = None + + @model_validator(mode="after") + def validate_partition_score_and_identity(self) -> Self: + tuples = ( + self.expected_stable_claim_ids, + self.preserved_stable_claim_ids, + self.drifted_stable_claim_ids, + self.unexpected_claim_ids, + ) + if any(items != tuple(sorted(set(items))) for items in tuples): + raise ValueError("revision review claim identities must be unique and sorted") + expected = set(self.expected_stable_claim_ids) + preserved = set(self.preserved_stable_claim_ids) + drifted = set(self.drifted_stable_claim_ids) + if preserved & drifted or preserved | drifted != expected: + raise ValueError("preserved and drifted claims must exactly partition stable claims") + if self.expected_affected_claim_id in expected: + raise ValueError("the affected claim cannot also be an expected stable claim") + expected_update = self.replacement_claim_present and not self.stale_affected_claim_present + if self.affected_update_correct != expected_update: + raise ValueError("affected update disposition differs from exact claim presence") + expected_count_preserved = self.prior_claim_count == self.revised_claim_count + if self.claim_count_preserved != expected_count_preserved: + raise ValueError("claim-count disposition differs from exact counts") + expected_rate = len(preserved) / len(expected) + if self.unaffected_preservation_rate != expected_rate: + raise ValueError("unaffected preservation rate differs from exact claim partition") + gates = ( + self.affected_update_correct, + self.correction_visible, + self.source_coverage_complete, + self.claim_count_preserved, + ) + expected_score = expected_rate if all(gates) else 0.0 + if self.revision_stability_score != expected_score: + raise ValueError("revision stability score differs from frozen product rule") + _derive_identity( + self, + prefix="brief_revision_stability_review", + id_field="review_id", + digest_field="review_digest", + ) + return self + + +class _ReplayMustNotAuthorize: + async def authorize_action(self, request): + raise AssertionError( + f"historical revision-stability evaluation requested new authority: {request.authorization_key}" + ) + + +def _lineage( + resource: ObservationV1Alpha1 | BriefV1Alpha1, + *, + relation: LineageRelation = LineageRelation.DERIVED_FROM, +) -> LineageReferenceV1Alpha1: + if isinstance(resource, ObservationV1Alpha1): + kind = LineageResourceKind.OBSERVATION + available_at = resource.ingested_at + else: + kind = LineageResourceKind.BRIEF + available_at = resource.generated_at + return LineageReferenceV1Alpha1( + resource_kind=kind, + relation=relation, + resource_id=str(resource.resource_id), + resource_digest=str(resource.resource_digest), + resource_as_of=resource.as_of, + resource_available_at=available_at, + ) + + +def _citation( + observation: ObservationV1Alpha1, + *, + locator: str, + excerpt: str, +) -> CitationV1Alpha1: + return CitationV1Alpha1( + source_ref=observation.source_ref, + source_digest=observation.source_digest, + acquisition_mode=observation.acquisition_mode, + acquisition_receipt_ref=observation.acquisition_receipt_ref, + acquisition_receipt_digest=observation.acquisition_receipt_digest, + source_as_of=observation.source_published_at or observation.observed_at, + retrieved_at=observation.ingested_at, + locator=locator, + excerpt=excerpt, + ) + + +def _claim(statement: str, citation: CitationV1Alpha1) -> GroundedClaimV1Alpha1: + return GroundedClaimV1Alpha1( + statement=statement, + grounding_kind=ClaimGroundingKind.CITED, + citation_ids=(str(citation.citation_id),), + confidence=1.0, + uncertainty="Bounded to the exact recorded Federal Register documents and source-policy limits.", + ) + + +def _body(title: str, claims: tuple[GroundedClaimV1Alpha1, ...]) -> str: + return "\n".join((f"# {title}", "", *(f"- {item.statement}" for item in claims))) + "\n" + + +def _build_briefs(state: dict[str, Any]) -> dict[str, Any]: + environment = state["environment"] + original: ObservationV1Alpha1 = state["p2c7_original_observation"] + correction: ObservationV1Alpha1 = state["p2c7_correction_observation"] + activation_revision = state["brief_admission"].brief.activation_revision + original_citation = _citation( + original, + locator="Federal Register 85 FR 85524 and page 85530 instruction material", + excerpt="FCC document 2020-28779, 85 FR 85524.", + ) + correction_citation = _citation( + correction, + locator="Federal Register 86 FR 27275 correction to page 85530", + excerpt=("Remove instruction 20a and redesignate instructions 20b and 20c as instructions 20a and 20b."), + ) + affected = _claim( + "The page 85530 amendment instructions include instructions 20a, 20b, and 20c.", + original_citation, + ) + stable_publication = _claim( + "FCC document 2020-28779 was published on 2020-12-29 at 85 FR 85524.", + original_citation, + ) + stable_agency = _claim( + "The issuing agency is the Federal Communications Commission.", + original_citation, + ) + prior_claims = (affected, stable_publication, stable_agency) + prior = BriefV1Alpha1( + product_id=environment.fixture["product_id"], + mode=IntelligenceResourceMode.PREPARED, + activation_revision=activation_revision, + as_of=PRIOR_BRIEF_AT, + lineage=(_lineage(original),), + brief_type_ref="brief_type:world-reality-brief", + title="FCC Electronic Filing Rule — Recorded Brief", + executive_summary="Recorded orientation to the original FCC electronic-filing rule instructions.", + body_markdown=_body("FCC Electronic Filing Rule — Recorded Brief", prior_claims), + generated_at=PRIOR_BRIEF_AT, + citations=(original_citation,), + claims=prior_claims, + ) + replacement = _claim( + ( + "Correction 2021-10670 directs removal of instruction 20a and redesignation of " + "instructions 20b and 20c as instructions 20a and 20b on page 85530." + ), + correction_citation, + ) + treatment_claims = (replacement, stable_publication, stable_agency) + control_publication = _claim( + "Publication of FCC document 2020-28779 occurred on 2020-12-29 in 85 FR 85524.", + original_citation, + ) + control_agency = _claim( + "The Federal Communications Commission issued the document.", + original_citation, + ) + control_claims = (replacement, control_publication, control_agency) + common = { + "product_id": environment.fixture["product_id"], + "mode": IntelligenceResourceMode.PREPARED, + "activation_revision": activation_revision, + "as_of": REVISED_BRIEF_AT, + "lineage": ( + _lineage(original), + _lineage(correction), + _lineage(prior, relation=LineageRelation.CONTEXT), + ), + "brief_type_ref": "brief_type:world-reality-brief", + "title": "FCC Electronic Filing Rule — Corrected Brief", + "executive_summary": "The explicit FCC correction is visible while unaffected facts remain stable.", + "generated_at": REVISED_BRIEF_AT, + "citations": (original_citation, correction_citation), + } + treatment = BriefV1Alpha1( + **common, + body_markdown=_body("FCC Electronic Filing Rule — Corrected Brief", treatment_claims), + claims=treatment_claims, + ) + control = BriefV1Alpha1( + **common, + body_markdown=_body("FCC Electronic Filing Rule — Corrected Brief", control_claims), + claims=control_claims, + ) + return { + "prior": prior, + "treatment": treatment, + "control": control, + "original_citation": original_citation, + "correction_citation": correction_citation, + "affected_claim": affected, + "replacement_claim": replacement, + "stable_claims": (stable_publication, stable_agency), + } + + +async def _append_brief( + state: dict[str, Any], + *, + brief: BriefV1Alpha1, + role: str, +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + requested_at = state["clock"]() + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"append:world-correction-revision-brief:{role}", + subject_ref=str(brief.resource_id), + subject_digest=str(brief.resource_digest), + requested_at=requested_at, + ) + return await _append_value( + state, + value=brief, + record_kind="brief", + record_key=str(brief.resource_id), + transaction_key=f"world-correction-revision-brief:{role}:{brief.resource_id}", + as_of=brief.as_of, + authorization=authorization, + ) + + +async def _load_brief(state: dict[str, Any], reference: ImmutableRecordReferenceV1) -> BriefV1Alpha1: + record = await state["environment"].store.load_record( + reference.storage_id, + product_id=reference.product_id, + record_space=reference.record_space, + record_kind=reference.record_kind, + ) + if ( + record is None + or record.reference() != reference + or record.payload_contract != "ace.intelligence.brief/v1alpha1" + ): + raise AssertionError("revision-stability Brief is unavailable or changed") + return BriefV1Alpha1.model_validate(record.payload) + + +def _policy_digest( + *, + fixture_digest: str, + prior_ref: ImmutableRecordReferenceV1, + affected_claim_id: str, + replacement_claim_id: str, + stable_claim_ids: tuple[str, ...], +) -> str: + return _digest( + { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "fixture_digest": fixture_digest, + "prior_brief": prior_ref.model_dump(mode="json"), + "expected_affected_claim_id": affected_claim_id, + "expected_replacement_claim_id": replacement_claim_id, + "expected_stable_claim_ids": stable_claim_ids, + "score": ( + "unaffected preservation rate when the affected update, correction visibility, " + "source coverage, and claim count all pass; otherwise 0" + ), + } + ) + + +async def _review_revision( + state: dict[str, Any], + *, + material: dict[str, Any], + prior_ref: ImmutableRecordReferenceV1, + revised_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: str, +) -> tuple[BriefRevisionStabilityReviewV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + prior = await _load_brief(state, prior_ref) + revised = await _load_brief(state, revised_ref) + expected_stable = tuple(sorted(str(item.claim_id) for item in material["stable_claims"])) + affected_id = str(material["affected_claim"].claim_id) + replacement_id = str(material["replacement_claim"].claim_id) + prior_ids = {str(item.claim_id) for item in prior.claims} + revised_ids = {str(item.claim_id) for item in revised.claims} + preserved = tuple(sorted(set(expected_stable) & revised_ids)) + drifted = tuple(sorted(set(expected_stable) - revised_ids)) + unexpected = tuple(sorted(revised_ids - set(expected_stable) - {replacement_id})) + correction_citation_id = str(material["correction_citation"].citation_id) + original_citation_id = str(material["original_citation"].citation_id) + revised_citation_ids = {str(item.citation_id) for item in revised.citations} + lineage = {(item.resource_id, item.resource_digest) for item in revised.lineage} + correction = state["p2c7_correction_observation"] + prior_lineage = (str(prior.resource_id), str(prior.resource_digest)) in lineage + correction_lineage = (str(correction.resource_id), str(correction.resource_digest)) in lineage + replacement_present = replacement_id in revised_ids + stale_present = affected_id in revised_ids + correction_visible = correction_citation_id in revised_citation_ids and correction_lineage and prior_lineage + source_coverage_complete = {original_citation_id, correction_citation_id}.issubset(revised_citation_ids) + claim_count_preserved = len(prior.claims) == len(revised.claims) + preservation_rate = len(preserved) / len(expected_stable) + affected_update_correct = replacement_present and not stale_present + score = ( + preservation_rate + if affected_update_correct and correction_visible and source_coverage_complete and claim_count_preserved + else 0.0 + ) + reviewed_at = state["clock"]() + reviewer = _context(environment.context, "principal:world-revision-stability-reviewer") + fixture_digest = correction_fixture_digest(state["p2c7_fixture"]) + review = BriefRevisionStabilityReviewV1Alpha1( + product_id=environment.fixture["product_id"], + review_key=f"recorded-correction-revision-stability:{pair_index}:{variant}", + prior_brief=prior_ref, + revised_brief=revised_ref, + original_observation=state["p2c7_original_observation_ref"], + correction_observation=state["p2c7_correction_observation_ref"], + reviewer_context=reviewer, + policy_id=REVIEW_POLICY_ID, + policy_version=REVIEW_POLICY_VERSION, + policy_digest=_policy_digest( + fixture_digest=fixture_digest, + prior_ref=prior_ref, + affected_claim_id=affected_id, + replacement_claim_id=replacement_id, + stable_claim_ids=expected_stable, + ), + source_fixture_digest=fixture_digest, + expected_affected_claim_id=affected_id, + expected_replacement_claim_id=replacement_id, + expected_stable_claim_ids=expected_stable, + preserved_stable_claim_ids=preserved, + drifted_stable_claim_ids=drifted, + unexpected_claim_ids=unexpected, + prior_claim_count=len(prior.claims), + revised_claim_count=len(revised.claims), + replacement_claim_present=replacement_present, + stale_affected_claim_present=stale_present, + affected_update_correct=affected_update_correct, + correction_visible=correction_visible, + source_coverage_complete=source_coverage_complete, + claim_count_preserved=claim_count_preserved, + unaffected_preservation_rate=preservation_rate, + revision_stability_score=score, + limitations=( + "recorded_replay_not_live_revision", + "one_explicit_correction_pair", + "two_replicated_workflows_not_independent_events", + "semantic_equivalence_of_paraphrases_is_product_fixture_policy", + ), + reviewed_at=reviewed_at, + ) + authorization = await _authorize_append( + state, + context=reviewer, + authorization_key=f"recorded-correction-revision-stability:{pair_index}:{variant}", + subject_ref=str(review.review_id), + subject_digest=str(review.review_digest), + requested_at=reviewed_at, + ) + reference = await _append_value( + state, + value=review, + record_kind="brief_revision_stability_review", + record_key=str(review.review_id), + transaction_key=f"brief-revision-stability-review:{review.review_id}", + as_of=reviewed_at, + authorization=authorization, + ) + if affected_id not in prior_ids: + raise AssertionError("frozen affected claim is absent from the exact prior Brief") + return review, reference + + +async def _record_review_outcome( + state: dict[str, Any], + *, + export: ReviewedExport, + review: BriefRevisionStabilityReviewV1Alpha1, + review_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: str, +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + measures = ImpactOutcomeMeasuresV1Alpha1( + primary_value=review.revision_stability_score, + observed_result=review_ref, + cost_usd=0.0, + failure_count=0, + degraded=False, + limitations=review.limitations, + ) + recorded_at = state["clock"]() + observer = _context(environment.context, "principal:world-revision-stability-outcome-observer") + intent = OutcomeIntentV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=observer, + decision=export.decision_ref, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + value_json=canonical_json(measures.model_dump(mode="json")), + observed_at=review.reviewed_at, + recorded_at=recorded_at, + ) + authorization = await _authorize_append( + state, + context=observer, + authorization_key=f"recorded-correction-revision-stability-outcome:{pair_index}:{variant}", + subject_ref=str(intent.intent_id), + subject_digest=str(intent.intent_digest), + requested_at=recorded_at, + ) + outcome = OutcomeV1Alpha1(intent=intent, authorization=authorization) + return await _append_value( + state, + value=outcome, + record_kind="outcome", + record_key=str(outcome.outcome_id), + transaction_key=f"outcome:{outcome.outcome_id}", + as_of=review.reviewed_at, + authorization=authorization, + ) + + +def _install_policy(state: dict[str, Any]): + environment = state["environment"] + runtime = state["runtime"] + product_id = environment.fixture["product_id"] + criterion_head = _head(product_id, "impact_criterion", CRITERION_ID, 90) + operation_head = _head( + product_id, + "governed_operation_configuration", + "governed_operation_configuration:world-recorded-correction-revision-stability", + 91, + ) + binding = GovernedOperationBindingV1Alpha1( + product_id=product_id, + artifact=IMPACT_ARTIFACT, + configuration_ref=operation_head.state_id, + authority="append_measured_impact", + grant_ref="authority_grant:world-recorded-correction-revision-stability", + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(operation_head), + ) + capability_head = _head( + product_id, + "capability_state", + capability_state_ref_for_artifact(IMPACT_ARTIFACT), + 92, + ) + authority_head = _head(product_id, "authority_grant", binding.grant_ref, 93) + for head in (criterion_head, operation_head, capability_head, authority_head): + environment.store.set_governed_state_head(head) + runtime.heads[head.state_kind, head.state_id] = head + runtime.bindings = (*runtime.bindings, binding) + return criterion_head, binding + + +async def run_correction_revision_stability_outcome(workspace_root: Path) -> dict[str, Any]: + """Run P2C8 over exact prior, stable revision, and drift-control Briefs.""" + + state: dict[str, Any] = {} + prior_packet = await run_correction_detection_delay_outcome(workspace_root, state_sink=state) + environment = state["environment"] + material = _build_briefs(state) + prior_ref = await _append_brief(state, brief=material["prior"], role="prior") + treatment_ref = await _append_brief(state, brief=material["treatment"], role="treatment") + control_ref = await _append_brief(state, brief=material["control"], role="drift-control") + treatment_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=treatment_ref, + content=material["treatment"].body_markdown, + pair_index=index, + variant="correction-revision-treatment", + ) + for index in (1, 2) + ] + ) + control_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=control_ref, + content=material["control"].body_markdown, + pair_index=index, + variant="correction-revision-control", + ) + for index in (1, 2) + ] + ) + criterion_head, impact_binding = _install_policy(state) + criterion = ImpactCriterionV1Alpha1( + product_id=environment.fixture["product_id"], + criterion_id=CRITERION_ID, + criterion_version="candidate-1", + target_kind=ImpactTargetKind.INTELLIGENCE_ARTIFACT, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + metric_direction=ImpactMetricDirection.HIGHER_IS_BETTER, + useful_effect_threshold=0.75, + harmful_effect_threshold=0.75, + minimum_matched_pairs=2, + requires_observed_result=True, + harmful_action=ImpactGovernanceAction.ROLLBACK, + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(criterion_head), + frozen_at=CRITERION_FROZEN_AT, + ) + + evidence: list[ImpactEvidenceV1Alpha1] = [] + treatment_reviews: list[BriefRevisionStabilityReviewV1Alpha1] = [] + control_reviews: list[BriefRevisionStabilityReviewV1Alpha1] = [] + observed_times: list[datetime] = [] + for index, (treatment_export, control_export) in enumerate( + zip(treatment_exports, control_exports, strict=True), start=1 + ): + treatment_attribution = await _record_attribution( + state, + export=treatment_export, + subject=treatment_ref, + pair_index=index, + variant="correction-revision-treatment", + ) + control_attribution = await _record_attribution( + state, + export=control_export, + subject=control_ref, + pair_index=index, + variant="correction-revision-control", + ) + treatment_review, treatment_review_ref = await _review_revision( + state, + material=material, + prior_ref=prior_ref, + revised_ref=treatment_ref, + pair_index=index, + variant="treatment", + ) + control_review, control_review_ref = await _review_revision( + state, + material=material, + prior_ref=prior_ref, + revised_ref=control_ref, + pair_index=index, + variant="control", + ) + treatment_outcome = await _record_review_outcome( + state, + export=treatment_export, + review=treatment_review, + review_ref=treatment_review_ref, + pair_index=index, + variant="treatment", + ) + control_outcome = await _record_review_outcome( + state, + export=control_export, + review=control_review, + review_ref=control_review_ref, + pair_index=index, + variant="control", + ) + treatment_reviews.append(treatment_review) + control_reviews.append(control_review) + observed_times.extend((treatment_review.reviewed_at, control_review.reviewed_at)) + conditions = ImpactConditionsV1Alpha1( + product_id=environment.fixture["product_id"], + condition_key=f"world-recorded-correction-revision-stability-pair:{index}", + route_id="world:fcc-recorded-correction-revision-review", + context_json=canonical_json( + { + "fixture_digest": correction_fixture_digest(state["p2c7_fixture"]), + "pair_index": index, + "prior_brief": prior_ref.model_dump(mode="json"), + "review_policy_digest": treatment_review.policy_digest, + "task": "exact_correction_update_with_unaffected_claim_identity_preservation", + } + ), + observation_window_start=CRITERION_FROZEN_AT, + observation_window_end=max(observed_times), + frozen_at=CRITERION_FROZEN_AT, + ) + evidence.append( + ImpactEvidenceV1Alpha1( + product_id=environment.fixture["product_id"], + evidence_key=f"world-recorded-correction-revision-stability:{index}", + treatment_attribution=treatment_attribution, + control_attribution=control_attribution, + treatment_decision=treatment_export.decision_ref, + control_decision=control_export.decision_ref, + treatment_action_review=treatment_export.review_ref, + treatment_action_admission=treatment_export.admission_ref, + treatment_action_terminal=treatment_export.terminal_ref, + control_action_review=control_export.review_ref, + control_action_admission=control_export.admission_ref, + control_action_terminal=control_export.terminal_ref, + treatment_outcome=treatment_outcome, + control_outcome=control_outcome, + treatment_conditions=conditions, + control_conditions=conditions, + ) + ) + + request = ImpactEvaluationRequestV1Alpha1( + evaluation_key="world-recorded-correction-revision-stability:fcc-2021-10670", + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + criterion=criterion, + target=treatment_ref, + control=control_ref, + evidence=tuple(evidence), + cutoff_at=state["clock"](), + requested_at=state["clock"](), + ) + service = MeasuredImpactService( + store=environment.store, + authorizer=state["reasoning"], + operation_binding=impact_binding, + ) + admission = await service.evaluate(request) + historical = await MeasuredImpactService( + store=environment.store, + authorizer=_ReplayMustNotAuthorize(), + operation_binding=impact_binding, + ).evaluate(request) + if admission.replayed or not historical.replayed or historical.evaluation != admission.evaluation: + raise AssertionError("revision-stability evaluation did not replay exact historical material") + if admission.evaluation.classification is not ImpactClassification.USEFUL: + raise AssertionError("frozen revision-stability criterion did not classify useful") + if admission.proposal is None or admission.proposal.action is not ImpactGovernanceAction.PROMOTE: + raise AssertionError("revision-stability result did not emit its proposal-only mapping") + if {item.revision_stability_score for item in treatment_reviews} != {1.0}: + raise AssertionError("treatment did not preserve every unaffected claim identity") + if {item.revision_stability_score for item in control_reviews} != {0.0}: + raise AssertionError("drift control did not expose gratuitous unrelated revision") + if {item.affected_update_correct for item in (*treatment_reviews, *control_reviews)} != {True}: + raise AssertionError("one revision lost the exact correction update") + if {item.source_coverage_complete for item in (*treatment_reviews, *control_reviews)} != {True}: + raise AssertionError("one revision changed exact source coverage") + + state.update( + { + "p2c8_prior_brief": material["prior"], + "p2c8_prior_brief_ref": prior_ref, + "p2c8_treatment_brief": material["treatment"], + "p2c8_treatment_brief_ref": treatment_ref, + "p2c8_control_brief": material["control"], + "p2c8_control_brief_ref": control_ref, + } + ) + return { + "contract": "ace.world-intelligence.correction-revision-stability-outcome/v1alpha1", + "prior_correction_detection": prior_packet, + "source_pair": { + "fixture_id": state["p2c7_fixture"]["fixture_id"], + "fixture_digest": correction_fixture_digest(state["p2c7_fixture"]), + "original_observation_id": str(state["p2c7_original_observation"].resource_id), + "correction_observation_id": str(state["p2c7_correction_observation"].resource_id), + }, + "review_policy": { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "policy_digest": treatment_reviews[0].policy_digest, + "reviewer_ref": treatment_reviews[0].reviewer_context.actor_ref, + "score_rule": ( + "unaffected preservation rate gated by exact correction update, correction visibility, " + "source coverage, and claim-count preservation" + ), + }, + "briefs": { + "prior": material["prior"].model_dump(mode="json"), + "treatment": material["treatment"].model_dump(mode="json"), + "control": material["control"].model_dump(mode="json"), + }, + "expected_revision": { + "affected_claim_id": str(material["affected_claim"].claim_id), + "replacement_claim_id": str(material["replacement_claim"].claim_id), + "stable_claim_ids": tuple(sorted(str(item.claim_id) for item in material["stable_claims"])), + }, + "observed_results": { + "treatment": tuple(item.model_dump(mode="json") for item in treatment_reviews), + "control": tuple(item.model_dump(mode="json") for item in control_reviews), + }, + "evaluation": admission.evaluation.model_dump(mode="json"), + "proposal": admission.proposal.model_dump(mode="json"), + "replay": { + "historical": historical.replayed, + "no_reauthorization": True, + "transaction_receipt_id": str(historical.transaction_receipt.receipt_id), + }, + "scope": { + "actual_brief_contracts": True, + "exact_correction_update_reviewed": True, + "unaffected_claim_identity_preservation_reviewed": True, + "equal_source_coverage_control": True, + "equal_claim_count_control": True, + "network_access": False, + "live_revision_claimed": False, + "semantic_equivalence_engine_claimed": False, + "population_revision_stability_claimed": False, + "general_brief_quality_claimed": False, + "human_benefit_claimed": False, + "causality_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + }, + } + + +def main() -> None: + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + args = parser.parse_args() + print( + json.dumps( + asyncio.run(run_correction_revision_stability_outcome(args.workspace_root)), + indent=2, + sort_keys=True, + ) + ) + + +if __name__ == "__main__": + main() From 5186eec9715be0440a9916b861c7c9cbacc8a394 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Mon, 10 Aug 2026 20:22:58 -0700 Subject: [PATCH 07/17] Measure World forecast calibration --- README.md | 24 +- ROADMAP.md | 12 +- ...forecast-calibration-outcome-2026-08-10.md | 155 ++++ ...cast-calibration-outcome-work-packet-v1.md | 124 +++ .../test_p2c9_forecast_calibration_outcome.py | 200 +++++ ...p2c7_correction_detection_delay_outcome.py | 8 + ...8_correction_revision_stability_outcome.py | 15 +- scripts/p2c9_forecast_calibration_outcome.py | 790 ++++++++++++++++++ 8 files changed, 1320 insertions(+), 8 deletions(-) create mode 100644 docs/audits/world-intelligence-p2c9-forecast-calibration-outcome-2026-08-10.md create mode 100644 docs/design/world-intelligence-p2c9-forecast-calibration-outcome-work-packet-v1.md create mode 100644 domain_packs/tests/test_p2c9_forecast_calibration_outcome.py create mode 100644 scripts/p2c9_forecast_calibration_outcome.py diff --git a/README.md b/README.md index 6aa5a37..76abfcf 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,19 @@ of `1.0` and `0.0` across two matched pairs and another non-effective proposal. This freezes a World product rule over one recorded pair. It is not live revision, a general semantic-equivalence engine, population stability, calibration, causality, or human benefit. +P2C9 freezes one exact probabilistic scoring boundary over that recorded correction. After the +original Observation is admitted but before the correction is available, treatment and control +record probabilities of `0.75` and `0.25` for the same explicit-correction event and complete the +same reviewed workflow. Only then is the exact correction Observation admitted. Independent +reviews derive the binary result and single-event Brier quality contributions of `0.9375` and +`0.4375`; the two-pair difference is useful and still emits only a non-effective proposal. + +The forecast artifacts contain no correction identity or result material, and every reviewed +forecast Action completes before the result becomes available. The probabilities are declared +fixture inputs, not ACE outputs. This is exact forecast/result scoring, not a historically +contemporaneous forecast, model-skill finding, empirical calibration curve, population reliability +estimate, causal claim, or human-benefit finding. + ## What the public World proof demonstrates Generate a self-contained visual Reality Brief and its exact machine-readable backing data: @@ -368,11 +381,12 @@ $PY -m scripts.p2c3_measured_feedback "$WORKSPACE" # Stacked candidate: explicit reject/no-action review of the exact proposal $PY -m scripts.p2c4_reviewed_impact_disposition "$WORKSPACE" -# Stacked candidates: correctness, attention, correction delay, and revision stability +# Stacked candidates: correctness, attention, correction delay, revision stability, and forecast scoring $PY -m scripts.p2c5_citation_correctness_outcome "$WORKSPACE" $PY -m scripts.p2c6_contradiction_attention_outcome "$WORKSPACE" $PY -m scripts.p2c7_correction_detection_delay_outcome "$WORKSPACE" $PY -m scripts.p2c8_correction_revision_stability_outcome "$WORKSPACE" +$PY -m scripts.p2c9_forecast_calibration_outcome "$WORKSPACE" ``` The released 0.9.0 gates are reproducible through the locked environment, as CI does. The @@ -414,6 +428,8 @@ The two-lineage LIVE Shift → Signal → Case → cited Brief proof is recorded [`docs/audits/world-intelligence-ai-command-center-live-2026-08-10.md`](docs/audits/world-intelligence-ai-command-center-live-2026-08-10.md). 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 withheld-result forecast-scoring candidate is recorded in +[`docs/audits/world-intelligence-p2c9-forecast-calibration-outcome-2026-08-10.md`](docs/audits/world-intelligence-p2c9-forecast-calibration-outcome-2026-08-10.md). 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), @@ -452,8 +468,10 @@ control, and valid silence under one frozen recorded-source challenge. P2C7 adds one explicit recorded correction pair, preserves the prior record, and measures frozen-replay detection delay against a product target. P2C8 measures exact unaffected-claim identity preservation across real Brief contracts while holding correction semantics, source coverage, and -claim count constant. The next bounded measurement work is calibration, another independently -sourced correction event, or independent Market reproduction. +claim count constant. P2C9 adds an exact withheld-result forecast record and derives a single-event +Brier contribution while explicitly withholding any population-calibration or model-skill claim. +The next bounded measurement work is another independently sourced correction event or independent +Market reproduction. Separately reviewed opt-in network transport and P2D multi-source conflict/correction with LIVE inputs remain independent work. None of these steps may add autonomous publishing, delivery, persuasion, or action authority to a Domain Pack. diff --git a/ROADMAP.md b/ROADMAP.md index 70ca3f4..673fb8c 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–P2C8 measured feedback and product-owned outcomes +## Candidate — P2C3–P2C9 measured feedback and product-owned outcomes - 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. @@ -46,6 +46,11 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). workflow, but treatment preserves both unaffected claim identities while the paraphrase-drift control preserves neither. Exact reviews expose the affected, replacement, stable, preserved, drifted, and unexpected claim sets without claiming general semantic equivalence. +- A sixth frozen criterion records treatment and control probabilities before the correction result + is available and completes every reviewed forecast Action first. The later exact correction + resolves the binary event; exact reviews derive single-event Brier quality of `0.9375` and + `0.4375`. This proves forecast/result scoring and leakage-resistant record order, not historical + contemporaneity, probability generation by ACE, model skill, or population calibration. - 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. @@ -63,7 +68,10 @@ freezes exact correction linkage, prior-record preservation, and recorded-replay without claiming live monitoring or network-arrival latency. The stacked [P2C8 work packet](docs/design/world-intelligence-p2c8-correction-revision-stability-outcome-work-packet-v1.md) freezes correction-induced Brief revision stability without claiming live revision, population -performance, or a general semantic-equivalence engine. +performance, or a general semantic-equivalence engine. The stacked +[P2C9 work packet](docs/design/world-intelligence-p2c9-forecast-calibration-outcome-work-packet-v1.md) +freezes an exact forecast/result scoring boundary without claiming a historical forecast, model +skill, or population calibration. ## Next — trustworthy live orientation diff --git a/docs/audits/world-intelligence-p2c9-forecast-calibration-outcome-2026-08-10.md b/docs/audits/world-intelligence-p2c9-forecast-calibration-outcome-2026-08-10.md new file mode 100644 index 0000000..f617754 --- /dev/null +++ b/docs/audits/world-intelligence-p2c9-forecast-calibration-outcome-2026-08-10.md @@ -0,0 +1,155 @@ +# World Intelligence P2C9 forecast-calibration outcome audit — 2026-08-10 + +Status: **stacked candidate evidence only; not a release, SI4 pass, population-calibration proof, +model-skill finding, or applied governance change** + +## Source identity + +- World base: P2C8 commit `129767d27d4af22dba292deb9e691375a0695bb8` +- World branch: `codex/world-forecast-calibration` +- Core dependency: exact observed-result candidate commit + `433e3d16c5458c975557dcd1552824fb959d4d12` +- Released identity intentionally unchanged: `ace-domain-world-intelligence==0.9.0`, + `ace-core>=0.5.0,<0.6` + +## Exact point-in-time result + +The source fixture remains +`sha256:2b81d3950cbfd127408eec227ec5cd249677a189120d6ca7b603d85d01074543`, +with original Observation `observation:f1768d6f4191a86e245846a9a1e33768` and correction +Observation `observation:fced5d3bbc3802c0285021142b332e29`. + +One source-checkout run recorded this exact availability order: + +```text +original Observation available: 2026-08-11T03:15:24.023307Z +forecast issued: 2026-08-11T03:15:24.024601Z +latest reviewed Action done: 2026-08-11T03:15:24.057528Z +correction result available: 2026-08-11T03:15:24.061041Z +``` + +The two forecast records were: + +```text +treatment: + public_event_forecast:cadabc0db05387ffda21e167a7ae8a0c + sha256:cadabc0db05387ffda21e167a7ae8a0cfba830841d39b9141f4faa1cfca4f56c + probability: 0.75 +control: + public_event_forecast:2ebf7bd7c21363bcc6074bd654f020de + sha256:2ebf7bd7c21363bcc6074bd654f020de32a021280450cde5f889e92f24243488 + probability: 0.25 +``` + +Both records bind only the original Observation, the same target event, policy, source family, +resolution rule, and window. Neither contains correction document `2021-10670`, the correction +Observation coordinate, the eventual outcome, or an outcome score. The correction's exact immutable +reference becomes available after all four forecast Actions complete. + +The reviews used World policy `world_recorded_binary_forecast_brier_quality` version `candidate-1`, +material `sha256:759c13b02bff4b6d749ff20888a9fa7d4f3a67e6ef94439801d28d9d99abf4e7`: + +```text +treatment review 1: forecast_resolution_review:dceee9319c93d8f4aaa1712f6ad4a736 +treatment review 2: forecast_resolution_review:388863533f4bceb49c49326c029048f9 +control review 1: forecast_resolution_review:585c2385de9b45b3aeee5705a577cfb0 +control review 2: forecast_resolution_review:6afe8778c77d840aca6b51d5a7198c3e + +binary event outcome: 1.0 +treatment Brier loss: 0.0625, 0.0625 +treatment quality: 0.9375, 0.9375 +control Brier loss: 0.5625, 0.5625 +control quality: 0.4375, 0.4375 +matched pairs: 2 +mean effect: 0.5 +classification: useful +proposal action: promote +proposal live effect: false +historical replay: true +replay reauthorization: false +``` + +The exact point-run evaluation was `impact_evaluation:d94ec6d786c8a4bbfb8038959ca7a7d4` +with material +`sha256:d94ec6d786c8a4bbfb8038959ca7a7d45567d4ddcdb3b6c431b8cdc2dac84c47`. +The exact non-effective proposal was +`impact_governance_proposal:260db0b19aff6fe01cb8f0fbc81f3327` with material +`sha256:260db0b19aff6fe01cb8f0fbc81f33278392794d8652a41442751bfebe79141f`. + +These point-run identities deliberately include exact record-availability and reviewed-action time. +Historical replay in the same durable store returns those exact identities without reauthorization. +Fresh hosts reproduce the source content identities, target definition, probabilities, event +outcome, Brier material, classification, and proposal semantics; they do not pretend independent +wall clocks are the same immutable availability coordinate. + +## Verification + +The frozen World dependency versions plus the stacked Core candidate and separately packaged +reference action adapter produced: + +```text +python -B -m pytest domain_packs/tests/test_p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py \ + domain_packs/tests/test_p2c5_citation_correctness_outcome.py \ + domain_packs/tests/test_p2c6_contradiction_attention_outcome.py \ + domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py \ + domain_packs/tests/test_p2c8_correction_revision_stability_outcome.py \ + domain_packs/tests/test_p2c9_forecast_calibration_outcome.py -q --tb=short +25 passed in 8.59s + +python -B -m pytest -q --tb=short +108 passed in 22.22s + +python -B -m pytest adapters/federal_register_source/tests -q --tb=short +26 passed in 0.22s + +python -B -m pytest tests/test_release_contract.py -q --tb=short +7 passed in 0.04s + +# Installed public ace-core==0.5.0; candidate tests skip explicitly. +python -B -m pytest -q --tb=short -rs +83 passed, 25 skipped in 13.72s + +ruff check --no-cache +PASS + +ruff format --check --no-cache +4 files already formatted + +uv build --out-dir /tmp/ace-p2c9-dist-20260810 +Successfully built unchanged 0.9.0 source distribution and inert data-only wheel + +git diff --check +PASS +``` + +The twenty-five public-Core skips are explicit candidate boundaries: P2C3 through P2C9 require +unreleased stacked Core measured-impact contracts. The public P2C2 journey and every released +boundary remain green. The wheel contains 45 inert Domain Pack JSON/metadata files, no Python or +entry points, and retains `ace-core>=0.5.0,<0.6`. + +Repository-wide Ruff remains an inherited release-hygiene blocker. With the same locked Ruff +version, both the P2C8 parent and this P2C9 worktree report exactly 14 lint findings and 12 format +targets. Scoped P2C9 checks and `git diff --check` are green. This packet does not rewrite unrelated +history, but release closeout must reconcile the repository-wide gate before publication. + +## Claim boundary + +The World forecast contract forbids extra result material and requires every basis reference to be +available at issuance. The review exact-loads the forecast, original Observation, and later +correction Observation, derives the binary event from their explicit correction link, and derives +the Brier contribution from probability and event outcome. The Core Outcome points to that exact +review. Historical replay requires no new authority, and the proposal remains non-effective, +non-selectable, and unapplied. + +This is a single-event probabilistic score over a held-out recorded result. It is not an empirical +calibration curve, population reliability estimate, historically contemporaneous forecast, ACE +probability-generation proof, model-skill finding, live-monitoring result, source-independence +finding, causal estimate, general Brief-quality score, legal-truth claim, or human-benefit result. + +## Remaining work + +A materially different real source, independent Market reproduction, combined-main review/CI, +public Core artifacts, repository-wide lint/format reconciliation, security/release checks, and +opt-in live transport remain future bounded work. Core issue #49 F1, F3, and F5 still require +explicit 0.6 release-owner disposition; this World packet neither implements nor re-dates them. diff --git a/docs/design/world-intelligence-p2c9-forecast-calibration-outcome-work-packet-v1.md b/docs/design/world-intelligence-p2c9-forecast-calibration-outcome-work-packet-v1.md new file mode 100644 index 0000000..e476464 --- /dev/null +++ b/docs/design/world-intelligence-p2c9-forecast-calibration-outcome-work-packet-v1.md @@ -0,0 +1,124 @@ +# World Intelligence P2C9 forecast-calibration outcome work packet (v1) + +**Status:** stacked source-checkout candidate; this packet does not release World Intelligence, +apply a governance proposal, close ACE Core issue #38, pass SI4, or complete ACE 0.6.0. + +**Frozen:** 2026-08-10 from World P2C8 commit +`129767d27d4af22dba292deb9e691375a0695bb8`, stacked on the Core exact observed-result +provenance candidate `433e3d16c5458c975557dcd1552824fb959d4d12`. + +## Objective + +Prove that a World-owned probabilistic forecast can be issued from exact admitted evidence before +an exact result is available, resolved under an inspectable scoring rule, and compared through the +unchanged domain-neutral measured-impact contract: + +```text +original Observation -> treatment probability / probability control + -> Decision -> reviewed Action + -> later correction Observation -> exact resolution review + -> observed Outcome -> useful / harmful / unproven evaluation -> proposal only +``` + +The real source pair remains FCC Federal Register document `2020-28779` and its explicit correction +`2021-10670`. P2C9 intercepts the recorded replay after the original Observation is admitted but +before the correction Observation is appended. It records two exact World forecast artifacts and +completes their reviewed Actions first. Only then does the existing P2C7/P2C8 journey admit and use +the correction result. + +## Frozen forecast and scoring policy + +Both forecasts use the same exact original Observation, target event definition, resolution rule, +window, reviewed workflow, later correction result, and matched conditions. The only deliberate +difference is probability: treatment declares `0.75`; control declares `0.25`. The binary event is +`1.0` only when the later exact admitted source explicitly names the basis document as corrected. + +World owns `world_recorded_binary_forecast_brier_quality` version `candidate-1`. For each exact +forecast/result pair it derives: + +```text +brier_loss = (forecast_probability - binary_event_outcome) ** 2 +brier_quality = 1 - brier_loss +``` + +The observed event is true, so treatment quality is `0.9375`, control quality is `0.4375`, and the +paired effect is `0.5` across two replicated reviewed workflows. The product criterion requires two +matched pairs and a useful threshold of `0.5`. + +This is one single-event Brier contribution. It exercises exact probability/result provenance and +score sensitivity; it is not an empirical calibration curve, population reliability estimate, or +evidence that ACE generated a skillful forecast. The two probabilities are declared fixture inputs, +not model outputs. + +## Exact acceptance + +P2C9 must: + +1. rerun P2C2 through P2C8 and preserve every prior immutable result and proposal; +2. append treatment and control forecast records from the exact original Observation without any + correction identity or correction material in either forecast; +3. complete two reviewed treatment Actions and two reviewed control Actions before the correction + result becomes available; +4. admit the existing exact correction Observation only after those forecast Actions; +5. exact-load the forecast, basis Observation, and correction Observation and derive the binary + outcome from the correction's explicit link to the original document; +6. append four independently authenticated resolution reviews and four Core Outcomes naming those + exact reviews as their observed results; +7. derive, never accept, the Brier loss and quality score from each exact probability/outcome pair; +8. classify the two-pair difference `useful` and emit only a non-effective, non-selectable + `promote` proposal requiring separate human review; +9. replay without reauthorization and reproduce the target definition, probabilities, event + outcome, scores, classification, and proposal semantics across fresh hosts; and +10. reject future/unavailable basis material, result coordinates injected into forecast material, + missing withholding, out-of-range probabilities, changed event linkage, and invented scores. + +## Negative and leakage controls + +The forecast contract has no observed-result field. Its only exact evidence coordinates are the +basis Observations, all of which must be available by forecast issuance. Extra result material is +forbidden. The resolution review requires the result reference to become available after the exact +forecast reference and within the declared window. The harness additionally proves every reviewed +forecast Action completed before the correction record became available. + +The control is not a source-only or no-action baseline. It is an exact probability control under +the same event and workflow. This isolates sensitivity to declared probability while holding result +identity, source linkage, action topology, review policy, and conditions constant. Stacked Core +tests remain authoritative for missing attribution, condition mismatch, cutoff leakage, unavailable +Outcomes, duplicate/replayed evidence, interruption, restart, and denied authority. + +## Ownership boundary + +World owns the public-event target, forecast vocabulary, probability fixtures, binary resolution +rule, Brier-quality mapping, source-policy limits, tests, and evidence. Core owns immutable records, +provenance, Decisions, reviewed Actions, Outcomes, authority, replay, and append-only history. +Intelligence owns domain-neutral conditions, matched evaluation, uncertainty, classification, and +proposal contracts. No FCC, Federal Register, forecast-policy, or Brier noun moves into Core or +Intelligence. + +## Files and rollback + +This packet owns: + +- `scripts/p2c9_forecast_calibration_outcome.py`; +- `domain_packs/tests/test_p2c9_forecast_calibration_outcome.py`; +- the additive P2C7/P2C8 pre-correction state handoff; +- this work packet, its audit, and restrained README/roadmap references. + +It changes no shipped Domain Pack, connector, fixture source policy, package version, dependency +range, lockfile, release record, Core contract, or public artifact. Rollback removes the P2C9 +harness, tests, handoff, and candidate documentation. Forecast, review, Outcome, evaluation, and +proposal records already persisted by a host remain immutable history. + +## Non-claims and next packet + +This packet does not establish a historically contemporaneous forecast, probability generation by +ACE, model skill, population calibration, live monitoring, network freshness, source independence, +causal benefit, legal truth, general Brief quality, or human usefulness. It does not apply the +proposal or grant authority to a Domain Pack. + +The next bounded packet should repeat a correction/outcome measure over a materially different +source or reproduce the unchanged measured-impact contracts independently in Market Intelligence. +Public Core artifacts, combined-main review/CI, compatibility, security and release gates, opt-in +live transport, repository-wide hygiene, and any separately authorized proposal application remain +separate work. Core issue #49 F1, F3, and F5 still require explicit 0.6 release-owner disposition; +this packet does not implement or re-date them. diff --git a/domain_packs/tests/test_p2c9_forecast_calibration_outcome.py b/domain_packs/tests/test_p2c9_forecast_calibration_outcome.py new file mode 100644 index 0000000..20339f2 --- /dev/null +++ b/domain_packs/tests/test_p2c9_forecast_calibration_outcome.py @@ -0,0 +1,200 @@ +from __future__ import annotations + +import copy +import importlib.util +import json + +import pytest +from pydantic import ValidationError + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact") is None: + pytest.skip("P2C9 requires the stacked ACE Core measured-impact candidate") + from ace.intelligence import ImpactOutcomeMeasuresV1Alpha1 + + if "observed_result" not in ImpactOutcomeMeasuresV1Alpha1.model_fields: + pytest.skip("P2C9 requires exact observed-result provenance from the stacked Core candidate") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("P2C9 requires the separately packaged Core reference adapter") + + +@pytest.mark.asyncio +async def test_exact_withheld_forecast_result_becomes_a_measured_outcome(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c9_forecast_calibration_outcome import run_forecast_calibration_outcome + + result = await run_forecast_calibration_outcome(tmp_path) + + assert result["review_policy"]["reviewer_ref"] == "principal:world-forecast-calibration-reviewer" + assert result["evaluation"]["criterion"]["requires_observed_result"] is True + assert result["evaluation"]["classification"] == "useful" + assert result["evaluation"]["matched_pair_count"] == 2 + assert result["evaluation"]["mean_effect"] == 0.5 + assert result["proposal"]["action"] == "promote" + assert result["proposal"]["live_effect"] is False + assert result["proposal"]["selectable"] is False + assert result["proposal"]["requires_human_review"] is True + assert result["replay"] == { + "historical": True, + "no_reauthorization": True, + "transaction_receipt_id": result["replay"]["transaction_receipt_id"], + } + + +@pytest.mark.asyncio +async def test_forecast_material_excludes_the_later_exact_result_and_conditions_match(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c9_forecast_calibration_outcome import run_forecast_calibration_outcome + + result = await run_forecast_calibration_outcome(tmp_path) + treatment = result["forecasts"]["treatment"] + control = result["forecasts"]["control"] + reviews = (*result["observed_results"]["treatment"], *result["observed_results"]["control"]) + + assert treatment["basis_observations"] == control["basis_observations"] + assert treatment["target_event_key"] == control["target_event_key"] + assert treatment["target_event_definition_json"] == control["target_event_definition_json"] + assert treatment["policy_digest"] == control["policy_digest"] + assert treatment["probability"] == 0.75 + assert control["probability"] == 0.25 + assert "2021-10670" not in json.dumps(treatment, sort_keys=True) + assert "2021-10670" not in json.dumps(control, sort_keys=True) + assert all(item["result_withheld_until_after_forecast"] for item in reviews) + assert all(item["reviewed_forecast"]["available_at"] < item["observed_result"]["available_at"] for item in reviews) + assert result["source_event"]["result_available_after_forecasts"] is True + assert result["source_event"]["result_available_after_reviewed_actions"] is True + assert ( + result["source_event"]["latest_forecast_action_completed_at"] + < result["source_event"]["observed_result"]["available_at"] + ) + + +@pytest.mark.asyncio +async def test_single_event_brier_contribution_is_derived_not_asserted(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c9_forecast_calibration_outcome import run_forecast_calibration_outcome + + result = await run_forecast_calibration_outcome(tmp_path) + treatment = result["observed_results"]["treatment"] + control = result["observed_results"]["control"] + + assert {item["event_outcome"] for item in (*treatment, *control)} == {1.0} + assert {item["explicit_correction_linkage_verified"] for item in (*treatment, *control)} == {True} + assert {item["brier_loss"] for item in treatment} == {0.0625} + assert {item["brier_quality_score"] for item in treatment} == {0.9375} + assert {item["brier_loss"] for item in control} == {0.5625} + assert {item["brier_quality_score"] for item in control} == {0.4375} + assert result["scope"]["population_calibration_claimed"] is False + assert result["scope"]["probability_generated_by_ace_claimed"] is False + assert result["scope"]["historically_contemporaneous_forecast_claimed"] is False + + +@pytest.mark.asyncio +async def test_leaked_basis_missing_withholding_and_invented_brier_material_fail_closed(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c9_forecast_calibration_outcome import ( + ForecastResolutionReviewV1Alpha1, + PublicEventForecastV1Alpha1, + run_forecast_calibration_outcome, + ) + + result = await run_forecast_calibration_outcome(tmp_path) + forecast = copy.deepcopy(result["forecasts"]["treatment"]) + forecast["probability"] = 1.1 + forecast["forecast_id"] = None + forecast["forecast_digest"] = None + with pytest.raises(ValidationError): + PublicEventForecastV1Alpha1.model_validate_json(json.dumps(forecast)) + + forecast = copy.deepcopy(result["forecasts"]["treatment"]) + forecast["basis_observations"][0]["available_at"] = forecast["resolution_window_end"] + forecast["forecast_id"] = None + forecast["forecast_digest"] = None + with pytest.raises(ValidationError, match="basis includes evidence unavailable"): + PublicEventForecastV1Alpha1.model_validate_json(json.dumps(forecast)) + + forecast = copy.deepcopy(result["forecasts"]["treatment"]) + forecast["observed_result"] = result["source_event"]["observed_result"] + forecast["forecast_id"] = None + forecast["forecast_digest"] = None + with pytest.raises(ValidationError): + PublicEventForecastV1Alpha1.model_validate_json(json.dumps(forecast)) + + review = copy.deepcopy(result["observed_results"]["treatment"][0]) + review["brier_quality_score"] = 1.0 + review["review_id"] = None + review["review_digest"] = None + with pytest.raises(ValidationError, match="Brier material differs"): + ForecastResolutionReviewV1Alpha1.model_validate_json(json.dumps(review)) + + review = copy.deepcopy(result["observed_results"]["treatment"][0]) + review["result_withheld_until_after_forecast"] = False + review["review_id"] = None + review["review_digest"] = None + with pytest.raises(ValidationError, match="result was not withheld"): + ForecastResolutionReviewV1Alpha1.model_validate_json(json.dumps(review)) + + +@pytest.mark.asyncio +async def test_forecast_material_scores_and_classification_are_deterministic_across_fresh_hosts( + tmp_path, +) -> None: + _require_candidate_contracts() + from scripts.p2c9_forecast_calibration_outcome import run_forecast_calibration_outcome + + first_root = tmp_path / "first" + second_root = tmp_path / "second" + first_root.mkdir() + second_root.mkdir() + first = await run_forecast_calibration_outcome(first_root) + second = await run_forecast_calibration_outcome(second_root) + + assert first["source_event"]["fixture_id"] == second["source_event"]["fixture_id"] + assert first["source_event"]["fixture_digest"] == second["source_event"]["fixture_digest"] + for coordinate in ("original_observation", "observed_result"): + for field in ("record_key", "payload_contract"): + assert first["source_event"][coordinate][field] == second["source_event"][coordinate][field] + for variant in ("treatment", "control"): + for field in ( + "target_event_key", + "target_event_definition_json", + "probability", + "policy_id", + "policy_version", + "limitations", + ): + assert first["forecasts"][variant][field] == second["forecasts"][variant][field] + first_scores = [ + ( + item["forecast_probability"], + item["event_outcome"], + item["brier_loss"], + item["brier_quality_score"], + item["explicit_correction_linkage_verified"], + item["result_withheld_until_after_forecast"], + ) + for item in first["observed_results"][variant] + ] + second_scores = [ + ( + item["forecast_probability"], + item["event_outcome"], + item["brier_loss"], + item["brier_quality_score"], + item["explicit_correction_linkage_verified"], + item["result_withheld_until_after_forecast"], + ) + for item in second["observed_results"][variant] + ] + assert first_scores == second_scores + for field in ( + "classification", + "matched_pair_count", + "mean_effect", + "treatment_mean", + "control_mean", + ): + assert first["evaluation"][field] == second["evaluation"][field] + for field in ("action", "live_effect", "selectable", "requires_human_review"): + assert first["proposal"][field] == second["proposal"][field] diff --git a/scripts/p2c7_correction_detection_delay_outcome.py b/scripts/p2c7_correction_detection_delay_outcome.py index 3c99b27..8c5bf0d 100644 --- a/scripts/p2c7_correction_detection_delay_outcome.py +++ b/scripts/p2c7_correction_detection_delay_outcome.py @@ -4,6 +4,7 @@ import asyncio import json +from collections.abc import Awaitable, Callable from datetime import datetime from pathlib import Path from typing import Any, Literal, Self @@ -548,6 +549,11 @@ async def run_correction_detection_delay_outcome( workspace_root: Path, *, state_sink: dict[str, Any] | None = None, + before_correction: Callable[ + [dict[str, Any], dict[str, Any], ObservationV1Alpha1, ImmutableRecordReferenceV1], + Awaitable[None], + ] + | None = None, ) -> dict[str, Any]: """Run P2C7 over an exact recorded official correction pair.""" @@ -556,6 +562,8 @@ async def run_correction_detection_delay_outcome( environment = state["environment"] fixture = load_correction_fixture() original, original_ref = await _append_source_observation(state, fixture=fixture, role="original") + if before_correction is not None: + await before_correction(state, fixture, original, original_ref) correction, correction_ref = await _append_source_observation(state, fixture=fixture, role="correction") replay = fixture["recorded_replay"] treatment_artifact, treatment_ref, treatment_content = await _append_correction_artifact( diff --git a/scripts/p2c8_correction_revision_stability_outcome.py b/scripts/p2c8_correction_revision_stability_outcome.py index 90a2e32..5aec053 100644 --- a/scripts/p2c8_correction_revision_stability_outcome.py +++ b/scripts/p2c8_correction_revision_stability_outcome.py @@ -573,11 +573,20 @@ def _install_policy(state: dict[str, Any]): return criterion_head, binding -async def run_correction_revision_stability_outcome(workspace_root: Path) -> dict[str, Any]: +async def run_correction_revision_stability_outcome( + workspace_root: Path, + *, + state_sink: dict[str, Any] | None = None, + before_correction=None, +) -> dict[str, Any]: """Run P2C8 over exact prior, stable revision, and drift-control Briefs.""" - state: dict[str, Any] = {} - prior_packet = await run_correction_detection_delay_outcome(workspace_root, state_sink=state) + state: dict[str, Any] = {} if state_sink is None else state_sink + prior_packet = await run_correction_detection_delay_outcome( + workspace_root, + state_sink=state, + before_correction=before_correction, + ) environment = state["environment"] material = _build_briefs(state) prior_ref = await _append_brief(state, brief=material["prior"], role="prior") diff --git a/scripts/p2c9_forecast_calibration_outcome.py b/scripts/p2c9_forecast_calibration_outcome.py new file mode 100644 index 0000000..047afab --- /dev/null +++ b/scripts/p2c9_forecast_calibration_outcome.py @@ -0,0 +1,790 @@ +"""Measure one withheld-result probabilistic forecast under a World-owned rule.""" + +from __future__ import annotations + +import asyncio +import json +from datetime import datetime +from pathlib import Path +from typing import Any, Literal, Self + +from ace.application import MeasuredImpactService +from ace.core import ( + AuthenticatedRuntimeContextV1Alpha1, + CapabilityArtifactIdentityV1Alpha1, + GovernedOperationBindingV1Alpha1, + GovernedStateHeadPreconditionV1Alpha1, + ImmutableRecordReferenceV1, + OutcomeIntentV1Alpha1, + OutcomeV1Alpha1, + canonical_json, + capability_state_ref_for_artifact, +) +from ace.intelligence import ( + ImpactClassification, + ImpactConditionsV1Alpha1, + ImpactCriterionV1Alpha1, + ImpactEvaluationRequestV1Alpha1, + ImpactEvidenceV1Alpha1, + ImpactGovernanceAction, + ImpactMetricDirection, + ImpactOutcomeMeasuresV1Alpha1, + ImpactTargetKind, + ObservationV1Alpha1, +) +from pydantic import Field, field_validator, model_validator + +from scripts.p2c2_federal_register_monitor import _time +from scripts.p2c2_governed_reality_brief import _context, _head +from scripts.p2c3_measured_feedback import ( + ReviewedExport, + _append_value, + _authorize_append, + _digest, + _record_attribution, + _run_reviewed_export, +) +from scripts.p2c5_citation_correctness_outcome import _derive_identity, _FrozenModel +from scripts.p2c7_correction_detection_delay_outcome import ( + _load_observation, + correction_fixture_digest, +) +from scripts.p2c8_correction_revision_stability_outcome import ( + run_correction_revision_stability_outcome, +) + +OUTCOME_TYPE = "independent_artifact_review" +MEASURE_ID = "recorded_binary_forecast_brier_quality" +CRITERION_ID = "impact_criterion:world-recorded-binary-forecast-brier-quality" +REVIEW_POLICY_ID = "world_recorded_binary_forecast_brier_quality" +REVIEW_POLICY_VERSION = "candidate-1" + +RESOLUTION_WINDOW_END = _time("2026-08-11T19:00:00Z") + +TARGET_EVENT_KEY = "recorded-replay:explicit-correction:2020-28779" +TARGET_EVENT_DEFINITION = canonical_json( + { + "basis_document_number": "2020-28779", + "event_type": "later_admitted_source_explicitly_corrects_basis_document", + "resolution_rule": ("true only when a later exact admitted source names the basis document as corrected"), + "source_family": "federal_register", + "withheld_result_policy": "forecast material contains no outcome identity or outcome material", + } +) + +IMPACT_ARTIFACT = CapabilityArtifactIdentityV1Alpha1( + capability="measured_impact_evaluation", + contract="ace.application.measured-impact-service/v1alpha1", + implementation_id="world_recorded_binary_forecast_brier_candidate", + implementation_version="0.1.0", + artifact_digest="sha256:" + "c" * 64, +) + + +class PublicEventForecastV1Alpha1(_FrozenModel): + """One World-owned probability issued before an exact result is available.""" + + contract: Literal["ace.world-intelligence.public-event-forecast/v1alpha1"] = ( + "ace.world-intelligence.public-event-forecast/v1alpha1" + ) + product_id: str + forecast_key: str + basis_observations: tuple[ImmutableRecordReferenceV1, ...] = Field(min_length=1, max_length=16) + target_event_key: str + target_event_definition_json: str + probability: float = Field(ge=0.0, le=1.0) + policy_id: str + policy_version: str + policy_digest: str + issued_at: datetime + resolution_window_start: datetime + resolution_window_end: datetime + limitations: tuple[str, ...] + forecast_id: str | None = None + forecast_digest: str | None = None + + @field_validator("basis_observations") + @classmethod + def canonicalize_basis( + cls, value: tuple[ImmutableRecordReferenceV1, ...] + ) -> tuple[ImmutableRecordReferenceV1, ...]: + ordered = tuple(sorted(value, key=lambda item: item.storage_id)) + if len({item.storage_id for item in ordered}) != len(ordered): + raise ValueError("forecast basis cannot amplify duplicate exact records") + return ordered + + @field_validator("target_event_definition_json") + @classmethod + def validate_target_definition(cls, value: str) -> str: + try: + material = json.loads(value) + except (json.JSONDecodeError, TypeError, ValueError) as exc: + raise ValueError("forecast target definition must be canonical JSON") from exc + if canonical_json(material) != value or material != json.loads(TARGET_EVENT_DEFINITION): + raise ValueError("forecast target definition differs from the frozen World event rule") + return value + + @field_validator("limitations") + @classmethod + def canonicalize_limitations(cls, value: tuple[str, ...]) -> tuple[str, ...]: + ordered = tuple(sorted(value)) + if not ordered or len(ordered) != len(set(ordered)): + raise ValueError("forecast limitations must be non-empty and unique") + return ordered + + @model_validator(mode="after") + def validate_scope_time_and_identity(self) -> Self: + if any(item.product_id != self.product_id for item in self.basis_observations): + raise ValueError("forecast basis crossed exact product scope") + if any(item.available_at > self.issued_at for item in self.basis_observations): + raise ValueError("forecast basis includes evidence unavailable when the forecast was issued") + if not self.issued_at <= self.resolution_window_start < self.resolution_window_end: + raise ValueError("forecast resolution window must begin at or after issuance") + if self.target_event_key != TARGET_EVENT_KEY: + raise ValueError("forecast target key differs from the frozen World event") + _derive_identity( + self, + prefix="public_event_forecast", + id_field="forecast_id", + digest_field="forecast_digest", + ) + return self + + +class ForecastResolutionReviewV1Alpha1(_FrozenModel): + """Exact product-owned resolution and single-event Brier contribution.""" + + contract: Literal["ace.world-intelligence.forecast-resolution-review/v1alpha1"] = ( + "ace.world-intelligence.forecast-resolution-review/v1alpha1" + ) + product_id: str + review_key: str + reviewed_forecast: ImmutableRecordReferenceV1 + basis_observation: ImmutableRecordReferenceV1 + observed_result: ImmutableRecordReferenceV1 + reviewer_context: AuthenticatedRuntimeContextV1Alpha1 + policy_id: str + policy_version: str + policy_digest: str + source_fixture_digest: str + target_event_key: str + target_event_definition_json: str + forecast_issued_at: datetime + resolution_window_start: datetime + resolution_window_end: datetime + forecast_probability: float = Field(ge=0.0, le=1.0) + result_withheld_until_after_forecast: bool + explicit_correction_linkage_verified: bool + event_outcome: float = Field(ge=0.0, le=1.0) + brier_loss: float = Field(ge=0.0, le=1.0) + brier_quality_score: float = Field(ge=0.0, le=1.0) + limitations: tuple[str, ...] + reviewed_at: datetime + review_id: str | None = None + review_digest: str | None = None + + @field_validator("target_event_definition_json") + @classmethod + def validate_target_definition(cls, value: str) -> str: + if value != TARGET_EVENT_DEFINITION: + raise ValueError("forecast review changed the frozen target event definition") + return value + + @field_validator("limitations") + @classmethod + def canonicalize_limitations(cls, value: tuple[str, ...]) -> tuple[str, ...]: + ordered = tuple(sorted(value)) + if not ordered or len(ordered) != len(set(ordered)): + raise ValueError("forecast review limitations must be non-empty and unique") + return ordered + + @model_validator(mode="after") + def validate_scope_resolution_score_and_identity(self) -> Self: + references = (self.reviewed_forecast, self.basis_observation, self.observed_result) + if any(item.product_id != self.product_id for item in references): + raise ValueError("forecast resolution review crossed exact product scope") + if self.reviewed_forecast.storage_id in { + self.basis_observation.storage_id, + self.observed_result.storage_id, + }: + raise ValueError("forecast, basis, and observed result require distinct exact records") + withheld = self.observed_result.available_at > self.reviewed_forecast.available_at + if self.result_withheld_until_after_forecast != withheld or not withheld: + raise ValueError("forecast result was not withheld until after exact forecast availability") + if not ( + self.forecast_issued_at + <= self.resolution_window_start + <= self.observed_result.available_at + <= self.reviewed_at + <= self.resolution_window_end + ): + raise ValueError("forecast resolution escaped its declared time window") + if self.target_event_key != TARGET_EVENT_KEY: + raise ValueError("forecast review changed the frozen target event") + expected_outcome = float(self.explicit_correction_linkage_verified) + if self.event_outcome != expected_outcome: + raise ValueError("forecast outcome differs from exact correction linkage") + expected_loss = (self.forecast_probability - self.event_outcome) ** 2 + expected_score = 1.0 - expected_loss + if self.brier_loss != expected_loss or self.brier_quality_score != expected_score: + raise ValueError("forecast Brier material differs from the frozen product formula") + _derive_identity( + self, + prefix="forecast_resolution_review", + id_field="review_id", + digest_field="review_digest", + ) + return self + + +class _ReplayMustNotAuthorize: + async def authorize_action(self, request): + raise AssertionError(f"historical forecast evaluation requested new authority: {request.authorization_key}") + + +def _policy_digest(original_ref: ImmutableRecordReferenceV1, *, issued_at: datetime) -> str: + return _digest( + { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "basis_observation": original_ref.model_dump(mode="json"), + "target_event_key": TARGET_EVENT_KEY, + "target_event_definition_json": TARGET_EVENT_DEFINITION, + "resolution_window_start": issued_at.isoformat(), + "resolution_window_end": RESOLUTION_WINDOW_END.isoformat(), + "score": "1 - (forecast_probability - binary_event_outcome) ** 2", + "claim_boundary": "single-event Brier contribution, not population calibration", + } + ) + + +def _install_policy(state: dict[str, Any]): + environment = state["environment"] + runtime = state["runtime"] + product_id = environment.fixture["product_id"] + criterion_head = _head(product_id, "impact_criterion", CRITERION_ID, 100) + operation_head = _head( + product_id, + "governed_operation_configuration", + "governed_operation_configuration:world-recorded-binary-forecast-brier-quality", + 101, + ) + binding = GovernedOperationBindingV1Alpha1( + product_id=product_id, + artifact=IMPACT_ARTIFACT, + configuration_ref=operation_head.state_id, + authority="append_measured_impact", + grant_ref="authority_grant:world-recorded-binary-forecast-brier-quality", + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(operation_head), + ) + capability_head = _head( + product_id, + "capability_state", + capability_state_ref_for_artifact(IMPACT_ARTIFACT), + 102, + ) + authority_head = _head(product_id, "authority_grant", binding.grant_ref, 103) + for head in (criterion_head, operation_head, capability_head, authority_head): + environment.store.set_governed_state_head(head) + runtime.heads[head.state_kind, head.state_id] = head + runtime.bindings = (*runtime.bindings, binding) + return criterion_head, binding + + +async def _append_forecast( + state: dict[str, Any], + *, + original_ref: ImmutableRecordReferenceV1, + variant: Literal["treatment", "control"], + probability: float, + issued_at: datetime, +) -> tuple[PublicEventForecastV1Alpha1, ImmutableRecordReferenceV1, str]: + environment = state["environment"] + forecast = PublicEventForecastV1Alpha1( + product_id=environment.fixture["product_id"], + forecast_key=f"recorded-binary-forecast:{variant}:2020-28779", + basis_observations=(original_ref,), + target_event_key=TARGET_EVENT_KEY, + target_event_definition_json=TARGET_EVENT_DEFINITION, + probability=probability, + policy_id=REVIEW_POLICY_ID, + policy_version=REVIEW_POLICY_VERSION, + policy_digest=_policy_digest(original_ref, issued_at=issued_at), + issued_at=issued_at, + resolution_window_start=issued_at, + resolution_window_end=RESOLUTION_WINDOW_END, + limitations=( + "declared_fixture_probability_not_generated_by_ace", + "offline_recorded_replay_not_live_forecasting", + "single_event_brier_contribution_not_population_calibration", + ), + ) + requested_at = state["clock"]() + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"append:world-recorded-binary-forecast:{variant}", + subject_ref=str(forecast.forecast_id), + subject_digest=str(forecast.forecast_digest), + requested_at=requested_at, + ) + reference = await _append_value( + state, + value=forecast, + record_kind="public_event_forecast", + record_key=str(forecast.forecast_id), + transaction_key=f"public-event-forecast:{forecast.forecast_id}", + as_of=forecast.issued_at, + authorization=authorization, + ) + content = ( + "# Recorded Binary Public-Event Forecast\n\n" + f"Basis Observation: {original_ref.storage_id}\n\n" + f"Target: {forecast.target_event_key}\n\n" + f"Declared probability: {forecast.probability}\n\n" + "The exact outcome identity and outcome material are withheld from this forecast record.\n" + ) + return forecast, reference, content + + +async def _issue_forecasts_before_correction( + state: dict[str, Any], + _fixture: dict[str, Any], + original: ObservationV1Alpha1, + original_ref: ImmutableRecordReferenceV1, +) -> None: + original_payload = original.payload.parsed_value()["record"] + if original_payload["document_number"] != "2020-28779": + raise AssertionError("forecast basis changed its exact original public record") + criterion_head, impact_binding = _install_policy(state) + issued_at = state["clock"]() + treatment, treatment_ref, treatment_content = await _append_forecast( + state, + original_ref=original_ref, + variant="treatment", + probability=0.75, + issued_at=issued_at, + ) + control, control_ref, control_content = await _append_forecast( + state, + original_ref=original_ref, + variant="control", + probability=0.25, + issued_at=issued_at, + ) + treatment_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=treatment_ref, + content=treatment_content, + pair_index=index, + variant="forecast-calibration-treatment", + ) + for index in (1, 2) + ] + ) + control_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=control_ref, + content=control_content, + pair_index=index, + variant="forecast-calibration-control", + ) + for index in (1, 2) + ] + ) + state.update( + { + "p2c9_criterion_head": criterion_head, + "p2c9_criterion_frozen_at": issued_at, + "p2c9_forecast_issued_at": issued_at, + "p2c9_impact_binding": impact_binding, + "p2c9_treatment_forecast": treatment, + "p2c9_treatment_forecast_ref": treatment_ref, + "p2c9_control_forecast": control, + "p2c9_control_forecast_ref": control_ref, + "p2c9_treatment_exports": treatment_exports, + "p2c9_control_exports": control_exports, + } + ) + + +async def _load_forecast(state: dict[str, Any], reference: ImmutableRecordReferenceV1) -> PublicEventForecastV1Alpha1: + record = await state["environment"].store.load_record( + reference.storage_id, + product_id=reference.product_id, + record_space=reference.record_space, + record_kind=reference.record_kind, + ) + if ( + record is None + or record.reference() != reference + or record.payload_contract != "ace.world-intelligence.public-event-forecast/v1alpha1" + ): + raise AssertionError("recorded forecast is unavailable or changed") + return PublicEventForecastV1Alpha1.model_validate(record.payload) + + +async def _review_forecast( + state: dict[str, Any], + *, + forecast_ref: ImmutableRecordReferenceV1, + original_ref: ImmutableRecordReferenceV1, + correction_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: Literal["treatment", "control"], +) -> tuple[ForecastResolutionReviewV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + forecast = await _load_forecast(state, forecast_ref) + original = await _load_observation(state, original_ref) + correction = await _load_observation(state, correction_ref) + original_payload = original.payload.parsed_value()["record"] + correction_payload = correction.payload.parsed_value()["record"] + linkage_verified = bool( + correction_payload["corrects_document_number"] == original_payload["document_number"] + and correction_payload["document_number"] == "2021-10670" + and forecast.basis_observations == (original_ref,) + and forecast.target_event_key == TARGET_EVENT_KEY + ) + event_outcome = float(linkage_verified) + brier_loss = (forecast.probability - event_outcome) ** 2 + reviewed_at = state["clock"]() + reviewer = _context(environment.context, "principal:world-forecast-calibration-reviewer") + review = ForecastResolutionReviewV1Alpha1( + product_id=environment.fixture["product_id"], + review_key=f"recorded-binary-forecast-resolution:{pair_index}:{variant}", + reviewed_forecast=forecast_ref, + basis_observation=original_ref, + observed_result=correction_ref, + reviewer_context=reviewer, + policy_id=forecast.policy_id, + policy_version=forecast.policy_version, + policy_digest=forecast.policy_digest, + source_fixture_digest=correction_fixture_digest(state["p2c7_fixture"]), + target_event_key=forecast.target_event_key, + target_event_definition_json=forecast.target_event_definition_json, + forecast_issued_at=forecast.issued_at, + resolution_window_start=forecast.resolution_window_start, + resolution_window_end=forecast.resolution_window_end, + forecast_probability=forecast.probability, + result_withheld_until_after_forecast=correction_ref.available_at > forecast_ref.available_at, + explicit_correction_linkage_verified=linkage_verified, + event_outcome=event_outcome, + brier_loss=brier_loss, + brier_quality_score=1.0 - brier_loss, + limitations=forecast.limitations, + reviewed_at=reviewed_at, + ) + requested_at = state["clock"]() + authorization = await _authorize_append( + state, + context=reviewer, + authorization_key=f"recorded-binary-forecast-resolution:{pair_index}:{variant}", + subject_ref=str(review.review_id), + subject_digest=str(review.review_digest), + requested_at=requested_at, + ) + reference = await _append_value( + state, + value=review, + record_kind="forecast_resolution_review", + record_key=str(review.review_id), + transaction_key=f"forecast-resolution-review:{review.review_id}", + as_of=review.reviewed_at, + authorization=authorization, + ) + return review, reference + + +async def _record_review_outcome( + state: dict[str, Any], + *, + export: ReviewedExport, + review: ForecastResolutionReviewV1Alpha1, + review_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: Literal["treatment", "control"], +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + latency_ms = int((review.reviewed_at - review.forecast_issued_at).total_seconds() * 1_000) + measures = ImpactOutcomeMeasuresV1Alpha1( + primary_value=review.brier_quality_score, + observed_result=review_ref, + latency_ms=latency_ms, + cost_usd=0.0, + failure_count=0, + degraded=False, + limitations=review.limitations, + ) + recorded_at = state["clock"]() + observer = _context(environment.context, "principal:world-forecast-calibration-outcome-observer") + intent = OutcomeIntentV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=observer, + decision=export.decision_ref, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + value_json=canonical_json(measures.model_dump(mode="json")), + observed_at=review.reviewed_at, + recorded_at=recorded_at, + ) + authorization = await _authorize_append( + state, + context=observer, + authorization_key=f"recorded-binary-forecast-outcome:{pair_index}:{variant}", + subject_ref=str(intent.intent_id), + subject_digest=str(intent.intent_digest), + requested_at=recorded_at, + ) + outcome = OutcomeV1Alpha1(intent=intent, authorization=authorization) + return await _append_value( + state, + value=outcome, + record_kind="outcome", + record_key=str(outcome.outcome_id), + transaction_key=f"outcome:{outcome.outcome_id}", + as_of=review.reviewed_at, + authorization=authorization, + ) + + +async def run_forecast_calibration_outcome(workspace_root: Path) -> dict[str, Any]: + """Run P2C9 over a withheld exact correction result and declared probabilities.""" + + state: dict[str, Any] = {} + prior_packet = await run_correction_revision_stability_outcome( + workspace_root, + state_sink=state, + before_correction=_issue_forecasts_before_correction, + ) + environment = state["environment"] + original_ref = state["p2c7_original_observation_ref"] + correction_ref = state["p2c7_correction_observation_ref"] + treatment_ref = state["p2c9_treatment_forecast_ref"] + control_ref = state["p2c9_control_forecast_ref"] + treatment_exports = state["p2c9_treatment_exports"] + control_exports = state["p2c9_control_exports"] + if correction_ref.available_at <= max(treatment_ref.available_at, control_ref.available_at): + raise AssertionError("held-out correction became available before the exact forecasts") + latest_forecast_action_completed_at = max( + *(item.terminal.result.completed_at for item in treatment_exports), + *(item.terminal.result.completed_at for item in control_exports), + ) + if correction_ref.available_at <= latest_forecast_action_completed_at: + raise AssertionError("held-out correction became available before the reviewed forecast actions completed") + + evidence: list[ImpactEvidenceV1Alpha1] = [] + treatment_reviews: list[ForecastResolutionReviewV1Alpha1] = [] + control_reviews: list[ForecastResolutionReviewV1Alpha1] = [] + for index, (treatment_export, control_export) in enumerate( + zip(treatment_exports, control_exports, strict=True), start=1 + ): + treatment_attribution = await _record_attribution( + state, + export=treatment_export, + subject=treatment_ref, + pair_index=index, + variant="forecast-calibration-treatment", + ) + control_attribution = await _record_attribution( + state, + export=control_export, + subject=control_ref, + pair_index=index, + variant="forecast-calibration-control", + ) + treatment_review, treatment_review_ref = await _review_forecast( + state, + forecast_ref=treatment_ref, + original_ref=original_ref, + correction_ref=correction_ref, + pair_index=index, + variant="treatment", + ) + control_review, control_review_ref = await _review_forecast( + state, + forecast_ref=control_ref, + original_ref=original_ref, + correction_ref=correction_ref, + pair_index=index, + variant="control", + ) + treatment_outcome = await _record_review_outcome( + state, + export=treatment_export, + review=treatment_review, + review_ref=treatment_review_ref, + pair_index=index, + variant="treatment", + ) + control_outcome = await _record_review_outcome( + state, + export=control_export, + review=control_review, + review_ref=control_review_ref, + pair_index=index, + variant="control", + ) + treatment_reviews.append(treatment_review) + control_reviews.append(control_review) + conditions = ImpactConditionsV1Alpha1( + product_id=environment.fixture["product_id"], + condition_key=f"world-recorded-binary-forecast-brier-pair:{index}", + route_id="world:fcc-recorded-binary-forecast-review", + context_json=canonical_json( + { + "basis_observation": original_ref.model_dump(mode="json"), + "pair_index": index, + "review_policy_digest": treatment_review.policy_digest, + "target_event_definition_json": TARGET_EVENT_DEFINITION, + "target_event_key": TARGET_EVENT_KEY, + "task": "score_declared_probability_after_exact_withheld_result", + "withheld_result_policy": "no outcome coordinate in frozen conditions", + } + ), + observation_window_start=state["p2c9_forecast_issued_at"], + observation_window_end=RESOLUTION_WINDOW_END, + frozen_at=state["p2c9_criterion_frozen_at"], + ) + evidence.append( + ImpactEvidenceV1Alpha1( + product_id=environment.fixture["product_id"], + evidence_key=f"world-recorded-binary-forecast-brier:{index}", + treatment_attribution=treatment_attribution, + control_attribution=control_attribution, + treatment_decision=treatment_export.decision_ref, + control_decision=control_export.decision_ref, + treatment_action_review=treatment_export.review_ref, + treatment_action_admission=treatment_export.admission_ref, + treatment_action_terminal=treatment_export.terminal_ref, + control_action_review=control_export.review_ref, + control_action_admission=control_export.admission_ref, + control_action_terminal=control_export.terminal_ref, + treatment_outcome=treatment_outcome, + control_outcome=control_outcome, + treatment_conditions=conditions, + control_conditions=conditions, + ) + ) + + criterion = ImpactCriterionV1Alpha1( + product_id=environment.fixture["product_id"], + criterion_id=CRITERION_ID, + criterion_version="candidate-1", + target_kind=ImpactTargetKind.INTELLIGENCE_ARTIFACT, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + metric_direction=ImpactMetricDirection.HIGHER_IS_BETTER, + useful_effect_threshold=0.5, + harmful_effect_threshold=0.5, + minimum_matched_pairs=2, + requires_observed_result=True, + harmful_action=ImpactGovernanceAction.ROLLBACK, + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(state["p2c9_criterion_head"]), + frozen_at=state["p2c9_criterion_frozen_at"], + ) + request = ImpactEvaluationRequestV1Alpha1( + evaluation_key="world-recorded-binary-forecast-brier:fcc-2021-10670", + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + criterion=criterion, + target=treatment_ref, + control=control_ref, + evidence=tuple(evidence), + cutoff_at=state["clock"](), + requested_at=state["clock"](), + ) + service = MeasuredImpactService( + store=environment.store, + authorizer=state["reasoning"], + operation_binding=state["p2c9_impact_binding"], + ) + admission = await service.evaluate(request) + historical = await MeasuredImpactService( + store=environment.store, + authorizer=_ReplayMustNotAuthorize(), + operation_binding=state["p2c9_impact_binding"], + ).evaluate(request) + if admission.replayed or not historical.replayed or historical.evaluation != admission.evaluation: + raise AssertionError("forecast evaluation did not replay exact historical material") + if admission.evaluation.classification is not ImpactClassification.USEFUL: + raise AssertionError("frozen forecast Brier criterion did not classify useful") + if admission.proposal is None or admission.proposal.action is not ImpactGovernanceAction.PROMOTE: + raise AssertionError("forecast evaluation did not emit its proposal-only mapping") + if {item.brier_quality_score for item in treatment_reviews} != {0.9375}: + raise AssertionError("treatment forecast lost its exact Brier contribution") + if {item.brier_quality_score for item in control_reviews} != {0.4375}: + raise AssertionError("control forecast lost its exact Brier contribution") + + return { + "contract": "ace.world-intelligence.forecast-calibration-outcome/v1alpha1", + "prior_revision_stability": prior_packet, + "source_event": { + "fixture_id": state["p2c7_fixture"]["fixture_id"], + "fixture_digest": correction_fixture_digest(state["p2c7_fixture"]), + "original_observation": original_ref.model_dump(mode="json"), + "observed_result": correction_ref.model_dump(mode="json"), + "result_available_after_forecasts": True, + "latest_forecast_action_completed_at": latest_forecast_action_completed_at.isoformat(), + "result_available_after_reviewed_actions": True, + }, + "review_policy": { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "policy_digest": treatment_reviews[0].policy_digest, + "reviewer_ref": treatment_reviews[0].reviewer_context.actor_ref, + "score_rule": "1 - (forecast_probability - binary_event_outcome) ** 2", + "claim_boundary": "single-event Brier contribution, not population calibration", + }, + "forecasts": { + "treatment": state["p2c9_treatment_forecast"].model_dump(mode="json"), + "control": state["p2c9_control_forecast"].model_dump(mode="json"), + }, + "observed_results": { + "treatment": tuple(item.model_dump(mode="json") for item in treatment_reviews), + "control": tuple(item.model_dump(mode="json") for item in control_reviews), + }, + "evaluation": admission.evaluation.model_dump(mode="json"), + "proposal": admission.proposal.model_dump(mode="json"), + "replay": { + "historical": historical.replayed, + "no_reauthorization": True, + "transaction_receipt_id": str(historical.transaction_receipt.receipt_id), + }, + "scope": { + "exact_real_correction_result": True, + "result_withheld_until_after_forecast_records": True, + "exact_probability_and_result_scoring": True, + "network_access": False, + "historically_contemporaneous_forecast_claimed": False, + "probability_generated_by_ace_claimed": False, + "model_forecast_skill_claimed": False, + "population_calibration_claimed": False, + "causality_claimed": False, + "human_benefit_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + }, + } + + +def main() -> None: + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + args = parser.parse_args() + print( + json.dumps( + asyncio.run(run_forecast_calibration_outcome(args.workspace_root)), + indent=2, + sort_keys=True, + ) + ) + + +if __name__ == "__main__": + main() From a5e3f62fcffe4af47f999043bc0bdd20c41980c7 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Mon, 10 Aug 2026 20:43:36 -0700 Subject: [PATCH 08/17] Reproduce measured correction over BLS --- README.md | 24 +- ROADMAP.md | 11 +- ...dent-correction-reproduction-2026-08-10.md | 137 +++ ...-correction-reproduction-work-packet-v1.md | 117 +++ .../fixtures/p2c10_bls_correction_pair.json | 30 + ...c10_independent_correction_reproduction.py | 170 ++++ ...c10_independent_correction_reproduction.py | 852 ++++++++++++++++++ scripts/p2c9_forecast_calibration_outcome.py | 8 +- 8 files changed, 1342 insertions(+), 7 deletions(-) create mode 100644 docs/audits/world-intelligence-p2c10-independent-correction-reproduction-2026-08-10.md create mode 100644 docs/design/world-intelligence-p2c10-independent-correction-reproduction-work-packet-v1.md create mode 100644 domain_packs/tests/fixtures/p2c10_bls_correction_pair.json create mode 100644 domain_packs/tests/test_p2c10_independent_correction_reproduction.py create mode 100644 scripts/p2c10_independent_correction_reproduction.py diff --git a/README.md b/README.md index 76abfcf..db2c904 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,20 @@ fixture inputs, not ACE outputs. This is exact forecast/result scoring, not a hi contemporaneous forecast, model-skill finding, empirical calibration curve, population reliability estimate, causal claim, or human-benefit finding. +P2C10 independently reproduces correction-quality measurement over the U.S. Bureau of Labor +Statistics public errata family. The recorded July 1, 2025 JOLTS release `USDL-25-1087` and BLS's +July 2 correction are admitted as distinct immutable Observations. Treatment and control preserve +both source identities, the exact correction link, two reviewed Actions each, and the same matched +conditions; treatment renders the required minus sign in `−39,000`, while control retains the +reported pre-correction form. Exact reviews score `1.0` and `0.0`, so the unchanged domain-neutral +contract classifies the bounded two-pair difference as useful and emits only a non-effective +proposal. + +The historical wrong form is derived from BLS's explicit statement that the sentence required a +missing minus sign; the currently archived release is already corrected. This is recorded replay +over one correction, not live monitoring, statistical validation of JOLTS, population correction +performance, causality, or human benefit. No Domain Pack, connector, or Core contract changes. + ## What the public World proof demonstrates Generate a self-contained visual Reality Brief and its exact machine-readable backing data: @@ -387,6 +401,7 @@ $PY -m scripts.p2c6_contradiction_attention_outcome "$WORKSPACE" $PY -m scripts.p2c7_correction_detection_delay_outcome "$WORKSPACE" $PY -m scripts.p2c8_correction_revision_stability_outcome "$WORKSPACE" $PY -m scripts.p2c9_forecast_calibration_outcome "$WORKSPACE" +$PY -m scripts.p2c10_independent_correction_reproduction "$WORKSPACE" ``` The released 0.9.0 gates are reproducible through the locked environment, as CI does. The @@ -428,8 +443,8 @@ The two-lineage LIVE Shift → Signal → Case → cited Brief proof is recorded [`docs/audits/world-intelligence-ai-command-center-live-2026-08-10.md`](docs/audits/world-intelligence-ai-command-center-live-2026-08-10.md). 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 withheld-result forecast-scoring candidate is recorded in -[`docs/audits/world-intelligence-p2c9-forecast-calibration-outcome-2026-08-10.md`](docs/audits/world-intelligence-p2c9-forecast-calibration-outcome-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). 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), @@ -470,8 +485,9 @@ detection delay against a product target. P2C8 measures exact unaffected-claim i preservation across real Brief contracts while holding correction semantics, source coverage, and claim count constant. P2C9 adds an exact withheld-result forecast record and derives a single-event Brier contribution while explicitly withholding any population-calibration or model-skill claim. -The next bounded measurement work is another independently sourced correction event or independent -Market reproduction. +P2C10 reproduces correction-quality measurement over an independently sourced BLS erratum without +changing the shared contracts. The next bounded measurement work is independent Market +reproduction. Separately reviewed opt-in network transport and P2D multi-source conflict/correction with LIVE inputs remain independent work. None of these steps may add autonomous publishing, delivery, persuasion, or action authority to a Domain Pack. diff --git a/ROADMAP.md b/ROADMAP.md index 673fb8c..2b1d209 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–P2C9 measured feedback and product-owned outcomes +## Candidate — P2C3–P2C10 measured feedback and product-owned outcomes - 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. @@ -51,6 +51,11 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). resolves the binary event; exact reviews derive single-event Brier quality of `0.9375` and `0.4375`. This proves forecast/result scoring and leakage-resistant record order, not historical contemporaneity, probability generation by ACE, model skill, or population calibration. +- A seventh frozen criterion repeats correction-quality measurement over the independent BLS public + errata source family. Treatment and control retain the same release, correction, correction link, + source coverage, reviewed workflow, and matched conditions; only treatment renders the exact + corrected minus sign. The unchanged shared contract derives `1.0` versus `0.0`, classifies the + 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. @@ -72,6 +77,10 @@ performance, or a general semantic-equivalence engine. The stacked [P2C9 work packet](docs/design/world-intelligence-p2c9-forecast-calibration-outcome-work-packet-v1.md) freezes an exact forecast/result scoring boundary without claiming a historical forecast, model skill, or population calibration. +The stacked +[P2C10 work packet](docs/design/world-intelligence-p2c10-independent-correction-reproduction-work-packet-v1.md) +freezes independent BLS correction reproduction without claiming live monitoring, statistical +validity, population correction performance, causality, or human benefit. ## Next — trustworthy live orientation diff --git a/docs/audits/world-intelligence-p2c10-independent-correction-reproduction-2026-08-10.md b/docs/audits/world-intelligence-p2c10-independent-correction-reproduction-2026-08-10.md new file mode 100644 index 0000000..c483125 --- /dev/null +++ b/docs/audits/world-intelligence-p2c10-independent-correction-reproduction-2026-08-10.md @@ -0,0 +1,137 @@ +# World Intelligence P2C10 independent correction reproduction audit — 2026-08-10 + +Status: **stacked candidate evidence only; not a release, SI4 pass, live-monitoring result, +population-performance finding, or applied governance change** + +## Source identity + +- World base: P2C9 commit `53feadb40fcc93d23f326b16979ed6640471c4cf` +- World branch: `codex/world-independent-correction-reproduction` +- Core dependency: exact observed-result candidate commit + `433e3d16c5458c975557dcd1552824fb959d4d12` +- Released identity intentionally unchanged: `ace-domain-world-intelligence==0.9.0`, + `ace-core>=0.5.0,<0.6` + +## Exact point-in-time result + +The frozen BLS fixture is +`sha256:981183a2464f74f4421bd0a6470f0342a5abae8cfebc1b5a8da1562df26babb1`. +It binds release `USDL-25-1087` to correction `bls-errata-2025-07-01-jolts`, with recorded +Observation identities: + +```text +original: observation:faf25d26cc88802368cabf3e17538a7d +correction: observation:3a1351d6ac306374b8a5b472c192d2b9 +``` + +The point-run treatment artifact was +`official_correction_artifact:34d538fbd2c3a6ef6d3e79d0fdb8a344` with material +`sha256:34d538fbd2c3a6ef6d3e79d0fdb8a3440c06b02a1e156a6001bfc1491fd86e21`. +The matched control was +`official_correction_artifact:ab6cfedd1b76602e51c0c8d3c1dbd6d2` with material +`sha256:ab6cfedd1b76602e51c0c8d3c1dbd6d22e5c76b01b1eb59350a8e1bdaa7d8207`. + +Both artifacts name the same exact release and correction Observations, `corrects` relation, +source-policy digest, and reviewed workflow. Treatment renders `−39,000`; control renders the +reported pre-correction `(39,000)` form. All four reviews independently recorded complete source +coverage, visible correction linkage, and preserved prior history: + +```text +treatment scores: 1.0, 1.0 +control scores: 0.0, 0.0 +matched pairs: 2 +mean effect: 1.0 +classification: useful +proposal action: promote +proposal live effect: false +historical replay: true +replay reauthorization: false +``` + +The exact point-run evaluation was `impact_evaluation:5490b5c680940d88d25d9dacca67103b` +with material +`sha256:5490b5c680940d88d25d9dacca67103b6fb33b8d8c98e0e756488f45dece964e`. +The exact non-effective proposal was +`impact_governance_proposal:da09bf45bb9f48d6cefbb3fb49122e67` with material +`sha256:da09bf45bb9f48d6cefbb3fb49122e679d010cd39140950a57c447e2465f7f86`. + +Point-run artifact and evaluation identities include exact record-availability and reviewed-action +times. Historical replay in the same durable store returns those exact identities without +reauthorization. Fresh hosts reproduce the fixture digest, source content identities, scores, +classification, and proposal semantics without pretending independent wall-clock availability +coordinates are identical. + +## Verification + +The frozen World dependency versions plus the stacked Core candidate and separately packaged +reference action adapter produced: + +```text +python -B -m pytest domain_packs/tests/test_p2c3_measured_feedback.py \ + domain_packs/tests/test_p2c4_reviewed_impact_disposition.py \ + domain_packs/tests/test_p2c5_citation_correctness_outcome.py \ + domain_packs/tests/test_p2c6_contradiction_attention_outcome.py \ + domain_packs/tests/test_p2c7_correction_detection_delay_outcome.py \ + domain_packs/tests/test_p2c8_correction_revision_stability_outcome.py \ + domain_packs/tests/test_p2c9_forecast_calibration_outcome.py \ + domain_packs/tests/test_p2c10_independent_correction_reproduction.py -q --tb=short +30 passed in 11.01s + +python -B -m pytest -q --tb=short +113 passed in 24.20s + +python -B -m pytest adapters/federal_register_source/tests -q --tb=short +26 passed in 0.25s + +python -B -m pytest tests/test_release_contract.py -q --tb=short +7 passed in 0.05s + +# Installed public ace-core==0.5.0; candidate tests skip explicitly. +python -B -m pytest -q --tb=short -rs +83 passed, 30 skipped in 14.10s + +ruff check --no-cache +PASS + +ruff format --check --no-cache +3 files already formatted + +UV_CACHE_DIR=/tmp/ace-p2c10-uv-cache uv build --out-dir /tmp/ace-p2c10-dist-20260810 +Successfully built unchanged 0.9.0 source distribution and inert data-only wheel + +git diff --check +PASS +``` + +The thirty public-Core skips are explicit candidate boundaries: P2C3 through P2C10 require +unreleased stacked Core measured-impact contracts. The public P2C2 journey and every released +boundary remain green. The wheel contains 45 inert Domain Pack JSON/metadata files, no Python or +entry points, and retains `ace-core>=0.5.0,<0.6`. + +Repository-wide Ruff remains an inherited release-hygiene blocker. With the same locked Ruff +version, both the P2C9 parent and this P2C10 worktree report exactly 14 lint findings and 12 format +targets. Scoped P2C10 checks and `git diff --check` are green. This packet does not rewrite +unrelated history, but release closeout must reconcile the repository-wide gate before publication. + +## Claim boundary + +BLS's public errata states that the sentence required a missing minus sign; the current archived +release already exposes the corrected form. The fixture explicitly derives the historical original +form from that erratum. It does not claim to preserve original response bytes. + +The World review exact-loads the artifact and both immutable source Observations, derives source +coverage, correction linkage, prior-record preservation, corrected-form equality, and stale-form +absence, then records an exact observed result. Core and Intelligence receive only domain-neutral +records, conditions, scores, and classification. Historical replay requires no new authority, and +the proposal is non-effective, non-selectable, unapplied, and subject to separate human review. + +This is one hermetic recorded BLS correction. It is not live monitoring, network-arrival evidence, +statistical validation of JOLTS, population correction performance, a general source-independence +claim, causality, general Brief quality, or human benefit. + +## Remaining work + +Independent Market reproduction, combined-main review/CI, public Core artifacts, +repository-wide lint/format reconciliation, security/release checks, and opt-in live transport +remain future bounded work. Core issue #49 F1, F3, and F5 still require explicit 0.6 release-owner +disposition; this World packet neither implements nor re-dates them. diff --git a/docs/design/world-intelligence-p2c10-independent-correction-reproduction-work-packet-v1.md b/docs/design/world-intelligence-p2c10-independent-correction-reproduction-work-packet-v1.md new file mode 100644 index 0000000..362fc53 --- /dev/null +++ b/docs/design/world-intelligence-p2c10-independent-correction-reproduction-work-packet-v1.md @@ -0,0 +1,117 @@ +# World Intelligence P2C10 independent correction reproduction work packet (v1) + +**Status:** stacked source-checkout candidate; this packet does not release World Intelligence, +apply a governance proposal, close ACE Core issue #38, pass SI4, or complete ACE 0.6.0. + +**Frozen:** 2026-08-10 from World P2C9 commit +`53feadb40fcc93d23f326b16979ed6640471c4cf`, stacked on the Core exact observed-result +provenance candidate `433e3d16c5458c975557dcd1552824fb959d4d12`. + +## Objective + +Falsify source-family coupling by reproducing the measured correction journey over a materially +different real publisher and source policy while leaving the shared Core + Intelligence contracts +unchanged: + +```text +BLS release Observation + later BLS erratum Observation + -> treatment corrected artifact / stale-form control + -> Decision -> reviewed Action -> independent review -> exact Outcome + -> useful / harmful / unproven evaluation -> proposal only +``` + +The source pair is the BLS Job Openings and Labor Turnover release `USDL-25-1087` and its public +erratum. The [archived release](https://www.bls.gov/news.release/archives/jolts_07012025.htm) now +contains the corrected `−39,000` form. The [BLS errata page](https://www.bls.gov/errata/) states +that the July 1, 2025 sentence required a missing minus sign and that corrections were made July 2. +The fixture therefore labels the pre-correction form as derived from that explicit erratum; it does +not pretend the current archive still exposes the superseded bytes. + +## Frozen product policy and matched control + +World owns `world_independent_official_correction_statement_quality` version `candidate-1`. A +review scores `1.0` only when all of the following are exact and inspectable: + +1. both the original-release and correction Observations are present; +2. the correction names the exact release it corrects; +3. the original immutable record remains loadable and unchanged; +4. the rendered statement equals the public corrected statement; and +5. the reported pre-correction form is absent. + +Otherwise the score is `0.0`. Treatment and control share both source references, correction +linkage, policy digest, two reviewed Action workflows, observation window, and matched conditions. +Treatment renders `The number of job openings decreased in federal government (−39,000).`; control +retains the missing-sign form `(39,000)`. Source coverage and action volume therefore cannot explain +the score difference. + +The criterion requires two matched pairs and an effect of `1.0`. Intelligence derives useful, +harmful, or unproven under that frozen rule. Core appends exact reviews, Outcomes, evaluation, and +proposal history. A useful result maps only to a non-effective, non-selectable `promote` proposal +requiring separate human review. + +## Exact acceptance + +P2C10 must: + +1. rerun P2C2 through P2C9 and preserve all prior immutable results and proposals; +2. admit the recorded BLS release and erratum as distinct exact Observations without network use; +3. retain BLS source vocabulary and historical-original derivation policy only in World; +4. append treatment and stale-form control artifacts that name the same exact source pair and + correction relation; +5. complete two reviewed treatment Actions and two reviewed control Actions; +6. exact-load each artifact and both source Observations before deriving the product score; +7. append four authenticated reviews and four Core Outcomes naming those reviews as observed + results; +8. classify `1.0` versus `0.0` over two pairs as useful and emit proposal-only `promote`; +9. replay without reauthorization and reproduce the fixture digest, scores, classification, and + proposal semantics across fresh hosts; and +10. reject drifted source linkage, duplicate source identity, changed statement forms, invented + scores, and fixture-policy drift. + +Stacked Core tests remain authoritative for missing attribution, condition mismatch, cutoff +leakage, unavailable Outcomes, duplicate/replayed evidence, interruption, restart, and denied +authority. This packet exercises those unchanged contracts through a second real source family +rather than duplicating their lower-level tests in World. + +## Ownership boundary + +World owns BLS vocabulary, source URLs, the historical-original derivation disclosure, correction +statement policy, fixture, matched control, review contract, and product evidence. Core owns durable +identities, append-only records, provenance, Decisions, reviewed Actions, Outcomes, authority, and +replay. Intelligence owns domain-neutral conditions, matched evaluation, uncertainty, +classification, and proposal contracts. No BLS, JOLTS, errata, or minus-sign noun moves into Core or +Intelligence. + +The installable Domain Pack remains inert JSON and unchanged. The Federal Register connector is +unchanged and is not used to fetch BLS. The fixture is recorded, hermetic, and network-free. + +## Files, rollback, and deletion criteria + +This packet owns: + +- `domain_packs/tests/fixtures/p2c10_bls_correction_pair.json`; +- `scripts/p2c10_independent_correction_reproduction.py`; +- `domain_packs/tests/test_p2c10_independent_correction_reproduction.py`; +- the additive P2C9 state handoff; and +- this work packet, its audit, and restrained README/roadmap references. + +It changes no shipped Domain Pack, connector, package version, dependency range, lockfile, release +record, Core contract, or public artifact. Rollback removes the harness, tests, handoff, fixture, +and candidate documentation. Records already persisted by a host remain immutable history. + +Delete or replace this fixture only if BLS removes the public correction evidence, the exact URLs +cannot be independently verified, or a stronger redistributable snapshot supersedes it. Such a +change requires a new fixture identity and cannot rewrite prior evidence. + +## Non-claims and next packet + +This packet does not establish live monitoring, network freshness, the statistical validity of the +JOLTS estimate, general correction quality, population performance, source independence beyond the +two exercised families, causality, general Brief quality, or human benefit. It does not apply a +proposal or grant authority to a Domain Pack. + +The next bounded falsification packet is an independent Market Intelligence reproduction of the +same public Core + Intelligence contracts. Combined-main review/CI, public Core artifacts, +compatibility and security checks, repository-wide hygiene, and separately reviewed opt-in live +transport remain release work. Core issue #49 F1, F3, and F5 still require explicit 0.6 +release-owner disposition; this packet does not implement, defer, or re-date them. diff --git a/domain_packs/tests/fixtures/p2c10_bls_correction_pair.json b/domain_packs/tests/fixtures/p2c10_bls_correction_pair.json new file mode 100644 index 0000000..ab1e3e1 --- /dev/null +++ b/domain_packs/tests/fixtures/p2c10_bls_correction_pair.json @@ -0,0 +1,30 @@ +{ + "fixture_id": "bls-jolts-may-2025-minus-sign-correction", + "network_access": false, + "recorded_at": "2026-08-10T23:50:00Z", + "source_policy": { + "publisher": "U.S. Bureau of Labor Statistics", + "source_family": "bls_public_errata", + "release_uri": "https://www.bls.gov/news.release/archives/jolts_07012025.htm", + "errata_uri": "https://www.bls.gov/errata/", + "recorded_replay": true, + "historical_original_form_derived_from_erratum": true, + "statistical_validity_claimed": false + }, + "original": { + "record_id": "USDL-25-1087", + "release_date": "2025-07-01", + "published_at": "2025-07-01T14:00:00Z", + "release_uri": "https://www.bls.gov/news.release/archives/jolts_07012025.htm", + "reported_sentence_without_required_minus_sign": "The number of job openings decreased in federal government (39,000)." + }, + "correction": { + "record_id": "bls-errata-2025-07-01-jolts", + "corrects_record_id": "USDL-25-1087", + "date_added": "2025-07-01", + "corrected_at": "2025-07-02T14:00:00Z", + "errata_uri": "https://www.bls.gov/errata/", + "correction_description": "The following sentence requires correction to add a missing minus sign.", + "corrected_sentence": "The number of job openings decreased in federal government (−39,000)." + } +} diff --git a/domain_packs/tests/test_p2c10_independent_correction_reproduction.py b/domain_packs/tests/test_p2c10_independent_correction_reproduction.py new file mode 100644 index 0000000..795d5c0 --- /dev/null +++ b/domain_packs/tests/test_p2c10_independent_correction_reproduction.py @@ -0,0 +1,170 @@ +from __future__ import annotations + +import copy +import importlib.util +import json + +import pytest +from pydantic import ValidationError + + +def _require_candidate_contracts() -> None: + if importlib.util.find_spec("ace.application.measured_impact") is None: + pytest.skip("P2C10 requires the stacked ACE Core measured-impact candidate") + from ace.intelligence import ImpactOutcomeMeasuresV1Alpha1 + + if "observed_result" not in ImpactOutcomeMeasuresV1Alpha1.model_fields: + pytest.skip("P2C10 requires exact observed-result provenance from the stacked Core candidate") + if importlib.util.find_spec("ace_reference_workspace_action") is None: + pytest.skip("P2C10 requires the separately packaged Core reference adapter") + + +def test_recorded_bls_fixture_freezes_an_independent_exact_correction_pair() -> None: + _require_candidate_contracts() + from scripts.p2c10_independent_correction_reproduction import ( + bls_correction_fixture_digest, + load_bls_correction_fixture, + ) + + fixture = load_bls_correction_fixture() + + assert fixture["network_access"] is False + assert fixture["source_policy"]["source_family"] == "bls_public_errata" + assert fixture["source_policy"]["historical_original_form_derived_from_erratum"] is True + assert fixture["original"]["record_id"] == "USDL-25-1087" + assert fixture["correction"]["corrects_record_id"] == fixture["original"]["record_id"] + assert fixture["original"]["reported_sentence_without_required_minus_sign"].endswith("(39,000).") + assert fixture["correction"]["corrected_sentence"].endswith("(−39,000).") + assert fixture["original"]["release_uri"].startswith("https://www.bls.gov/") + assert fixture["correction"]["errata_uri"] == "https://www.bls.gov/errata/" + assert ( + bls_correction_fixture_digest(fixture) + == "sha256:981183a2464f74f4421bd0a6470f0342a5abae8cfebc1b5a8da1562df26babb1" + ) + + +@pytest.mark.asyncio +async def test_independent_source_correction_becomes_an_exact_measured_outcome(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c10_independent_correction_reproduction import run_independent_correction_reproduction + + result = await run_independent_correction_reproduction(tmp_path) + + assert result["review_policy"]["reviewer_ref"] == "principal:world-independent-correction-reviewer" + assert result["evaluation"]["criterion"]["requires_observed_result"] is True + assert result["evaluation"]["classification"] == "useful" + assert result["evaluation"]["matched_pair_count"] == 2 + assert result["evaluation"]["mean_effect"] == 1.0 + assert result["proposal"]["action"] == "promote" + assert result["proposal"]["live_effect"] is False + assert result["proposal"]["selectable"] is False + assert result["proposal"]["requires_human_review"] is True + assert result["replay"]["historical"] is True + assert result["replay"]["no_reauthorization"] is True + assert result["scope"]["independent_source_family_reproduction"] is True + assert result["scope"]["domain_neutral_core_contract_unchanged"] is True + + +@pytest.mark.asyncio +async def test_source_coverage_linkage_and_reviewed_workflow_are_matched(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c10_independent_correction_reproduction import run_independent_correction_reproduction + + result = await run_independent_correction_reproduction(tmp_path) + treatment_artifact = result["artifacts"]["treatment"] + control_artifact = result["artifacts"]["control"] + treatment_reviews = result["observed_results"]["treatment"] + control_reviews = result["observed_results"]["control"] + + assert treatment_artifact["original_observation"] == control_artifact["original_observation"] + assert treatment_artifact["correction_observation"] == control_artifact["correction_observation"] + assert treatment_artifact["corrects_source_record_id"] == control_artifact["corrects_source_record_id"] + for reviews in (treatment_reviews, control_reviews): + assert {item["source_coverage_complete"] for item in reviews} == {True} + assert {item["correction_link_visible"] for item in reviews} == {True} + assert {item["prior_record_preserved"] for item in reviews} == {True} + assert {item["corrected_statement_exact"] for item in treatment_reviews} == {True} + assert {item["stale_form_present"] for item in treatment_reviews} == {False} + assert {item["correction_quality_score"] for item in treatment_reviews} == {1.0} + assert {item["corrected_statement_exact"] for item in control_reviews} == {False} + assert {item["stale_form_present"] for item in control_reviews} == {True} + assert {item["correction_quality_score"] for item in control_reviews} == {0.0} + assert result["scope"]["prior_record_preserved"] is True + assert result["scope"]["network_access"] is False + assert result["scope"]["population_correction_performance_claimed"] is False + + +@pytest.mark.asyncio +async def test_drifted_source_link_duplicate_identity_and_invented_score_fail_closed(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c10_independent_correction_reproduction import ( + IndependentCorrectionReviewV1Alpha1, + OfficialCorrectionArtifactV1Alpha1, + load_bls_correction_fixture, + run_independent_correction_reproduction, + validate_bls_correction_fixture, + ) + + fixture = copy.deepcopy(load_bls_correction_fixture()) + fixture["correction"]["corrects_record_id"] = "USDL-OTHER" + with pytest.raises(AssertionError, match="correction linkage changed"): + validate_bls_correction_fixture(fixture) + + fixture = copy.deepcopy(load_bls_correction_fixture()) + fixture["source_policy"]["statistical_validity_claimed"] = True + with pytest.raises(AssertionError, match="source policy changed"): + validate_bls_correction_fixture(fixture) + + result = await run_independent_correction_reproduction(tmp_path) + artifact = copy.deepcopy(result["artifacts"]["treatment"]) + artifact["corrects_source_record_id"] = "USDL-OTHER" + artifact["artifact_id"] = None + artifact["artifact_digest"] = None + with pytest.raises(ValidationError, match="lost its exact correction linkage"): + OfficialCorrectionArtifactV1Alpha1.model_validate_json(json.dumps(artifact)) + + artifact = copy.deepcopy(result["artifacts"]["treatment"]) + artifact["correction_observation"] = artifact["original_observation"] + artifact["artifact_id"] = None + artifact["artifact_digest"] = None + with pytest.raises(ValidationError, match="requires distinct exact source records"): + OfficialCorrectionArtifactV1Alpha1.model_validate_json(json.dumps(artifact)) + + artifact = copy.deepcopy(result["artifacts"]["treatment"]) + artifact["displayed_statement"] = "The estimate was corrected." + artifact["artifact_id"] = None + artifact["artifact_digest"] = None + with pytest.raises(ValidationError, match="introduced an unreviewed statement form"): + OfficialCorrectionArtifactV1Alpha1.model_validate_json(json.dumps(artifact)) + + review = copy.deepcopy(result["observed_results"]["control"][0]) + review["correction_quality_score"] = 1.0 + review["review_id"] = None + review["review_digest"] = None + with pytest.raises(ValidationError, match="score differs from the frozen product rule"): + IndependentCorrectionReviewV1Alpha1.model_validate_json(json.dumps(review)) + + +@pytest.mark.asyncio +async def test_independent_reproduction_is_substantively_deterministic_across_fresh_hosts(tmp_path) -> None: + _require_candidate_contracts() + from scripts.p2c10_independent_correction_reproduction import run_independent_correction_reproduction + + first_root = tmp_path / "first" + second_root = tmp_path / "second" + first_root.mkdir() + second_root.mkdir() + first = await run_independent_correction_reproduction(first_root) + second = await run_independent_correction_reproduction(second_root) + + assert first["source_pair"]["fixture_digest"] == second["source_pair"]["fixture_digest"] + assert first["review_policy"]["policy_id"] == second["review_policy"]["policy_id"] + assert first["review_policy"]["policy_version"] == second["review_policy"]["policy_version"] + for variant in ("treatment", "control"): + first_scores = [item["correction_quality_score"] for item in first["observed_results"][variant]] + second_scores = [item["correction_quality_score"] for item in second["observed_results"][variant]] + assert first_scores == second_scores + for field in ("classification", "matched_pair_count", "mean_effect"): + assert first["evaluation"][field] == second["evaluation"][field] + for field in ("action", "live_effect", "selectable", "requires_human_review"): + assert first["proposal"][field] == second["proposal"][field] diff --git a/scripts/p2c10_independent_correction_reproduction.py b/scripts/p2c10_independent_correction_reproduction.py new file mode 100644 index 0000000..8e8a7de --- /dev/null +++ b/scripts/p2c10_independent_correction_reproduction.py @@ -0,0 +1,852 @@ +"""Reproduce measured correction quality over an independent BLS source family.""" + +from __future__ import annotations + +import asyncio +import json +from datetime import datetime +from pathlib import Path +from typing import Any, Literal, Self + +from ace.application import MeasuredImpactService +from ace.core import ( + AuthenticatedRuntimeContextV1Alpha1, + CapabilityArtifactIdentityV1Alpha1, + GovernedOperationBindingV1Alpha1, + GovernedStateHeadPreconditionV1Alpha1, + ImmutableRecordReferenceV1, + OutcomeIntentV1Alpha1, + OutcomeV1Alpha1, + canonical_hash, + canonical_json, + capability_state_ref_for_artifact, +) +from ace.intelligence import ( + CanonicalJsonValueV1Alpha1, + EvidenceAcquisitionMode, + ImpactClassification, + ImpactConditionsV1Alpha1, + ImpactCriterionV1Alpha1, + ImpactEvaluationRequestV1Alpha1, + ImpactEvidenceV1Alpha1, + ImpactGovernanceAction, + ImpactMetricDirection, + ImpactOutcomeMeasuresV1Alpha1, + ImpactTargetKind, + IntelligenceResourceMode, + ObservationV1Alpha1, +) +from pydantic import Field, field_validator, model_validator + +from scripts.p2c2_federal_register_monitor import _time +from scripts.p2c2_governed_reality_brief import _context, _head +from scripts.p2c3_measured_feedback import ( + ReviewedExport, + _append_value, + _authorize_append, + _digest, + _record_attribution, + _run_reviewed_export, +) +from scripts.p2c5_citation_correctness_outcome import _derive_identity, _FrozenModel +from scripts.p2c7_correction_detection_delay_outcome import _load_observation +from scripts.p2c9_forecast_calibration_outcome import run_forecast_calibration_outcome + +FIXTURE_PATH = ( + Path(__file__).resolve().parents[1] / "domain_packs" / "tests" / "fixtures" / "p2c10_bls_correction_pair.json" +) +OUTCOME_TYPE = "independent_artifact_review" +MEASURE_ID = "official_correction_statement_quality" +CRITERION_ID = "impact_criterion:world-independent-official-correction-statement-quality" +CRITERION_FROZEN_AT = _time("2026-08-10T23:59:00Z") +REVIEW_POLICY_ID = "world_independent_official_correction_statement_quality" +REVIEW_POLICY_VERSION = "candidate-1" + +ORIGINAL_STATEMENT = "The number of job openings decreased in federal government (39,000)." +CORRECTED_STATEMENT = "The number of job openings decreased in federal government (−39,000)." +RELEASE_URI = "https://www.bls.gov/news.release/archives/jolts_07012025.htm" +ERRATA_URI = "https://www.bls.gov/errata/" + +IMPACT_ARTIFACT = CapabilityArtifactIdentityV1Alpha1( + capability="measured_impact_evaluation", + contract="ace.application.measured-impact-service/v1alpha1", + implementation_id="world_independent_correction_reproduction_candidate", + implementation_version="0.1.0", + artifact_digest="sha256:" + "d" * 64, +) + + +class OfficialCorrectionArtifactV1Alpha1(_FrozenModel): + """One exact World rendering of an official correction pair.""" + + contract: Literal["ace.world-intelligence.official-correction-artifact/v1alpha1"] = ( + "ace.world-intelligence.official-correction-artifact/v1alpha1" + ) + product_id: str + artifact_key: str + original_observation: ImmutableRecordReferenceV1 + correction_observation: ImmutableRecordReferenceV1 + source_family: Literal["bls_public_errata"] = "bls_public_errata" + source_release_id: str + correction_record_id: str + corrects_source_record_id: str + correction_relation: Literal["corrects"] = "corrects" + original_statement: str + corrected_statement: str + displayed_statement: str + source_coverage_complete: Literal[True] = True + correction_link_visible: Literal[True] = True + prior_record_preserved: Literal[True] = True + limitations: tuple[str, ...] + generated_at: datetime + artifact_id: str | None = None + artifact_digest: str | None = None + + @field_validator("limitations") + @classmethod + def canonicalize_limitations(cls, value: tuple[str, ...]) -> tuple[str, ...]: + ordered = tuple(sorted(value)) + if not ordered or len(ordered) != len(set(ordered)): + raise ValueError("official-correction limitations must be non-empty and unique") + return ordered + + @model_validator(mode="after") + def validate_scope_pair_and_identity(self) -> Self: + if ( + self.original_observation.product_id != self.product_id + or self.correction_observation.product_id != self.product_id + ): + raise ValueError("official-correction artifact crossed exact product scope") + if self.original_observation.storage_id == self.correction_observation.storage_id: + raise ValueError("official-correction artifact requires distinct exact source records") + if self.corrects_source_record_id != self.source_release_id: + raise ValueError("official-correction artifact lost its exact correction linkage") + if self.original_statement != ORIGINAL_STATEMENT or self.corrected_statement != CORRECTED_STATEMENT: + raise ValueError("official-correction artifact changed the frozen statement pair") + if self.displayed_statement not in {self.original_statement, self.corrected_statement}: + raise ValueError("official-correction artifact introduced an unreviewed statement form") + _derive_identity( + self, + prefix="official_correction_artifact", + id_field="artifact_id", + digest_field="artifact_digest", + ) + return self + + +class IndependentCorrectionReviewV1Alpha1(_FrozenModel): + """Exact product-owned review of correction visibility and statement quality.""" + + contract: Literal["ace.world-intelligence.independent-correction-review/v1alpha1"] = ( + "ace.world-intelligence.independent-correction-review/v1alpha1" + ) + product_id: str + review_key: str + reviewed_subject: ImmutableRecordReferenceV1 + original_observation: ImmutableRecordReferenceV1 + correction_observation: ImmutableRecordReferenceV1 + reviewer_context: AuthenticatedRuntimeContextV1Alpha1 + policy_id: str + policy_version: str + policy_digest: str + source_fixture_digest: str + source_family: Literal["bls_public_errata"] = "bls_public_errata" + source_coverage_complete: bool + correction_link_visible: bool + prior_record_preserved: bool + original_statement: str + expected_corrected_statement: str + displayed_statement: str + corrected_statement_exact: bool + stale_form_present: bool + correction_quality_score: float = Field(ge=0.0, le=1.0) + limitations: tuple[str, ...] + reviewed_at: datetime + review_id: str | None = None + review_digest: str | None = None + + @field_validator("limitations") + @classmethod + def canonicalize_limitations(cls, value: tuple[str, ...]) -> tuple[str, ...]: + ordered = tuple(sorted(value)) + if not ordered or len(ordered) != len(set(ordered)): + raise ValueError("independent-correction review limitations must be non-empty and unique") + return ordered + + @model_validator(mode="after") + def validate_scope_score_and_identity(self) -> Self: + references = (self.reviewed_subject, self.original_observation, self.correction_observation) + if any(item.product_id != self.product_id for item in references): + raise ValueError("independent-correction review crossed exact product scope") + if self.reviewer_context.product_id != self.product_id: + raise ValueError("independent-correction reviewer crossed exact product scope") + if self.original_observation.storage_id == self.correction_observation.storage_id: + raise ValueError("independent-correction review requires distinct source records") + exact = self.displayed_statement == self.expected_corrected_statement + stale = self.displayed_statement == self.original_statement + if self.corrected_statement_exact != exact or self.stale_form_present != stale: + raise ValueError("independent-correction statement disposition was not derived exactly") + expected_score = float( + self.source_coverage_complete + and self.correction_link_visible + and self.prior_record_preserved + and exact + and not stale + ) + if self.correction_quality_score != expected_score: + raise ValueError("correction quality score differs from the frozen product rule") + _derive_identity( + self, + prefix="independent_correction_review", + id_field="review_id", + digest_field="review_digest", + ) + return self + + +class _ReplayMustNotAuthorize: + async def authorize_action(self, request): + raise AssertionError( + f"historical independent-correction evaluation requested new authority: {request.authorization_key}" + ) + + +def validate_bls_correction_fixture(fixture: dict[str, Any]) -> dict[str, Any]: + """Fail closed if the recorded BLS source pair or its policy drifts.""" + + if fixture.get("network_access") is not False: + raise AssertionError("recorded BLS correction fixture must remain network-free") + if fixture.get("source_policy") != { + "publisher": "U.S. Bureau of Labor Statistics", + "source_family": "bls_public_errata", + "release_uri": RELEASE_URI, + "errata_uri": ERRATA_URI, + "recorded_replay": True, + "historical_original_form_derived_from_erratum": True, + "statistical_validity_claimed": False, + }: + raise AssertionError("recorded BLS correction source policy changed") + original = fixture.get("original", {}) + correction = fixture.get("correction", {}) + if original.get("record_id") != "USDL-25-1087" or original.get("release_uri") != RELEASE_URI: + raise AssertionError("recorded BLS release identity changed") + if original.get("reported_sentence_without_required_minus_sign") != ORIGINAL_STATEMENT: + raise AssertionError("recorded BLS original statement changed") + if ( + correction.get("record_id") != "bls-errata-2025-07-01-jolts" + or correction.get("corrects_record_id") != original.get("record_id") + or correction.get("errata_uri") != ERRATA_URI + ): + raise AssertionError("recorded BLS correction linkage changed") + if correction.get("corrected_sentence") != CORRECTED_STATEMENT: + raise AssertionError("recorded BLS corrected statement changed") + return fixture + + +def load_bls_correction_fixture() -> dict[str, Any]: + return validate_bls_correction_fixture(json.loads(FIXTURE_PATH.read_text(encoding="utf-8"))) + + +def bls_correction_fixture_digest(fixture: dict[str, Any]) -> str: + return f"sha256:{canonical_hash(fixture)}" + + +def _install_policy(state: dict[str, Any]): + environment = state["environment"] + runtime = state["runtime"] + product_id = environment.fixture["product_id"] + criterion_head = _head(product_id, "impact_criterion", CRITERION_ID, 110) + operation_head = _head( + product_id, + "governed_operation_configuration", + "governed_operation_configuration:world-independent-official-correction-quality", + 111, + ) + binding = GovernedOperationBindingV1Alpha1( + product_id=product_id, + artifact=IMPACT_ARTIFACT, + configuration_ref=operation_head.state_id, + authority="append_measured_impact", + grant_ref="authority_grant:world-independent-official-correction-quality", + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(operation_head), + ) + capability_head = _head( + product_id, + "capability_state", + capability_state_ref_for_artifact(IMPACT_ARTIFACT), + 112, + ) + authority_head = _head(product_id, "authority_grant", binding.grant_ref, 113) + for head in (criterion_head, operation_head, capability_head, authority_head): + environment.store.set_governed_state_head(head) + runtime.heads[head.state_kind, head.state_id] = head + runtime.bindings = (*runtime.bindings, binding) + return criterion_head, binding + + +async def _append_source_observation( + state: dict[str, Any], + *, + fixture: dict[str, Any], + role: Literal["original", "correction"], +) -> tuple[ObservationV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + source = fixture[role] + source_id = source["record_id"] + published_at = _time(source["published_at"] if role == "original" else source["corrected_at"]) + ingested_at = _time(fixture["recorded_at"]) + fixture_digest = bls_correction_fixture_digest(fixture) + payload = { + "fixture_id": fixture["fixture_id"], + "fixture_digest": fixture_digest, + "record_role": role, + "source_policy": fixture["source_policy"], + "record": source, + } + observation = ObservationV1Alpha1( + product_id=environment.fixture["product_id"], + mode=IntelligenceResourceMode.PREPARED, + activation_revision=state["brief_admission"].brief.activation_revision, + as_of=ingested_at, + source_ref=f"bls_{'release' if role == 'original' else 'erratum'}:{source_id}", + source_digest=_digest(source), + acquisition_mode=EvidenceAcquisitionMode.RECORDED_REPLAY, + acquisition_receipt_ref=f"recorded_replay_acquisition:{source_id}", + acquisition_receipt_digest=_digest( + {"fixture_digest": fixture_digest, "record_id": source_id, "network_access": False} + ), + source_published_at=published_at, + event_effective_at=None, + observed_at=published_at, + ingested_at=ingested_at, + subject_refs=("bls_program:jolts", "bls_release:USDL-25-1087"), + payload=CanonicalJsonValueV1Alpha1(value_json=canonical_json(payload)), + confidence=1.0, + ) + requested_at = state["clock"]() + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"append:world-bls-correction-observation:{role}", + subject_ref=str(observation.resource_id), + subject_digest=str(observation.resource_digest), + requested_at=requested_at, + ) + reference = await _append_value( + state, + value=observation, + record_kind="observation", + record_key=str(observation.resource_id), + transaction_key=f"world-bls-correction-observation:{observation.resource_id}", + as_of=observation.as_of, + authorization=authorization, + ) + return observation, reference + + +async def _append_artifact( + state: dict[str, Any], + *, + fixture: dict[str, Any], + original_ref: ImmutableRecordReferenceV1, + correction_ref: ImmutableRecordReferenceV1, + variant: Literal["treatment", "control"], +) -> tuple[OfficialCorrectionArtifactV1Alpha1, ImmutableRecordReferenceV1, str]: + environment = state["environment"] + displayed = CORRECTED_STATEMENT if variant == "treatment" else ORIGINAL_STATEMENT + artifact = OfficialCorrectionArtifactV1Alpha1( + product_id=environment.fixture["product_id"], + artifact_key=f"bls-jolts-correction:{variant}:USDL-25-1087", + original_observation=original_ref, + correction_observation=correction_ref, + source_release_id=fixture["original"]["record_id"], + correction_record_id=fixture["correction"]["record_id"], + corrects_source_record_id=fixture["correction"]["corrects_record_id"], + original_statement=ORIGINAL_STATEMENT, + corrected_statement=CORRECTED_STATEMENT, + displayed_statement=displayed, + 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", + ), + generated_at=state["clock"](), + ) + authorization = await _authorize_append( + state, + context=environment.context, + authorization_key=f"append:world-bls-correction-artifact:{variant}", + subject_ref=str(artifact.artifact_id), + subject_digest=str(artifact.artifact_digest), + requested_at=state["clock"](), + ) + reference = await _append_value( + state, + value=artifact, + record_kind="official_correction_artifact", + record_key=str(artifact.artifact_id), + transaction_key=f"world-bls-correction-artifact:{artifact.artifact_id}", + as_of=artifact.generated_at, + authorization=authorization, + ) + content = ( + "# BLS JOLTS Correction Review\n\n" + f"Original Observation: {original_ref.storage_id}\n\n" + f"Correction Observation: {correction_ref.storage_id}\n\n" + f"Release: {RELEASE_URI}\n\n" + f"Erratum: {ERRATA_URI}\n\n" + f"Reviewed statement: {displayed}\n" + ) + return artifact, reference, content + + +async def _load_artifact( + state: dict[str, Any], reference: ImmutableRecordReferenceV1 +) -> OfficialCorrectionArtifactV1Alpha1: + record = await state["environment"].store.load_record( + reference.storage_id, + product_id=reference.product_id, + record_space=reference.record_space, + record_kind=reference.record_kind, + ) + if ( + record is None + or record.reference() != reference + or record.payload_contract != "ace.world-intelligence.official-correction-artifact/v1alpha1" + ): + raise AssertionError("official-correction artifact is unavailable or changed") + return OfficialCorrectionArtifactV1Alpha1.model_validate(record.payload) + + +def _policy_digest( + fixture: dict[str, Any], + *, + original_ref: ImmutableRecordReferenceV1, + correction_ref: ImmutableRecordReferenceV1, +) -> str: + return _digest( + { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "fixture_digest": bls_correction_fixture_digest(fixture), + "original_observation": original_ref.model_dump(mode="json"), + "correction_observation": correction_ref.model_dump(mode="json"), + "original_statement": ORIGINAL_STATEMENT, + "corrected_statement": CORRECTED_STATEMENT, + "score": ( + "1 only when exact source coverage, correction linkage, prior-record preservation, " + "corrected statement, and stale-form removal all pass; otherwise 0" + ), + } + ) + + +async def _review_artifact( + state: dict[str, Any], + *, + fixture: dict[str, Any], + subject_ref: ImmutableRecordReferenceV1, + original_ref: ImmutableRecordReferenceV1, + correction_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: Literal["treatment", "control"], +) -> tuple[IndependentCorrectionReviewV1Alpha1, ImmutableRecordReferenceV1]: + environment = state["environment"] + artifact = await _load_artifact(state, subject_ref) + original = await _load_observation(state, original_ref) + correction = await _load_observation(state, correction_ref) + original_payload = original.payload.parsed_value() + correction_payload = correction.payload.parsed_value() + expected_original = original_payload["record"] == fixture["original"] + expected_correction = correction_payload["record"] == fixture["correction"] + source_coverage = bool( + expected_original + and expected_correction + and artifact.original_observation == original_ref + and artifact.correction_observation == correction_ref + ) + linkage = bool( + artifact.correction_relation == "corrects" + and artifact.corrects_source_record_id == artifact.source_release_id + and fixture["correction"]["corrects_record_id"] == fixture["original"]["record_id"] + ) + prior_preserved = bool(await _load_observation(state, original_ref) == original) + exact = artifact.displayed_statement == CORRECTED_STATEMENT + stale = artifact.displayed_statement == ORIGINAL_STATEMENT + reviewer = _context(environment.context, "principal:world-independent-correction-reviewer") + review = IndependentCorrectionReviewV1Alpha1( + product_id=environment.fixture["product_id"], + review_key=f"bls-independent-correction-quality:{pair_index}:{variant}", + reviewed_subject=subject_ref, + original_observation=original_ref, + correction_observation=correction_ref, + reviewer_context=reviewer, + policy_id=REVIEW_POLICY_ID, + policy_version=REVIEW_POLICY_VERSION, + policy_digest=_policy_digest( + fixture, + original_ref=original_ref, + correction_ref=correction_ref, + ), + source_fixture_digest=bls_correction_fixture_digest(fixture), + source_coverage_complete=source_coverage, + correction_link_visible=linkage, + prior_record_preserved=prior_preserved, + original_statement=ORIGINAL_STATEMENT, + expected_corrected_statement=CORRECTED_STATEMENT, + displayed_statement=artifact.displayed_statement, + corrected_statement_exact=exact, + stale_form_present=stale, + correction_quality_score=float(source_coverage and linkage and prior_preserved and exact and not stale), + limitations=artifact.limitations, + reviewed_at=state["clock"](), + ) + authorization = await _authorize_append( + state, + context=reviewer, + authorization_key=f"review:world-bls-independent-correction:{pair_index}:{variant}", + subject_ref=str(review.review_id), + subject_digest=str(review.review_digest), + requested_at=state["clock"](), + ) + reference = await _append_value( + state, + value=review, + record_kind="independent_correction_review", + record_key=str(review.review_id), + transaction_key=f"world-independent-correction-review:{review.review_id}", + as_of=review.reviewed_at, + authorization=authorization, + ) + return review, reference + + +async def _record_review_outcome( + state: dict[str, Any], + *, + export: ReviewedExport, + review: IndependentCorrectionReviewV1Alpha1, + review_ref: ImmutableRecordReferenceV1, + pair_index: int, + variant: Literal["treatment", "control"], +) -> ImmutableRecordReferenceV1: + environment = state["environment"] + latency_ms = max(0, int((review.reviewed_at - export.intent.requested_at).total_seconds() * 1_000)) + measures = ImpactOutcomeMeasuresV1Alpha1( + primary_value=review.correction_quality_score, + observed_result=review_ref, + latency_ms=latency_ms, + cost_usd=0.0, + failure_count=0, + degraded=False, + limitations=review.limitations, + ) + observer = _context(environment.context, "principal:world-independent-correction-outcome-observer") + recorded_at = state["clock"]() + intent = OutcomeIntentV1Alpha1( + product_id=environment.fixture["product_id"], + authenticated_context=observer, + decision=export.decision_ref, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + value_json=canonical_json(measures.model_dump(mode="json")), + observed_at=review.reviewed_at, + recorded_at=recorded_at, + ) + authorization = await _authorize_append( + state, + context=observer, + authorization_key=f"outcome:world-bls-independent-correction:{pair_index}:{variant}", + subject_ref=str(intent.intent_id), + subject_digest=str(intent.intent_digest), + requested_at=recorded_at, + ) + outcome = OutcomeV1Alpha1(intent=intent, authorization=authorization) + return await _append_value( + state, + value=outcome, + record_kind="outcome", + record_key=str(outcome.outcome_id), + transaction_key=f"outcome:{outcome.outcome_id}", + as_of=review.reviewed_at, + authorization=authorization, + ) + + +async def run_independent_correction_reproduction(workspace_root: Path) -> dict[str, Any]: + """Run P2C10 over a recorded BLS correction and unchanged impact contracts.""" + + state: dict[str, Any] = {} + prior_packet = await run_forecast_calibration_outcome(workspace_root, state_sink=state) + environment = state["environment"] + fixture = load_bls_correction_fixture() + original, original_ref = await _append_source_observation(state, fixture=fixture, role="original") + correction, correction_ref = await _append_source_observation(state, fixture=fixture, role="correction") + criterion_head, impact_binding = _install_policy(state) + treatment_artifact, treatment_ref, treatment_content = await _append_artifact( + state, + fixture=fixture, + original_ref=original_ref, + correction_ref=correction_ref, + variant="treatment", + ) + control_artifact, control_ref, control_content = await _append_artifact( + state, + fixture=fixture, + original_ref=original_ref, + correction_ref=correction_ref, + variant="control", + ) + treatment_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=treatment_ref, + content=treatment_content, + pair_index=index, + variant="bls-independent-correction-treatment", + ) + for index in (1, 2) + ] + ) + control_exports = tuple( + [ + await _run_reviewed_export( + state, + subject=control_ref, + content=control_content, + pair_index=index, + variant="bls-independent-correction-control", + ) + for index in (1, 2) + ] + ) + + evidence: list[ImpactEvidenceV1Alpha1] = [] + treatment_reviews: list[IndependentCorrectionReviewV1Alpha1] = [] + control_reviews: list[IndependentCorrectionReviewV1Alpha1] = [] + for index, (treatment_export, control_export) in enumerate( + zip(treatment_exports, control_exports, strict=True), start=1 + ): + treatment_attribution = await _record_attribution( + state, + export=treatment_export, + subject=treatment_ref, + pair_index=index, + variant="bls-independent-correction-treatment", + ) + control_attribution = await _record_attribution( + state, + export=control_export, + subject=control_ref, + pair_index=index, + variant="bls-independent-correction-control", + ) + treatment_review, treatment_review_ref = await _review_artifact( + state, + fixture=fixture, + subject_ref=treatment_ref, + original_ref=original_ref, + correction_ref=correction_ref, + pair_index=index, + variant="treatment", + ) + control_review, control_review_ref = await _review_artifact( + state, + fixture=fixture, + subject_ref=control_ref, + original_ref=original_ref, + correction_ref=correction_ref, + pair_index=index, + variant="control", + ) + treatment_outcome = await _record_review_outcome( + state, + export=treatment_export, + review=treatment_review, + review_ref=treatment_review_ref, + pair_index=index, + variant="treatment", + ) + control_outcome = await _record_review_outcome( + state, + export=control_export, + review=control_review, + review_ref=control_review_ref, + pair_index=index, + variant="control", + ) + treatment_reviews.append(treatment_review) + control_reviews.append(control_review) + conditions = ImpactConditionsV1Alpha1( + product_id=environment.fixture["product_id"], + condition_key=f"world-bls-independent-correction-quality-pair:{index}", + route_id="world:bls-recorded-correction-review", + context_json=canonical_json( + { + "fixture_digest": bls_correction_fixture_digest(fixture), + "pair_index": index, + "review_policy_digest": treatment_review.policy_digest, + "source_family": "bls_public_errata", + "source_refs": sorted((original_ref.storage_id, correction_ref.storage_id)), + "task": "render_exact_official_correction_with_prior_record_preserved", + } + ), + observation_window_start=CRITERION_FROZEN_AT, + observation_window_end=state["clock"](), + frozen_at=CRITERION_FROZEN_AT, + ) + evidence.append( + ImpactEvidenceV1Alpha1( + product_id=environment.fixture["product_id"], + evidence_key=f"world-bls-independent-correction-quality:{index}", + treatment_attribution=treatment_attribution, + control_attribution=control_attribution, + treatment_decision=treatment_export.decision_ref, + control_decision=control_export.decision_ref, + treatment_action_review=treatment_export.review_ref, + treatment_action_admission=treatment_export.admission_ref, + treatment_action_terminal=treatment_export.terminal_ref, + control_action_review=control_export.review_ref, + control_action_admission=control_export.admission_ref, + control_action_terminal=control_export.terminal_ref, + treatment_outcome=treatment_outcome, + control_outcome=control_outcome, + treatment_conditions=conditions, + control_conditions=conditions, + ) + ) + + criterion = ImpactCriterionV1Alpha1( + product_id=environment.fixture["product_id"], + criterion_id=CRITERION_ID, + criterion_version="candidate-1", + target_kind=ImpactTargetKind.INTELLIGENCE_ARTIFACT, + outcome_type=OUTCOME_TYPE, + measure_id=MEASURE_ID, + metric_direction=ImpactMetricDirection.HIGHER_IS_BETTER, + useful_effect_threshold=1.0, + harmful_effect_threshold=1.0, + minimum_matched_pairs=2, + requires_observed_result=True, + harmful_action=ImpactGovernanceAction.ROLLBACK, + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(criterion_head), + frozen_at=CRITERION_FROZEN_AT, + ) + request = ImpactEvaluationRequestV1Alpha1( + evaluation_key="world-independent-correction-quality:bls-jolts-2025-minus-sign", + product_id=environment.fixture["product_id"], + authenticated_context=environment.context, + criterion=criterion, + target=treatment_ref, + control=control_ref, + evidence=tuple(evidence), + cutoff_at=state["clock"](), + requested_at=state["clock"](), + ) + service = MeasuredImpactService( + store=environment.store, + authorizer=state["reasoning"], + operation_binding=impact_binding, + ) + admission = await service.evaluate(request) + historical = await MeasuredImpactService( + store=environment.store, + authorizer=_ReplayMustNotAuthorize(), + operation_binding=impact_binding, + ).evaluate(request) + if admission.replayed or not historical.replayed or historical.evaluation != admission.evaluation: + raise AssertionError("independent-correction evaluation did not replay exact historical material") + if admission.evaluation.classification is not ImpactClassification.USEFUL: + raise AssertionError("frozen independent-correction criterion did not classify useful") + if admission.proposal is None or admission.proposal.action is not ImpactGovernanceAction.PROMOTE: + raise AssertionError("independent-correction result did not emit its proposal-only mapping") + if {item.correction_quality_score for item in treatment_reviews} != {1.0}: + raise AssertionError("independent-correction treatment lost the exact corrected statement") + if {item.correction_quality_score for item in control_reviews} != {0.0}: + raise AssertionError("independent-correction control did not retain the stale statement form") + + state.update( + { + "p2c10_fixture": fixture, + "p2c10_original_observation": original, + "p2c10_original_observation_ref": original_ref, + "p2c10_correction_observation": correction, + "p2c10_correction_observation_ref": correction_ref, + } + ) + return { + "contract": "ace.world-intelligence.independent-correction-reproduction/v1alpha1", + "prior_forecast_calibration": prior_packet, + "source_pair": { + "fixture_id": fixture["fixture_id"], + "fixture_digest": bls_correction_fixture_digest(fixture), + "network_access": fixture["network_access"], + "source_policy": fixture["source_policy"], + "original": fixture["original"], + "correction": fixture["correction"], + "original_observation": original_ref.model_dump(mode="json"), + "correction_observation": correction_ref.model_dump(mode="json"), + }, + "review_policy": { + "policy_id": REVIEW_POLICY_ID, + "policy_version": REVIEW_POLICY_VERSION, + "policy_digest": treatment_reviews[0].policy_digest, + "reviewer_ref": treatment_reviews[0].reviewer_context.actor_ref, + "score_rule": ( + "1 only when exact source coverage, correction linkage, prior-record preservation, " + "corrected statement, and stale-form removal all pass; otherwise 0" + ), + }, + "artifacts": { + "treatment": treatment_artifact.model_dump(mode="json"), + "control": control_artifact.model_dump(mode="json"), + }, + "observed_results": { + "treatment": tuple(item.model_dump(mode="json") for item in treatment_reviews), + "control": tuple(item.model_dump(mode="json") for item in control_reviews), + }, + "evaluation": admission.evaluation.model_dump(mode="json"), + "proposal": admission.proposal.model_dump(mode="json"), + "replay": { + "historical": historical.replayed, + "no_reauthorization": True, + "transaction_receipt_id": str(historical.transaction_receipt.receipt_id), + }, + "scope": { + "independent_source_family_reproduction": True, + "exact_recorded_official_correction_pair": True, + "prior_record_preserved": True, + "domain_neutral_core_contract_unchanged": True, + "domain_pack_changed": False, + "connector_changed": False, + "network_access": False, + "live_monitoring_claimed": False, + "statistical_validity_claimed": False, + "population_correction_performance_claimed": False, + "causality_claimed": False, + "human_benefit_claimed": False, + "proposal_applied": False, + "autonomous_publication": False, + }, + } + + +def main() -> None: + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("workspace_root", type=Path) + args = parser.parse_args() + print( + json.dumps( + asyncio.run(run_independent_correction_reproduction(args.workspace_root)), + indent=2, + sort_keys=True, + ) + ) + + +if __name__ == "__main__": + main() diff --git a/scripts/p2c9_forecast_calibration_outcome.py b/scripts/p2c9_forecast_calibration_outcome.py index 047afab..cb82693 100644 --- a/scripts/p2c9_forecast_calibration_outcome.py +++ b/scripts/p2c9_forecast_calibration_outcome.py @@ -551,10 +551,14 @@ async def _record_review_outcome( ) -async def run_forecast_calibration_outcome(workspace_root: Path) -> dict[str, Any]: +async def run_forecast_calibration_outcome( + workspace_root: Path, + *, + state_sink: dict[str, Any] | None = None, +) -> dict[str, Any]: """Run P2C9 over a withheld exact correction result and declared probabilities.""" - state: dict[str, Any] = {} + state: dict[str, Any] = {} if state_sink is None else state_sink prior_packet = await run_correction_revision_stability_outcome( workspace_root, state_sink=state, From 66712c2e26dedccf45c7f9b825065485a74c8236 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 06:45:46 -0700 Subject: [PATCH 09/17] 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 db2c904..5dceb1f 100644 --- a/README.md +++ b/README.md @@ -445,6 +445,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 2e799203b5f0e4ac93553c4f99a15228d894651f Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 06:48:04 -0700 Subject: [PATCH 10/17] 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 654007a9844b9b078c57ed9b1be9fa06c70bbfee Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 06:50:24 -0700 Subject: [PATCH 11/17] 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 b2e8284b68fd4542ded033ddf5ddbf4c953186d5 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 06:58:27 -0700 Subject: [PATCH 12/17] 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 5dceb1f..9e0acd8 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 9238ab05267d5eb1c1344defe6026780d5f7e1f2 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 07:01:19 -0700 Subject: [PATCH 13/17] 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 9e0acd8..624932c 100644 --- a/README.md +++ b/README.md @@ -447,6 +447,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. From 87625d55c717a9c649d4f44a06d1767b52fed255 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 07:40:15 -0700 Subject: [PATCH 14/17] chore(world): reconcile live-main release hygiene --- .../ai_policy_adapter.py | 36 ++----- .../network_transport.py | 74 ++++----------- .../white_house_adapter.py | 11 +-- .../tests/test_ai_policy_adapter.py | 4 +- .../tests/test_opt_in_network_transport.py | 8 +- .../tests/test_white_house_adapter.py | 10 +- .../tests/test_world_intelligence_ai_pack.py | 9 +- scripts/ai_command_center_live_acceptance.py | 95 +++++-------------- 8 files changed, 61 insertions(+), 186 deletions(-) diff --git a/adapters/federal_register_source/src/ace_world_federal_register_source/ai_policy_adapter.py b/adapters/federal_register_source/src/ace_world_federal_register_source/ai_policy_adapter.py index de94462..938c06f 100644 --- a/adapters/federal_register_source/src/ace_world_federal_register_source/ai_policy_adapter.py +++ b/adapters/federal_register_source/src/ace_world_federal_register_source/ai_policy_adapter.py @@ -33,16 +33,12 @@ AI_POLICY_AGENCY_NAME = "Executive Office of the President" AI_POLICY_DOCUMENT_TYPE = "Presidential Document" AI_POLICY_TITLE = "Promoting Advanced Artificial Intelligence Innovation and Security" -AI_POLICY_DOCUMENT_URI = ( - "https://www.federalregister.gov/api/v1/documents/2026-11415.json" -) +AI_POLICY_DOCUMENT_URI = "https://www.federalregister.gov/api/v1/documents/2026-11415.json" AI_POLICY_HTML_URI = ( "https://www.federalregister.gov/documents/2026/06/05/2026-11415/" "promoting-advanced-artificial-intelligence-innovation-and-security" ) -AI_POLICY_OFFICIAL_PDF_URI = ( - "https://www.govinfo.gov/content/pkg/FR-2026-06-05/pdf/2026-11415.pdf" -) +AI_POLICY_OFFICIAL_PDF_URI = "https://www.govinfo.gov/content/pkg/FR-2026-06-05/pdf/2026-11415.pdf" AI_POLICY_LOCATOR = "json-pointer:/document_number" AI_POLICY_LINEAGE_ID = "federal_register:2026-11415" AI_POLICY_LINKED_POLICY_REF = "executive_order:14409" @@ -104,26 +100,20 @@ def _canonical_ai_policy_payload(response_body: object, *, max_chars: int) -> st raise _fail("AI-policy response must be one JSON object") title = _ai_text(payload.get("title"), name="title", maximum=1_000) - document_number = _ai_text( - payload.get("document_number"), name="document_number", maximum=32 - ) + document_number = _ai_text(payload.get("document_number"), name="document_number", maximum=32) executive_order_number = _ai_text( payload.get("executive_order_number"), name="executive_order_number", maximum=32, ) document_type = _ai_text(payload.get("type"), name="type", maximum=128) - publication_date = _ai_text( - payload.get("publication_date"), name="publication_date", maximum=10 - ) + publication_date = _ai_text(payload.get("publication_date"), name="publication_date", maximum=10) html_url = _ai_text(payload.get("html_url"), name="html_url", maximum=2_048) pdf_url = _ai_text(payload.get("pdf_url"), name="pdf_url", maximum=2_048) agencies = payload.get("agencies") if type(agencies) is not list or len(agencies) != 1 or type(agencies[0]) is not dict: raise _fail("agencies must contain exactly one agency object") - agency_name = _ai_text( - agencies[0].get("name"), name="agencies[0].name", maximum=256 - ) + agency_name = _ai_text(agencies[0].get("name"), name="agencies[0].name", maximum=256) exact = { "title": (title, AI_POLICY_TITLE), @@ -191,9 +181,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: @@ -247,12 +235,8 @@ async def capture( if result.status_code != 200 or result.media_type != "application/json": raise _fail("retrieval result must be exact HTTP 200 application/json material") - resolved = _ai_addresses( - result.resolved_ip_addresses, name="resolved_ip_addresses" - ) - connected = _ai_addresses( - result.connected_ip_addresses, name="connected_ip_addresses" - ) + resolved = _ai_addresses(result.resolved_ip_addresses, name="resolved_ip_addresses") + connected = _ai_addresses(result.connected_ip_addresses, name="connected_ip_addresses") if connected != resolved: raise _fail("every resolved and connected address must remain exactly attested") observed_at = _ai_time(result.observed_at, name="observed_at") @@ -264,9 +248,7 @@ async def capture( result.response_body, max_chars=transport_request.max_response_chars, ) - payload_digest = "sha256:" + hashlib.sha256( - payload_json.encode("utf-8") - ).hexdigest() + payload_digest = "sha256:" + hashlib.sha256(payload_json.encode("utf-8")).hexdigest() return CapturedSourceMaterialV1Alpha1( capture_request_ref=str(validated.request_id), capture_request_digest=str(validated.request_digest), diff --git a/adapters/federal_register_source/src/ace_world_federal_register_source/network_transport.py b/adapters/federal_register_source/src/ace_world_federal_register_source/network_transport.py index c12200a..71d55ae 100644 --- a/adapters/federal_register_source/src/ace_world_federal_register_source/network_transport.py +++ b/adapters/federal_register_source/src/ace_world_federal_register_source/network_transport.py @@ -77,14 +77,9 @@ def _resolve_public_addresses(host: str, port: int) -> tuple[str, ...]: if not addresses: raise FederalRegisterNetworkTransportError("DNS returned no addresses") try: - return tuple( - validate_public_ip_literal(address, name="resolved_ip_address") - for address in addresses - ) + return tuple(validate_public_ip_literal(address, name="resolved_ip_address") for address in addresses) except ValueError as exc: - raise FederalRegisterNetworkTransportError( - "DNS returned a non-public or otherwise prohibited address" - ) from exc + raise FederalRegisterNetworkTransportError("DNS returned a non-public or otherwise prohibited address") from exc def _connection(host: str, address: str, timeout: float) -> http.client.HTTPSConnection: @@ -111,9 +106,7 @@ def __init__( clock: Clock = _utc_now, ) -> None: if type(enabled) is not bool or enabled is not True: - raise FederalRegisterNetworkTransportError( - "public network capture requires explicit enabled=True opt-in" - ) + raise FederalRegisterNetworkTransportError("public network capture requires explicit enabled=True opt-in") if ( type(timeout_seconds) not in {int, float} or isinstance(timeout_seconds, bool) @@ -138,13 +131,9 @@ def __init__( "authorized_uri must be one exact credential-free Federal Register API document" ) if type(source_type_ref) is not str or not source_type_ref: - raise FederalRegisterNetworkTransportError( - "source_type_ref must be non-empty text" - ) + raise FederalRegisterNetworkTransportError("source_type_ref must be non-empty text") if type(locator) is not str or not locator.startswith("json-pointer:/"): - raise FederalRegisterNetworkTransportError( - "locator must be one explicit JSON pointer" - ) + raise FederalRegisterNetworkTransportError("locator must be one explicit JSON pointer") self._authorized_uri = authorized_uri self._source_type_ref = source_type_ref self._locator = locator @@ -176,16 +165,9 @@ def _retrieve( or request.public_network_only is not True or request.dns_rebinding_protection_required is not True ): - raise FederalRegisterNetworkTransportError( - "network request crossed the reviewed source or security policy" - ) - if ( - type(request.max_response_chars) is not int - or not 1 <= request.max_response_chars <= 32_768 - ): - raise FederalRegisterNetworkTransportError( - "max_response_chars crossed the reviewed 1..32768 bound" - ) + raise FederalRegisterNetworkTransportError("network request crossed the reviewed source or security policy") + if type(request.max_response_chars) is not int or not 1 <= request.max_response_chars <= 32_768: + raise FederalRegisterNetworkTransportError("max_response_chars crossed the reviewed 1..32768 bound") parsed = urlsplit(request.requested_uri) if ( @@ -196,18 +178,13 @@ def _retrieve( or parsed.password is not None or parsed.fragment ): - raise FederalRegisterNetworkTransportError( - "reviewed source URI must remain exact credential-free HTTPS" - ) + raise FederalRegisterNetworkTransportError("reviewed source URI must remain exact credential-free HTTPS") path = parsed.path + (f"?{parsed.query}" if parsed.query else "") addresses = tuple(self._resolver(parsed.hostname, 443)) if not addresses: raise FederalRegisterNetworkTransportError("DNS returned no addresses") try: - validated = tuple( - validate_public_ip_literal(address, name="resolved_ip_address") - for address in addresses - ) + validated = tuple(validate_public_ip_literal(address, name="resolved_ip_address") for address in addresses) except ValueError as exc: raise FederalRegisterNetworkTransportError( "DNS returned a non-public or otherwise prohibited address" @@ -232,9 +209,7 @@ def _retrieve( }, ) response = connection.getresponse() - content_encoding = ( - response.getheader("Content-Encoding") or "identity" - ).lower() + content_encoding = (response.getheader("Content-Encoding") or "identity").lower() if content_encoding not in {"", "identity"}: raise FederalRegisterNetworkTransportError( "compressed response crossed the bounded identity encoding policy" @@ -249,31 +224,18 @@ def _retrieve( "response Content-Length was not an integer" ) from exc if declared_length < 0 or declared_length > maximum_bytes: - raise FederalRegisterNetworkTransportError( - "response exceeded the bounded byte limit" - ) + raise FederalRegisterNetworkTransportError("response exceeded the bounded byte limit") body_bytes = response.read(maximum_bytes + 1) if len(body_bytes) > maximum_bytes: - raise FederalRegisterNetworkTransportError( - "response exceeded the bounded byte limit" - ) + raise FederalRegisterNetworkTransportError("response exceeded the bounded byte limit") try: body = body_bytes.decode("utf-8", errors="strict") except UnicodeDecodeError as exc: - raise FederalRegisterNetworkTransportError( - "response was not strict UTF-8" - ) from exc + raise FederalRegisterNetworkTransportError("response was not strict UTF-8") from exc if len(body) > request.max_response_chars: - raise FederalRegisterNetworkTransportError( - "response exceeded the bounded character limit" - ) + raise FederalRegisterNetworkTransportError("response exceeded the bounded character limit") captured_at = self._clock() - media_type = ( - (response.getheader("Content-Type") or "") - .split(";", 1)[0] - .strip() - .lower() - ) + media_type = (response.getheader("Content-Type") or "").split(";", 1)[0].strip().lower() return FederalRegisterRetrievalResult( source_type_ref=request.source_type_ref, requested_uri=request.requested_uri, @@ -301,9 +263,7 @@ def _retrieve( finally: connection.close() summary = ", ".join(errors) if errors else "no connection attempt completed" - raise FederalRegisterNetworkTransportError( - f"all validated public source addresses failed: {summary}" - ) + raise FederalRegisterNetworkTransportError(f"all validated public source addresses failed: {summary}") __all__ = [ diff --git a/adapters/federal_register_source/src/ace_world_federal_register_source/white_house_adapter.py b/adapters/federal_register_source/src/ace_world_federal_register_source/white_house_adapter.py index 5beee48..8194a1d 100644 --- a/adapters/federal_register_source/src/ace_world_federal_register_source/white_house_adapter.py +++ b/adapters/federal_register_source/src/ace_world_federal_register_source/white_house_adapter.py @@ -33,8 +33,7 @@ "cybersecurity-vulnerability-coordination/" ) WHITE_HOUSE_RELEASE_TITLE = ( - "White House Launches Gold Eagle Initiative for Unprecedented " - "Cybersecurity Vulnerability Coordination" + "White House Launches Gold Eagle Initiative for Unprecedented Cybersecurity Vulnerability Coordination" ) WHITE_HOUSE_RELEASE_DATE = "2026-07-14" WHITE_HOUSE_RELEASE_IDENTIFIER = "white-house-release-2026-07-14-gold-eagle" @@ -204,9 +203,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: @@ -292,9 +289,7 @@ async def capture( resolved_ip_addresses=resolved, dns_rebinding_protection_applied=True, captured_payload_json=payload_json, - captured_payload_digest=( - "sha256:" + hashlib.sha256(payload_json.encode("utf-8")).hexdigest() - ), + captured_payload_digest=("sha256:" + hashlib.sha256(payload_json.encode("utf-8")).hexdigest()), locator=WHITE_HOUSE_LOCATOR, source_published_at=datetime(2026, 7, 14, tzinfo=UTC), event_effective_at=None, diff --git a/adapters/federal_register_source/tests/test_ai_policy_adapter.py b/adapters/federal_register_source/tests/test_ai_policy_adapter.py index 89ee05a..cde9962 100644 --- a/adapters/federal_register_source/tests/test_ai_policy_adapter.py +++ b/adapters/federal_register_source/tests/test_ai_policy_adapter.py @@ -122,9 +122,7 @@ async def test_ai_policy_document_becomes_closed_attributable_metadata() -> None "publication_date": "2026-06-05", "source_lineage_id": "federal_register:2026-11415", "source_uri": AI_POLICY_HTML_URI, - "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 capture.captured_payload_json assert capture.requested_uri == capture.effective_uri == AI_POLICY_DOCUMENT_URI diff --git a/adapters/federal_register_source/tests/test_opt_in_network_transport.py b/adapters/federal_register_source/tests/test_opt_in_network_transport.py index 607ee42..fefcd39 100644 --- a/adapters/federal_register_source/tests/test_opt_in_network_transport.py +++ b/adapters/federal_register_source/tests/test_opt_in_network_transport.py @@ -25,9 +25,7 @@ def __init__( ) -> None: self.status = status self._body = body - self._headers = { - key.lower(): value for key, value in (headers or {}).items() - } + self._headers = {key.lower(): value for key, value in (headers or {}).items()} def getheader(self, name: str): return self._headers.get(name.lower()) @@ -198,9 +196,7 @@ async def test_transport_rejects_policy_drift_before_dns() -> None: @pytest.mark.asyncio async def test_transport_reuses_security_boundary_for_another_exact_document() -> None: ai_uri = "https://www.federalregister.gov/api/v1/documents/2026-11415.json" - connection = _Connection( - _Response(b"{}", headers={"Content-Type": "application/json"}) - ) + connection = _Connection(_Response(b"{}", headers={"Content-Type": "application/json"})) transport = OptInFederalRegisterNetworkTransport( enabled=True, authorized_uri=ai_uri, diff --git a/adapters/federal_register_source/tests/test_white_house_adapter.py b/adapters/federal_register_source/tests/test_white_house_adapter.py index 9de3c5c..bac0803 100644 --- a/adapters/federal_register_source/tests/test_white_house_adapter.py +++ b/adapters/federal_register_source/tests/test_white_house_adapter.py @@ -122,21 +122,17 @@ async def test_exact_white_house_release_becomes_closed_inert_material() -> None ), "initiative_name": "GOLD EAGLE", "legal_status_notice": ( - "WhiteHouse.gov announces implementation; it is not the legal edition of " - "Executive Order 14409." + "WhiteHouse.gov announces implementation; it is not the legal edition of Executive Order 14409." ), "linked_policy_ref": "executive_order:14409", - "official_pdf_url": ( - "https://www.govinfo.gov/content/pkg/FR-2026-06-05/pdf/2026-11415.pdf" - ), + "official_pdf_url": ("https://www.govinfo.gov/content/pkg/FR-2026-06-05/pdf/2026-11415.pdf"), "policy_status": "implementation_reported", "policy_topic": "artificial_intelligence", "publication_date": "2026-07-14", "source_lineage_id": "white_house_release:gold_eagle_2026_07_14", "source_uri": WHITE_HOUSE_RELEASE_URI, "verification_reference": ( - "The release names Executive Order 14409; the govinfo PDF remains the " - "official-format order reference." + "The release names Executive Order 14409; the govinfo PDF remains the official-format order reference." ), } assert capture.source_published_at == datetime(2026, 7, 14, tzinfo=UTC) diff --git a/domain_packs/tests/test_world_intelligence_ai_pack.py b/domain_packs/tests/test_world_intelligence_ai_pack.py index 56a5fb2..ca2dc63 100644 --- a/domain_packs/tests/test_world_intelligence_ai_pack.py +++ b/domain_packs/tests/test_world_intelligence_ai_pack.py @@ -15,10 +15,7 @@ def _compile(): manifest = json.loads(manifest_bytes) return compile_pack_document( manifest_bytes, - { - resource["path"]: (PACK / resource["path"]).read_bytes() - for resource in manifest["resources"] - }, + {resource["path"]: (PACK / resource["path"]).read_bytes() for resource in manifest["resources"]}, ) @@ -50,9 +47,7 @@ def test_ai_topic_pack_is_json_only_and_source_specific() -> None: } manifest = json.loads((PACK / "manifest.json").read_text()) - assert {item["authority"] for item in manifest["authority_requests"]} == { - "source_read" - } + assert {item["authority"] for item in manifest["authority_requests"]} == {"source_read"} assert "entry_points" not in manifest diff --git a/scripts/ai_command_center_live_acceptance.py b/scripts/ai_command_center_live_acceptance.py index 4e81f85..40e9b15 100644 --- a/scripts/ai_command_center_live_acceptance.py +++ b/scripts/ai_command_center_live_acceptance.py @@ -117,10 +117,7 @@ def compile_ai_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"]}, ) @@ -145,9 +142,7 @@ def _head( 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, @@ -165,9 +160,7 @@ async def resolve_source_definition( class ExactAdapterRegistry: def __init__(self, adapters: tuple[Any, ...]) -> None: - self.adapters = { - item.artifact_identity: item for item in adapters - } + self.adapters = {item.artifact_identity: item for item in adapters} def resolve_source_adapter(self, *, artifact): return self.adapters.get(artifact) @@ -215,8 +208,7 @@ async def resolve_capability_use(self, **request): or request["context"] != self.context or request["operation"] != "capture" or request["configuration_ref"] != binding.configuration_ref - or request["capability_state_ref"] - != capability_state_ref_for_artifact(binding.artifact) + or request["capability_state_ref"] != capability_state_ref_for_artifact(binding.artifact) ): raise ValueError("capability use crossed exact AI source scope") return CapabilityUseReceiptV1Alpha1( @@ -231,9 +223,7 @@ async def resolve_capability_use(self, **request): configuration_ref=binding.configuration_ref, evaluated_at=request["evaluated_at"], resolved_at=request["evaluated_at"], - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - binding.capability_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(binding.capability_head), ) async def resolve_authority_use(self, **request): @@ -258,17 +248,13 @@ async def resolve_authority_use(self, **request): grant_hash=binding.grant_hash, evaluated_at=request["evaluated_at"], expires_at=self.context.expires_at, - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - binding.grant_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(binding.grant_head), ) class ExactAppendAuthorizer: def __init__(self) -> None: - self.issued: dict[ - tuple[str, str, str], GovernedActionAuthorizationProjection - ] = {} + self.issued: dict[tuple[str, str, str], GovernedActionAuthorizationProjection] = {} async def authorize_action(self, request): projection = GovernedActionAuthorizationProjection( @@ -279,9 +265,7 @@ async def authorize_action(self, request): authorized_at=request.requested_at, state_preconditions=request.required_state_preconditions, ) - self.issued[(request.operation, request.subject_ref, request.subject_digest)] = ( - projection - ) + self.issued[(request.operation, request.subject_ref, request.subject_digest)] = projection return projection async def verify_action_reference( @@ -375,9 +359,7 @@ async def build_environment() -> CommandCenterEnvironment: pack=pack, overlay=overlay, compilation_receipt_ref=fixture["activation"]["compilation_receipt_ref"], - conformance_receipt_refs=( - fixture["activation"]["conformance_receipt_ref"], - ), + conformance_receipt_refs=(fixture["activation"]["conformance_receipt_ref"],), capability_bindings=tuple( CapabilityBindingV1( requirement_id=source["capability_requirement_id"], @@ -417,9 +399,7 @@ async def build_environment() -> CommandCenterEnvironment: expected_head_revision_id=None, committed_at=_time(fixture["activation"]["committed_at"]), ) - 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)] heads: list[GovernedStateHeadV1] = [] runtime_bindings: list[RuntimeBinding] = [] @@ -472,9 +452,7 @@ async def build_environment() -> CommandCenterEnvironment: 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( @@ -552,9 +530,7 @@ async def build_environment() -> CommandCenterEnvironment: configuration_ref=append_head.state_id, authority="append_immutable_records", grant_ref="authority_grant:world-ai-live-append", - state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head( - append_head - ), + state_head_precondition=GovernedStateHeadPreconditionV1Alpha1.from_head(append_head), ) store = InMemoryImmutableRecordStore() for head in (activation_head, *heads, append_head): @@ -638,12 +614,8 @@ async def _append_resource( subject_digest=str(resource.resource_digest), requested_at=submitted_at, required_state_preconditions=( - GovernedStateHeadPreconditionV1Alpha1.from_head( - environment.activation_head - ), - GovernedStateHeadPreconditionV1Alpha1.from_head( - environment.append_head - ), + GovernedStateHeadPreconditionV1Alpha1.from_head(environment.activation_head), + GovernedStateHeadPreconditionV1Alpha1.from_head(environment.append_head), ), ) ) @@ -755,13 +727,9 @@ async def run_acceptance() -> dict[str, Any]: def snapshot_reference(admission): available_at = next( - item.available_at - for item in admission.transaction_receipt.records - if item.record_kind == "entity_snapshot" - ) - return resource_reference(admission.entity_snapshot).model_copy( - update={"available_at": available_at} + item.available_at for item in admission.transaction_receipt.records if item.record_kind == "entity_snapshot" ) + return resource_reference(admission.entity_snapshot).model_copy(update={"available_at": available_at}) derivation_request = LiveDerivationRequestV1Alpha1( derivation_key=derivation_fixture["derivation_key"], @@ -773,9 +741,7 @@ def snapshot_reference(admission): baseline=snapshot_reference(baseline), current=snapshot_reference(current), 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( @@ -803,16 +769,11 @@ def snapshot_reference(admission): lineage=( _lineage(derivation.shift, relation=LineageRelation.DERIVED_FROM), _lineage(derivation.signal, relation=LineageRelation.DERIVED_FROM), - *( - _lineage(item, relation=LineageRelation.SUPPORTS) - for item in observations - ), + *(_lineage(item, relation=LineageRelation.SUPPORTS) for item in observations), ), case_type_ref="case_type:ai_policy_progression", title="Executive Order 14409 to reported GOLD EAGLE implementation", - purpose=( - "Freeze the exact two-lineage official-source progression before cited synthesis." - ), + purpose=("Freeze the exact two-lineage official-source progression before cited synthesis."), subject_refs=(environment.fixture["entity_ref"],), assembled_at=case_time, ) @@ -900,12 +861,10 @@ def snapshot_reference(admission): "source": { "modes": [item.observation.mode.value for item in (baseline, current)], "lineages": [ - item.entity_snapshot.attributes.parsed_value()["source_lineage_id"] - for item in (baseline, current) + item.entity_snapshot.attributes.parsed_value()["source_lineage_id"] for item in (baseline, current) ], "stages": [ - item.entity_snapshot.attributes.parsed_value()["development_stage"] - for item in (baseline, current) + item.entity_snapshot.attributes.parsed_value()["development_stage"] for item in (baseline, current) ], "stable_entity_ref": ( baseline.entity_snapshot.entity_ref @@ -929,20 +888,14 @@ def snapshot_reference(admission): "brief_mode": brief.mode.value, "citation_count": len(brief.citations), "claim_count": len(brief.claims), - "cited_source_refs": sorted( - citation.source_ref for citation in brief.citations - ), + "cited_source_refs": sorted(citation.source_ref for citation in brief.citations), }, "separation": { "live_record_count": sum( - 1 - for record in environment.store.records.values() - if record.record_space == LIVE_SOURCE_RECORD_SPACE + 1 for record in environment.store.records.values() if record.record_space == LIVE_SOURCE_RECORD_SPACE ), "prepared_record_count": sum( - 1 - for record in environment.store.records.values() - if record.record_space == "prepared" + 1 for record in environment.store.records.values() if record.record_space == "prepared" ), "prepared_material_reused": False, "autonomous_publication": False, From 2d7a0ace72bed4d175b0884c8a9b81b6ec063d56 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 07:47:03 -0700 Subject: [PATCH 15/17] docs(world): freeze live-main convergence evidence --- README.md | 11 ++- ROADMAP.md | 3 + .../measured-intelligence/convergence-v1.json | 6 +- ...ntelligence-main-convergence-2026-08-11.md | 90 +++++++++++++++++++ ...ligence-main-convergence-work-packet-v1.md | 67 ++++++++++++++ 5 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 docs/audits/world-measured-intelligence-main-convergence-2026-08-11.md create mode 100644 docs/design/world-measured-intelligence-main-convergence-work-packet-v1.md diff --git a/README.md b/README.md index 624932c..d8d853d 100644 --- a/README.md +++ b/README.md @@ -447,9 +447,14 @@ 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). +The original point-in-time +[stacked convergence audit](docs/audits/world-measured-intelligence-release-convergence-2026-08-11.md) +and the later +[live-main convergence audit](docs/audits/world-measured-intelligence-main-convergence-2026-08-11.md) +bind their exact built-artifact hashes and byte-reproducible +[`convergence-v1.json`](artifacts/measured-intelligence/convergence-v1.json). The live-main packet +also proves coexistence with the separately merged AI Command Center lineage work without changing +the measured-feedback contract or silently applying its proposal. 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 ea4de4a..06b08db 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -62,6 +62,9 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). 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. +- A separate direct-to-main convergence candidate replays the measured stack on the live World + baseline that includes the AI Command Center lineage proof, rebuilds exact artifacts, and passes + the combined journey. It does not merge the review stack or advance release status. 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/artifacts/measured-intelligence/convergence-v1.json b/artifacts/measured-intelligence/convergence-v1.json index cec945b..864ea77 100644 --- a/artifacts/measured-intelligence/convergence-v1.json +++ b/artifacts/measured-intelligence/convergence-v1.json @@ -12,17 +12,17 @@ }, "source_adapter_wheel": { "filename": "ace_ext_world_federal_register_source-0.2.0-py3-none-any.whl", - "sha256": "sha256:bee0161c6a02b2d82b698d72365e401e7c58af633c8f0e774e513619866a90d6" + "sha256": "sha256:1b80cc598b467a8ab0f47aabb5f01bd0cb1c7709b48aa02352a0ef802988b4fe" }, "world_wheel": { "filename": "ace_domain_world_intelligence-0.9.0-py3-none-any.whl", - "sha256": "sha256:61abbd08bfedb2dc23cdd0eab8b9a0454b7d7a911ba150e4308e12d9e1cfa534" + "sha256": "sha256:a067b3106772437d2dcfee890dc7d89005d3f7afd9e6dc0cbed027327bea9cae" } }, "core_commit": "433e3d16c5458c975557dcd1552824fb959d4d12", "core_distribution_version": "0.5.0", "source_adapter_distribution_version": "0.2.0", - "world_commit": "7fec49b163fd4c50964576a45511c8645e856f3d", + "world_commit": "87625d55c717a9c649d4f44a06d1767b52fed255", "world_distribution_version": "0.9.0" }, "claim_boundary": { diff --git a/docs/audits/world-measured-intelligence-main-convergence-2026-08-11.md b/docs/audits/world-measured-intelligence-main-convergence-2026-08-11.md new file mode 100644 index 0000000..e36cf01 --- /dev/null +++ b/docs/audits/world-measured-intelligence-main-convergence-2026-08-11.md @@ -0,0 +1,90 @@ +# World measured-intelligence main-convergence audit — 2026-08-11 + +**Status:** bounded direct-to-main candidate evidence. This is not a merge, tag, release, SI4 pass, +ACE 0.6.0 completion, live-monitoring proof, or applied governance change. + +## Exact source and artifact identity + +- World live-main base: `8de1027c4c995582b42c4a1f936a72e2c42878a0` +- World executable source: `87625d55c717a9c649d4f44a06d1767b52fed255` +- Core measured-impact source: `433e3d16c5458c975557dcd1552824fb959d4d12` +- Branch: `codex/world-measured-intelligence-main-convergence` + +| 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 | `1b80cc598b467a8ab0f47aabb5f01bd0cb1c7709b48aa02352a0ef802988b4fe` | +| `ace_domain_world_intelligence-0.9.0-py3-none-any.whl` | 0.9.0 candidate | `a067b3106772437d2dcfee890dc7d89005d3f7afd9e6dc0cbed027327bea9cae` | + +Both World-owned wheels were built twice from the exact source with +`SOURCE_DATE_EPOCH=1786459215`; each repeated wheel was byte-identical. The two generated source +distributions contained the same source but their gzip containers were not byte-identical, so this +packet makes no reproducible-sdist claim. A final release must bind one exact sdist and wheel set. + +No version was advanced and no artifact was published. + +## Live-main reconciliation + +The existing thirteen candidate commits were replayed in order onto live `main` without rewriting +or updating any stacked review branch. The only conflict was the README audit list and dispatch +paragraph: the resolution preserved both the merged AI Command Center lineage evidence and the +measured-feedback evidence. No Python, fixture, manifest, or expected-result conflict occurred. + +The repository-wide locked formatter then identified eight files inherited from the new live-main +commit. One mechanical commit formatted those files. The focused AI/source tests remained green, +and no product rule, fixture, source coordinate, expected outcome, or authority boundary changed. + +## Installed-artifact reproduction + +A fresh Python 3.12 environment loaded Core, the reference action adapter, and the Federal Register +source adapter from `site-packages`. The generator rejected every declared Core checkout root. Two +fresh workspace roots produced byte-identical canonical JSON: + +```text +sha256:b70f972e6b7e86ddce09eb3feaa3cd89eede2b236d3e592ee5417dda4d3e95f7 +``` + +The record retains the exact public BLS correction pair, product-owned scoring rule, treatment +scores `[1.0, 1.0]`, control scores `[0.0, 0.0]`, two matched pairs, mean effect `1.0`, useful +classification, and proposal-only `promote`. The proposal remains non-effective, non-selectable, +unapplied, requires human review, and is not reauthorized on historical replay. + +## Verification + +```text +# combined live-main AI lineage plus P2C3-P2C10 and convergence controls +37 passed in 19.49s + +# complete World suite with the exact candidate Core artifact +120 passed in 31.74s + +# Federal Register adapter suite +62 passed in 0.39s + +# package/release contract +7 passed in 0.07s + +# focused post-format AI/source controls +66 passed in 0.52s + +ruff 0.16.2 check --no-cache . +All checks passed! + +ruff 0.16.2 format --check --no-cache . +98 files already formatted + +git diff --check +PASS +``` + +## Claim boundary and remaining gates + +This is one deterministic recorded-replay association under a frozen World correction rule. It is +not causality, population correction performance, JOLTS statistical validation, live freshness, +general SI4 completion, or human benefit. The newly coexisting AI Command Center proof is also +recorded transport, not autonomous live monitoring or publishing. + +Core issue #49 F1, F3, and F5 remain open 0.6 gates. Core stack review, merged-source security and +compatibility checks, final version and artifact decisions, public-index installation, and +publication remain release-owner work. diff --git a/docs/design/world-measured-intelligence-main-convergence-work-packet-v1.md b/docs/design/world-measured-intelligence-main-convergence-work-packet-v1.md new file mode 100644 index 0000000..9d277e4 --- /dev/null +++ b/docs/design/world-measured-intelligence-main-convergence-work-packet-v1.md @@ -0,0 +1,67 @@ +# World measured-intelligence main-convergence work packet (v1) + +**Status:** bounded direct-to-main integration candidate. This packet does not merge or close any +existing stacked pull request, 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 base:** World `main` commit `8de1027c4c995582b42c4a1f936a72e2c42878a0`, including the +LIVE AI Command Center lineage proof from World PR #14. + +**Executable candidate:** World commit `87625d55c717a9c649d4f44a06d1767b52fed255` with Core +measured-impact commit `433e3d16c5458c975557dcd1552824fb959d4d12`. + +## Objective + +Reproduce the P2C3-P2C10 measured-intelligence stack and its artifact-convergence packet directly +on live World `main` without rewriting or merging the existing review branches. The result must +show that the newly landed AI Command Center lineage proof and the measured-feedback journey can +coexist under the same Domain Pack boundary and release gates. + +## Method and acceptance + +The packet must: + +1. replay the thirteen existing candidate commits onto an isolated branch from exact live `main`; +2. preserve both sides of the one documentation overlap and encounter no code conflict; +3. use the repository-locked formatter for inherited live-main files and prove no expected outcome + or public identity changed; +4. rebuild the exact World and Federal Register source-adapter wheels twice with a fixed source + epoch and require byte-identical wheel output; +5. install exact Core, action-adapter, source-adapter, and World wheels in a fresh Python 3.12 + environment outside every declared Core checkout; +6. reproduce the canonical P2C10 result byte-for-byte from two fresh workspace roots; +7. run the combined AI Command Center plus P2C3-P2C10 focused checks, the complete World suite, + adapter suite, release contract, Ruff, formatting, and whitespace gates; and +8. retain proposal-only authority and every prior claim limitation. + +## Ownership and exclusions + +World continues to own source translation, BLS/FCC/AI-policy fixtures, product rules, controls, and +the canonical artifact. Core owns durable identities, provenance, authority, Decision, Action, +Outcome, and append-only replay. Intelligence owns only domain-neutral evaluation and proposal +machinery. + +This packet adds no Core or Intelligence contract, domain noun, network acquisition, proposal +application, package version, schema, CLI, MCP tool, publication authority, or release claim. It +does not establish causality, live-monitoring performance, statistical validity, population +benefit, general source independence, or human benefit. + +## Owned files and rollback + +- the isolated direct-main branch and its mechanically replayed history; +- eight locked-format live-main files in one explicit hygiene commit; +- `artifacts/measured-intelligence/convergence-v1.json` regenerated from the exact new source; +- this work packet and its point-in-time audit; and +- restrained README and roadmap references. + +Rollback closes the direct-main draft and removes its additive audit references. The original +stacked drafts remain unchanged and recoverable. No released artifact or durable ACE history is +rewritten. + +## External release gates + +Core issue #49 F1, F3, and F5 remain open 0.6 release gates. This World integration packet does not +implement, waive, defer, resolve, or re-date them. Final merged-source Core verification, version +decisions, final artifact hashes, public-index installation, and publication also remain outside +this packet. From cb7b6fdb2b9fe4dd3c34df8afc1368c86d026710 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 09:48:08 -0700 Subject: [PATCH 16/17] docs(world): record P2D convergence reconciliation --- README.md | 4 + ...ence-p2d-main-reconciliation-2026-08-11.md | 75 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 docs/audits/world-measured-intelligence-p2d-main-reconciliation-2026-08-11.md diff --git a/README.md b/README.md index 010acbd..a92a47b 100644 --- a/README.md +++ b/README.md @@ -483,6 +483,10 @@ bind their exact built-artifact hashes and byte-reproducible [`convergence-v1.json`](artifacts/measured-intelligence/convergence-v1.json). The live-main packet also proves coexistence with the separately merged AI Command Center lineage work without changing the measured-feedback contract or silently applying its proposal. +The additive +[P2D main reconciliation audit](docs/audits/world-measured-intelligence-p2d-main-reconciliation-2026-08-11.md) +records source-level coexistence with the later merged LIVE correction packet without relabeling the +earlier artifact hashes. The LIVE conflict, correction, supersession, and per-claim status proof is recorded in [`docs/audits/world-intelligence-p2d-live-conflict-correction-2026-08-11.md`](docs/audits/world-intelligence-p2d-live-conflict-correction-2026-08-11.md). diff --git a/docs/audits/world-measured-intelligence-p2d-main-reconciliation-2026-08-11.md b/docs/audits/world-measured-intelligence-p2d-main-reconciliation-2026-08-11.md new file mode 100644 index 0000000..84335f9 --- /dev/null +++ b/docs/audits/world-measured-intelligence-p2d-main-reconciliation-2026-08-11.md @@ -0,0 +1,75 @@ +# World measured-intelligence P2D main reconciliation audit — 2026-08-11 + +**Status:** bounded draft-PR reconciliation evidence. This record restores source-level +mergeability and verifies coexistence with the merged P2D proof. It is not a rebuilt-artifact +convergence record, merge, tag, release, SI4 pass, ACE 0.6.0 completion, live-monitoring proof, or +applied governance change. + +## Exact source identity + +- World predecessor candidate: `2d7a0ace72bed4d175b0884c8a9b81b6ec063d56` +- World merged P2D `main`: `5447cf160e1b56ffa8b4c505ce4b00b33b6a1aea` +- Reconciled executable merge: `df11bcad790ce854369f640c379cacbecdbf3089` +- Branch: `codex/world-measured-intelligence-main-convergence` +- Installed measured-impact Core candidate: `433e3d16c5458c975557dcd1552824fb959d4d12` + +The exact full merge commit above was verified with `git rev-parse HEAD` before this additive audit +commit was created. + +## Reconciliation + +P2D changed the release workflow, root package payload, connector package, release-contract test, +README, and roadmap. Git merged every executable, fixture, manifest, package, workflow, and release +contract change without a code conflict. The only conflicts were the README evidence/dispatch text +and the roadmap candidate/next sections. + +The resolution retains both candidate families: + +- P2C3–P2C10 measured feedback, non-effective proposal disposition, and artifact-convergence + history remain visible and unchanged; and +- P2D LIVE conflict, correction, supersession, historical-artifact preservation, and per-claim + status evidence remain visible, while World dispatch advances to user-owned monitoring and + subscription state. + +No product rule, source coordinate, immutable identity, evaluation criterion, authority boundary, +package version, schema, or public tool changed in the resolution. + +## Verification + +```text +# measured-impact convergence, P2C3–P2C10, P2D pack/journey, and P2D connector focus +54 passed in 16.84s + +# complete World suite with the installed measured-impact Core candidate +123 passed in 35.32s + +# complete Federal Register / official-source connector suite +80 passed in 0.49s + +# package and release contract +7 passed in 0.07s + +ruff check --no-cache tests scripts adapters/federal_register_source/tests +All checks passed! + +ruff format --check --no-cache tests scripts adapters/federal_register_source/tests +29 files already formatted + +git diff --cached --check +PASS +``` + +The first Ruff invocation could not access the sandbox-external default `uv` cache. The exact same +locked commands passed with a task-local temporary cache; no dependency or source changed between +attempts. + +## Artifact and release boundary + +The existing `artifacts/measured-intelligence/convergence-v1.json` and its earlier audit remain +point-in-time evidence for their named source commits and artifact hashes. This reconciliation did +not rebuild or silently relabel them after P2D changed the World package payload. + +Final convergence still requires Core to land, World and Market to rebuild against the exact merged +Core artifact, fresh artifact hashes, compatibility and security gates, and public-index install +proof. The measured-impact proposal remains non-effective, non-selectable, unapplied, and subject to +separate human review. From a85da4289ff80fff6e6507b546dca191ff92d841 Mon Sep 17 00:00:00 2001 From: Edwin Amirian Date: Tue, 11 Aug 2026 11:26:05 -0700 Subject: [PATCH 17/17] docs(world): bind merged Core convergence --- README.md | 11 ++- ROADMAP.md | 3 + .../measured-intelligence/convergence-v1.json | 12 +-- ...ence-merged-core-convergence-2026-08-11.md | 76 +++++++++++++++++++ 4 files changed, 93 insertions(+), 9 deletions(-) create mode 100644 docs/audits/world-measured-intelligence-merged-core-convergence-2026-08-11.md diff --git a/README.md b/README.md index a92a47b..cd6bd4f 100644 --- a/README.md +++ b/README.md @@ -237,9 +237,10 @@ classifies the exact result as `useful` and appends a `promote` proposal that is non-selectable, and requires separate human review. Historical replay performs no reauthorization. That measure is structural citation coverage. It is not a human-benefit measure, causal estimate, -general Brief-quality score, or network-freshness proof. The proposal is not applied. P2C3 depends -on the unreleased Core candidate in [PR #88](https://github.com/augmented-cognition-engine/core/pull/88), -so World 0.9.0 and its `ace-core>=0.5.0,<0.6` release contract remain unchanged. +general Brief-quality score, or network-freshness proof. The proposal is not applied. P2C3 now +resolves from the merged experimental Core source introduced through +[PR #88](https://github.com/augmented-cognition-engine/core/pull/88), but no 0.6 artifact is +published. World 0.9.0 and its `ace-core>=0.5.0,<0.6` release contract remain unchanged. P2C4 submits that exact proposal to a separate governed review path. A named, authenticated World reviewer records `reject` with `no_action`: the bounded `useful` classification and `promote` @@ -487,6 +488,10 @@ The additive [P2D main reconciliation audit](docs/audits/world-measured-intelligence-p2d-main-reconciliation-2026-08-11.md) records source-level coexistence with the later merged LIVE correction packet without relabeling the earlier artifact hashes. +The subsequent +[merged-Core convergence audit](docs/audits/world-measured-intelligence-merged-core-convergence-2026-08-11.md) +rebuilds all four candidate wheels from exact merged Core and World sources and freezes the updated +byte-reproducible canonical result. It remains draft artifact evidence, not a release or SI4 pass. The LIVE conflict, correction, supersession, and per-claim status proof is recorded in [`docs/audits/world-intelligence-p2d-live-conflict-correction-2026-08-11.md`](docs/audits/world-intelligence-p2d-live-conflict-correction-2026-08-11.md). diff --git a/ROADMAP.md b/ROADMAP.md index 3eaef0f..4f86310 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -65,6 +65,9 @@ See the [0.9.0 release record](docs/releases/world-intelligence-p2c2-v0.9.0.md). - A separate direct-to-main convergence candidate replays the measured stack on the live World baseline that includes the AI Command Center lineage proof, rebuilds exact artifacts, and passes the combined journey. It does not merge the review stack or advance release status. +- The follow-on merged-Core artifact receipt rebuilds that unchanged World result against exact + Core `main` commit `7013de62ae7320c51c3de9e9a03b049e768e4d84`. The bounded result remains + `useful` with a non-effective proposal; World PR #17 and ACE 0.6.0 remain unreleased candidates. 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/artifacts/measured-intelligence/convergence-v1.json b/artifacts/measured-intelligence/convergence-v1.json index 864ea77..f47169f 100644 --- a/artifacts/measured-intelligence/convergence-v1.json +++ b/artifacts/measured-intelligence/convergence-v1.json @@ -4,25 +4,25 @@ "artifacts": { "action_adapter_wheel": { "filename": "ace_reference_workspace_action-0.1.0-py3-none-any.whl", - "sha256": "sha256:9c600d4b3e0d19525f1e04629bd231d8d6913d2ad11bc63fa2858e7da396f8f1" + "sha256": "sha256:31463fbcfe2a9c62b5cc9abe0a67814cd7fdd36de3c9f6ec47835d7be080ed5a" }, "core_wheel": { "filename": "ace_core-0.5.0-py3-none-any.whl", - "sha256": "sha256:29752aa751570286794ff2abd1071a43f622883d4778e161687e10363f76f6c3" + "sha256": "sha256:662c4197f3ff0cf7dc1e64b0f8bc6bc705c8a1d6373a8468d9cb1d2df3d8c214" }, "source_adapter_wheel": { "filename": "ace_ext_world_federal_register_source-0.2.0-py3-none-any.whl", - "sha256": "sha256:1b80cc598b467a8ab0f47aabb5f01bd0cb1c7709b48aa02352a0ef802988b4fe" + "sha256": "sha256:4841a02b46fba867d8bac092cd2eab1a45e71537d364fda389192857313e049c" }, "world_wheel": { "filename": "ace_domain_world_intelligence-0.9.0-py3-none-any.whl", - "sha256": "sha256:a067b3106772437d2dcfee890dc7d89005d3f7afd9e6dc0cbed027327bea9cae" + "sha256": "sha256:8470b903c165e6897159172c918245fbc7bae7470ce6ad82dbb940776417c049" } }, - "core_commit": "433e3d16c5458c975557dcd1552824fb959d4d12", + "core_commit": "7013de62ae7320c51c3de9e9a03b049e768e4d84", "core_distribution_version": "0.5.0", "source_adapter_distribution_version": "0.2.0", - "world_commit": "87625d55c717a9c649d4f44a06d1767b52fed255", + "world_commit": "cb7b6fdb2b9fe4dd3c34df8afc1368c86d026710", "world_distribution_version": "0.9.0" }, "claim_boundary": { diff --git a/docs/audits/world-measured-intelligence-merged-core-convergence-2026-08-11.md b/docs/audits/world-measured-intelligence-merged-core-convergence-2026-08-11.md new file mode 100644 index 0000000..db6814d --- /dev/null +++ b/docs/audits/world-measured-intelligence-merged-core-convergence-2026-08-11.md @@ -0,0 +1,76 @@ +# World measured-intelligence merged-Core convergence — 2026-08-11 + +**Status:** bounded draft-PR artifact evidence. This is not a World or Core release, a tag, +publication, SI4 pass, live-monitoring proof, applied governance change, or ACE 0.6.0 completion. + +## Exact source identity + +- Core merged `main`: `7013de62ae7320c51c3de9e9a03b049e768e4d84` +- Core main push CI: [run 31520372788](https://github.com/augmented-cognition-engine/core/actions/runs/31520372788), all six gates passed +- World executable/evidence source: `cb7b6fdb2b9fe4dd3c34df8afc1368c86d026710` +- World draft: [PR #17](https://github.com/augmented-cognition-engine/domain-world-intelligence/pull/17) + +Core pull requests #88 through #93 were merged in dependency order. This receipt rebuilds the +World convergence artifact from that exact default-branch source instead of inheriting the earlier +stacked Core candidate hash. + +## Reproducible candidate artifacts + +Each wheel was built twice from its exact source with a fixed source epoch. Both copies were +byte-identical. + +| Artifact | Source epoch | SHA-256 | +|---|---:|---| +| `ace_core-0.5.0-py3-none-any.whl` | `1786471152` | `662c4197f3ff0cf7dc1e64b0f8bc6bc705c8a1d6373a8468d9cb1d2df3d8c214` | +| `ace_reference_workspace_action-0.1.0-py3-none-any.whl` | `1786471152` | `31463fbcfe2a9c62b5cc9abe0a67814cd7fdd36de3c9f6ec47835d7be080ed5a` | +| `ace_ext_world_federal_register_source-0.2.0-py3-none-any.whl` | `1786466888` | `4841a02b46fba867d8bac092cd2eab1a45e71537d364fda389192857313e049c` | +| `ace_domain_world_intelligence-0.9.0-py3-none-any.whl` | `1786466888` | `8470b903c165e6897159172c918245fbc7bae7470ce6ad82dbb940776417c049` | + +No version changed and no artifact was published. The Core wheel still reports `0.5.0`; the +complete source commit and artifact hash distinguish this local candidate from public Core 0.5.0. + +## Installed-artifact result + +A fresh Python 3.12 environment installed all four exact wheels plus public dependencies. Core, +the reference action adapter, and the official-source adapter imported from `site-packages`; the +generator rejected every declared Core checkout root. Two fresh workspace runs emitted +byte-identical canonical records: + +```text +sha256:c62a7db77b66a15f2930c850bdb8bbc44b542f928c2e0b146b5bf3dde08f30df +``` + +The updated +[`convergence-v1.json`](../../artifacts/measured-intelligence/convergence-v1.json) retains the +frozen BLS correction pair, treatment scores `[1.0, 1.0]`, control scores `[0.0, 0.0]`, two +matched pairs, mean effect `1.0`, and bounded `useful` classification. The `promote` proposal +remains non-effective, non-selectable, unapplied, requires separate human review, and is not +reauthorized on historical replay. Only the exact source and artifact coordinates changed. + +## Verification + +```text +# complete World suite against the installed merged Core wheel +123 passed in 37.82s + +# complete Federal Register / official-source connector suite +80 passed in 0.65s + +# package and release contract +7 passed in 0.07s + +# repeated canonical artifact generation +2 identical results; sha256:c62a7db77b66a15f2930c850bdb8bbc44b542f928c2e0b146b5bf3dde08f30df +``` + +The run used recorded public-source fixtures and made no network request, external action, +provider call, tag, release, or publication. + +## Claim boundary and remaining gates + +This remains one deterministic recorded-replay association under a World-owned correction rule. +It is not causality, population correction performance, statistical validation, current +freshness, general SI4 completion, or human benefit. World PR #17 remains a draft until its new +head passes review and CI. Core still requires the cross-domain merged-source evidence, issue #49 +disposition, final package-version and artifact identities, public-index installation, and an +explicit release-owner decision before ACE 0.6.0 can be published or closed.