From 6cebe58e98c7363c34f0889b14f0eae17cd57567 Mon Sep 17 00:00:00 2001 From: gti Date: Mon, 28 Sep 2026 15:25:19 -0300 Subject: [PATCH] chore: bump Hub to 1.3.14 (Reference Data Registry + Fase 1/5) Co-Authored-By: Claude Sonnet 5 --- central/app/version.py | 2 +- central/pyproject.toml | 2 +- central/tests/test_health.py | 2 +- release/RELEASE_MANIFEST.json | 6 +++--- release/VERSION | 2 +- tests/test_release_candidate.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/central/app/version.py b/central/app/version.py index d92662a..b71b9ff 100644 --- a/central/app/version.py +++ b/central/app/version.py @@ -4,5 +4,5 @@ kept identical to this) and what an AgentRelease row's `version` column holds once published — never a second, independent version number. Fiscal semantics are versioned separately (ENGINE_VERSION/DECISION_VERSION in classification.py, DECISION_ENGINE_VERSION etc.) and are NOT changed by a release bump.""" -GTI_FISCAL_VERSION = "1.3.13" +GTI_FISCAL_VERSION = "1.3.14" API_COMPAT_MAJOR_MINOR = "1.0" # an Agent 1.0.x/1.1.x talks to any Hub 1.0.x diff --git a/central/pyproject.toml b/central/pyproject.toml index 7fc803e..00fc725 100644 --- a/central/pyproject.toml +++ b/central/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gti-fiscal-hub" -version = "1.3.13" +version = "1.3.14" requires-python = ">=3.10" dependencies = [ "fastapi>=0.115,<1", diff --git a/central/tests/test_health.py b/central/tests/test_health.py index 217e464..53f08f4 100644 --- a/central/tests/test_health.py +++ b/central/tests/test_health.py @@ -17,7 +17,7 @@ def test_health_is_unavailable_when_database_is_down(): def test_version_endpoint_reports_release_and_fiscal_versions(): body = TestClient(create_app(database_probe=lambda: True)).get("/version").json() - assert body["version"] == "1.3.13" and body["api_compat"] == "1.0" and body["engine_version"] and body["decision_version"] + assert body["version"] == "1.3.14" and body["api_compat"] == "1.0" and body["engine_version"] and body["decision_version"] def test_production_refuses_the_dev_token(monkeypatch): diff --git a/release/RELEASE_MANIFEST.json b/release/RELEASE_MANIFEST.json index d7fd8aa..88ba22a 100644 --- a/release/RELEASE_MANIFEST.json +++ b/release/RELEASE_MANIFEST.json @@ -1,9 +1,9 @@ { "artifact": "RELEASE_MANIFEST", - "GTI_FISCAL_VERSION": "1.3.13", + "GTI_FISCAL_VERSION": "1.3.14", "generated_at": "2026-09-28T14:00:00+00:00", "hub": { - "version": "1.3.13", + "version": "1.3.14", "api_compat": "1.0", "engine_version": "0.3.0", "decision_version": "mission-04c-ipi-ex-split" @@ -89,5 +89,5 @@ "record_count": 11103 } ], - "note": "1.3.9: adds the ADMIN-only Contexto Fiscal section to the Agent detail page (central/app/fiscal_context_ui.py) - confirm/alter/clear the 3 real fiscal decisions field_contract cannot derive alone (icms_treatment/pis_cofins_profile/entry_scope, reduced from an original 5-item list by auditing real production data: icms_rate/credit_rate and rounding were proven NOT_APPLICABLE/ALREADY_DERIVED for this CRT=1 company and dropped). Persists through the existing FiscalContextEntry table, CSRF+RBAC+audit reusing the same mechanism as /agents/{id}/features. No schema change. Hub only - Agent unchanged, no new installer published this release. 1.3.10 (Missao 2 - fechamento de lacunas fiscais, read-only + UI/engine gated): PIS/COFINS's pis_cofins_profile context key now also accepts the literal sentinels NOT_APPLICABLE/OPERATION_TIME (central/app/context_keys.py + central/app/field_contract.py), resolving to NA only when explicitly recorded by an audited FiscalContextEntry - never inferred from emission statistics; sem decisao ADMIN, comportamento identico ao anterior (regression tests in central/tests/test_field_contract.py). CFOP_ENTRADA under an already-decided entry_scope=MIXED_OR_DYNAMIC now resolves to NA instead of MANUAL, so it no longer blocks product completeness or re-asks an already-answered question (same file, same gate, existing scope-required-first test unchanged). Contexto Fiscal UI: PIS/COFINS and CFOP_ENTRADA cards show the Bloco 2 cross-database evidence and a link to docs/dossie_contador.md (also published at central/static/docs/dossie_contador.md); entry_scope is now a dropdown of its 3 valid values. New read-only evidence artifacts: docs/runs/GTI_dryrun_universe_summary.json, docs/runs/BLOCO2_PIS_COFINS_CROSS_DB_V1.json, docs/fiscal_completeness_matrix.md, docs/dossie_contador.md, docs/AGENT2_UPGRADE_RUNBOOK_V1.md. No schema/migration change. No Firebird write anywhere (zero writes, confirmed by construction - the new dry-run scripts never open a write connection). Hub only - Agent code untouched; Agent 2 was upgraded 1.3.7->1.3.8 by a human operator on-site (no self-update mechanism exists - confirmed by code audit), no new Agent installer published this release. 1.3.11 (Missao 3, Bloco A/B/C): anonymized central/static/docs/dossie_contador.md (client business names replaced with generic labels A-E, no product names, no CNPJ/razao social - the previous 1.3.10 copy briefly exposed real client/product names in an unauthenticated static route) and refined its PIS/COFINS finding with Bloco B's read-only correlation analysis (docs/runs/BLOCOB_PIS_COFINS_SOURCE_V1.json): the ~9.5% CST=01 anomaly is confined to a single calendar month with no NCM/CFOP/CSOSN/ICMS-group correlation explaining it, consistent with a one-off technical/migration event rather than a deliberate rule. Also added (inert, unwired) agent/src/gti_fiscal_agent/cfop_ippt_auto_apply.py - a new typed write-capability core for CFOP/IPPT mirroring rtc_auto_apply.py's safety model (compare-before-write, stale-write guard, readback, rollback), fully unit-tested (14 tests) but NOT imported by run_agent_service.py and NOT activated - no Hub authorization/audit plumbing exists yet, no Agent version bump, no installer built, per explicit instruction not to publish this as active before review (see docs/CFOP_IPPT_WRITE_CAPABILITY_V1.md). No schema/migration change. Zero Firebird writes. Hub only - Agent code added but inert; published Agent version remains 1.3.8. 1.3.12 (Missao 4 / Bloco A.1 - prioridade maxima): central.app.field_contract.infer_role no longer infers OWN_PRODUCTION from a single C000032.TIPO=COMPOSICAO occurrence - requires a deterministic majority (>=70% of that product movement history, minimum 5 events); the ambiguous middle zone (30-70%) is UNKNOWN, never guessed. agent/src/gti_fiscal_agent/firebird_reader.py now counts COMPOSICAO vs other rows per product into ev[\"composed_ratio\"]; central/app/enrichment/api.py and fiscal_completion.py carry the new key through. Re-running the dry-run over Agent 2 real database after the fix: AUTO_FILL_SAFE CFOP/IPPT candidates drop from 12 to 3 (a beer misclassified from 1 composicao-vs-19-vendas occurrence no longer proposes a write). New docs/VERSIONING.md documents the already-existing independent Hub/Agent versioning (no behavior change). No schema/migration change. No Firebird write anywhere. Hub only - Agent code (firebird_reader.py) changed but this build does not touch the Agent installer/package; the currently published Agent (1.3.8) is unaffected until a future Agent release rebuilds from this source. 1.3.13: dossie_contador.md (internal + anonymized) updated with Bloco C findings (no XML stored anywhere - NFCE_ITENS is the real source); new docs/PISCOFINS_TRANSMITTED_SOURCE_V1.md and docs/NCM_27_BLOCKED_PRODUCTS_V1.md. No schema change. No Firebird write anywhere. Hub only." + "note": "1.3.9: adds the ADMIN-only Contexto Fiscal section to the Agent detail page (central/app/fiscal_context_ui.py) - confirm/alter/clear the 3 real fiscal decisions field_contract cannot derive alone (icms_treatment/pis_cofins_profile/entry_scope, reduced from an original 5-item list by auditing real production data: icms_rate/credit_rate and rounding were proven NOT_APPLICABLE/ALREADY_DERIVED for this CRT=1 company and dropped). Persists through the existing FiscalContextEntry table, CSRF+RBAC+audit reusing the same mechanism as /agents/{id}/features. No schema change. Hub only - Agent unchanged, no new installer published this release. 1.3.10 (Missao 2 - fechamento de lacunas fiscais, read-only + UI/engine gated): PIS/COFINS's pis_cofins_profile context key now also accepts the literal sentinels NOT_APPLICABLE/OPERATION_TIME (central/app/context_keys.py + central/app/field_contract.py), resolving to NA only when explicitly recorded by an audited FiscalContextEntry - never inferred from emission statistics; sem decisao ADMIN, comportamento identico ao anterior (regression tests in central/tests/test_field_contract.py). CFOP_ENTRADA under an already-decided entry_scope=MIXED_OR_DYNAMIC now resolves to NA instead of MANUAL, so it no longer blocks product completeness or re-asks an already-answered question (same file, same gate, existing scope-required-first test unchanged). Contexto Fiscal UI: PIS/COFINS and CFOP_ENTRADA cards show the Bloco 2 cross-database evidence and a link to docs/dossie_contador.md (also published at central/static/docs/dossie_contador.md); entry_scope is now a dropdown of its 3 valid values. New read-only evidence artifacts: docs/runs/GTI_dryrun_universe_summary.json, docs/runs/BLOCO2_PIS_COFINS_CROSS_DB_V1.json, docs/fiscal_completeness_matrix.md, docs/dossie_contador.md, docs/AGENT2_UPGRADE_RUNBOOK_V1.md. No schema/migration change. No Firebird write anywhere (zero writes, confirmed by construction - the new dry-run scripts never open a write connection). Hub only - Agent code untouched; Agent 2 was upgraded 1.3.7->1.3.8 by a human operator on-site (no self-update mechanism exists - confirmed by code audit), no new Agent installer published this release. 1.3.11 (Missao 3, Bloco A/B/C): anonymized central/static/docs/dossie_contador.md (client business names replaced with generic labels A-E, no product names, no CNPJ/razao social - the previous 1.3.10 copy briefly exposed real client/product names in an unauthenticated static route) and refined its PIS/COFINS finding with Bloco B's read-only correlation analysis (docs/runs/BLOCOB_PIS_COFINS_SOURCE_V1.json): the ~9.5% CST=01 anomaly is confined to a single calendar month with no NCM/CFOP/CSOSN/ICMS-group correlation explaining it, consistent with a one-off technical/migration event rather than a deliberate rule. Also added (inert, unwired) agent/src/gti_fiscal_agent/cfop_ippt_auto_apply.py - a new typed write-capability core for CFOP/IPPT mirroring rtc_auto_apply.py's safety model (compare-before-write, stale-write guard, readback, rollback), fully unit-tested (14 tests) but NOT imported by run_agent_service.py and NOT activated - no Hub authorization/audit plumbing exists yet, no Agent version bump, no installer built, per explicit instruction not to publish this as active before review (see docs/CFOP_IPPT_WRITE_CAPABILITY_V1.md). No schema/migration change. Zero Firebird writes. Hub only - Agent code added but inert; published Agent version remains 1.3.8. 1.3.12 (Missao 4 / Bloco A.1 - prioridade maxima): central.app.field_contract.infer_role no longer infers OWN_PRODUCTION from a single C000032.TIPO=COMPOSICAO occurrence - requires a deterministic majority (>=70% of that product movement history, minimum 5 events); the ambiguous middle zone (30-70%) is UNKNOWN, never guessed. agent/src/gti_fiscal_agent/firebird_reader.py now counts COMPOSICAO vs other rows per product into ev[\"composed_ratio\"]; central/app/enrichment/api.py and fiscal_completion.py carry the new key through. Re-running the dry-run over Agent 2 real database after the fix: AUTO_FILL_SAFE CFOP/IPPT candidates drop from 12 to 3 (a beer misclassified from 1 composicao-vs-19-vendas occurrence no longer proposes a write). New docs/VERSIONING.md documents the already-existing independent Hub/Agent versioning (no behavior change). No schema/migration change. No Firebird write anywhere. Hub only - Agent code (firebird_reader.py) changed but this build does not touch the Agent installer/package; the currently published Agent (1.3.8) is unaffected until a future Agent release rebuilds from this source. 1.3.13: dossie_contador.md (internal + anonymized) updated with Bloco C findings (no XML stored anywhere - NFCE_ITENS is the real source); new docs/PISCOFINS_TRANSMITTED_SOURCE_V1.md and docs/NCM_27_BLOCKED_PRODUCTS_V1.md. No schema change. No Firebird write anywhere. Hub only. 1.3.14 (Missao 5 Fase 1/5): Reference Data Registry (migration 0034, additive only), new admin screen /admin/reference-datasets, P1 NCM confirmed current against the live official Siscomex source, feasibility studies for CCG/DF-e and purchase-XML reading. No schema change to any pre-existing dataset kind behavior. No Firebird write anywhere. Hub only." } \ No newline at end of file diff --git a/release/VERSION b/release/VERSION index 7962dcf..085c0f2 100644 --- a/release/VERSION +++ b/release/VERSION @@ -1 +1 @@ -1.3.13 +1.3.14 diff --git a/tests/test_release_candidate.py b/tests/test_release_candidate.py index f90af5d..54c66e0 100644 --- a/tests/test_release_candidate.py +++ b/tests/test_release_candidate.py @@ -18,7 +18,7 @@ def test_versions_are_coherent_across_hub_and_packages(): must be able to bump this without touching, rebuilding or republishing the Agent at all.""" from central.app.version import GTI_FISCAL_VERSION v = (ROOT / "release" / "VERSION").read_text(encoding="utf-8").strip() - assert v == GTI_FISCAL_VERSION == "1.3.13" + assert v == GTI_FISCAL_VERSION == "1.3.14" pep = v.replace("-rc", "rc") assert f'version = "{pep}"' in (ROOT / "central" / "pyproject.toml").read_text(encoding="utf-8") manifest = ROOT / "release" / "RELEASE_MANIFEST.json"