"""Local release-state fixture. Verdicts are synthetic, never malware analysis.""" import hashlib,json,platform from pathlib import Path class Upload: def __init__(self,tenant): self.tenant=tenant;self.generation=0;self.state='pending';self.body=b'';self.digest=None def receive(self,body): self.generation+=1;self.body=body;self.digest=hashlib.sha256(body).hexdigest();self.state='scanning' return (self.generation,self.digest) def verdict(self,generation,digest,passed): # Caller represents a trusted worker. Real authentication is outside this model. if self.state!='scanning' or (generation,digest)!=(self.generation,self.digest):return False self.state='approved' if passed else 'rejected';return True def download(self,tenant): if tenant!=self.tenant or self.state!='approved':return None return self.body u=Upload('tenant-a');cases=[] def record(name,condition): assert condition,name cases.append(dict(case=name,passed=True,state=u.state,generation=u.generation)) v1=u.receive(b'illustrative bytes A');record('blocked_before_verdict',u.download('tenant-a') is None) v2=u.receive(b'illustrative bytes B');record('stale_v1_verdict_rejected',not u.verdict(*v1,True) and u.state=='scanning') record('current_negative_verdict_blocks',u.verdict(*v2,False) and u.download('tenant-a') is None) v3=u.receive(b'illustrative bytes C');record('current_positive_verdict_releases_exact_bytes',u.verdict(*v3,True) and u.download('tenant-a')==b'illustrative bytes C') record('other_tenant_blocked',u.download('tenant-b') is None) v4=u.receive(b'illustrative bytes D');record('replacement_resets_approval',u.download('tenant-a') is None and not u.verdict(*v3,True)) Path(__file__).with_name('results.json').write_text(json.dumps(dict(scope='Sequential state-machine checks with synthetic trusted verdicts; no scanner, HTTP endpoint, storage policy or authentication integration',python=platform.python_version(),cases=cases),indent=2)+'\n') print('PASS: 6 release-state checks; no malware analysis performed.')