Validate migration didn't create inconsistencies Checks that: 1. Program island metadata matches actual island assignment 2. No programs are assigned to multiple islands 3. All island best programs exist and are in correct islands
(self)
| 1883 | self._validate_migration_results() |
| 1884 | |
| 1885 | def _validate_migration_results(self) -> None: |
| 1886 | """ |
| 1887 | Validate migration didn't create inconsistencies |
| 1888 | |
| 1889 | Checks that: |
| 1890 | 1. Program island metadata matches actual island assignment |
| 1891 | 2. No programs are assigned to multiple islands |
| 1892 | 3. All island best programs exist and are in correct islands |
| 1893 | """ |
| 1894 | seen_program_ids = set() |
| 1895 | |
| 1896 | for i, island in enumerate(self.islands): |
| 1897 | for program_id in island: |
| 1898 | # Check for duplicate assignments |
| 1899 | if program_id in seen_program_ids: |
| 1900 | logger.error(f"Program {program_id} assigned to multiple islands") |
| 1901 | continue |
| 1902 | seen_program_ids.add(program_id) |
| 1903 | |
| 1904 | # Check program exists |
| 1905 | if program_id not in self.programs: |
| 1906 | logger.warning(f"Island {i} contains nonexistent program {program_id}") |
| 1907 | continue |
| 1908 | |
| 1909 | # Check metadata consistency |
| 1910 | program = self.programs[program_id] |
| 1911 | stored_island = program.metadata.get("island") |
| 1912 | if stored_island != i: |
| 1913 | logger.warning( |
| 1914 | f"Island mismatch for program {program_id}: " |
| 1915 | f"in island {i} but metadata says {stored_island}" |
| 1916 | ) |
| 1917 | |
| 1918 | # Validate island best programs |
| 1919 | for i, best_id in enumerate(self.island_best_programs): |
| 1920 | if best_id is not None: |
| 1921 | if best_id not in self.programs: |
| 1922 | logger.warning(f"Island {i} best program {best_id} does not exist") |
| 1923 | elif best_id not in self.islands[i]: |
| 1924 | logger.warning(f"Island {i} best program {best_id} not in island") |
| 1925 | |
| 1926 | def _cleanup_stale_island_bests(self) -> None: |
| 1927 | """ |
no test coverage detected