Skip to content

refactor: switch TRgeometry regular families to the generated mixin#93

Open
estebanzimanyi wants to merge 1 commit into
refactor/oo-codegen-tnpoint-switchfrom
refactor/oo-codegen-trgeometry-switch
Open

refactor: switch TRgeometry regular families to the generated mixin#93
estebanzimanyi wants to merge 1 commit into
refactor/oo-codegen-tnpoint-switchfrom
refactor/oo-codegen-trgeometry-switch

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Fourth family in the codegen-switch fan-out (after TCbuffer #90, TPose #91,
TNpoint #92), independent of the upstream MEOS gate.

What changed

  • codegen.py: add the rgeo FAMILY_MODEL (temporal_token trgeo;
    geo token uses geometry_to_gserialized($o) — single-arg, unlike the
    geo_to_gserialized(g, False) of the other spatial families; tokens
    geo/trgeo/tpoint/stbox) + tpoint/trgeo in _ORDER. Additive
    refactor: switch TCbuffer regular families to the generated mixin #90/refactor: switch TPose regular families to the generated mixin #91/refactor: switch TNpoint regular families to the generated mixin #92 mixins regenerate byte-identical (regression-guarded).
  • _generated/trgeometry_methods.py: TRgeometryRegularMixin — 10
    methods (comparison / temporal-cmp / distance / nad / nai / shortest_line).
    Static: 10/10 backing-and-fallback identical to the hand-written
    oracle.
  • trgeometry.py: inherits the mixin; the 10 generated methods removed.
    at/minus stay hand-written — rgeo restriction is the irregular
    trgeo_restrict_<timetype>+direction-bool pattern (no trgeometry_at_*
    in the catalog), so the generator never collects them. never_*/the
    irregular core kept. Documented NotImplementedError stubs for
    from_base_time/from_mfjson (pending upstream MEOS) make
    TRgeometry* concrete.

Proof

tests/main/trgeometry_test.py is byte-identical hand-written vs wired
(A/B, 2 stubs constant): both 23 passed / 6 failed, the same 6
pre-existing #88 hand-written-core defects outside the switch domain
(TestTRgeometryConstructors/Accessors/GapMethods — constructors,
accessors, known-gap methods; not comparison/distance), unrelated to and
unaffected by this change. Every switch-domain test passes. Positive
proof: static 10/10 backing-identical (equivalence by construction).
#89 coverage gate stays green.

Fan-out status

4 of 6 families now switched: TCbuffer #90, TPose #91, TNpoint #92,
TRgeometry #93. Stacked #88#89#90#91#92#93, all MERGEABLE/CLEAN.

geo (TGeomPoint/TGeogPoint) and temporal (TFloat/TInt/TBool/TText) are
deliberately NOT generated
: their hand-written regular families use
generic self-type backings (always_eq_temporal_temporal, not typed
*_tgeompoint_*/*_tfloat_tfloat) plus editorial dispatch not in
meos-idl.json (geo: STBox-via-stbox_to_geo, Point/Geometry split,
geodetic flag, split base/subclass; temporal: scalar-by-value with
per-member casts). Forcing the generator would emit wrong backings —
violating equivalence-by-construction — so they correctly remain
hand-written (the codegen's design scope is regular, uniform,
typed-per-overload
families).

Fourth family in the codegen-switch fan-out (after TCbuffer #90, TPose
#91, TNpoint #92).

- codegen.py: add the `rgeo` FAMILY_MODEL (temporal_token `trgeo`; geo
  token uses `geometry_to_gserialized($o)` -- single-arg, unlike the
  geo_to_gserialized(g, False) of the other spatial families; tokens
  geo/trgeo/tpoint/stbox) + `tpoint`/`trgeo` to _ORDER. Additive:
  #90/#91/#92 mixins regenerate byte-identical (regression-guarded).
- pymeos/main/_generated/trgeometry_methods.py: generated
  TRgeometryRegularMixin -- 10 methods (comparison, temporal comparison,
  distance/nad/nai/shortest_line). Static: 10/10 backing-and-fallback
  identical to the hand-written oracle.
- pymeos/main/trgeometry.py: inherits the mixin; the 10 now-generated
  regular methods removed. at/minus stay hand-written (rgeo restriction
  is the irregular `trgeo_restrict_<timetype>`+direction-bool pattern,
  not `trgeometry_at_*`, so the generator never collects them);
  never_*/irregular core kept. Adds documented NotImplementedError stubs
  for from_base_time and from_mfjson (pending upstream MEOS) so
  TRgeometry/Inst/Seq/SeqSet are concrete.

Proof: tests/main/trgeometry_test.py is byte-identical hand-written vs
wired (A/B, 2 stubs constant) -- both 6 failed / 23 passed, the SAME 6
pre-existing #88 hand-written-core defects OUTSIDE the switch domain
(TestTRgeometryConstructors/Accessors/GapMethods -- constructors,
accessors, known-gap methods; not comparison/distance), unrelated to and
unaffected by this change. Every switch-domain test passes. Static 10/10
identical is the positive proof. Stacked on #92.
estebanzimanyi added a commit that referenced this pull request May 19, 2026
geo (TGeomPoint/TGeogPoint) and temporal (TFloat/TInt/TBool/TText) are
the 2 of 6 families not switched to generated mixins. Verified root
cause: their regular-method dispatch encodes editorial decisions absent
from meos-idl.json (geo: STBox-via-stbox_to_geo, Point/Geometry split,
runtime geodetic flag, GeoSet->generic; temporal: Int->Float coercion
via super(), scalar-by-value casts, generic *_temporal_temporal self).

A PyMEOS-local FAMILY_MODEL extension was rejected as the transcription
anti-pattern (relocates editorial logic into per-binding config; no
equivalence by construction; diverges across bindings).

This RFC proposes the sound, ecosystem-correct solution: an
oo.<family>.<member>.dispatch annotation in MEOS-API's
meta/meos-meta.json (merged into meos-idl.json like the existing shape
annotations GoMEOS already consumes), so every binding's faithful
generator derives geo/temporal from the SAME canonical catalog facts --
equivalence by construction restored at the catalog level, A/B suite as
the unchanged acceptance gate, ecosystem-wide 100%.

The §3 dispatch tables are extracted verbatim from PyMEOS's hand-written
oracle and are complete for geo/temporal. Cross-repo handoff: MEOS-API
(parallel-owned) lands the metadata; PyMEOS then consumes it and
generates the final 2 families. Until then geo/temporal correctly stay
hand-written (fully functional -- no API-parity gap; only the
codegen-uniformity goal is outstanding). Stacked on #93.
estebanzimanyi added a commit that referenced this pull request May 19, 2026
Implements the PyMEOS-side follow-up of RFC #94 §5: a consumer that
emits faithful geo/temporal mixins from the canonical
oo.<family>.<member>.dispatch blocks the parallel MEOS-API session is
adding to meta/meos-meta.json (merged into meos-idl.json).

Additive only -- the 4 shipped families' FAMILY_MODEL path
(emit_faithful_mixin) is untouched; #90/#91/#92/#93 mixins regenerate
byte-identical (regression-guarded) and #89 coverage gate stays green.

Proven correct WITHOUT waiting on the not-yet-published metadata:
_serialize_family_dispatch() expresses each of the 4 A/B-proven families
(cbuffer/pose/npoint/rgeo) in the RFC #94 §3 schema; feeding those back
through emit_from_oo_dispatch() reproduces their committed mixins
BYTE-IDENTICALLY for all 4 (the new --verify-oo-roundtrip gate +
OoDispatchConsumer test, permanently enforced). geo/temporal then plug
into this same proven consumer the instant MEOS-API emits their
oo.dispatch (via --mixin-from-dispatch), closing codegen 6/6 -- no
PyMEOS-local transcription, equivalence by construction at the catalog
level.

This is the non-wasted parallel prep: when the keystone enrichment
lands, PyMEOS converges immediately. Stacked on #94 (the RFC).
estebanzimanyi added a commit that referenced this pull request May 19, 2026
Implements the PyMEOS-side follow-up of RFC #94 §5: a consumer that
emits faithful geo/temporal mixins from the canonical
oo.<family>.<member>.dispatch blocks the parallel MEOS-API session is
adding to meta/meos-meta.json (merged into meos-idl.json).

Additive only -- the 4 shipped families' FAMILY_MODEL path
(emit_faithful_mixin) is untouched; #90/#91/#92/#93 mixins regenerate
byte-identical (regression-guarded) and #89 coverage gate stays green.

Proven correct WITHOUT waiting on the not-yet-published metadata:
_serialize_family_dispatch() expresses each of the 4 A/B-proven families
(cbuffer/pose/npoint/rgeo) in the RFC #94 §3 schema; feeding those back
through emit_from_oo_dispatch() reproduces their committed mixins
BYTE-IDENTICALLY for all 4 (the new --verify-oo-roundtrip gate +
OoDispatchConsumer test, permanently enforced). geo/temporal then plug
into this same proven consumer the instant MEOS-API emits their
oo.dispatch (via --mixin-from-dispatch), closing codegen 6/6 -- no
PyMEOS-local transcription, equivalence by construction at the catalog
level.

This is the non-wasted parallel prep: when the keystone enrichment
lands, PyMEOS converges immediately. Stacked on #94 (the RFC).
estebanzimanyi added a commit that referenced this pull request May 19, 2026
geo (TGeomPoint/TGeogPoint) and temporal (TFloat/TInt/TBool/TText) are
the 2 of 6 families not switched to generated mixins. Verified root
cause: their regular-method dispatch encodes editorial decisions absent
from meos-idl.json (geo: STBox-via-stbox_to_geo, Point/Geometry split,
runtime geodetic flag, GeoSet->generic; temporal: Int->Float coercion
via super(), scalar-by-value casts, generic *_temporal_temporal self).

A PyMEOS-local FAMILY_MODEL extension was rejected as the transcription
anti-pattern (relocates editorial logic into per-binding config; no
equivalence by construction; diverges across bindings).

This RFC proposes the sound, ecosystem-correct solution: an
oo.<family>.<member>.dispatch annotation in MEOS-API's
meta/meos-meta.json (merged into meos-idl.json like the existing shape
annotations GoMEOS already consumes), so every binding's faithful
generator derives geo/temporal from the SAME canonical catalog facts --
equivalence by construction restored at the catalog level, A/B suite as
the unchanged acceptance gate, ecosystem-wide 100%.

The §3 dispatch tables are extracted verbatim from PyMEOS's hand-written
oracle and are complete for geo/temporal. Cross-repo handoff: MEOS-API
(parallel-owned) lands the metadata; PyMEOS then consumes it and
generates the final 2 families. Until then geo/temporal correctly stay
hand-written (fully functional -- no API-parity gap; only the
codegen-uniformity goal is outstanding). Stacked on #93.
estebanzimanyi added a commit that referenced this pull request May 19, 2026
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).
estebanzimanyi added a commit that referenced this pull request May 19, 2026
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant