perf(selfop): index staged observation joins and verify candidate builds

This commit is contained in:
2026-10-13 01:47:17 +08:00
parent d689112656
commit bf693fab6b
5 changed files with 245 additions and 0 deletions
@@ -94,6 +94,16 @@ class SelfoperatedAnalyticsSchemaContractTest {
assertTrue(ddl.get("ll_selfop_inventory_snapshot").contains("snapshot_run_id,source_account,customer_code,warehouse_code,sku_code,product_quality"));
}
@Test
void factObservationLookupHasEqualityPrefixAndCoversProfileEvidence() throws Exception {
var ddl = tables(Files.readString(Path.of("src/main/resources/db/lastleg.sql")));
var stage = ddl.get("ll_selfop_sync_stage");
assertTrue(stage.contains("KEY idx_selfop_stage_fact_observation (observation_sequence,warehouse_code,object_type,validation_status,run_id,observed_at_utc)"));
// Observation lookup and business-key history serve different consumers; both are required.
assertTrue(stage.contains("KEY idx_selfop_stage_history (object_type,object_key_hash,stage_batch_id)"));
assertTrue(stage.contains("UNIQUE KEY uk_selfop_stage_object (stage_batch_id,object_type,object_key_hash)"));
}
@Test
void readAndSyncPermissionsAreIndependentWithThreeAuthorizedAdminMenus() throws Exception {
var seed = Files.readString(Path.of("../iam/src/main/resources/db/selfoperated-analytics-permissions.sql"));