MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / main

Function main

modules/module-test-cpp/compare_module_schemas.py:166–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164 break
165
166def 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
207if __name__ == "__main__":
208 main()

Callers 1

Calls 7

load_schemasFunction · 0.85
compare_tablesFunction · 0.85
compare_indexesFunction · 0.85
compare_reducersFunction · 0.85
check_testf_enumFunction · 0.85
setFunction · 0.50
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…