{"id":100,"date":"2026-09-03T09:00:00","date_gmt":"2026-09-03T15:00:00","guid":{"rendered":"https:\/\/rafaelsolis.dev\/notas\/control-volumetrico-dominios\/"},"modified":"2026-09-03T09:00:00","modified_gmt":"2026-09-03T15:00:00","slug":"control-volumetrico-dominios","status":"publish","type":"post","link":"https:\/\/rafaelsolis.dev\/en\/notas\/control-volumetrico-dominios\/","title":{"rendered":"Volumetric control without bleeding domains together"},"content":{"rendered":"<p class=\"wp-block-paragraph\">\u201cVolumetric control\u201d sounds like one domain until its participants are examined. A fuel retailer receives product, measures inventory, and dispenses to the public. A distributor may focus on documented purchases and sales without operating the same physical infrastructure. A carrier adds vehicles, routes, and telemetry. A self-consumption operator records fuel intended for its own operation. The public portfolio describes these variants and the need to generate and validate a JSON report for the authority, alongside billing and connected systems. That experience does not make this note regulatory advice: current obligations must be checked against official material and reviewed by the accountable specialists. The more durable engineering lesson is that four business types sharing a vocabulary does not mean they share precisely the same process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Design can begin by separating shared concepts from divergent workflows. Product, volume, facility, period, movement, and document are candidates for a common language. Their meanings need precise definitions, explicit units, and traceable identifiers. Receiving a tanker, capturing a commercial operation, assigning a transport unit, or recording an issue for internal consumption belong to different journeys. Sharing a core does not require forcing them into one universal screen or service. A useful model lets each business type compose capabilities: physical inventory where it exists, transport where relevant, billing when needed, and report generation from already normalized facts. The distinction also improves discussions. A team can talk about a shared movement without erasing who originated it, which evidence exists, and which rules constrain that particular path.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Boundaries should protect invariants, not merely organize folders. A quantity needs a unit and direction; a movement needs a date and valid origin; a correction should preserve a trail to the earlier value; an external reference must not be mistaken for an internal identifier. Each domain can add constraints without rewriting the others. Transport may require a unit and route, while retail validates relationships among receiving, inventory, and dispensing. Integrations consume explicit events or contracts instead of reading another module's tables and inferring state. This is not a claim about the hidden architecture of a confidential system; it is a reasoning pattern for the public problem. Its value appears when a new rule changes one business type and the other three do not need more conditional branches to keep working.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Regulatory JSON generation should be treated as a controlled translation from the internal model to a versioned external contract. First, the application gathers a complete set of business facts. Then an adapter serializes those facts using the field names, structures, and formats required by the applicable version. Technical validation can check types, required fields, known catalogs, formats, coherent totals, and internal references before producing a file. Errors should retain enough context for a person to correct them without turning a technical message into a legal conclusion. Passing a schema demonstrates structural conformance to that schema, not comprehensive fulfillment of an obligation. The contract version, regulatory source consulted, and approval by the responsible domain expert therefore belong in an explicit change process rather than scattered branches in application code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Billing and integrations create another boundary. The public portfolio mentions invoices, the Carta Porte transport complement, loyalty applications, fleet data, sensors, and monitoring. Those systems have different rhythms and owners; trying to solve them through one remote transaction makes the process brittle. A safer design records the business fact first, then coordinates idempotent outputs: repeating a request should not duplicate an invoice, award a benefit twice, or report two movements. Intermediate states\u2014pending, sent, rejected, confirmed\u2014are business information, not noise to hide. External keys need their own mapping, and retries should distinguish a temporary outage from a definitive validation error. Periodic reconciliation completes the design because no network guarantees that request and response arrive together, or that every downstream acknowledgement reaches the originating service.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Domain bleeding becomes visible when every method asks for the business type: if a retailer does A, if a carrier does B, except during billing, unless it is self-consumption. It looks direct at first. Later, every new rule multiplies combinations and makes it hard to know which paths exist. One alternative is to keep small use cases behind explicit capabilities and named policies. The shared flow coordinates genuinely common steps and delegates decisions that vary. Not every resemblance deserves an abstraction: two similar rules can remain separate until they share a provable invariant. The goal is not to eliminate every conditional. It is to prevent one global label from governing details that belong to different modules. Domain names usually communicate this better than a generic inheritance hierarchy or a configuration matrix no reviewer can confidently read.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tests should mirror that structure. The core can use tables of examples with quantities and expected results derived independently. Each business type needs successful cases, boundary rejections, and examples in which a capability does not apply. The regulatory serializer deserves approved fixtures per version, validation against the corresponding schema, and error tests that identify the correct field. Billing and integrations are exercised through contracts: idempotency, retries, event order, and reconciliation after a late response. Negative tests between domains are equally valuable: a transport rule must not block a commercial capture, and a physical-inventory field must not become mandatory for an operator without a tank. Test data should be fictional and minimal, never copied from clients, credentials, invoices, telemetry, or real regulatory submissions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The final lesson is organizational. Separating domains requires product, specialists, and developers to name differences before encoding them. A shared glossary, reviewed examples, and versioned decisions reduce the temptation to hide ambiguity in a boolean. When an external requirement changes, the team can locate the affected contract and business type, review its adapter, and preserve the history. When an integration changes, it can retry or reconcile without rewriting the volume calculation. This discipline does not guarantee compliance and does not replace an audit. It does provide a base on which rules can be explained, tested, and changed without turning the entire platform into an exception. In software with operational consequences, being able to point to the responsible boundary is as important as producing the final file.<\/p>","protected":false},"excerpt":{"rendered":"<p>How to separate the rules for fuel retailers, distributors, carriers, and self-consumption operators in one platform.<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-100","post","type-post","status-publish","format-standard","hentry","category-notas"],"_links":{"self":[{"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":0,"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"wp:attachment":[{"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rafaelsolis.dev\/en\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}