from pathlib import Path from hashlib import sha256 from datetime import datetime, timezone import json, re OUT=Path(__file__).resolve().parent;ROOT=OUT.parents[1];DOC=ROOT/'docs/investmoz/v2/auditoria-portal' QA=ROOT/'storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742' read=lambda p:json.loads(p.read_text(encoding='utf-8-sig')) sha=lambda p:sha256(p.read_bytes()).hexdigest() canonical=lambda obj:json.dumps(obj,ensure_ascii=False,sort_keys=True,separators=(',',':')).encode() STAMP='20261014_QA21_browser_block' EVIDENCE='acceptance-396c-QA21-browser-block-20261014.json' ENTRY='https://portal-investidor.test:18445/aceitacao-B-396c691930bc.html' recorded=datetime.now(timezone.utc).isoformat() results_path=OUT/'acceptance-396c-results.json';ledger_path=OUT/'acceptance-396c-visual-reconciliation-20261014.json' manifest_path=OUT/'acceptance-396c-manifest.json' results=read(results_path);ledger=read(ledger_path);manifest=read(manifest_path) criterion_hash=sha256(canonical(ledger['remaining_steps'])).hexdigest() assert criterion_hash=='6f8e6f56372065ebc558f487fc8536178c9c813bb379bd54293c2d775363d6e0' assert len(ledger['remaining_steps'])==12 before_accepted={c['scenario']:dict(c) for c in results['cases'] if c['scenario'] in [2,3]} before_protected={str(p.relative_to(ROOT)):sha(p) for p in [ROOT/'public/build/manifest.json',QA/'public/build/manifest.json',DOC/'matriz-requisitos.csv',DOC/'backlog-priorizado.csv']} tls=read(OUT/'grouped-passage-HTTPS-readonly-20261014.json') evidence={'recorded_at':recorded,'base_review':'396c691930bc','planned_first_line':1,'planned_first_account':21, 'planned_criterion_url':'https://portal-investidor.test:18445/minhas-oportunidades/30/edit', 'requested_entry_url':ENTRY,'observed_failure_url':ENTRY, 'first_blocked_point':'TLS page opening before login, MFA or any functional criterion', 'blocker':'C135','product_failure_observed':False, 'tool_observations':[ {'tool':'mcp__cua_repl','api':'cua.getState','result':{'apps':0,'browsers':['Codex In-app Browser','Codex MCP Apps'],'local_Chrome_available':False}}, {'tool':'mcp__cua_repl','api':'cua.createBrowserTab','url':ENTRY,'result':'net::ERR_CERT_AUTHORITY_INVALID','page_opened':False}, {'tool':'computer-use via node_repl/@oai/sky','api':'sky.list_apps','result':'Computer Use native pipe is unavailable: failed to connect native pipe: O sistema não conseguiu localizar o ficheiro especificado. (os error 2)','local_browser_selected':False} ], 'read_only_TLS_evidence':'grouped-passage-HTTPS-readonly-20261014.json', 'read_only_TLS_result':tls['tls'], 'diagnosis':'IAB rejects the QA certificate authority; Windows native connector cannot connect to its named pipe. OS curl additionally cannot perform certificate revocation checking. No evidence of bad password, MFA, authorization, workflow or product action failure.', 'diagnosis_limits':'The native IPC failure does not establish a Chromium fault. IAB trust failure and OS revocation checking are distinct observations; the browser/system trust stores were not changed.', 'resets':0,'certificate_bypass':False,'browser_security_settings_changed':False, 'QA_accounts_used':[],'authentication_material_read_or_recorded':False, 'functional_URLs_opened':[],'functional_results_passed':0,'functional_results_failed':0, 'remaining_rows_not_observed':list(range(1,13)), 'QA_business_data_changes':0,'active_requests':0,'active_changes':0, 'fixed_criteria_sha256':criterion_hash,'new_criteria':0, 'next_dependency':'Restore a permitted browser transport with valid QA certificate trust, or the existing local Chromium connector. No ignored TLS errors, undocumented protocol, browser automation through shell, or further resets.', 'accepted_proofs_preserved':[2,3,'A/B','C37','COUNTRY02'],'C132_separate':True} assert not (OUT/EVIDENCE).exists() entry_failure={'kind':'C135 — browser access dependency','url':ENTRY, 'observed':'IAB: net::ERR_CERT_AUTHORITY_INVALID; nativeWindows: missing pipe/os error2.', 'criterion_not_reached':True,'not_a_product_failure':True,'evidence':EVIDENCE} last_attempt={'recorded_at':recorded,'evidence':EVIDENCE,'phase_started':1,'planned_first_account':21, 'first_line':1,'entry_result':'falhou — acesso pela ferramenta, antes da autenticação', 'criterion_results':'12 linhas não observadas; nenhuma nova prova funcional', 'later_phases_executed':False,'fixed_list_preserved':True} for case in results['cases']: for row in case.get('fixed_passage_lines',[]): assert row['result']=='não observado' row['last_attempt_blocker']='C135' row['last_attempt_evidence']=EVIDENCE for part in row['observations']: assert part['result']=='não observado' if row['line']==1 and part['phase']==1: part['attempt_recorded_at']=recorded part['requested_entry_url']=ENTRY part['failure']=entry_failure part['evidence'].append(EVIDENCE) else: part['not_observed_reason']='A ferramenta não abriu a entrada QA; este trecho não foi executado.' if case['scenario'] in [2,3]: assert case==before_accepted[case['scenario']] results['last_grouped_passage_attempt']=last_attempt results['fixed_grouped_passage']['latest_attempt']=last_attempt ledger['fixed_grouped_passage']['latest_attempt']=last_attempt manifest['fixed_grouped_passage']['latest_attempt']=last_attempt def save(p,data): archived=OUT/(STAMP+'-'+p.name+'.before');assert not archived.exists() archived.write_bytes(p.read_bytes());p.write_bytes(data) guide=DOC/'aceitacao-B-396c691930bc.md';page=QA/'public/aceitacao-B-396c691930bc.html' guide_old=guide.read_text(encoding='utf-8-sig');html_old=page.read_text(encoding='utf-8-sig') note=('\n**Tentativa QA21 registada:** entrada '+ENTRY+' bloqueada antes do login: IAB `ERR_CERT_AUTHORITY_INVALID`; ' 'conector Windows com pipe nativo indisponível (`os error2`). Linha01 não chegou a abrir o contrato; ' 'as12linhas/partes permanecem **não observado**, não são12falhas do produto. Não foram executadas QA24/25, QA17 ou revogações. ' 'Sem resets, bypass TLS, credenciais lidas, dados alterados ou repetição de provas aceites. Evidência: `'+EVIDENCE+'`.\n\n') note=note.replace('Linha01','Linha 01').replace('as12linhas','as 12 linhas').replace('são12falhas','são 12 falhas') guide_new=guide_old.replace('## Passagem por conta — lista fixa\n','## Passagem por conta — lista fixa\n\n'+note,1) html_note=('
Tentativa QA21: entrada bloqueada antes do login por IAB '
'ERR_CERT_AUTHORITY_INVALID e pipe Windows ausente (os error2). '
'Linha01 não observada; as12linhas continuam não observadas. As provas já aceites mantêm-se. Sem resets/bypass ou alterações no ativo.