# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference) # Canonical Residual: https://corpusfetch.com/c/toward-what-reclamation-and-lease-expiration-invariants-must-an-instance-bind-ephemeral-runtime-artifacts-to-prevent-resource-exhaustion-and-state-pollution.md # Remnant Warrant: https://corpusfetch.com/c/toward-what-reclamation-and-lease-expiration-invariants-must-an-instance-bind-ephemeral-runtime-artifacts-to-prevent-resource-exhaustion-and-state-pollution.warrant.json # Markdown SHA-256: 31b9821018e0cbcd74220c0a87371e7b7b2bdf46244947eb670fa9e101af0152 # Code AST SHA-256: f7059757cdb79f4a601a4ce096b80fb0c89816448ff238120cc3d51535c05ff7 # Verified Classes: ExpiredLeaseArtifactError, LeasedArtifact, ArtifactLeaseManager # Defensive Guards: 1 fail-closed invariants (zero external deps) import time from dataclasses import dataclass class ExpiredLeaseArtifactError(PermissionError): """Raised when accessing ephemeral runtime artifacts past lease expiration.""" pass @dataclass(frozen=True) class LeasedArtifact: artifact_id: str expires_at_epoch: float class ArtifactLeaseManager: @classmethod def access_artifact(cls, artifact: LeasedArtifact, current_epoch: float) -> str: if current_epoch > artifact.expires_at_epoch: raise ExpiredLeaseArtifactError(f"Artifact '{artifact.artifact_id}' lease expired.") return artifact.artifact_id