Skip to content

WIP: author Python expressions directly as protobuf - #449

Closed
saulshanabrook wants to merge 4 commits into
mainfrom
codex/proto-ir-conformance
Closed

saulshanabrook wants to merge 4 commits into
mainfrom
codex/proto-ir-conformance

Conversation

@saulshanabrook

@saulshanabrook saulshanabrook commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Work in progress: author Python expressions directly as generated protobuf records and execute them through the shared bytes adapter. This is a compatibility experiment, not a completed migration or a merge-ready release.

RuntimeExpr holds a canonical record reference rather than the old expression dataclasses. Packing preserves declaration closure and ordered commands; decoded results retain their declaration owners. Scalar builtin wrappers consume an exported engine-owned catalog, with local .value, pretty printing and deconstruction over records. The native extension transports bytes and does not lower Python syntax or fall back to the old AST execution path.

Depends on egraphs-good/egglog-experimental#80 and egraphs-good/egglog#1047. Dependency revisions are immutable; no local path overrides are required.

Supported checkpoint

  • Ordinary i64/f64 literal and addition authoring, extraction, costs and equality checks through the real native wheel.
  • Concrete bodyless Expr initializers now author equality-sort/constructor records directly, including keyword/default arguments and exact supplied names. Preserved Python methods/properties stay local; their owner-scoped lifetime survives extraction without a global strong class registry. Unsupported decorated members reject before callable publication.
  • Immutable record ownership, relocation, signature inference and inert defaults, including deep iterative packing.
  • Clone/pop ownership and failure handling. Runtime thread query/update returns actual native counts over bytes, including automatic0 and restored settings after pop.

Remaining work

The complete package is not migrated: constants, symbolic user methods/functions, generic classes, rules/schedules, other builtin providers, custom costs, observation/freeze/recording, richer pretty output and generated typing surfaces remain unfinished. Broad tests and type checking do not pass yet. Existing compatibility requirements remain part of the goal; unsupported operations are not accepted as permanent API removals.

Proof requests/results and creation modes are represented in the shared schema, but native proof execution is not yet exposed by this frontend.

Verification

The independently reviewed scalar/resource/constructor checkpoint passes144 focused tests against a built and installed native wheel, with no deselections or source bootstrap. The coordinator independently reran the full admitted set. Catalog bytes match the engine export; changed source modules match the wheel and installed package. Targeted typing, Python lint/format and Rust formatting pass.

The unchanged original high-level test module now reaches constant(...) before failing collection on that unmigrated producer; an ignored interpreter-shutdown warning follows the error. Neither is claimed passing. Nondefault no_decomp remains explicitly unsupported. The earlier strict Clippy gate reports13 diagnostics in unchanged native source; it is not claimed green or rerun for this Python-only slice.

Earlier full-suite results are native baselines only, not migrated coverage. No performance claim or new native compiler is included.

Store generated messages directly behind immutable owner/index references and pack rooted closures iteratively. Pin the standalone generated-message package; preserve existing public behavior until the next migration slice.

Verified 63 ownership/relocation tests, scoped Ruff and mypy, and resolver lock freshness without native builds.
Use canonical record references for runtime expressions and catalog-backed scalar APIs; pack commands directly and execute over the bytes-only extension seam. Preserve declaration closure and result ownership without the old AST execution fallback.

The independently reviewed scalar checkpoint has 87 focused passes. Actual thread query remains a deliberate failing regression pending protocol support; full providers, user declarations, rules, readers and type coverage are incomplete. Preserve this intermediate artifact before the next schema epoch.
Return actual native thread counts, preserve integer-index inputs and clone/pop restoration, and classify proof request references in the canonical record inventory. Update immutable shared pins without unrelated dependency changes.

Independent review and 120 focused installed-wheel tests pass. High-level module collection remains blocked by unmigrated dynamic classes; no_decomp and broad typing are incomplete, and strict Clippy reports diagnostics in unchanged native files. This is not full frontend conformance.
Keep preserved Python hooks with canonical declaration owners and derive call metadata from records. Retain keywords, defaults, recursive sort references and class lifetimes; reject unsupported decorated members before publication. Verified by 144 installed-wheel tests and independent source review.
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