Skip to content

feat: meos-idl.json-driven OO method-family codegen (Draft preview)#89

Open
estebanzimanyi wants to merge 1 commit into
feat/extended-temporal-typesfrom
refactor/oo-codegen-meos-idl
Open

feat: meos-idl.json-driven OO method-family codegen (Draft preview)#89
estebanzimanyi wants to merge 1 commit into
feat/extended-temporal-typesfrom
refactor/oo-codegen-meos-idl

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Adds a meos-idl.json-driven generator for PyMEOS's regular OO method
families, delivered as a non-destructive Draft artifact.

What it does

tools/oo_codegen/codegen.py reads the vendored meos-idl.json (the
signature catalog every binding consumes) and emits one PyMEOS OO method
per regular method-family member — comparison, spatial relationship
(ever/always/temporal), distance, restriction — into
tools/oo_codegen/_preview/<family>_methods.py.

Each generated method dispatches, by the argument's C-name token, to the
exact pymeos_cffi backing function the hand-written surface uses, so
it is identical to its hand-written counterpart by construction — nothing
is reimplemented. The irregular core (constructors, conversions,
accessors, transforms, I/O) is not synthesisable from signatures and
stays hand-written; it is counted and named, never silently dropped.

tools/oo_codegen/_preview/ is never imported by the pymeos
package (underscore-prefixed, lazily-resolved cffi shim). It exists so a
reviewer can diff the generated uniform, deterministic surface against
pymeos/main/*.py before any staged migration. Delivery mirrors GoMEOS
PR #2
(refactor/codegen-meos-idl); the dispatch/backing model mirrors
PyMEOS PR #87 (tools/portable_aliases/).

Coverage

2833 catalogued functions, fully accounted for:

Bucket Count
Emitted regular methods 107 (407 typed overloads), all 6 families
cbuffer / geo / npoint / pose / rgeo / temporal 30 / 29 / 12 / 12 / 10 / 14
Hand-written core 864
Datum-bearing internals (excluded) 43
Out of scope (non-temporal-family headers) 1519

Zero unaccounted. cbuffer/npoint/pose/rgeo are full first-class families,
never a headline exclusion.

Gates

  • tests/test_oo_codegen_coverage.py (offline): zero unaccounted, all six
    families, preview compiles, committed preview stays in lock-step with
    the generator, every backing symbol is a real catalogued function.
  • CI step running codegen.py --check.

Base

Stacked on #88 (feat/extended-temporal-types) so the preview covers the
extended cbuffer/npoint/pose/rgeo types.

Follow-up

A staged migration that retires the hand-written regular families in
favour of the generated ones (rename _preview/ and wire the mixins into
the type hierarchy) once the preview has been reviewed.

@estebanzimanyi estebanzimanyi force-pushed the feat/extended-temporal-types branch from 98f5065 to a5a558f Compare May 19, 2026 07:24
Reads a vendored meos-idl.json and emits one PyMEOS OO method per
regular method-family member (comparison, spatial relationship, distance,
restriction) into tools/oo_codegen/_preview/<family>_methods.py.

Each generated method dispatches, by the argument's C-name token, to the
exact pymeos_cffi backing function the hand-written surface uses, so it
is identical to its hand-written counterpart by construction; nothing is
reimplemented. The irregular core (constructors, conversions, accessors,
transforms, I/O) stays hand-written and is counted, not dropped.

tools/oo_codegen/_preview/ is a non-destructive Draft artifact the
package never imports; it lets a reviewer diff the generated uniform
surface against pymeos/main/*.py before any staged migration. Delivery
mirrors GoMEOS PR #2; the dispatch/backing model mirrors PyMEOS PR #87.

Coverage: 2833 catalogued functions fully accounted for - 107 regular
methods (407 typed overloads) across all six families (cbuffer, geo,
npoint, pose, rgeo, temporal), 864 hand-written core, 43 Datum-bearing
internals excluded, 1519 out of scope. Zero unaccounted.

Adds tests/test_oo_codegen_coverage.py (offline gate: zero unaccounted,
six families, preview compiles and stays in lock-step with the
generator, every backing symbol is a real catalogued function) and a
CI step running the generator's accounting check.
@estebanzimanyi estebanzimanyi force-pushed the refactor/oo-codegen-meos-idl branch from 1e7d6ea to 85deb9b Compare May 19, 2026 07:25
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
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