"""Stage A containment: no current payload authorizes a physical write. There is deliberately no environment-variable override. Re-enabling physical control requires a separately reviewed identity-binding protocol. """ PHYSICAL_CONTROL_DISABLED = "physical_control_disabled_stage_a" UNSUPPORTED_COMMAND = "unsupported_command_schema_stage_a" READ_ONLY_COMMAND_TYPES = ( "poll_known_miners_now", "discover_new_miners", "enrich_match_discovery", ) def rejection_reason(command_type: str) -> str | None: if command_type == "miner_control": return PHYSICAL_CONTROL_DISABLED if command_type not in READ_ONLY_COMMAND_TYPES: return UNSUPPORTED_COMMAND return None def rejection_execution_outcome(row: dict) -> str: """A current pending state alone says nothing about earlier delivery. The repository supplies an explicit pre-transition evidence check while holding the queue row lock. Missing/ambiguous checks and result submissions are unknown. This describes queue delivery, never proof of physical outcome. """ if (row.get("previous_status") == "pending" and row.get("no_delivery_evidence") is True and row.get("delivery_reported", False) is False): return "not_dispatched" return "unknown"