build(agent): new-agents#a6e6ec iteration
This commit is contained in:
parent
b62899242a
commit
bafe384595
|
|
@ -1,6 +1,8 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
import time
|
||||||
|
import uuid
|
||||||
from typing import List, Dict, Any
|
from typing import List, Dict, Any
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,6 +31,18 @@ class PlanDelta:
|
||||||
delta_id: str
|
delta_id: str
|
||||||
fleet_id: str
|
fleet_id: str
|
||||||
changes: Dict[str, Any]
|
changes: Dict[str, Any]
|
||||||
|
# Metadata for verifiable reconciliation and auditing
|
||||||
|
version: int = 1
|
||||||
|
nonce: str | None = None
|
||||||
|
timestamp: float | None = None
|
||||||
|
|
||||||
|
def __post_init__(self):
|
||||||
|
# Ensure timestamp is set for auditing
|
||||||
|
if self.timestamp is None:
|
||||||
|
self.timestamp = time.time()
|
||||||
|
# Ensure a unique nonce for replay-safe reconciliation
|
||||||
|
if self.nonce is None:
|
||||||
|
self.nonce = uuid.uuid4().hex
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|
|
||||||
|
|
@ -70,3 +70,8 @@ def test_two_fleets_cross_exchange_basic():
|
||||||
delta = asyncio.get_event_loop().run_until_complete(run())
|
delta = asyncio.get_event_loop().run_until_complete(run())
|
||||||
assert delta.fleet_id == plan_a.fleet_id
|
assert delta.fleet_id == plan_a.fleet_id
|
||||||
assert isinstance(delta.changes, dict)
|
assert isinstance(delta.changes, dict)
|
||||||
|
# New metadata should be present and well-formed
|
||||||
|
assert isinstance(delta.version, int)
|
||||||
|
assert delta.version >= 1
|
||||||
|
assert isinstance(delta.nonce, str) and len(delta.nonce) > 0
|
||||||
|
assert isinstance(delta.timestamp, float)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue