Compare commits

...
4 Commits
16 changed files with 1014 additions and 9 deletions
@@ -15960,5 +15960,298 @@
"rollback_executed": false
},
"activation": "Normal Git fast-forward/webhook/installer;zero migrations/imports"
},
"iva_l1_g6h_P060_homologation_20261024": {
"status": "installed_delta_verified_partial_L1",
"candidate": "2359a88dba92147eb28769c7d9ae908cb2df7227",
"base_installed": "9b26217dec945fe07b665c6ad7638a965bf104a9",
"coverage_complete_branches": {
"AUD-SIM-L1-P060": [
"un_development_exemption",
"un_development_reduction"
]
},
"branch_count_complete": 1,
"treatment_count": 2,
"runtime_delta": [
{
"path": "resources/js/lib/iva-import-exemptions.ts",
"sha256_LF": "799e9a0020e805af9f67387bfa36608c4973f15c4427d1b82c3f6b6398aed129"
},
{
"path": "resources/js/components/simulation-import-exemptions.tsx",
"sha256_LF": "89ab431fa6810c1f56897f203a817a41722c4a9df0cb075561dee6208e8730d1"
}
],
"counts_before": {
"delivered": 77,
"QA": 1,
"functional_pending": 54,
"documentary": 1,
"total": 133
},
"counts_current": {
"delivered": 78,
"QA": 0,
"functional_pending": 54,
"documentary": 1,
"total": 133
},
"counts_after_delivery": {
"delivered": 78,
"QA": 0,
"functional_pending": 54,
"documentary": 1,
"total": 133
},
"QA_proofs_reused": [
"iva-l1-g6h-qa-20261024.json"
],
"authorization": "Tempo explicitly deploy2359a88d by existingGit,preserve concurrentchanges and check installeddelta only;keep decision/list/plan/scope associated with result",
"scope": "P060 only,two treatments un_development_exemption/un_development_reduction,samebranch;decision/list/plan/scope references in immutable calculation inputs/report;request not grant;no extension to other goods/operations/periods",
"preservation": "77priorclosures and partialP084/P085 preserved;accepted QA reused;freshbackup/realisolatedrestore beforeinstallation;installeddelta only",
"partial_P084_P085": "Already available for preparation/conditional simulation only,benefits pending;no closure in this release",
"limits": "L1open;P00105/06;beveragesL2/L3;importclassification separate fromserviceVAT/deduction/field11;Stats/AIdeferred",
"containment": "l1-g6h-readonly-rollback-20261024.patch,checked only,not applied;blocks newP060classification only,preserves readers/history and otherbranches",
"authenticated_preflight": {
"installed": {
"status": "installed",
"commit": "9b26217dec945fe07b665c6ad7638a965bf104a9",
"release": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"previous_release": "/var/www/investmoz-homologacao/releases/78c9f4a356d5eaf590d8d82168228a2f84b1f633-a865ec5f",
"database_migrations": 0,
"content_imports": 0
},
"current_link": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"release_revision": {
"commit": "9b26217dec945fe07b665c6ad7638a965bf104a9",
"branch": "main",
"built_at": "2026-10-24T19:13:31.576700+00:00",
"manifest_sha256": "713be11fd1eee3f6ccc10f850260dbcc91e98577eb1e124b2fd0dacdaec9ecee"
},
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
"configuration_keys": [
"repository",
"branch",
"target_url",
"legacy_root",
"state_root",
"release_root",
"current_link",
"shared_assets",
"php",
"schema_contract",
"ci_environment",
"postgis_image",
"test_database",
"qa_port",
"retention",
"webhook_secret_file"
],
"safe_paths": {
"repository": "nala/Investidor-V2",
"release_root": "/var/www/investmoz-homologacao/releases",
"postgis_image": "postgis/postgis@sha256:01a6a70e41e6c4467c8f55f6063555ed72db2d6662cd0d571040d42eadaeb6f6"
},
"pipeline_sha256": "adec1c17654f3a8658b83b134f1e75f95391b235738552721906c3236e388604"
},
"backup_restore": {
"backup": {
"stage": "/var/backups/investmoz-l1-g6h-delivery-20261024/backup",
"target": {
"database": "teste_investidor",
"port": 5432
},
"tables": 174,
"files_verified": 369,
"dump_sha256": "6f6e23986cf21dffca468eaa8ba8b1493150a8eec78a5de238a9fc25d028a5c6",
"files_sha256": "6d7a2cdeede7f11edcb5f9a94935a1d79a50ce8b6f5bf86ef279db5ef25d086a",
"restore_verified": false
},
"restore": {
"restore_verified": true,
"tables_verified": 174,
"container_network": "none",
"database": "l1_g6h_restore_20261024",
"port": 55441,
"source_dump_sha256": "6f6e23986cf21dffca468eaa8ba8b1493150a8eec78a5de238a9fc25d028a5c6",
"active_database_writes": 0
}
},
"served_commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"installation": {
"protected": {
"installed": {
"status": "installed",
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"release": "/var/www/investmoz-homologacao/releases/eb9294ef42c2cfc97eb8c2553d545e3bff7c0add-08cf86ab",
"previous_release": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"database_migrations": 0,
"content_imports": 0
},
"runtime_files_verified": 2,
"persistent_files_and_env_verified": 369,
"tables_compared": 174,
"changed_tables": {
"cache": {
"before": {
"rows": 105,
"checksum": "38de6d88500d221365f198307f300e5d"
},
"after": {
"rows": 105,
"checksum": "4308332b7b4f3cfdbc90a7cf7bab2fc1"
}
},
"sessions": {
"before": {
"rows": 50,
"checksum": "14fad68aad0bd514ab29e6644c64945c"
},
"after": {
"rows": 51,
"checksum": "73a64a88a6f9f973258112f3ba0be512"
}
}
},
"preserved_counts": {
"published_fiches": 29,
"relations": 28,
"geometries": 408
},
"migration_count": 0,
"content_imports": 0,
"comparison_role": "postgres_before_and_after;sameexportedsnapshotbaseline;noapplicationRLSvisibilityinference",
"writes_by_verification": 0
},
"public": {
"status": "installed_delta_verified",
"served_revision": {
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"branch": "main",
"built_at": "2026-10-24T19:38:38.127391+00:00",
"manifest_sha256": "b419662fb9f09f3f0b33902a8935a88a6b48399575219fe3d33cceb9153172ee"
},
"manifest_hash_matches": true,
"compiled_delta_markers": {
"import-un-development/1": [
"assets/project-dossier-DkFpKnTK.js"
],
"un_development_exemption": [
"assets/project-dossier-DkFpKnTK.js"
],
"un_development_reduction": [
"assets/services-DVetpVxR.js",
"assets/project-dossier-DkFpKnTK.js"
],
"developmentProject": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentAgency": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentDecisionRef": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentListRef": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentPlanRef": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentScope": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentRightsRef": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentReductionPercent": [
"assets/services-DVetpVxR.js",
"assets/project-dossier-DkFpKnTK.js"
],
"developmentNormalVat": [
"assets/services-DVetpVxR.js",
"assets/project-dossier-DkFpKnTK.js"
],
"developmentNormalVatRef": [
"assets/services-DVetpVxR.js",
"assets/project-dossier-DkFpKnTK.js"
],
"Redução proporcional": [
"assets/project-dossier-DkFpKnTK.js"
]
},
"assets": [
{
"file": "assets/simulation-form-CPZAFZU3.js",
"status": 200,
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
},
{
"file": "assets/services-DVetpVxR.js",
"status": 200,
"sha256": "f7223ac486557504b96f3edec95c5a7f31d90e73c1f714108cf05177f0806eaf"
},
{
"file": "assets/project-dossier-DkFpKnTK.js",
"status": 200,
"sha256": "d362c8cb613b564d9597ac40ddc9883a1c97b08a11f15c9103a5fbe105cdeb00"
},
{
"file": "assets/project-dossier-document-DVHvkUfS.js",
"status": 200,
"sha256": "a77d217dd0e77b7193d9707f01aa9df31ce4dfe3a16d0e6cf644f8cc811dfef3"
}
],
"simulator_status": 200,
"simulator_entry": "assets/app-DD5AMs0u.js",
"existing_fiscal_availability": {
"data": {
"enabled": true,
"coverage_start": "2026-01-01",
"coverage_end": "2026-12-31",
"message": "IVA geral sobre base líquida disponível; enquadramento declarado."
}
},
"synthetic_private_writes": 0,
"method": "Read-only installedrevision/manifest/newcompiledcatalogueandreaders/simulatorentry;acceptedQAproofsreused"
},
"installer": {
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
"installed": {
"status": "installed",
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"release": "/var/www/investmoz-homologacao/releases/eb9294ef42c2cfc97eb8c2553d545e3bff7c0add-08cf86ab",
"previous_release": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"database_migrations": 0,
"content_imports": 0
},
"latest_report": {
"status": "installed",
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"release": "/var/www/investmoz-homologacao/releases/eb9294ef42c2cfc97eb8c2553d545e3bff7c0add-08cf86ab",
"previous_release": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"database_migrations": 0,
"content_imports": 0,
"requested_commits": [
"eb9294ef42c2cfc97eb8c2553d545e3bff7c0add"
],
"finished_at": "2026-10-24T19:38:40.794974+00:00"
},
"log_file": "1792870624830982809.log",
"summaries": [
"OK (1 test, 3106 assertions)",
"built in 24.99s",
"OK (59 tests, 317 assertions)",
"# tests 342",
"# pass 342",
"# fail 0"
],
"log_bytes": 128657
},
"rollback_executed": false
},
"result_associations": "Decision,list,plan and scope remain in immutable result.inputs and report;accepted QA proof reused and exact installed runtime hashes/compiled fields checked;no synthetic write in active",
"activation": "Normal Git fast-forward/webhook/installer;zero migrations/imports"
}
}
@@ -1,6 +1,6 @@
{
"implementation_commit": "69b6c49a600c02352fdb9d10b0f756dca6c500a5",
"status": "QA_complete_not_delivered",
"status": "delivered_with_QA_proofs_preserved",
"coverage": {
"AUD-SIM-L1-P060": [
"un_development_exemption",
@@ -147,5 +147,18 @@
"homologation_unchanged": "9b26217d",
"remaining": "Integrate/deliver by existingGit with manifest,freshbackup/realisolatedrestore and installeddelta;no push in QA task",
"limits": "P084/P085 partial,pending;P00105/06;L1open;beveragesL2/L3;Stats/AI deferred",
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g6h-development-20261024\\source-archive-inventory.json"
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g6h-development-20261024\\source-archive-inventory.json",
"qa_status_preserved": "QA_complete_not_delivered",
"delivery_followup": {
"served_commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"receipt": "l1-g6h-delivery-20261024.json",
"record": "iva_l1_g6h_P060_homologation_20261024",
"counts": {
"delivered": 78,
"QA": 0,
"functional_pending": 54,
"documentary": 1,
"total": 133
}
}
}
@@ -0,0 +1,152 @@
{
"implementation_commit": "1dda6ea25858f9fd35304458b09b8e6ab899ebb8",
"status": "QA_complete_not_delivered",
"coverage": {
"AUD-SIM-L1-P090": [
"public_authority_indemnity",
"public_authority_compensation"
]
},
"branch_count": 1,
"treatment_count": 2,
"source": "CIVA15(2)(d),Lei13/2016PDF13/p1426(271);15(3)/(4)/(5)/(6),PDF14/p1426(272);Lei22/2022PDF3maintains2d/3–6,Lei10/2025doesnotamend15. Statutory public-act compensation distinct from judicial contract-breach indemnity15(6)(a).",
"source_links": [
"https://www.inm.gov.mz/pt-br/content/suplemento-n%C2%BA-10-de-301216-pag-1426-259-290-br-n%C2%BA-156-boletim-da-rep%C3%BAblica-i-serie",
"https://www.parlamento.mz/?post_documents=boletim-da-republica-i-serie-nr-250-quarta-feira-28-de-dezembro-de-2022"
],
"meaning": "Determine the tax base for an identified taxable domestic supply of goods/services resulting from a public-authority act,using indemnity or other compensation;do not infer taxability from compensation/publicentity alone. Judicial contract-breach indemnity is not included by analogy.",
"technical_choices": "New opportunity-scoped publicAuthorityBases book inside existing modelo_a_snapshot;no schema/API/permissions change. Existing dossier/report and monthlyIVA components extended incrementally. Cash/nonmonetary/mixed form hides irrelevant fields but retains edits. Exact decimal sums with integers,up to6fractiondigits per input;no fiscalrounding assumption. Normalvalue explicitly supplied with valuationreference,not appraised by portal. References/conditions trace source,not newcertificate/approver or revalidation of officialsource.",
"scope": "2026/MZN;P090baseonly. BaseAmount independent from vat/rate,which alwaysremainnull. No determination of incidence,rate,exemption,tax,customsbase,deduction/field11/ModeloA totals orautomaticposting toother fiscalbooks. Components supplied netofIVA with applicable15(5)/(6)composition identified.",
"formula": "base = applicable net monetary component + applicable net nonmonetary normalvalue;form explicitly selects applicablecomponents;missing/invalid applicableamount orvaluationref staysnull,explicitzero is allowed;hiddenvalues not erased.",
"verification": {
"frontend": {
"tests": 4,
"passed": 4,
"failed": 0,
"scope": "Ownconditions unknown/no;judicialexclusion;money/in-kind/mixed;exactlarge/fractionalamounts/zero;missingrefs;context/version/history;malformedwriteguard;allpriorbooks unchanged;report"
},
"privateAPI": {
"tests": 1,
"assertions": 29,
"target": "simulator_fiscal_delta_20261021_test:55441",
"transaction_rollback": true,
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7a-public-base-20261024\\api-tests.xml"
},
"types": "passed",
"build": "passed,existing plugin timing warnings;final build after Portuguese report-label adjustment",
"UI": "Realcomponent Edge/CUA:unknownact/missingvaluation indeterminate;judicialcontractbreach notapplicable;switchmoney->mixed retains250.20and1500.25,base1750.45;finalbases1500.25/1250.30withVATnull;save/recover/report2rows+5priorversions;documents/act/value/compositionrefs retained. Synthetic only,not manualTempoacceptance.",
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7a-public-base-20261024\\qa-recovered-report.png"
},
"preservation": {
"base": "0a80f1c457cd5670110d153e90962671c73535f4",
"delivered_ids": [
"AUD-SIM-L1-P003",
"AUD-SIM-L1-P004",
"AUD-SIM-L1-P005",
"AUD-SIM-L1-P006",
"AUD-SIM-L1-P007",
"AUD-SIM-L1-P008",
"AUD-SIM-L1-P009",
"AUD-SIM-L1-P010",
"AUD-SIM-L1-P011",
"AUD-SIM-L1-P012",
"AUD-SIM-L1-P013",
"AUD-SIM-L1-P014",
"AUD-SIM-L1-P015",
"AUD-SIM-L1-P016",
"AUD-SIM-L1-P017",
"AUD-SIM-L1-P018",
"AUD-SIM-L1-P019",
"AUD-SIM-L1-P020",
"AUD-SIM-L1-P021",
"AUD-SIM-L1-P022",
"AUD-SIM-L1-P023",
"AUD-SIM-L1-P024",
"AUD-SIM-L1-P025",
"AUD-SIM-L1-P026",
"AUD-SIM-L1-P027",
"AUD-SIM-L1-P028",
"AUD-SIM-L1-P029",
"AUD-SIM-L1-P030",
"AUD-SIM-L1-P031",
"AUD-SIM-L1-P032",
"AUD-SIM-L1-P033",
"AUD-SIM-L1-P034",
"AUD-SIM-L1-P035",
"AUD-SIM-L1-P036",
"AUD-SIM-L1-P037",
"AUD-SIM-L1-P038",
"AUD-SIM-L1-P039",
"AUD-SIM-L1-P040",
"AUD-SIM-L1-P041",
"AUD-SIM-L1-P042",
"AUD-SIM-L1-P043",
"AUD-SIM-L1-P044",
"AUD-SIM-L1-P045",
"AUD-SIM-L1-P048",
"AUD-SIM-L1-P049",
"AUD-SIM-L1-P050",
"AUD-SIM-L1-P051",
"AUD-SIM-L1-P052",
"AUD-SIM-L1-P053",
"AUD-SIM-L1-P054",
"AUD-SIM-L1-P055",
"AUD-SIM-L1-P056",
"AUD-SIM-L1-P057",
"AUD-SIM-L1-P060",
"AUD-SIM-L1-P061",
"AUD-SIM-L1-P062",
"AUD-SIM-L1-P063",
"AUD-SIM-L1-P064",
"AUD-SIM-L1-P065",
"AUD-SIM-L1-P066",
"AUD-SIM-L1-P067",
"AUD-SIM-L1-P068",
"AUD-SIM-L1-P069",
"AUD-SIM-L1-P070",
"AUD-SIM-L1-P071",
"AUD-SIM-L1-P072",
"AUD-SIM-L1-P073",
"AUD-SIM-L1-P074",
"AUD-SIM-L1-P075",
"AUD-SIM-L1-P076",
"AUD-SIM-L1-P077",
"AUD-SIM-L1-P078",
"AUD-SIM-L1-P079",
"AUD-SIM-L1-P080",
"AUD-SIM-L1-P081",
"AUD-SIM-L1-P082",
"AUD-SIM-L1-P083",
"AUD-SIM-L1-P086"
],
"confirmed_losses": [],
"accepted_delivery": "eb9294ef/0a80f1c4;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions checked at delivery",
"frozen": "tests\\frontend\\fixtures\\iva-g7a-preserved-inputs.json",
"sha256": "418c1825be1cb6e0851d3bc9b8a6c03335349645bda5e73792fc3ff2c3bf28da",
"counts_before": {
"delivered": 78,
"QA": 0,
"functional_pending": 54,
"P001": 1,
"total": 133
},
"scope": "P090 only;preserve P060decision/list/plan/scope and proportional results,P056authorization/P050serviceVAT/partialP084P085;no active query/write"
},
"runtime_delta": {
"resources/js/lib/iva-public-authority-base.ts": "667704ba8c2d26421993f5e7e2c6599afb2912e052b27a96e423cb8d01a21d85",
"resources/js/components/simulation-public-authority-base.tsx": "7aa05785fdb6fcb7de4c0345e9c09073ebdbb3a8b39f1bd2610da08abc8c8a89",
"resources/js/components/simulation-monthly-iva.tsx": "db5b4431351766f8f86b4e60195381dab17c077ca3db72de48f2fb7e0f2a320b",
"resources/js/lib/project-dossier.ts": "60a9dd9f4eed5884b16c7097906bc438958b3b1407976e10f4699d35c1c68b19"
},
"counts_current": {
"delivered": 78,
"QA": 1,
"functional_pending": 53,
"P001": 1,
"total": 133
},
"homologation_unchanged": "eb9294ef",
"remaining": "Integrate/deliver by existingGit with manifest,freshbackup/realisolatedrestore and installeddelta;no push in QA task",
"limits": "P084/P085partial,pending;P00105/06;L1open;beveragesL2/L3;Stats/AIdeferred",
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7a-public-base-20261024\\source-archive-inventory.json"
}
@@ -1,5 +1,5 @@
{
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
"status": "installed_delta_verified_partial_L1",
"candidate": "2359a88dba92147eb28769c7d9ae908cb2df7227",
"base_installed": "9b26217dec945fe07b665c6ad7638a965bf104a9",
"coverage_complete_branches": {
@@ -28,8 +28,8 @@
"total": 133
},
"counts_current": {
"delivered": 77,
"QA": 1,
"delivered": 78,
"QA": 0,
"functional_pending": 54,
"documentary": 1,
"total": 133
@@ -114,5 +114,180 @@
"source_dump_sha256": "6f6e23986cf21dffca468eaa8ba8b1493150a8eec78a5de238a9fc25d028a5c6",
"active_database_writes": 0
}
}
},
"served_commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"installation": {
"protected": {
"installed": {
"status": "installed",
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"release": "/var/www/investmoz-homologacao/releases/eb9294ef42c2cfc97eb8c2553d545e3bff7c0add-08cf86ab",
"previous_release": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"database_migrations": 0,
"content_imports": 0
},
"runtime_files_verified": 2,
"persistent_files_and_env_verified": 369,
"tables_compared": 174,
"changed_tables": {
"cache": {
"before": {
"rows": 105,
"checksum": "38de6d88500d221365f198307f300e5d"
},
"after": {
"rows": 105,
"checksum": "4308332b7b4f3cfdbc90a7cf7bab2fc1"
}
},
"sessions": {
"before": {
"rows": 50,
"checksum": "14fad68aad0bd514ab29e6644c64945c"
},
"after": {
"rows": 51,
"checksum": "73a64a88a6f9f973258112f3ba0be512"
}
}
},
"preserved_counts": {
"published_fiches": 29,
"relations": 28,
"geometries": 408
},
"migration_count": 0,
"content_imports": 0,
"comparison_role": "postgres_before_and_after;sameexportedsnapshotbaseline;noapplicationRLSvisibilityinference",
"writes_by_verification": 0
},
"public": {
"status": "installed_delta_verified",
"served_revision": {
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"branch": "main",
"built_at": "2026-10-24T19:38:38.127391+00:00",
"manifest_sha256": "b419662fb9f09f3f0b33902a8935a88a6b48399575219fe3d33cceb9153172ee"
},
"manifest_hash_matches": true,
"compiled_delta_markers": {
"import-un-development/1": [
"assets/project-dossier-DkFpKnTK.js"
],
"un_development_exemption": [
"assets/project-dossier-DkFpKnTK.js"
],
"un_development_reduction": [
"assets/services-DVetpVxR.js",
"assets/project-dossier-DkFpKnTK.js"
],
"developmentProject": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentAgency": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentDecisionRef": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentListRef": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentPlanRef": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentScope": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentRightsRef": [
"assets/project-dossier-DkFpKnTK.js"
],
"developmentReductionPercent": [
"assets/services-DVetpVxR.js",
"assets/project-dossier-DkFpKnTK.js"
],
"developmentNormalVat": [
"assets/services-DVetpVxR.js",
"assets/project-dossier-DkFpKnTK.js"
],
"developmentNormalVatRef": [
"assets/services-DVetpVxR.js",
"assets/project-dossier-DkFpKnTK.js"
],
"Redução proporcional": [
"assets/project-dossier-DkFpKnTK.js"
]
},
"assets": [
{
"file": "assets/simulation-form-CPZAFZU3.js",
"status": 200,
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
},
{
"file": "assets/services-DVetpVxR.js",
"status": 200,
"sha256": "f7223ac486557504b96f3edec95c5a7f31d90e73c1f714108cf05177f0806eaf"
},
{
"file": "assets/project-dossier-DkFpKnTK.js",
"status": 200,
"sha256": "d362c8cb613b564d9597ac40ddc9883a1c97b08a11f15c9103a5fbe105cdeb00"
},
{
"file": "assets/project-dossier-document-DVHvkUfS.js",
"status": 200,
"sha256": "a77d217dd0e77b7193d9707f01aa9df31ce4dfe3a16d0e6cf644f8cc811dfef3"
}
],
"simulator_status": 200,
"simulator_entry": "assets/app-DD5AMs0u.js",
"existing_fiscal_availability": {
"data": {
"enabled": true,
"coverage_start": "2026-01-01",
"coverage_end": "2026-12-31",
"message": "IVA geral sobre base líquida disponível; enquadramento declarado."
}
},
"synthetic_private_writes": 0,
"method": "Read-only installedrevision/manifest/newcompiledcatalogueandreaders/simulatorentry;acceptedQAproofsreused"
},
"installer": {
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
"installed": {
"status": "installed",
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"release": "/var/www/investmoz-homologacao/releases/eb9294ef42c2cfc97eb8c2553d545e3bff7c0add-08cf86ab",
"previous_release": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"database_migrations": 0,
"content_imports": 0
},
"latest_report": {
"status": "installed",
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"release": "/var/www/investmoz-homologacao/releases/eb9294ef42c2cfc97eb8c2553d545e3bff7c0add-08cf86ab",
"previous_release": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"database_migrations": 0,
"content_imports": 0,
"requested_commits": [
"eb9294ef42c2cfc97eb8c2553d545e3bff7c0add"
],
"finished_at": "2026-10-24T19:38:40.794974+00:00"
},
"log_file": "1792870624830982809.log",
"summaries": [
"OK (1 test, 3106 assertions)",
"built in 24.99s",
"OK (59 tests, 317 assertions)",
"# tests 342",
"# pass 342",
"# fail 0"
],
"log_bytes": 128657
},
"rollback_executed": false
},
"result_associations": "Decision,list,plan and scope remain in immutable result.inputs and report;accepted QA proof reused and exact installed runtime hashes/compiled fields checked;no synthetic write in active",
"activation": "Normal Git fast-forward/webhook/installer;zero migrations/imports"
}
@@ -0,0 +1,126 @@
{
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
"candidate": "20bfeb4f71743fd7316b252c027a88d0c67d5eae",
"base_installed": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"coverage_complete_branches": {
"AUD-SIM-L1-P090": [
"public_authority_indemnity",
"public_authority_compensation"
]
},
"branch_count_complete": 1,
"treatment_count": 2,
"runtime_delta": [
{
"path": "resources/js/lib/iva-public-authority-base.ts",
"sha256_LF": "667704ba8c2d26421993f5e7e2c6599afb2912e052b27a96e423cb8d01a21d85"
},
{
"path": "resources/js/components/simulation-public-authority-base.tsx",
"sha256_LF": "7aa05785fdb6fcb7de4c0345e9c09073ebdbb3a8b39f1bd2610da08abc8c8a89"
},
{
"path": "resources/js/components/simulation-monthly-iva.tsx",
"sha256_LF": "db5b4431351766f8f86b4e60195381dab17c077ca3db72de48f2fb7e0f2a320b"
},
{
"path": "resources/js/lib/project-dossier.ts",
"sha256_LF": "60a9dd9f4eed5884b16c7097906bc438958b3b1407976e10f4699d35c1c68b19"
}
],
"counts_before": {
"delivered": 78,
"QA": 1,
"functional_pending": 53,
"documentary": 1,
"total": 133
},
"counts_current": {
"delivered": 78,
"QA": 1,
"functional_pending": 53,
"documentary": 1,
"total": 133
},
"counts_after_delivery": {
"delivered": 79,
"QA": 0,
"functional_pending": 53,
"documentary": 1,
"total": 133
},
"QA_proofs_reused": [
"iva-l1-g7a-qa-20261024.json"
],
"authorization": "Tempo explicitly deploy20bfeb4f through existingGit,preserve concurrentchanges and check installeddelta only;two treatments sameP090branch,base remains separate fromVAT",
"scope": "P090only,public_authority_indemnity/public_authority_compensation;net monetary/nonmonetary normalvalue components,act/document/composition/valuationreferences in immutable result.inputs/report;vat/rate alwaysnull,no incidence/tax/deduction/field11/ModeloAtotals inferred",
"preservation": "78priorclosures and partialP084/P085 preserved;acceptedQA reused;freshbackup/realisolatedrestore beforeinstallation;installeddelta only;P060decision/list/plan/scope andproportionalresults,P056authorization,P050serviceVAT preserved",
"partial_P084_P085": "Already available for preparation/conditional simulation only,benefits pending;no closure in this release",
"limits": "L1open;P00105/06;beveragesL2/L3;Statistics/AIdeferred;L1closuredoesnotrequireL2/L3/alltaxes",
"containment": "l1-g7a-readonly-rollback-20261024.patch,checked only,not applied;blocks newP090calculations only,preserves readers/history andotherbranches",
"authenticated_preflight": {
"installed": {
"status": "installed",
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"release": "/var/www/investmoz-homologacao/releases/eb9294ef42c2cfc97eb8c2553d545e3bff7c0add-08cf86ab",
"previous_release": "/var/www/investmoz-homologacao/releases/9b26217dec945fe07b665c6ad7638a965bf104a9-80907805",
"database_migrations": 0,
"content_imports": 0
},
"current_link": "/var/www/investmoz-homologacao/releases/eb9294ef42c2cfc97eb8c2553d545e3bff7c0add-08cf86ab",
"release_revision": {
"commit": "eb9294ef42c2cfc97eb8c2553d545e3bff7c0add",
"branch": "main",
"built_at": "2026-10-24T19:38:38.127391+00:00",
"manifest_sha256": "b419662fb9f09f3f0b33902a8935a88a6b48399575219fe3d33cceb9153172ee"
},
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
"configuration_keys": [
"repository",
"branch",
"target_url",
"legacy_root",
"state_root",
"release_root",
"current_link",
"shared_assets",
"php",
"schema_contract",
"ci_environment",
"postgis_image",
"test_database",
"qa_port",
"retention",
"webhook_secret_file"
],
"safe_paths": {
"repository": "nala/Investidor-V2",
"release_root": "/var/www/investmoz-homologacao/releases",
"postgis_image": "postgis/postgis@sha256:01a6a70e41e6c4467c8f55f6063555ed72db2d6662cd0d571040d42eadaeb6f6"
},
"pipeline_sha256": "adec1c17654f3a8658b83b134f1e75f95391b235738552721906c3236e388604"
},
"backup_restore": {
"backup": {
"stage": "/var/backups/investmoz-l1-g7a-delivery-20261024/backup",
"target": {
"database": "teste_investidor",
"port": 5432
},
"tables": 174,
"files_verified": 369,
"dump_sha256": "30a6764b68526e358a4f9bc64bb8dd65df25af1b379878e9619105d1d871e408",
"files_sha256": "67134f77514350569cd1a4a70357f73258b6fa65bb3f6fe7655ec5cd02939ef2",
"restore_verified": false
},
"restore": {
"restore_verified": true,
"tables_verified": 174,
"container_network": "none",
"database": "l1_g7a_restore_20261024",
"port": 55441,
"source_dump_sha256": "30a6764b68526e358a4f9bc64bb8dd65df25af1b379878e9619105d1d871e408",
"active_database_writes": 0
}
}
}
@@ -0,0 +1,10 @@
--- a/resources/js/lib/iva-public-authority-base.ts
+++ b/resources/js/lib/iva-public-authority-base.ts
@@ -60,6 +60,7 @@
function formLabel(value:string):string{return value==='money'?'Em dinheiro':value==='non_money'?'Em espécie':value==='mixed'?'Mista — dinheiro e espécie':'Por indicar';}
export function publicBaseCurrent(draft:Record<string,unknown>,book:PublicBaseBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
export function recordPublicBases(draft:Record<string,unknown>,book:PublicBaseBook):PublicBaseBook{
+ throw new Error('Novas bases P090 temporariamente suspensas; dados, histórico, relatórios e restantes ramos preservados.');
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos; originais conservados.');
const result:PublicBaseCalculation={version:publicBaseVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:publicBaseSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluatePublicBase(row,draft.currency))};
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};savePublicBaseBook(draft,next);return next;
@@ -1,6 +1,38 @@
# Rastreabilidade, utilização e formação
## 24/10/2026 — G7A/P090 concluído em QA, base separada de IVA
Implementação`1dda6ea2`. **Um ramo,dois tratamentos**:`public_authority_indemnity` e`public_authority_compensation`. FonteCIVA15(2)(d),2016PDF13/p1426(271),15(3–6)PDF14/p1426(272);2022PDF3mantém2d/3–6,2025não altera15. Indemnização/outra compensação por acto de autoridade pública ligado a transmissão de bens ou prestação de serviços sujeita;entidade pública/pagamento não provam incidência. Distinguir exclusão da indemnização judicial por incumprimento total/parcial de contrato15(6)a;não incluir por analogia.
**Base=componente monetária semIVA +valor normal não monetário semIVA**,apenas componentes aplicáveis à forma em dinheiro/espécie/mista expressamente escolhida. Valor normal15(3)/(4) informado com fundamento/pressuposto,não avaliado pelo portal;composição15(5)/(6)referenciada,sem próprioIVA/duplicações. Condições/referências/valores em falta mantêm base indeterminada,zero só se expressamente informado. Base não equivale a imposto:IVA/taxa permanecemnull;sem isenção presumida,dedução/campo11/totaisModeloA ou escrita em livros anteriores. Novo livropublicAuthorityBases por oportunidade no snapshot existente,API/relatório integrados incrementalmente,sem schema/permissões/procedimento organizacional novo. Mudar de forma oculta componentes sem apagar edições;documentos/acto/composição/valorização e versões conservados.
Provas do delta:**4testes frontend**;**APIprivada1teste/29asserções**,guarda`simulator_fiscal_delta_20261021_test:55441` e rollback;tipos/build passaram,build final após ajustar rótulos do relatório para português. Interface real Edge/CUA:acto desconhecido/valorização em falta→indeterminado;exclusão contratual→nãoaplicação;dinheiro1500.25,componente em espécie250.20 conservada ao mudar para mista→1750.45;gravação final recuperada com bases1500.25/1250.30,IVAindeterminado,2linhas/5versões anteriores e referências completas. Apenas dados sintéticos,não aceitação manual atribuída à Tempo.78fechos anteriores e livros/resultados/históricos intactos,incluindoP060(despacho/lista/plano/âmbito/redução),P056(autorização),P050(IVAserviço) eP084/P085parciais. [RegistoQA](../simulations/iva-l1-g7a-qa-20261024.json).
**78entregues +1emQA(P090) +53funcionaispendentes +P001 =133**. Homologação permanece`eb9294ef`;falta integração/entrega pelo processoGit,manifesto/backup/restauro e delta instalado. P084/P085 continuam nos53,apenas preparação/simulação condicionada,sem benefícios confirmados. L1aberto;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas.
## 24/10/2026 — preparação G7A/P090, inventário antes de testes
G6H/P060 aceiteeb9294ef/0a80f1c4;**78entregues+54funcionaispendentes+P001=133**. Inventariados78fechos,sem perdas confirmadas;provas de código/schema/dados/configuração/permissões174tabelas/369ficheiros/29fichas/28relações/408geometrias reutilizadas. Congelados livros/resultados/históricos,P060(despacho/lista/plano/âmbito e redução proporcional),P056(autorização),P050(IVAserviço),P084/P085(preparação/cenários parciais,benefícios pendentes). Conferir apenas delta,sem repetir aceitação anterior ou ensaiar no activo.
G7A/P090 abre o grupo de bases especiais numa alínea documentada independente:CIVA15(2)(d),2016PDF13/p1426(271),base das transmissões de bens/prestações de serviços resultantes de actos de autoridades públicas é indemnização ou outra compensação.15(3)/(4),PDF14/p1426(272),componente não monetária pelo valor normal;15(5)/(6),composição/exclusões,sem próprioIVA;distinguir indemnização judicial por incumprimento de contrato15(6)(a),não incluída por analogia.2022PDF3mantém2d/3–6,2025não altera15. Fontes oficiais/exemplares/inventários existentes aceites;skillPDF para cotejo visual. Não aplicar taxa17%histórica da página como taxa presente.
Dois tratamentos técnicos no mesmo ramo:indemnização e outra compensação. Forma em dinheiro/espécie/mista determina componentes aplicáveis,sem apagar valores ocultos;valor normal não monetário vem de referência/pressuposto explícito,não avaliação automática pelo portal. Somar componentes semIVA e composição identificada;desconhecido não é zero. Base separada de incidência/taxa/IVA/dedução/campo11/totaisModeloA;sem tratar entidade pública/qualquer indemnização como operação sujeita por defeito. Novo livro por oportunidade no snapshot existente,versionamento/histórico/relatório e API de rascunhos existentes;sem migração ou novo procedimento organizacional. L1aberto;P00105/06;bebidasL2/L3;P084/P085parciais;Estatísticas/IAadiadas.
## 24/10/2026 — G6H/P060 entregue; despacho, lista, plano e âmbito associados ao resultado
Homologação **`eb9294ef`**,pelo processoGit existente,sobre`9b26217d`;candidata`2359a88d` expressamente aceite pela Tempo. **P060:um ramo,dois tratamentos**,`un_development_exemption` e`un_development_reduction`. Despacho favorável,lista discriminada aprovada,plano de importações e âmbito desta operação mantêm-se nas entradas imutáveis do resultado e no relatório. Pedido apresentado não equivale a despacho/concessão;pressupostos de projecção estão identificados. Isenção integral distingue-se de redução proporcional sobre o IVA sem benefício e a percentagem de redução de direitos expressamente informados. Não presume taxa/base/direitos,dedução/campo11 ou totaisModeloA,nem estende decisão/lista/plano a outros bens/operações/períodos. P056 e IVA do serviçoP050 preservados.
Destino e main conferidos novamente;sem avanço concorrente encontrado. Backup novo e restauro real isolado sem rede:**174tabelas e369ficheiros/configuração**. ProvasQA aceites reutilizadas;conferido apenas delta instalado:revisão servida,manifesto/hash,14marcadores compilados(incluindo despacho/lista/plano/âmbito),dois ficheiros funcionais e simuladorHTTP200. Comparação PostgreSQL pela mesma identidade antes/depois:174tabelas/369ficheiros,29fichas publicadas/28relações/408geometrias preservados;diferenças apenas cache/sessões. Zero migrações/importações/alterações de permissões e zero ensaios sintéticos no activo. Release/backup anteriores preservados;contençãoP060 conferida,não aplicada,leitores/históricos e restantes ramos preservados.
[Manifesto/recibo](../simulations/l1-g6h-delivery-20261024.json),registo`iva_l1_g6h_P060_homologation_20261024`. **78entregues +54funcionaispendentes +P001 =133;sem candidatasQA por disponibilizar.** Os77fechos anteriores permanecem encerrados. P084/P085 continuam incluídos nos54,apenas preparação/simulação condicionada,sem benefícios confirmados;rascunhos,decisões,âmbitos e históricos preservados. L1aberto;P001 só05/06;bebidasL2/L3;Estatísticas/IAadiadas. FecharL1 não exige concluirL2/L3 nem todos os impostos.
## 24/10/2026 — G6H/P060 concluído em QA, não disponibilizado
Implementação`69b6c49a`. **Um ramo,dois tratamentos**: `un_development_exemption` e `un_development_reduction`. CIVA12(2)(c)/4,2016PDF11–12,p1426(269–270),mantidos2022PDF2–3/2025PDF13. Materiais/equipamentos de projectos de desenvolvimento financiados pelas agências/instituições especializadas ONU devidamente acreditadas junto do Governo Moçambicano e destinados exclusivamente à implementação. Conservar projecto,agência/acreditação,despacho favorável,requerimento prévio/lista discriminada/plano,concessão aduaneira conforme plano/lista aprovada e âmbito da importação. Pedido apresentado não equivale a despacho favorável/concessão. Autoridades/condições vêm da norma;campos de referência são rastreabilidade técnica,sem novo certificado/aprovador ou revalidação oficial.
File diff suppressed because one or more lines are too long
@@ -6,6 +6,7 @@ import { type ApiSimulationExecutionV1 } from '@/lib/simulation-contract';
import { SimulationModeloA } from './simulation-modelo-a';
import { SimulationAcquisitions } from './simulation-acquisitions';
import { SimulationImportExemptions } from './simulation-import-exemptions';
import { SimulationPublicAuthorityBase } from './simulation-public-authority-base';
import { SimulationOfferPreparations } from './simulation-offer-preparations';
import { SimulationOperations } from './simulation-operations';
@@ -90,6 +91,7 @@ export function SimulationMonthlyIva({draft, busy, onCalculate, onChange}: {
<SimulationOperations draft={draft} onChange={onChange} />
<SimulationAcquisitions draft={draft} onChange={onChange} />
<SimulationImportExemptions draft={draft} onChange={onChange} />
<SimulationPublicAuthorityBase draft={draft} onChange={onChange} />
<SimulationOfferPreparations draft={draft} onChange={onChange} />
<SimulationModeloA draft={draft} />
</section>;
@@ -0,0 +1,32 @@
import {useState} from 'react';
import {newPublicBase,publicBaseBook,publicBaseConditions,publicBaseCurrent,publicBaseReportRows,publicBaseSource,publicBaseTreatments,recordPublicBases,savePublicBaseBook,type PublicBaseBook,type PublicBaseRow} from '@/lib/iva-public-authority-base';
export function SimulationPublicAuthorityBase({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
const[error,setError]=useState('');let book:PublicBaseBook;
try{book=publicBaseBook(draft);}catch(cause){return<p role="alert">{String(cause)}</p>;}
const save=(next:PublicBaseBook)=>{try{onChange('modelo_a_snapshot',savePublicBaseBook(draft,next));setError('');}catch(cause){setError(String(cause));}};
const change=(id:string,patch:Partial<PublicBaseRow>)=>save({...book,rows:book.rows.map(row=>row.id===id?{...row,...patch}:row)});
return<details className="space-y-3 rounded border p-3">
<summary>Base tributável — actos de autoridades públicas</summary>
<p>Oportunidade: {String(draft.context_opportunity||'entrada geral')}. Prepare apenas as operações relevantes. A base do artigo15(2)(d) é a indemnização ou outra compensação ligada à transmissão de bens ou prestação de serviços resultante do acto público. Um pagamento ou a natureza pública da entidade não determinam incidência nem taxa de IVA.</p>
<p>A indemnização judicial por incumprimento de contrato tem exclusão própria no artigo15(6)(a); não é incluída por analogia. Indique as componentes sem IVA e o fundamento da composição. Na compensação em espécie ou mista, identifique o valor normal conforme15(3)/(4). Valores em falta permanecem indeterminados; não se convertem em zero.</p>
<p>{publicBaseSource}</p>
{error&&<p role="alert">{error}</p>}
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newPublicBase(crypto.randomUUID(),String(draft.currency??''))]})}>Acrescentar operação de acto público</button>
{book.rows.map(row=><details key={row.id} className="rounded border p-3"><summary>{row.description||'Operação por identificar'} — {row.period||'mês por indicar'}</summary>
<div className="grid gap-3 md:grid-cols-2">
<label>Tratamento da compensação<select className="block rounded border p-2" value={row.treatment} onChange={e=>change(row.id,{treatment:e.target.value})}><option value="">Por indicar</option>{publicBaseTreatments.map(item=><option key={item.id} value={item.id}>{item.label}</option>)}</select></label>
<label>Natureza da operação<select className="block rounded border p-2" value={row.operationNature} onChange={e=>change(row.id,{operationNature:e.target.value as PublicBaseRow['operationNature']})}><option value="">Por indicar</option><option value="goods">Transmissão de bens</option><option value="services">Prestação de serviços</option></select></label>
<label>Natureza dos dados<select className="block rounded border p-2" value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as PublicBaseRow['origin']})}><option value="projected">Projectados / pressupostos</option><option value="effective">Efectivos declarados</option></select></label>
{([['description','Operação identificada'],['authority','Autoridade pública'],['actRef','Acto da autoridade / referência da previsão'],['documentRef','Documento da compensação / referência da previsão'],['documentDate','Data do documento / prevista'],['period','Mês da operação'],['currency','Moeda de origem'],['compositionRef','Referência da composição sem IVA — inclusões e exclusões aplicáveis'],['evidence','Fundamento factual / pressupostos']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" type={field==='documentDate'?'date':field==='period'?'month':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
<label>Forma da compensação<select className="block rounded border p-2" value={row.compensationForm} onChange={e=>change(row.id,{compensationForm:e.target.value as PublicBaseRow['compensationForm']})}><option value="">Por indicar</option><option value="money">Em dinheiro</option><option value="non_money">Em espécie</option><option value="mixed">Mista — dinheiro e espécie</option></select></label>
{['money','mixed'].includes(row.compensationForm)&&<label>Componente monetária sem IVA (moeda indicada)<input className="block rounded border p-2" value={row.moneyAmount} onChange={e=>change(row.id,{moneyAmount:e.target.value})}/></label>}
{['non_money','mixed'].includes(row.compensationForm)&&<><label>Valor normal não monetário sem IVA (moeda indicada)<input className="block rounded border p-2" value={row.nonMoneyValue} onChange={e=>change(row.id,{nonMoneyValue:e.target.value})}/></label><label>Referência da valorização / pressuposto do valor normal<input className="block rounded border p-2" value={row.valuationRef} onChange={e=>change(row.id,{valuationRef:e.target.value})}/></label></>}
</div>
<p>Ao mudar de tratamento ou forma, os valores e referências anteriores conservam-se; só entram no cálculo as componentes aplicáveis à forma escolhida.</p>
<fieldset><legend>Condições próprias desta base</legend>{publicBaseConditions.map(([key,label])=><label className="block" key={key}>{label}<select className="block rounded border p-2" value={row.conditions[key]??''} onChange={e=>change(row.id,{conditions:{...row.conditions,[key]:e.target.value}})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}</fieldset>
</details>)}
{!!book.rows.length&&<button type="button" className="rounded bg-emerald-800 p-2 text-white" onClick={()=>{try{save(recordPublicBases(draft,book));}catch(cause){setError(String(cause));}}}>Determinar bases e guardar versão</button>}
{book.result&&<><p role="status">{publicBaseCurrent(draft,book)?'Bases correspondentes às entradas guardadas.':'Entradas alteradas; bases históricas conservadas. Reveja e determine novamente.'} {book.history?.length??0} versões anteriores. IVA e campo11 não são preenchidos por estas bases.</p><dl>{publicBaseReportRows(draft).map(([,label,value,origin],index)=><div key={index}><dt className="font-semibold">{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
</details>;
}
@@ -0,0 +1,70 @@
import { acquisitionScope, readAcquisitionStore } from './iva-acquisitions.ts';
export const publicBaseVersion='public-authority-base/1';
export const publicBaseSource='CIVA republicado Lei13/2016,15(2)(d),PDF13/p1426(271): base das transmissões de bens e prestações de serviços resultantes de actos de autoridades públicas é a indemnização ou qualquer outra compensação. Art15(3)/(4),PDF14/p1426(272): componente não monetária pelo valor normal;15(5)/(6),composição/exclusões,incluindo exclusão do próprio IVA e indemnização judicial por incumprimento de contratos. Lei22/2022PDF3 mantém15(2)(d)/(3–6)por remissão;Lei10/2025não altera15. Recorte2026/MZN,determinação da base;sem inferir incidência,taxa,isenção,IVA,dedução/campo11 ou totaisModeloA.';
export const publicBaseTreatments=[
{id:'public_authority_indemnity',label:'Indemnização por acto de autoridade pública'},
{id:'public_authority_compensation',label:'Outra compensação por acto de autoridade pública'},
] as const;
export const publicBaseConditions=[
['taxableDomesticSupply','Está identificada uma transmissão de bens ou prestação de serviços sujeita a IVA no território nacional; não basta existir um pagamento ou uma entidade pública'],
['authorityAct','A transmissão ou prestação resulta do acto da autoridade pública identificado'],
['compensationLink','O montante e as componentes indicadas correspondem à indemnização ou compensação desta operação'],
['notJudicialContractBreach','Não se trata de quantia recebida a título de indemnização declarada judicialmente por incumprimento total ou parcial de contrato, excluída pelo artigo15(6)(a)'],
['netComposition','Os valores indicados excluem o próprio IVA e reflectem a composição aplicável dos números5/6 do artigo15, sem omissões nem duplicações; a referência explica a composição'],
] as const;
type Condition=typeof publicBaseConditions[number][0];
type Choice=''|'yes'|'no';
export type PublicBaseRow={id:string;treatment:string;description:string;operationNature:''|'goods'|'services';period:string;origin:'projected'|'effective';currency:string;authority:string;actRef:string;documentRef:string;documentDate:string;compensationForm:''|'money'|'non_money'|'mixed';moneyAmount:string;nonMoneyValue:string;valuationRef:string;compositionRef:string;evidence:string;conditions:Partial<Record<Condition,Choice>>};
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';baseAmount:string|null;vat:null;rate:null;reason:string};
export type PublicBaseCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:PublicBaseRow[];rows:LineResult[]};
export type PublicBaseBook={rows:PublicBaseRow[];result?:PublicBaseCalculation;history?:PublicBaseCalculation[]};
type Store=ReturnType<typeof readAcquisitionStore>&{publicAuthorityBases?:Record<string,PublicBaseBook>};
export function newPublicBase(id:string,currency:string):PublicBaseRow{return{id,treatment:'',description:'',operationNature:'',period:'',origin:'projected',currency,authority:'',actRef:'',documentRef:'',documentDate:'',compensationForm:'',moneyAmount:'',nonMoneyValue:'',valuationRef:'',compositionRef:'',evidence:'',conditions:{}};}
function readStore(draft:Record<string,unknown>):Store{
const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
if(store.publicAuthorityBases!==undefined&&(!store.publicAuthorityBases||typeof store.publicAuthorityBases!=='object'||Array.isArray(store.publicAuthorityBases)))throw new Error('Bases de actos públicos não recuperáveis; originais preservados.');
const fields=Object.keys(newPublicBase('','')).filter(key=>key!=='conditions');
for(const book of Object.values(store.publicAuthorityBases??{})){
if(!book||!Array.isArray(book.rows)||(book.history!==undefined&&!Array.isArray(book.history))||book.rows.some(row=>!row||fields.some(key=>typeof row[key as keyof PublicBaseRow]!=='string')||!row.conditions||typeof row.conditions!=='object'||Array.isArray(row.conditions)))throw new Error('Linhas de base tributável não recuperáveis; originais preservados,sem substituição por lista vazia.');
}
return store;
}
export function publicBaseBook(draft:Record<string,unknown>):PublicBaseBook{return readStore(draft).publicAuthorityBases?.[acquisitionScope(draft)]??{rows:[]};}
export function savePublicBaseBook(draft:Record<string,unknown>,book:PublicBaseBook):string{
const current=readStore(draft),encoded=JSON.stringify({...current,publicAuthorityBases:{...current.publicAuthorityBases,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;
}
function decimal(raw:unknown):bigint|null{if(typeof raw!=='string'||!/^\d{1,15}(\.\d{1,6})?$/.test(raw.trim()))return null;const[whole,fraction='']=raw.trim().split('.');return BigInt(whole)*1000000n+BigInt(fraction.padEnd(6,'0'));}
function money(n:bigint):string{return`${n/1000000n}.${(n%1000000n).toString().padStart(6,'0').replace(/0+$/,'').padEnd(2,'0')}`;}
function validDate(value:string):boolean{const d=new Date(value+'T00:00:00Z');return /^\d{4}-\d{2}-\d{2}$/.test(value)&&Number.isFinite(d.getTime())&&d.toISOString().slice(0,10)===value;}
export function evaluatePublicBase(row:PublicBaseRow,currency:unknown):LineResult{
const result:LineResult={id:row.id,status:'indeterminate',baseAmount:null,vat:null,rate:null,reason:''};
const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
if(!publicBaseTreatments.some(item=>item.id===row.treatment))return stop('Escolha indemnização ou outra compensação por acto de autoridade pública; um pagamento genérico não determina esta base.');
if(currency!=='MZN'||row.currency!==currency)return stop('Moeda fora do âmbito MZN ou divergente do projecto; originais conservados,sem conversão.');
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin))return stop('Indique o período em2026 e dados efectivos declarados ou pressupostos de projecção; não são inferidos do orçamento.');
const failed=publicBaseConditions.filter(([key])=>row.conditions[key]==='no');
if(failed.length)return stop('Não se aplica esta determinação de base: '+failed.map(([,label])=>label).join('; ')+'. Não é isenção nem IVA zero; conserve o enquadramento próprio da operação.','not_applicable');
const missing=publicBaseConditions.filter(([key])=>row.conditions[key]!=='yes');
if(missing.length)return stop('Condições por indicar: '+missing.map(([,label])=>label).join('; ')+'. Desconhecido não significa não aplicável ou zero.');
if(!['goods','services'].includes(row.operationNature)||!row.description.trim()||!row.authority.trim()||!row.actRef.trim()||!row.documentRef.trim()||!row.compositionRef.trim()||!row.evidence.trim()||!validDate(row.documentDate))return stop('Identifique a operação,natureza,autoridade,acto,documento/data e fundamento da composição,ou pressupostos expressos; reutilize referências existentes,sem novo certificado.');
if(!['money','non_money','mixed'].includes(row.compensationForm))return stop('Indique se a compensação é em dinheiro,em espécie ou mista; ausência de resposta não elimina uma componente.');
const cash=row.compensationForm==='non_money'?0n:decimal(row.moneyAmount),kind=row.compensationForm==='money'?0n:decimal(row.nonMoneyValue);
if(cash===null||kind===null)return stop('Indique os valores sem IVA das componentes aplicáveis; montante em falta ou inválido não é zero.');
if(row.compensationForm!=='money'&&!row.valuationRef.trim())return stop('Identifique o fundamento do valor normal da componente não monetária,conforme15(3)/(4),ou o pressuposto expresso; não é avaliado pelo portal.');
const base=money(cash+kind);
return{...result,status:'determined',baseAmount:base,reason:`Base15(2)(d): componente monetária ${money(cash)} + valor normal não monetário ${money(kind)} = ${base}MZN,${row.origin==='projected'?'nas condições expressamente assumidas na projecção':'nos dados efectivos declarados'}. Componentes sem IVA,não duplicadas,composição15(5)/(6) identificada. Base não é imposto; incidência/taxa/IVA/dedução/campo11 não são determinados por este cálculo.`};
}
function key(draft:Record<string,unknown>,book:PublicBaseBook):string{return JSON.stringify({version:publicBaseVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
function natureLabel(value:string):string{return value==='goods'?'Transmissão de bens':value==='services'?'Prestação de serviços':'Por indicar';}
function formLabel(value:string):string{return value==='money'?'Em dinheiro':value==='non_money'?'Em espécie':value==='mixed'?'Mista — dinheiro e espécie':'Por indicar';}
export function publicBaseCurrent(draft:Record<string,unknown>,book:PublicBaseBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
export function recordPublicBases(draft:Record<string,unknown>,book:PublicBaseBook):PublicBaseBook{
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos; originais conservados.');
const result:PublicBaseCalculation={version:publicBaseVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:publicBaseSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluatePublicBase(row,draft.currency))};
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};savePublicBaseBook(draft,next);return next;
}
export function publicBaseReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{
try{const book=publicBaseBook(draft),result=book.result;if(!result)return[];return result.inputs.map((row,index)=>['IVA mensal',`Base P090 — ${row.period} — ${row.id}`,`${row.description}; base tributável: ${result.rows[index].baseAmount??'Indeterminada'} ${row.currency}; IVA: Indeterminado; ${result.rows[index].reason}`,`${result.opportunity}; ${result.location}; ${publicBaseCurrent(draft,book)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'}; versão${result.revision}; ${result.calculatedAt}; ${result.source}; ${row.origin==='projected'?'Projecção':'Dados efectivos declarados'}; ${publicBaseTreatments.find(item=>item.id===row.treatment)?.label??row.treatment}; natureza ${natureLabel(row.operationNature)}; autoridade ${row.authority}; acto ${row.actRef}; documento ${row.documentRef},${row.documentDate}; forma ${formLabel(row.compensationForm)}; ${row.compensationForm!=='non_money'?`dinheiro ${row.moneyAmount} ${row.currency}; `:''}${row.compensationForm!=='money'?`valor normal não monetário ${row.nonMoneyValue} ${row.currency},fundamento ${row.valuationRef}; `:''}composição ${row.compositionRef}; condições ${publicBaseConditions.map(([key,label])=>label+': '+(row.conditions[key]==='yes'?'Sim':row.conditions[key]==='no'?'Não':'Por indicar')).join('; ')}; fundamento ${row.evidence}; não preenche totaisModeloA ou campo11.`]);}
catch{return[['IVA mensal','Base de actos públicos','Dados não recuperáveis','Originais preservados;sem substituir por zero.']];}
}
+2
View File
@@ -5,6 +5,7 @@ import { monthlyIvaInput, monthlyIvaKey, readMonthlyIvaRecord, readMonthlyIvaSet
import { modeloAPurchaseReferences } from './iva-modelo-a.ts';
import { acquisitionReportRows } from './iva-acquisitions.ts';
import { importExemptionReportRows } from './iva-import-exemptions.ts';
import { publicBaseReportRows } from './iva-public-authority-base.ts';
import { offerPreparationReportRows } from './iva-offer-preparations.ts';
import { salesReportRows } from './iva-operations.ts';
import { fiscalQaRows } from './fiscal-qa-preview.ts';
@@ -620,6 +621,7 @@ export function buildProjectDossierRows(
}
rows.push(...acquisitionReportRows(draft));
rows.push(...importExemptionReportRows(draft));
rows.push(...publicBaseReportRows(draft));
rows.push(...offerPreparationReportRows(draft));
const operationRows = salesReportRows(draft);
rows.push(...operationRows);
@@ -0,0 +1,55 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Tests\TestCase;
final class IvaPublicAuthorityBaseDraftTest extends TestCase
{
use DatabaseTransactions;
public function test_public_act_base_recovers_privately_without_changing_delivered_fiscal_books(): void
{
$target = DB::selectOne('select current_database() as name,inet_server_port() as port');
$this->assertSame('simulator_fiscal_delta_20261021_test', $target->name);
$this->assertSame(55441, (int) $target->port);
config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]);
$this->actingAs(User::factory()->create(['email_verified_at' => now()]));
$draft = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g7a-bases.json')), true, flags: JSON_THROW_ON_ERROR);
$id = $this->postJson('/api/v1/simulation-drafts', ['personal_snapshot' => [], 'economic_snapshot' => $draft], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id');
$recovered = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->json('data.economic_snapshot');
$this->assertSame($draft['modelo_a_snapshot'], $recovered['modelo_a_snapshot']);
$this->assertSame('opportunity:339', $recovered['context_opportunity']);
$this->assertSame('Manica', $recovered['selection_labels']['province_id']);
$store = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
$book = $store['publicAuthorityBases']['opportunity:339'];
$this->assertCount(2, $book['rows']);
$this->assertSame(['public_authority_indemnity','public_authority_compensation'], array_column($book['rows'], 'treatment'));
$this->assertSame(['1500.25','1250.30'], array_column($book['result']['rows'], 'baseAmount'));
$this->assertSame(['determined','determined'], array_column($book['result']['rows'], 'status'));
$this->assertSame([null,null], array_column($book['result']['rows'], 'vat'));
$this->assertSame([null,null], array_column($book['result']['rows'], 'rate'));
$this->assertSame('2026-12', $book['rows'][0]['period']);
$this->assertSame('SYNTHETIC QA acto A,operação própria', $book['rows'][0]['actRef']);
$this->assertSame('mixed', $book['rows'][1]['compensationForm']);
$this->assertSame('1000.10', $book['rows'][1]['moneyAmount']);
$this->assertSame('250.20', $book['rows'][1]['nonMoneyValue']);
$this->assertStringContainsString('valor normal', $book['rows'][1]['valuationRef']);
$this->assertStringContainsString('composição15(5)/(6)', $book['rows'][1]['compositionRef']);
$this->assertStringContainsString('15(2)(d)', $book['result']['source']);
$this->assertCount(2, $book['history']);
$this->assertNull($book['history'][0]['rows'][0]['baseAmount']);
$this->assertNull($book['history'][1]['rows'][0]['vat']);
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g7a-preserved-inputs.json')), true, flags: JSON_THROW_ON_ERROR);
$prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
$this->assertSame($prior, array_diff_key($store, ['publicAuthorityBases' => true]));
$this->assertSame('400.00', $store['importExemptions']['opportunity:338']['result']['rows'][1]['importVat']);
$this->assertStringContainsString('Plano de importações', $store['importExemptions']['opportunity:338']['rows'][1]['developmentPlanRef']);
$this->assertSame('0.00', $store['importExemptions']['opportunity:336']['result']['rows'][0]['serviceVat']);
$this->assertNull($store['books']['opportunity:329']['result']['periods'][0]['fields']['11']);
file_put_contents(base_path('outputs/iva-l1-g7a-public-base-20261024/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import {newPublicBase,publicBaseTreatments,publicBaseConditions,evaluatePublicBase,recordPublicBases,savePublicBaseBook,publicBaseBook,publicBaseCurrent,publicBaseReportRows} from '../../resources/js/lib/iva-public-authority-base.ts';
import {importExemptionCurrent} from '../../resources/js/lib/iva-import-exemptions.ts';
import {createProjectDossierReport} from '../../resources/js/lib/project-dossier-report.ts';
const frozen=JSON.parse(fs.readFileSync(new URL('./fixtures/iva-g7a-preserved-inputs.json',import.meta.url),'utf8'));
const row=(treatment=publicBaseTreatments[0].id)=>({...newPublicBase('g7a-'+treatment,'MZN'),treatment,description:'SYNTHETIC QA compensação por acto público',operationNature:treatment==='public_authority_indemnity'?'goods':'services',period:'2026-12',authority:'SYNTHETIC QA autoridade pública',actRef:'SYNTHETIC QA acto A,operação própria',documentRef:'SYNTHETIC QA G7A '+treatment,documentDate:'2026-11-14',compensationForm:treatment==='public_authority_indemnity'?'money':'mixed',moneyAmount:treatment==='public_authority_indemnity'?'1500.25':'1000.10',nonMoneyValue:'250.20',valuationRef:'SYNTHETIC QA valor normal nos termos15(4),pressuposto explícito',compositionRef:'SYNTHETIC QA documento A,composição15(5)/(6),semIVA e sem duplicações',evidence:'SYNTHETIC QA pressupostos;operação sujeita e ligada ao acto,não incumprimento contratual judicial',conditions:Object.fromEntries(publicBaseConditions.map(([key])=>[key,'yes']))});
const draft=()=>({...structuredClone(frozen),context_opportunity:'opportunity:339',project_title:'SYNTHETIC QA — G7A / Base de actos públicos'});
test('P090 bases distinguish indemnity/other compensation from incidence,tax and judicial contract-breach exclusion',()=>{
for(const treatment of publicBaseTreatments){const input=row(treatment.id),ok=evaluatePublicBase(input,'MZN');assert.equal(ok.status,'determined');assert.equal(ok.baseAmount,treatment.id==='public_authority_indemnity'?'1500.25':'1250.30');assert.equal(ok.vat,null);assert.equal(ok.rate,null);
for(const [key] of publicBaseConditions)for(const value of ['','unknown','no']){const r=evaluatePublicBase({...input,conditions:{...input.conditions,[key]:value}},'MZN');assert.equal(r.status,value==='no'?'not_applicable':'indeterminate');assert.equal(r.baseAmount,null);assert.equal(r.vat,null);}
for(const patch of [{authority:''},{actRef:''},{compositionRef:''},{operationNature:''},{documentDate:'2026-02-30'},{documentRef:''},{period:'2025-12'},{currency:'USD'}])assert.equal(evaluatePublicBase({...input,...patch},'MZN').baseAmount,null);
}
assert.match(evaluatePublicBase({...row(),conditions:{...row().conditions,notJudicialContractBreach:'no'}},'MZN').reason,/15\(6\)\(a\)/);
});
test('money,in-kind,mixed compute exact net components;unknown differs from explicit zero and hidden values are retained',()=>{
const input=row();
for(const [patch,expected] of [[{compensationForm:'money',moneyAmount:'0'},'0.00'],[{compensationForm:'non_money',moneyAmount:'',nonMoneyValue:'250.20'},'250.20'],[{compensationForm:'mixed',moneyAmount:'0.000001',nonMoneyValue:'0.000002'},'0.000003'],[{compensationForm:'mixed',moneyAmount:'999999999999999.999999',nonMoneyValue:'999999999999999.999999'},'1999999999999999.999998']]){const r=evaluatePublicBase({...input,...patch},'MZN');assert.equal(r.baseAmount,expected);assert.equal(r.vat,null);}
for(const patch of [{compensationForm:''},{moneyAmount:''},{moneyAmount:'-1'},{moneyAmount:'NaN'},{moneyAmount:'1.0000001'},{compensationForm:'mixed',nonMoneyValue:''},{compensationForm:'non_money',valuationRef:''}])assert.equal(evaluatePublicBase({...input,...patch},'MZN').baseAmount,null);
const switched={...input,compensationForm:'non_money'};assert.equal(switched.moneyAmount,'1500.25');assert.equal(evaluatePublicBase(switched,'MZN').baseAmount,'250.20');assert.equal(evaluatePublicBase({...switched,compensationForm:'mixed'},'MZN').baseAmount,'1750.45');
});
test('save/recovery/report isolate P090 from78delivered branches and partial offers,while keeping exact versions and contextual invalidation',()=>{
const d=draft(),prior=JSON.parse(d.modelo_a_snapshot);assert.deepEqual(publicBaseBook(d),{rows:[]});assert.deepEqual(publicBaseReportRows(d),[]);
let book=recordPublicBases(d,{rows:publicBaseTreatments.map(rule=>({...row(rule.id),conditions:{}}))});book=recordPublicBases(d,{...book,rows:publicBaseTreatments.map(rule=>({...row(rule.id),conditions:{...row(rule.id).conditions,notJudicialContractBreach:'no'}}))});book=recordPublicBases(d,{...book,rows:publicBaseTreatments.map(rule=>row(rule.id))});assert.equal(book.history.length,2);assert.ok(book.history.every(h=>h.rows.every(r=>r.baseAmount===null&&r.vat===null)));assert.ok(publicBaseCurrent(d,book));
for(const field of ['actRef','documentRef','compositionRef','compensationForm','valuationRef','moneyAmount'])assert.ok(!publicBaseCurrent(d,{...book,rows:book.rows.map(r=>({...r,[field]:'changed'}))}));for(const patch of [{context_opportunity:'opportunity:340'},{currency:'USD'},{selection_labels:{province_id:'Maputo'}}])assert.ok(!publicBaseCurrent({...d,...patch},book));
d.modelo_a_snapshot=savePublicBaseBook(d,book);assert.deepEqual(publicBaseBook(JSON.parse(JSON.stringify(d))),book);const next=JSON.parse(d.modelo_a_snapshot);const{publicAuthorityBases,...untouched}=next;assert.deepEqual(untouched,prior);for(const[scope,previous]of Object.entries(prior.importExemptions))assert.ok(importExemptionCurrent({...d,context_opportunity:scope},previous));
assert.equal(next.importExemptions['opportunity:338'].result.rows[1].importVat,'400.00');assert.equal(next.importExemptions['opportunity:336'].result.rows[0].serviceVat,'0.00');assert.equal(next.books['opportunity:329'].result.periods[0].fields['11'],null);
const report=JSON.stringify(createProjectDossierReport(d,{selectedSections:new Set(['finance']),version:'QA G7A'}));for(const token of ['Base P090','1500.25','1250.30','IVA: Indeterminado','opportunity:339','Manica','2026-12','acto A','15(2)(d)','composição15(5)/(6)','campo11'])assert.ok(report.includes(token),token);assert.deepEqual(publicBaseReportRows({...d,context_opportunity:'opportunity:340'}),[]);
if(process.env.IVA_G7A_CALCULATED)fs.writeFileSync(process.env.IVA_G7A_CALCULATED,JSON.stringify(d));
});
test('malformed public-base rows/store cannot replace originals;duplicate identifiers cannot create calculations',()=>{
const d=draft(),original=d.modelo_a_snapshot;
for(const patch of [{moneyAmount:4},{conditions:[]},{valuationRef:null}])assert.throws(()=>savePublicBaseBook(d,{rows:[{...row(),...patch}]}),/originais preservados/);
assert.equal(d.modelo_a_snapshot,original);assert.throws(()=>recordPublicBases(d,{rows:[row(),row()]}),/distintos/);assert.throws(()=>recordPublicBases(d,{rows:[]}),/distintos/);
const bad={...d,modelo_a_snapshot:JSON.stringify({...JSON.parse(original),publicAuthorityBases:[]})};assert.throws(()=>publicBaseBook(bad),/originais preservados/);assert.equal(d.modelo_a_snapshot,original);
});