From 5f43875e26ae6d81e2a392995579a3a43f123610 Mon Sep 17 00:00:00 2001 From: Marc Pont Date: Tue, 25 Aug 2026 22:03:50 +0200 Subject: [PATCH] Fix: persist PSI indices after building them run_psi_index_building() called build_index() but never save_index(), so aware_psi_index stayed empty. The Java fund services found no constituents and the mirror funds copied nothing. Empty indices are skipped so a failed build doesn't wipe a good one. --- aware-fund/services/analytics/run_all.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aware-fund/services/analytics/run_all.py b/aware-fund/services/analytics/run_all.py index 886c957..1412281 100644 --- a/aware-fund/services/analytics/run_all.py +++ b/aware-fund/services/analytics/run_all.py @@ -133,11 +133,15 @@ def run_psi_index_building(ch_client) -> dict: for index_type in INDEX_CONFIGS.keys(): try: index = builder.build_index(index_type) + # Persist so the Java fund services can read the constituents. + # Skip empty indices so a failed build doesn't wipe a good one. + saved = builder.save_index(index) if index.num_constituents else False results[index_type.value] = { 'status': 'success', - 'constituents': index.num_constituents + 'constituents': index.num_constituents, + 'saved': saved } - logger.info(f"Built {index_type.value}: {index.num_constituents} constituents") + logger.info(f"Built {index_type.value}: {index.num_constituents} constituents (saved={saved})") except Exception as e: results[index_type.value] = {'status': 'error', 'error': str(e)} logger.warning(f"Failed to build {index_type.value}: {e}")