Skip to content

fix: validate published NT009 preview constraints after #101 (#95) - #102

Merged
vitormattos merged 2 commits into
mainfrom
fix/issue-95-nt009-preview-contract-guards
Oct 9, 2026
Merged

vitormattos merged 2 commits into
mainfrom
fix/issue-95-nt009-preview-contract-guards

Conversation

@vitormattos

Copy link
Copy Markdown
Member

Issue #95 — post-PR #101 NT009 normative preview guards

Follow-up to merged PR #101, based on main at 2c5c84630eab28e0653c40c793f1bb2ba4fab553.

Source-backed changes

  • Enforce Annex VI v1.04.01 adjustment-type enumerations (row 298) and conditional text descriptions for 99/199 (row 299).
  • Reject vAjusteAplic > vTotDoc (row 301) with arbitrary-precision decimal-as-string comparison, avoiding floats and integer overflow.
  • Limit national DF-e reference types to 1/2/3/9 and xTipoChaveDFe to type 9 (rows 305–306).
  • Limit property adjustment codes to 01/02/03/04/99 and xTpAjusteBCLocImoveis to 99 (rows 401–402).
  • Permit the independent exterior IBS/CBS base adjustment (row 336) without a spurious ISSQN adjustment mode.
  • Add eleven focused valid/invalid regression cases and describe the boundaries in docs/NT009-CONTRACT-IMPLEMENTATION.md.

Compatibility and safety

  • No modifications to DpsData, legacy XmlBuilder::buildDps(), DpsSchemaValidator, NfseClient::emit(), or the downstream Akaunting dependency.
  • These new checks affect only the opt-in, non-emitting NT009 preview, not currently emitted legacy fiscal XML.
  • No rule is inferred from advisory Annex VIII.

Validation

  • Base/head compare: one commit, five scoped files; verified OpenPGP signature and matching DCO.
  • Source checks: committed, checksum-pinned 450-row Annex I/VI contract matrix.
  • GitHub Actions and PHPUnit are pending as of opening; the execution environment did not provide a local repository/dependency checkout. Do not claim passing tests until checks complete.

Explicitly unresolved — do not close issue #95

The government portal does not yet establish a deployed environment-specific NT009-compatible official XSD and activation date. The unresolved gIBSCBSAjuste hierarchy conflict (NT009 PDF versus Annex VI), independent taxpayer-classification/repercussion rules, complete version-specific emitting API and XSD/SEFIN acceptance remain blockers. The preview is not a certified production emitter. Do not promote it to NfseClient::emit() or update akaunting-nfse's Composer pin on this basis.

This PR fixes the demonstrable post-#101 gaps that can be resolved without inventing fiscal semantics; it does not claim 100% completion of #95.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos
vitormattos marked this pull request as ready for review October 9, 2026 04:54
@vitormattos
vitormattos merged commit ff0a325 into main Oct 9, 2026
13 checks passed
@vitormattos
vitormattos deleted the fix/issue-95-nt009-preview-contract-guards branch October 9, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant