Complete local generalisation tasks and document remaining experiment blockers

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a0e76f-be98-7ae3-965d-e0b31290a4c4
This commit is contained in:
tegwick 2026-09-28 12:06:24 +02:00
parent d54af628df
commit cf682281d7
36 changed files with 5394 additions and 279 deletions

View file

@ -2,7 +2,6 @@
from .actions import SemanticAction, Surface, SurfaceNotPermitted
from .drivers import DirectDriver, Realization
from .energy import EnergyEvent, EnergyEventType
from .evidence import EvidencePack, Observation, Stratum
from .intent import Claim, Invariant, UseCase
from .observers import StateObserver, Watch
@ -14,7 +13,7 @@ from .world import Actor, Cast, World
__all__ = [
"Actor", "Cast", "Claim", "CollectorIndependenceError",
"DirectDriver", "EnergyEvent", "EnergyEventType", "EvidencePack",
"DirectDriver", "EvidencePack",
"InadmissibleProvenance", "Invariant", "Judgment", "Observation", "Oracle",
"Provenance", "Realization", "RunResult", "Runner", "Scenario",
"SemanticAction", "StateObserver", "Step", "Stratum", "Surface",

View file

@ -1,45 +0,0 @@
"""Energy events — capture only.
H-005 is dormant by decision: verification energy is not testable at the current
scale, and a scoring function producing a number nobody can check is worse than
no number. Events are recorded from the first run because history cannot be
reconstructed later; scores always can.
There is deliberately no score() function in this module.
"""
from __future__ import annotations
from dataclasses import asdict, dataclass, field
from datetime import datetime, timezone
from enum import Enum
from typing import Any
class EnergyEventType(str, Enum):
DEFECT_DETECTED = "DEFECT_DETECTED"
REGRESSION_CAUGHT = "REGRESSION_CAUGHT"
MECHANICAL_ADAPTATION = "MECHANICAL_ADAPTATION"
SEMANTIC_ADAPTATION = "SEMANTIC_ADAPTATION"
TEST_DEFECT = "TEST_DEFECT"
FALSE_POSITIVE = "FALSE_POSITIVE"
DUPLICATE = "DUPLICATE"
CRYSTALLIZED = "CRYSTALLIZED"
USECASE_DEPRECATED = "USECASE_DEPRECATED"
EXECUTED = "EXECUTED"
@dataclass(frozen=True, slots=True)
class EnergyEvent:
"""Immutable. Energy is derived from event history, never stored as state."""
asset_id: str
run_id: str
event_type: EnergyEventType
detail: dict[str, Any] = field(default_factory=dict)
at: str = field(
default_factory=lambda: datetime.now(timezone.utc).isoformat()
)
def as_dict(self) -> dict[str, Any]:
return {**asdict(self), "event_type": self.event_type.value}

View file

@ -63,7 +63,6 @@ class EvidencePack:
finished_at: str | None = None
observations: list[Observation] = field(default_factory=list)
verdicts: list[dict[str, Any]] = field(default_factory=list)
energy_events: list[dict[str, Any]] = field(default_factory=list)
provenance_index: dict[str, str] = field(default_factory=dict)
def record(self, observation: Observation) -> None:

View file

@ -20,7 +20,12 @@ Predicate = Callable[[Mapping[str, object]], bool]
@dataclass(frozen=True, slots=True)
class Claim:
"""A statement that must hold at a specific point in a scenario."""
"""A statement that must hold at a specific point in a scenario.
Public contract (TD-WP-0003-T05): predicates remain Python callables over
independent snapshots. Generated tests import these original claims; no
serialized claim language is promised. See TestDriverGeneralisationReview.
"""
id: str
text: str

View file

@ -15,7 +15,6 @@ from typing import Any
from .actions import SurfaceNotPermitted
from .drivers import Driver
from .energy import EnergyEvent, EnergyEventType
from .evidence import EvidencePack, Observation, Stratum
from .observers import StateObserver
from .oracles import Judgment, Oracle, Verdict, overall
@ -125,9 +124,6 @@ class Runner:
**{c.id: c.provenance.value for c in scenario.use_case.claims},
**{i.id: i.provenance.value for i in scenario.use_case.invariants},
}
pack.energy_events.append(
EnergyEvent(asset.id, run_id, EnergyEventType.EXECUTED).as_dict()
)
isolation = self._isolation_violations()
self._record(
@ -229,8 +225,4 @@ class Runner:
pack.finished_at = datetime.now(timezone.utc).isoformat()
result_verdict = overall(judgments)
if result_verdict is Verdict.FAIL:
pack.energy_events.append(
EnergyEvent(asset.id, run_id, EnergyEventType.DEFECT_DETECTED).as_dict()
)
return RunResult(run_id, result_verdict, judgments, pack)