Skip to content

Version official NFS-e domain and correlation tables #51

Closed

Description

@vitormattos

Parent epic: #47

Context

Current production/RTC documentation publishes versioned domain data such as countries/IBGE, NBS-to-service correlation, cClassTrib, cIndOp and IBS/CBS correlation tables. Niterói and other municipalities use the national issuer, so consumers need national tables rather than hard-coded municipality lists.

Goal

Provide auditable, versioned access to official domain/correlation tables so applications can validate and assist fiscal configuration without copying ad-hoc lists.

Scope

  • identify authoritative files used by the current production layout and NT 009
  • store normalized snapshots or generated PHP artifacts with source/version/checksum metadata
  • expose query APIs for:
    • IBGE/country domains required by DPS
    • national service/NBS relations
    • cClassTrib/cIndOp correlations
    • other tables required by current IBS/CBS fields
  • add a reproducible update/generation script

Constraints

  • no runtime web scraping
  • do not infer a fiscal classification when the official table is ambiguous
  • preserve source version and effective-date metadata

Tests

  • known correlations
  • unknown code behavior
  • duplicate/ambiguous source rows
  • deterministic generator output
  • checksum/version change detection

Definition of done

  • consumers can validate a configured code against a named official version
  • update procedure documented
  • generated artifacts reproducible in CI

Activity

  1. vitormattos commented on Oct 4, 2026

    @vitormattos
    MemberAuthor

    Completed in #79.

    The library now ships versioned offline catalogs for:

    • municipalities and ISO2 countries — ANEXO_A v1.00 (20251210)
    • national service codes and NBS 2.0 — ANEXO_B v1.01 (20260122)
    • IBS/CBS operation indicators — ANEXO_C v1.01 (20260122)

    The snapshots include official-source/version provenance and tests for cardinality and representative lookups. Runtime lookup performs no web scraping.

    RTC Anexo VIII is deliberately not used as a rejection rule: the current official portal describes v1.01.00 as work in progress and explicitly says Production/Piloto do not base business rules on it. This is documented so a future advisory correlation layer cannot silently become normative.

  2. vitormattos commented on Oct 4, 2026

    @vitormattos
    MemberAuthor

    Reopened after DoD audit: #79 delivered the versioned snapshots and lookup API, but the issue explicitly requires a reproducible update/generation script. Documentation alone is not equivalent. A follow-up will add and test the generator before this issue is closed again.

  3. vitormattos commented on Oct 4, 2026

    @vitormattos
    MemberAuthor

    Completed by #80 and merged as 02ea4983f9cbe2fdc17739d8ce86f296222d3f52.

    The remaining reproducibility requirement is now covered:

    • dependency-free XLSX normalizer for official annexes A/B/C
    • deterministic generation of committed normalized snapshots
    • source cardinality guards
    • byte-for-byte --check mode
    • documented update procedure
    • dedicated network-free CI job

    PR #80 passed PHPUnit, static analysis, coding style, REUSE, minimum dependencies, conventional commits, and Domain Table Generator before merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions