T04: deterministic semantic kernel
Alice/Bob/Carol runs end to end, deterministically, replayable from seed. 16 tests pass, no third-party dependencies. - src/testdriver: intent, provenance, world, actions, drivers, observers, oracles, evidence, energy, scenario, runner - lab/minimal.py: the SUT, exposing the independent observation channel required by D-07 - evidence is stratified S1/S2/S3; Runner refuses to attribute S2/S3 to an actor; claims are frozen and provenance-checked at construction - missing evidence yields INCONCLUSIVE, which outranks PASS in the run verdict - EnergyEvents captured, no scoring (H-005 dormant) The observation channel records both stored state and an out-of-band enforcement probe; their disagreement is an invariant and is what detects an authorization defect that leaves the audit trail intact. A seeded RevokeIsCosmetic lab fails the run via both the claim and that invariant. Also closes TD-WP-0001-T02 (stack and commands now exist). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 1629012@bnt-lap001 Assistant-Session: 78d4fb13-8a1e-474b-87a3-9b9261c49a39
This commit is contained in:
parent
8da4c5bf7a
commit
04e9573b5a
42 changed files with 1533 additions and 20 deletions
45
src/testdriver/energy.py
Normal file
45
src/testdriver/energy.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"""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}
|
||||
Loading…
Add table
Add a link
Reference in a new issue