()
| 164 | break |
| 165 | |
| 166 | def main(): |
| 167 | print("=" * 60) |
| 168 | print("SpacetimeDB Module Schema Comparison") |
| 169 | print("Comparing Rust vs C++ module implementations") |
| 170 | print("=" * 60) |
| 171 | |
| 172 | # Load schemas |
| 173 | rust, cpp = load_schemas() |
| 174 | |
| 175 | # Extract tables and reducers |
| 176 | rust_tables = {t['name']: t for t in rust['tables']} |
| 177 | cpp_tables = {t['name']: t for t in cpp['tables']} |
| 178 | rust_reducers = rust['reducers'] |
| 179 | cpp_reducers = cpp['reducers'] |
| 180 | |
| 181 | # Run comparisons |
| 182 | common_tables = compare_tables(rust_tables, cpp_tables) |
| 183 | compare_indexes(rust_tables, cpp_tables, common_tables) |
| 184 | compare_reducers(rust_reducers, cpp_reducers) |
| 185 | check_testf_enum(rust, cpp) |
| 186 | |
| 187 | # Summary |
| 188 | print("\n" + "=" * 60) |
| 189 | print("SUMMARY") |
| 190 | print("=" * 60) |
| 191 | |
| 192 | perfect_match = ( |
| 193 | len(rust_tables) == len(cpp_tables) and |
| 194 | len(rust_reducers) == len(cpp_reducers) and |
| 195 | set(rust_tables.keys()) == set(cpp_tables.keys()) and |
| 196 | {r['name'] for r in rust_reducers} == {r['name'] for r in cpp_reducers} |
| 197 | ) |
| 198 | |
| 199 | if perfect_match: |
| 200 | print("✅ Schema structure matches (tables and reducers)") |
| 201 | print("⚠️ Note: There may be minor differences in:") |
| 202 | print(" - Index naming conventions (especially multi-column indexes)") |
| 203 | print(" - TestF enum payload support (C++ currently simplified)") |
| 204 | else: |
| 205 | print("❌ Schema structure has differences - review details above") |
| 206 | |
| 207 | if __name__ == "__main__": |
| 208 | main() |
no test coverage detected
searching dependent graphs…