41 lines
5.2 KiB
Python
41 lines
5.2 KiB
Python
from pathlib import Path
|
|
import json,hashlib
|
|
root=Path(__file__).resolve().parents[2];out=Path(__file__).resolve().parent
|
|
read=lambda n:json.loads((out/n).read_text('utf-8'))
|
|
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
|
|
branch=[r for r in read('CAE-ESTRUTURA.json')['books'][0]['records'] if r['code'] in ['A','01','011','0112','01120']]
|
|
branch.sort(key=lambda r:int(r['level']))
|
|
assert len(branch)==5
|
|
planned={
|
|
'database/migrations/2026_10_16_120000_extend_economic_reference_hierarchy.php':'new: non-unique sector index, nullable unassigned ancestor, economic metadata; preserve FKs and published immutability',
|
|
'database/data/economic-references-lot-01.json':'new: closed versioned manifest; UUIDs frozen at implementation, QA only',
|
|
'app/Services/EconomicReferenceCatalog.php':'new: shared hierarchy/source reader and QA-only preview/apply adapter',
|
|
'app/Services/OpportunityCanonicalContract.php':'replace: descendant hierarchy and legacy compatibility',
|
|
'app/Services/OpportunityClassification.php':'replace: shared options with code, level and provenance distinction',
|
|
'app/Http/Controllers/Api/V1/ReferenceCatalogController.php':'replace: explicit economic origin selection, unchanged legacy default',
|
|
'resources/js/components/opportunity-canonical-fields.tsx':'replace: recover and select division/activity with full path',
|
|
'resources/js/components/opportunity-classification.tsx':'replace: shared code/path presentation and filters',
|
|
}
|
|
files=[{'path':p,'planned_change':v,'exists':(root/p).is_file(),'before_sha256':sha(root/p) if (root/p).is_file() else None,'after_sha256':None} for p,v in planned.items()]
|
|
assert sum(f['exists'] for f in files)==5
|
|
lot={'date':'2026-10-16','status':'PROPOSED_MAP_BEFORE_IMPLEMENTATION','active_authorization':False,'app_code_changed':False,
|
|
'same_matrix':'docs/investmoz/v2/auditoria-portal/matriz-requisitos.csv','masters_reused':{'sector_id':1,'sector_slug':'agronegocio','cluster_code':'CLU-01','cluster_id':'2b37d84a-0b71-4b87-b577-6f550954c908'},
|
|
'proposed_catalog':{'code':'economic-activities-cae','version_no':1,'source_version':'eBAU exemplar identified by SHA256; normative edition unresolved','existing_editorial_catalog_unchanged':True},
|
|
'source_sha256':read('CAE-ESTRUTURA.json')['books'][0]['sha256'],'activities':branch,
|
|
'chain_stages':[{'code':'CLU01-'+s.upper(),'stage':s,'name':label,'nature':'editorial proposal for QA; not a real operator/capacity declaration'} for s,label in [('input','Fornecimento agroindustrial'),('production','Produção agrícola'),('processing','Transformação agroindustrial'),('logistics','Logística agroindustrial'),('market','Comercialização agroindustrial')]],
|
|
'chain_links':[{'from':'CLU01-'+a.upper(),'to':'CLU01-'+b.upper(),'type':t,'nature':'proposed editorial sequence'} for a,b,t in [('input','production','supplies'),('production','processing','processes'),('processing','logistics','distributes'),('logistics','market','distributes')]],
|
|
'new_reference_records':15,'additional_test_revisions_and_audit_events':'not counted as master/reference records; enumerate during future QA',
|
|
'existing_master_updates':0,'existing_classification_changes':0,'new_uuid_allocation':'not yet executed; freeze per version/source key in implementation manifest',
|
|
'decisions':['Use bounded eBAU exemplar in QA without claiming complete normative edition; discrepancy 600 versus 579 subclasses remains open','Display division 01 as subsector and subclass 01120 as activity for this case; retain all five original levels','Generic five-stage editorial chain in existing CLU-01, without real operators, capacities or flow assertions'],
|
|
'deferred':['Other 1355 economic codes','Energy combined versus specific mapping','Fintech cross-sector regulatory activity mapping','Parks full operational record','Duplicate consolidation','Full Fintech regulation'],
|
|
'prospective_files':files,'runtime_sources':6,'migration':1,'manifest':1,'QA_tools':['tools/economic-references-qa.php','tools/economic-references-acceptance-qa.php'],
|
|
'build':'Future build required if UI changes are implemented; no build performed this stage',
|
|
'estimate_hours':{'manifest':[2,3],'schema_and_import_QA':[2,3],'adapter_and_UI':[3,4],'directed_proofs_and_rollback':[4,6],'delivery_docs_receipt':[1,2],'total':[12,18]},
|
|
'positive_chain_case':'PENDING; planned in both canonical and existing-business consumers only in new isolated clone',
|
|
'reference_QA_business':'172aa874-98fc-4bf6-b78f-d2e9a386d345 published/v12 remains untouched',
|
|
'future_active_import_dependency':'An authenticated economic import/publication action is not installed; future active delivery requires its concrete procedure and separate authorization',
|
|
'rollback_after_use':'Keep additive schema/data plus hierarchy adapter, canonical contract and compatible selector; demonstrate old-code edit with compatibility contract without deleting new references or history'}
|
|
(out/'LOTE-PROPOSTO.json').write_text(json.dumps(lot,ensure_ascii=False,indent=2)+'\n','utf-8')
|
|
(out/'FONTES-E-DELTA-PREVISTO.json').write_text(json.dumps({'implemented':False,'files':files},ensure_ascii=False,indent=2)+'\n','utf-8')
|
|
print(json.dumps({'proposed_records':15,'prospective_artifacts':len(files),'existing_files':5,'new_files':3,'positive_chain_case':'pending','active_changes':0}))
|