Files
Investidor-V2/tools/portal-consumer-scope-qa.py
nala 287e991486
tests / ci (push) Waiting to run
oportunidades 7
2026-10-13 11:40:29 +02:00

42 lines
2.9 KiB
Python

"""Bind consumer proofs and checks to the exact candidate files; no database writes."""
from pathlib import Path
import hashlib, json
from datetime import datetime, timezone
root=Path(__file__).resolve().parent.parent
private=root/'storage/app/private/investmoz-v2/portal-audit'
def text_file(name):
b=(private/name).read_bytes()
return b.decode('utf-16' if b.startswith(b'\xff\xfe') else 'utf-8-sig')
def read(name):return json.loads(text_file(name))
def sha(file):return hashlib.sha256(file.read_bytes()).hexdigest()
active='75352185c2a85c34ab726613db864a598e301a5b342ebbc80ac8e678eed17a94'
assert sha(root/'public/build/manifest.json')==active
build=read('qa-consumer-c96-build-confirmed.json');assert build['native_exit']==0
regression=text_file('qa-consumer-final-regression.log')
assert '"result":"passed","tests":19,"passed":19,"assertions":451' in regression
policy=text_file('qa-consumer-private-resource-policy-proof.log')
assert '"result":"passed"' in policy and '"assertions":7' in policy
types=text_file('qa-consumer-c96-types.log')
assert 'tsc --noEmit' in types and 'error TS' not in types
proof_names=['entity','stats','business','structures-deep','documents','workflow','workflow-files','reviewer-files','corridor-label']
proofs={}
for name in proof_names:
file='consumer-'+name+'-chromium-20261010.json';p=read(file)
assert p['result']=='passed' and p['active_writes']==0 and p['target']=='desk_restore_20261009_174726_test:55441'
assert not p.get('javascript_errors'), (name,p.get('javascript_errors'))
proofs[file]=sha(private/file)
sources=['app/Http/Controllers/LandAssistanceController.php','app/Services/OpportunityCategoryFields.php',
'resources/js/pages/land-assistance/print.tsx','resources/js/layouts/portal-navigation.tsx',
'resources/js/pages/management/opportunity-resources.tsx','resources/js/pages/investment/business-wizard.tsx',
'resources/js/pages/structures/editor.tsx','tests/Feature/LandAssistanceTest.php',
'tests/Feature/OpportunityCanonicalWorkflowTest.php','public/build-qa-opportunities/manifest.json']
scope={'at':datetime.now(timezone.utc).isoformat(),'target':'desk_restore_20261009_174726_test:55441',
'regression_exit':0,'typescript_exit':0,'build_exit':build['native_exit'],'active_writes':0,
'active_manifest_sha256':active,'tested_sources':{f:sha(root/f)for f in sources},'browser_receipts':proofs,
'corrections':['C91','C92','C93','C94','C95','C96'],
'candidate':'consumer increment only; global activation candidate not fixed',
'previous_acceptance_preserved':['C37 QA18 authentication','A/B internal integrated scenarios 320/390px'],
'separate':['full accessibility','real devices','active activation','other categories and consumers']}
(private/'consumer-final-scope-qa.json').write_text(json.dumps(scope,ensure_ascii=False,indent=2),encoding='utf-8')
print(json.dumps({'result':'passed','browser_receipts':len(proofs),'source_files':len(sources),'active_build_preserved':True,'active_writes':0}))