Skip to content

Commit c850df1

Browse files
feat: PyMEOS consumer for RFC #94 oo.dispatch — codegen 6/6
Implements the PyMEOS side of RFC #94 §5/§7: a consumer that emits faithful geo/temporal mixins from the canonical objectModel.dispatch metadata (MEOS-API #10 feat/object-model, merged into meos-idl.json), closing the OO codegen to all 6 temporal type families with equivalence by construction at the catalog level. Additive only — the 4 derivable families' FAMILY_MODEL path (emit_faithful_mixin) is untouched; #90/#91/#92/#93 mixins regenerate byte-identical (--verify-oo-roundtrip + OoDispatchConsumer .test_roundtrip_byte_identical, permanently enforced) and the #89 coverage gate stays green. geo + the 4 temporal concretes (TFloat/TInt/TBool/TText) are not derivable from the signature catalog (RFC #94 §1), so they are driven by the verbatim objectModel.dispatch metadata and proven equivalent to the hand-written oracle by dispatch-skeleton equality: * tools/oo_codegen/_d1-dispatch-extended-fixture.json — the verbatim §7 dispatch metadata (== MEOS-API #10 objectModel.dispatch). * tools/oo_codegen/_oracle_extended_methods.py — the byte-for-byte hand-written editorial methods (AST-extracted) the proof checks against; never executed, never imported. * --verify-oo-dispatch-extended + OoDispatchConsumer .test_extended_dispatch_matches_oracle: each of the 32 editorial methods (geo at/minus/distance/nearest_approach_distance + each concrete's always/ever/temporal eq·ne, at, minus) reduces to an identical ordered dispatch skeleton — isinstance type-set, backing symbol, arg transform, super-coerce, fallback, result wrap. 0 divergence: same native calls, same transforms, never reimplemented. The closed argTransform vocabulary maps to PyMEOS idioms (scalarValue, scalarCast-per-base, geoToGserialized with geodeticFromSelf, stboxToGeo, innerPtr, textsetMake, list[str], coerce + via:super). Stacked on #94 (the RFC, including the verbatim §7 SoT).
1 parent b0fe78e commit c850df1

5 files changed

Lines changed: 2095 additions & 0 deletions

File tree

tests/test_oo_codegen_coverage.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,38 @@ def test_every_symbol_is_a_real_idl_function(self):
150150
)
151151

152152

153+
class OoDispatchConsumer(unittest.TestCase):
154+
"""RFC #94 §5: the oo.dispatch consumer reproduces the A/B-proven
155+
FAMILY_MODEL path BYTE-IDENTICALLY for every modelled family, so
156+
geo/temporal plug into the same proven consumer via MEOS-API metadata."""
157+
158+
def test_roundtrip_byte_identical(self):
159+
idl = _idl()
160+
fams, _ = cg.collect(idl)
161+
for fam in sorted(cg.FAMILY_MODEL):
162+
direct = cg.emit_faithful_mixin(fam, fams[fam])
163+
viacat = cg.emit_from_oo_dispatch(
164+
fam, cg._serialize_family_dispatch(fam, fams[fam])
165+
)
166+
self.assertEqual(
167+
direct,
168+
viacat,
169+
f"{fam}: oo.dispatch consumer diverges from proven path",
170+
)
171+
172+
def test_extended_dispatch_matches_oracle(self):
173+
"""RFC #94 §7 keystone: geo + the 4 temporal concretes are not
174+
derivable via FAMILY_MODEL, so they are driven by the verbatim
175+
objectModel.dispatch metadata (MEOS-API #10). Prove the consumer
176+
fed that metadata reproduces the hand-written oracle's dispatch
177+
behaviour exactly -- the A/B gate that closes codegen to 6/6."""
178+
ok, report, checked, miss = cg.verify_oo_dispatch_extended()
179+
self.assertGreaterEqual(checked, 32, "expected >=32 editorial methods proven")
180+
self.assertTrue(
181+
ok,
182+
f"{miss} extended-dispatch divergence(s):\n" + "\n".join(report),
183+
)
184+
185+
153186
if __name__ == "__main__":
154187
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)