Skip to content

Add primitive body typecheck helpers#881

Draft
saulshanabrook wants to merge 5 commits into
egraphs-good:mainfrom
saulshanabrook:codex/split-primitive-body-runtime-apis
Draft

Add primitive body typecheck helpers#881
saulshanabrook wants to merge 5 commits into
egraphs-good:mainfrom
saulshanabrook:codex/split-primitive-body-runtime-apis

Conversation

@saulshanabrook
Copy link
Copy Markdown
Member

@saulshanabrook saulshanabrook commented May 18, 2026

Context

This is the egglog-side support needed by egglog-experimental's body-defined (primitive ...) command. It intentionally contains only the reusable API surface and not the experimental command implementation.

Companion experimental PR: egraphs-good/egglog-experimental#46.

Changes

  • Adds output-constrained expression typechecking helpers on EGraph.
  • Adds SpecializedPrimitive::apply for evaluating an already-specialized primitive against runtime values.
  • Adds focused tests and an unreleased changelog entry.

Validation

  • cargo test --lib typecheck_expr_with_output
  • cargo fmt
  • git diff --check

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 18, 2026

Merging this PR will improve performance by 27.82%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 22 untouched benchmarks
🆕 1 new benchmark
⏩ 215 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
🆕 Simulation tests[repro-herbie-vanilla] N/A 1.4 s N/A
Simulation tests[python_array_optimize] 1.5 s 1.6 s -6.94%
Simulation rust_rule_fib[rule_run_1000] 280.7 ms 202.7 ms +38.46%
Simulation tests[cykjson] 440.2 ms 271.6 ms +62.08%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing saulshanabrook:codex/split-primitive-body-runtime-apis (f8883c7) with main (8c1c70b)2

Open in CodSpeed

Footnotes

  1. 215 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (36de434) during the generation of this report, so 8c1c70b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@saulshanabrook saulshanabrook force-pushed the codex/split-primitive-body-runtime-apis branch 2 times, most recently from f5db02d to 22481a2 Compare May 18, 2026 20:44
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 18, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.99%. Comparing base (36de434) to head (f8883c7).

Files with missing lines Patch % Lines
src/exec_state.rs 0.00% 51 Missing ⚠️
src/lib.rs 95.00% 7 Missing ⚠️
src/typechecking.rs 93.10% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #881      +/-   ##
==========================================
- Coverage   87.06%   86.99%   -0.08%     
==========================================
  Files          88       88              
  Lines       25844    26064     +220     
==========================================
+ Hits        22502    22675     +173     
- Misses       3342     3389      +47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@saulshanabrook saulshanabrook force-pushed the codex/split-primitive-body-runtime-apis branch from 22481a2 to 2fbd1d1 Compare May 20, 2026 18:59
@saulshanabrook saulshanabrook moved this to This Week in Saul Shanabrook May 26, 2026
Comment thread src/lib.rs Outdated
Comment thread src/core.rs Outdated
Comment thread src/typechecking.rs
@saulshanabrook saulshanabrook moved this from This Week to In Progress in Saul Shanabrook May 26, 2026
@saulshanabrook saulshanabrook marked this pull request as ready for review May 26, 2026 21:51
@saulshanabrook saulshanabrook requested a review from a team as a code owner May 26, 2026 21:51
@saulshanabrook saulshanabrook requested review from oflatt and yihozhang and removed request for a team and oflatt May 26, 2026 21:51
@saulshanabrook saulshanabrook moved this from In Progress to Waiting for Review in Saul Shanabrook May 26, 2026
@saulshanabrook saulshanabrook marked this pull request as draft May 26, 2026 23:44
@saulshanabrook saulshanabrook moved this from Waiting for Review to In Progress in Saul Shanabrook May 27, 2026
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.

2 participants