Compliance API loops through all tenants but fetches tenant countries for the tenant in the RequestInfo
Context: The compliance trigger calls the BASE_URL/api/legal/v1/jobs/updateLegalTagStatus API. As is the norm with OSDU APIs, the API needs to be called with a certain data-partition-id. Since the compliance API loops through all tenants (see here), this API is called with any random data-partition-id.
Problem:
The LegalTagCountriesService has a @PostConstruct setup step where it reads all the tenant countries from provider specific storage but always uses the tenant from requestInfo object (the tenant with which the compliance API is called) which remains constant. This results in an inconsistency which may result in fetching of the wrong Legal_COO.json ultimately resulting in this error:
legal.app: Changing state of osdu-brazil-tag1 from Valid to Invalid. Errors found in legaltag Invalid country of origin set. It should match one of the ISO alpha 2 codes and be a country with no restriction on data residency. Found: BR. {correlation-id=8fbdd6f4-3bd8-4e7a-9c0e-655033806699, data-partition-id=int-test-csv-parser}