[FIX] Route SPV mail from trusted Moebiusol forwards #59

Open
moeardent wants to merge 0 commits from fix/spv-mail-routing-and-parser-dispatch into 18.0
Owner

Summary

  • Change class: bugfix
  • Promotion target: 18.0 after review and CI
  • Trace ref: 01a02870-5b59-7910-9a4a-7751b7cf3035

Scope

Included

  • Replace the hard-coded anaf.ro SPV sender gate with active parser-registry matching.
  • Accept configured direct ANAF and trusted moebiusol.eu forwarding identities.
  • Validate retained sender/recipient header consistency and fail closed on mismatch.
  • Preserve the email-trigger-only contract: create SPV expected-document evidence, never accounting postings.
  • Add regression coverage for internal forwarding, direct parser behavior, header mismatch, and supported SPV classifications.

Out of scope

  • Automatic accounting posting from email metadata.
  • New ANAF API or mailbox protocol.
  • Changes to existing e-Factura acquisition or Treasury parser algorithms.

Implementation Notes

  • Root cause: live record 14 was fetched successfully but bypassed the SPV parser because routing required literal anaf.ro; the configured sender pattern was unused.
  • Additional defect fixed: the optional parser model recordset was treated as unavailable when empty, even when the model was installed.
  • Data/schema impact: no schema change.
  • Operational impact: a correctly forwarded Documente noi SPV message should route to moe.spv.notification and create expected SPV documents; unrelated or inconsistent messages remain quarantined.

Verification Evidence

  • ruff check on changed Python files: passed.
  • Python compilation: passed.
  • python3 ci/validate_addons.py: passed.
  • PYTHONDONTWRITEBYTECODE=1 pytest -q ci: 123 passed, 110 subtests passed.
  • Live reproduction record: intake 14, fetched 1/1, quarantined before SPV dispatch.
  • Required next evidence: TeamCity Odoo TransactionCase run and controlled live mailbox acceptance after deployment.

Residual Risks

  • Internal sender acceptance is configuration-based; the mailbox remains the trust boundary and header inconsistency fails closed.
  • The email remains only a trigger; downstream retrieved-document parsing and accountant approval are separate controls.

Promotion and Recovery

  • Intended next step: review request, TeamCity validation, then DEV/GitOps promotion if gates pass.
  • Rollback: revert the single source commit and redeploy the prior release revision.
## Summary - Change class: bugfix - Promotion target: `18.0` after review and CI - Trace ref: `01a02870-5b59-7910-9a4a-7751b7cf3035` ## Scope ### Included - Replace the hard-coded `anaf.ro` SPV sender gate with active parser-registry matching. - Accept configured direct ANAF and trusted `moebiusol.eu` forwarding identities. - Validate retained sender/recipient header consistency and fail closed on mismatch. - Preserve the email-trigger-only contract: create SPV expected-document evidence, never accounting postings. - Add regression coverage for internal forwarding, direct parser behavior, header mismatch, and supported SPV classifications. ### Out of scope - Automatic accounting posting from email metadata. - New ANAF API or mailbox protocol. - Changes to existing e-Factura acquisition or Treasury parser algorithms. ## Implementation Notes - Root cause: live record 14 was fetched successfully but bypassed the SPV parser because routing required literal `anaf.ro`; the configured sender pattern was unused. - Additional defect fixed: the optional parser model recordset was treated as unavailable when empty, even when the model was installed. - Data/schema impact: no schema change. - Operational impact: a correctly forwarded `Documente noi SPV` message should route to `moe.spv.notification` and create expected SPV documents; unrelated or inconsistent messages remain quarantined. ## Verification Evidence - `ruff check` on changed Python files: passed. - Python compilation: passed. - `python3 ci/validate_addons.py`: passed. - `PYTHONDONTWRITEBYTECODE=1 pytest -q ci`: 123 passed, 110 subtests passed. - Live reproduction record: intake 14, fetched 1/1, quarantined before SPV dispatch. - Required next evidence: TeamCity Odoo TransactionCase run and controlled live mailbox acceptance after deployment. ## Residual Risks - Internal sender acceptance is configuration-based; the mailbox remains the trust boundary and header inconsistency fails closed. - The email remains only a trigger; downstream retrieved-document parsing and accountant approval are separate controls. ## Promotion and Recovery - Intended next step: review request, TeamCity validation, then DEV/GitOps promotion if gates pass. - Rollback: revert the single source commit and redeploy the prior release revision. <!-- migrated-from: pull-request Moebiusol/odoo-custom-addons #52 -->
Some checks failed
pre-commit / pre-commit (pull_request) Has been cancelled
tests / Detect unreleased dependencies (pull_request) Has been cancelled
This branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/spv-mail-routing-and-parser-dispatch:fix/spv-mail-routing-and-parser-dispatch
git switch fix/spv-mail-routing-and-parser-dispatch

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 18.0
git merge --no-ff fix/spv-mail-routing-and-parser-dispatch
git switch fix/spv-mail-routing-and-parser-dispatch
git rebase 18.0
git switch 18.0
git merge --ff-only fix/spv-mail-routing-and-parser-dispatch
git switch fix/spv-mail-routing-and-parser-dispatch
git rebase 18.0
git switch 18.0
git merge --no-ff fix/spv-mail-routing-and-parser-dispatch
git switch 18.0
git merge --squash fix/spv-mail-routing-and-parser-dispatch
git switch 18.0
git merge --ff-only fix/spv-mail-routing-and-parser-dispatch
git switch 18.0
git merge fix/spv-mail-routing-and-parser-dispatch
git push origin 18.0
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: moebiusol/odoo-custom-addons#59
No description provided.