Attach optional Railiance recording-time evidence

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a09cbb-87c6-7900-a145-4ce53ba9f1a6
This commit is contained in:
tegwick 2026-09-15 22:17:59 +02:00
parent a41fffedde
commit 48f4af63e5
3 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,12 @@
"""Optional recording-time evidence; original local timestamps remain intact."""
import os
def recording_time():
if not os.environ.get('INTELLIGENCE_RADAR_CLOCK_TRUST_FILE'):
return {}
try:
from railiance_clock.attribution import from_environment
result = from_environment('INTELLIGENCE_RADAR_CLOCK_TRUST_FILE')
return result
except (ImportError, OSError, ValueError):
return {'railiance_time': {'status': 'unavailable', 'kind': 'recording_time'}}

View file

@ -7,6 +7,8 @@ import time
from urllib.parse import urlparse
from urllib.request import Request, urlopen
from .clock_attribution import recording_time
from .store import all_records, atomic, put
MAX_BYTES = 5 * 1024 * 1024
@ -53,6 +55,7 @@ def capture(root, source, opener=urlopen, now=None):
'content_sha256': content_hash, 'media_type': media_type,
'bytes': len(body), 'changed': changed, 'attempts': attempts,
'status': 'captured_unreviewed'}
receipt.update(recording_time())
ident = put(root, 'captures', receipt)
if changed:
from .__main__ import record
@ -80,6 +83,7 @@ def ingest(root, registry):
results.append({'source_id': source['id'], 'ok': False, 'error': str(exc)})
run = {'observed_at': datetime.now(timezone.utc).isoformat(), 'sources': results,
'ok': all(r['ok'] for r in results)}
run.update(recording_time())
put(root, 'ingestion-runs', run)
return run

View file

@ -9,6 +9,7 @@ from pathlib import Path
import time
from urllib.request import Request, urlopen
from .clock_attribution import recording_time
from .store import all_records, canonical, get, put
ENDPOINT = 'https://openrouter.ai/api/v1/chat/completions'
@ -158,6 +159,7 @@ def execute(root, config, case, model, opener=urlopen):
'runtime_seconds':time.monotonic()-start,'completed_at':datetime.now(timezone.utc).isoformat(),
'reservation_id':reservation,'synthetic':False,
'sample_kind':'controlled repository work sample; real provider execution'}
trial.update(recording_time())
ident=put(root,'trials',trial)
put(root,'trial-events',{'kind':'settled','campaign':campaign,'run_id':run_id,
'reservation_id':reservation,'trial_id':ident,'actual_usd':str(cost)})