"""Owner mediator seam for the existing strict Secrets handoff and Approval GET. Only the disposable NativeFixtureAdapter is callable here. No production backend, caller-supplied authorizer/transport, approval boolean or portable receipt exists. The strict Secrets module is an explicit external dependency: absence refuses before credential-bearing requests or native effects, never a permissive fallback. """ from __future__ import annotations from dataclasses import dataclass from datetime import datetime,timezone import importlib import json from pathlib import Path from urllib.parse import urlsplit from task_execution_cleanup import run_cleanup from task_execution_journal import Binding,Cleanup,Journal,Refused from task_execution_plan import Compiler,encoded,content_hash from task_execution_native_fixture import FixtureAdmission,NativeFixtureAdapter @dataclass(frozen=True) class ConfirmationConfig: """Owner-installed independent read credential/route, never request fields.""" origin: str token_file: Path timeout_seconds: float = 3 _HANDOFF_FIELDS={'execution_contract','approval_id','request_digest','decision_id', 'native_binding','approval_binding_digest','submitted_request_digest', 'decision_not_before','decision_expires_at','approval_expires_at'} def _strict_dependency(): try: module=importlib.import_module('secrets_engine.task_execution_handoff') for name in ['TaskExecutionAuthorization','TaskExecutionConsumption', 'authorize_task_execution','consume_task_execution']: if not hasattr(module,name):raise ImportError() return module except ImportError: raise Refused('strict Secrets task execution handoff dependency unavailable') from None def _fresh(cfg,handoff,descriptor): from secrets_engine.application_time import read_window,validity_bounds lower,upper=validity_bounds(window=read_window(cfg)) try: parse=lambda value:datetime.fromisoformat(value.replace('Z','+00:00')) deadline=parse(descriptor['operation_deadline']) approval=parse(handoff['approval_expires_at']);decision=parse(handoff['decision_expires_at']) start=parse(handoff['decision_not_before']) if handoff['decision_not_before'] else None if any(value.tzinfo is None for value in [deadline,approval,decision]) or (start is not None and start.tzinfo is None):raise ValueError() if upper>=min(deadline,approval,decision) or deadline>min(approval,decision) or (start is not None and lower