Files
Investidor-V2/outputs/investmoz-audit-current-20261012/patch-C137-QA.py
T
nala 287e991486
tests / ci (push) Waiting to run
oportunidades 7
2026-10-13 11:40:29 +02:00

16 lines
2.1 KiB
Python

from pathlib import Path
from datetime import datetime,timezone
import json,hashlib,shutil
OUT=Path(__file__).resolve().parent;ROOT=OUT.parents[1];f=json.loads((OUT/'business-country-fixture.json').read_text(encoding='utf-8'));q=Path(f['QA_source']);assert q.resolve()!=ROOT.resolve()
inv=json.loads((OUT/'next-lot-inventory-QA.json').read_text(encoding='utf-8'));assert inv['target']==f['target']and inv['target']['port']==55441
relative='resources/js/pages/partnerships/room.tsx';file=q/relative;old=file.read_text(encoding='utf-8');needle='{mutable && d.owner_id === auth.user.id && (';assert old.count(needle)==1
backup=q/'storage/app/private/partnership-room-C137-20261012-before.tsx';assert not backup.exists();shutil.copyfile(file,backup);new=old.replace(needle,'{d.owner_id === auth.user.id && (mutable || d.shared) && (')
message=''' {!mutable && p.documents.some((d) => d.shared && d.owner_id === auth.user.id) && (
<p role="status" aria-live="polite">
A sala está encerrada. O autor pode retirar uma autorização de partilha existente; novas partilhas permanecem indisponíveis.
</p>
)}
'''
anchor=' {p.documents.map((d) => (';assert new.count(anchor)==1;new=new.replace(anchor,message+anchor);file.write_text(new,encoding='utf-8');sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest();assert sha(ROOT/relative)==sha(backup)
proof={'case':'C137','at':datetime.now(timezone.utc).isoformat(),'target':f['target'],'file':relative,'before_sha256':sha(backup),'QA_after_sha256':sha(file),'active_sha256_unchanged':sha(ROOT/relative),'root_cause':'The UI guarded revoke and grant with mutable; closed/cancelled rooms hid revocation allowed by server.','scope':'Author may revoke existing shared document in closed room; cannot grant new share there. No server permission changed.','API_variant_proof':'partnership-revocation-closed-room-revocation-HTTP.json','visual_reproduction_and_acceptance':'pending C135','compiled':False,'active_changes':0};(OUT/'C137-QA-delta.json').write_text(json.dumps(proof,indent=2),encoding='utf-8');print(json.dumps(proof))