refs #732: stabilize carrier report result schema
This commit is contained in:
28
vpd-backoffice/config/hmm_carrier_query_contract.json
Normal file
28
vpd-backoffice/config/hmm_carrier_query_contract.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": 1,
|
||||
"purpose": "Stable structured output contract for HMM carrier performance reports",
|
||||
"applies_to": "HMM_RDS_FEDERATION_PROFILE carrier assignment and performance questions",
|
||||
"required_objects": [
|
||||
"HMM_CARRIER_ASSIGNMENTS_V",
|
||||
"HMM_RDS_CARRIER_LATEST_V"
|
||||
],
|
||||
"join_contract": "Join HMM_CARRIER_ASSIGNMENTS_V.CARRIER_CODE to HMM_RDS_CARRIER_LATEST_V.CARRIER_CODE.",
|
||||
"required_output_aliases": [
|
||||
"EMPLOYEE_CODE",
|
||||
"EMPLOYEE_NAME",
|
||||
"MANAGER_EMPLOYEE_CODE",
|
||||
"CARRIER_CODE",
|
||||
"CARRIER_NAME",
|
||||
"LATEST_REVENUE_USD",
|
||||
"LATEST_GROSS_MARGIN_USD",
|
||||
"LATEST_SCHEDULE_RELIABILITY_PCT",
|
||||
"LATEST_RISK_LEVEL"
|
||||
],
|
||||
"rules": [
|
||||
"Return one ordinary structured row per employee and assigned carrier.",
|
||||
"Always include every required output alias, even when the natural-language question does not explicitly request the employee columns.",
|
||||
"Use the required ASCII uppercase underscore aliases exactly as written. Never translate aliases, insert spaces in aliases, or return HTML and Markdown.",
|
||||
"For latest or current metrics use HMM_RDS_CARRIER_LATEST_V.",
|
||||
"Do not add, weaken, or emulate authorization predicates. Oracle VPD on HMM_CARRIER_ASSIGNMENTS_V enforces the authenticated employee scope."
|
||||
]
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import com.cloudhandson.vpdbackoffice.config.BackofficeProperties;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class SelectAiServiceTest {
|
||||
@@ -32,4 +34,24 @@ class SelectAiServiceTest {
|
||||
service.validateReadOnlySql("SELECT * FROM x -- bypass"))
|
||||
.isInstanceOf(AppException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void carrierQueryContractRequiresStableAsciiAliases() throws Exception {
|
||||
var contract = new ObjectMapper().readTree(Files.readString(
|
||||
Path.of("config/hmm_carrier_query_contract.json")));
|
||||
|
||||
assertThat(contract.path("required_output_aliases").toString())
|
||||
.contains(
|
||||
"EMPLOYEE_CODE",
|
||||
"CARRIER_CODE",
|
||||
"CARRIER_NAME",
|
||||
"LATEST_REVENUE_USD",
|
||||
"LATEST_GROSS_MARGIN_USD",
|
||||
"LATEST_SCHEDULE_RELIABILITY_PCT",
|
||||
"LATEST_RISK_LEVEL"
|
||||
);
|
||||
assertThat(contract.path("rules").toString())
|
||||
.contains("Never translate aliases")
|
||||
.contains("Oracle VPD");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user