BE-587, BE-588: HashQL: Introduce CodeGenerationContext/CodeExecutionContext split and eval-stage Interner#8839
Conversation
chore: add new dependency chore: format feat: error module feat: introduce hashql_eval interner chore: checkpoint feat: checkpoint feat: checkpoint chore: remove old value module feat: checkpoint feat: checkpoint feat: checkpoint feat: checkpoint feat: checkpoint chore: checkpoint feat: move entity query into its own modul fix: query request feat: checkpoint (it compiles!) feat: checkpoint feat: checkpoint feat: checkpoint fix: issue around cached thunking feat: covariance for opaque inners fix: cfgattr serde chore: remove graph module fix: merge fuckup
PR SummaryMedium Risk Overview Graph API: removes in-process HashQL compile ( Diagnostics: drops the feature-gated Tests: orchestrator inputs are built as heap-allocated Reviewed by Cursor Bugbot for commit 0e47501. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8af8844. Configure here.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## bm/be-581-hashql-cached-constructor-produces-bare-fnptr-instead-of #8839 +/- ##
======================================================================================================
- Coverage 59.52% 59.50% -0.03%
======================================================================================================
Files 1347 1348 +1
Lines 130990 130797 -193
Branches 5883 5879 -4
======================================================================================================
- Hits 77978 77825 -153
+ Misses 52105 52066 -39
+ Partials 907 906 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CodeGenerationContext/CodeExecutionContext split and eval-stage InternerCodeGenerationContext/CodeExecutionContext split and eval-stage Interner
There was a problem hiding this comment.
Pull request overview
Refactors the HashQL evaluation pipeline to explicitly separate code-generation vs code-execution concerns by splitting the former EvalContext into CodeGenerationContext and CodeExecutionContext, and introduces an eval-stage intern::Interner to preserve interned pointer identity across the MIR → eval boundary. Test harnesses and orchestrator utilities are updated to construct typed Value inputs directly (without the JSON decoder/type-env dependency) and to pass the appropriate context/interner types through the compilation/execution stages.
Changes:
- Split evaluation context into generation/execution contexts and updated Postgres compilation + orchestrator execution call sites accordingly.
- Added eval-stage
intern::Interner(convertible from MIR interner) and migrated decoder/tests to use it. - Reworked orchestrator test input construction to build heap-allocated typed
Valuetrees directly; graph APIcompile_querywas stubbed pending BE-537.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/@local/hashql/eval/tests/orchestrator/output.rs | Generalized success rendering to support non-Global value allocators. |
| libs/@local/hashql/eval/tests/orchestrator/main.rs | Updated test driver to consume lowered artifacts and pass symbol intern sets into input builder. |
| libs/@local/hashql/eval/tests/orchestrator/inputs.rs | Replaced JSON-decoder-based input construction with direct typed Value construction using heap allocation + struct builders. |
| libs/@local/hashql/eval/tests/orchestrator/execution.rs | Updated lowering/execution glue to use MIR interner → eval interner conversion and the new context split; switched to Orchestrator::run_in. |
| libs/@local/hashql/eval/src/postgres/projections.rs | Added #[inline] on a conversion impl. |
| libs/@local/hashql/eval/src/postgres/parameters.rs | Added #[inline] on a conversion impl. |
| libs/@local/hashql/eval/src/postgres/mod.rs | Switched compiler context type to CodeGenerationContext and updated docs accordingly. |
| libs/@local/hashql/eval/src/postgres/filter/tests.rs | Migrated tests to CodeGenerationContext and eval-stage test interner helper. |
| libs/@local/hashql/eval/src/postgres/filter/mod.rs | Updated filter compiler to reference CodeGenerationContext. |
| libs/@local/hashql/eval/src/orchestrator/partial.rs | Switched to eval-stage Interner in hydration pipeline. |
| libs/@local/hashql/eval/src/orchestrator/mod.rs | Updated orchestrator to depend on CodeExecutionContext; added allocator-parametric run_in usage in call sites. |
| libs/@local/hashql/eval/src/orchestrator/events.rs | Added #[inline] on Default impl. |
| libs/@local/hashql/eval/src/orchestrator/codec/decode/tests.rs | Updated decoder tests to use eval-stage Interner::testing. |
| libs/@local/hashql/eval/src/orchestrator/codec/decode/mod.rs | Switched decoder interner reference to the eval-stage interner. |
| libs/@local/hashql/eval/src/lib.rs | Exported new intern module. |
| libs/@local/hashql/eval/src/intern.rs | Introduced eval-stage Interner convertible from MIR interner (preserves interned identity). |
| libs/@local/hashql/eval/src/error.rs | Replaced graph-gated diagnostic category variant with an orchestrator-backed variant. |
| libs/@local/hashql/eval/src/context.rs | Implemented CodeGenerationContext / CodeExecutionContext split and From conversion. |
| libs/@local/hashql/core/src/graph/linked.rs | Minor Debug impl formatting cleanup + added #[inline] on accessors. |
| libs/@local/hashql/compiletest/src/suite/eval_postgres.rs | Updated compiletest suite to use CodeGenerationContext and eval interner conversion. |
| libs/@local/graph/api/src/rest/entity_query_request.rs | Added lint expectation and stubbed compile_query while HashQL API wiring is pending BE-537. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
74f8c73 to
a203514
Compare
8af8844 to
82bb954
Compare
fa1c26d to
e8db60a
Compare
eb135ab to
631682a
Compare
631682a to
b939729
Compare
e8db60a to
4a8d4fd
Compare
3d05f60 to
f0ab12f
Compare
b939729 to
a8a9b46
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
libs/@local/graph/api/src/rest/entity_query_request.rs:336
- The doc comment describes compiling raw HashQL queries, but
EntityQuery::Queryis now intentionally stubbed to return 501/NOT_IMPLEMENTED. Updating the docs here will keep API behavior and documentation aligned.
/// Compiles a query into an executable entity filter.
///
/// Transforms the query representation into a [`Filter`] that can be executed
/// against the entity store. For already-compiled filter queries, this returns
/// the filter directly. For raw HashQL queries, it parses and compiles them using
/// the provided `heap` arena allocator.
///
| @@ -109,7 +109,7 @@ fn run_jexpr_test( | |||
| let mut pipeline = Pipeline::new(&heap); | |||
|
|
|||
| // Lower first so the type environment is populated, then build inputs. | |||
| /// Intermediate state after parsing and lowering a J-Expr query. | ||
| /// | ||
| /// Holds the MIR artifacts needed to build typed inputs (via the decoder | ||
| /// and the environment) before proceeding to execution. |
a8a9b46 to
ce89d48
Compare
f0ab12f to
0e47501
Compare


🌟 What is the purpose of this PR?
This PR refactors the HashQL evaluation pipeline to introduce a cleaner separation between the code generation phase and the code execution phase. The previously unified
EvalContextis split intoCodeGenerationContext(used during MIR compilation and Postgres query preparation) andCodeExecutionContext(used during orchestrated query execution). This makes the data flow and lifecycle of each phase explicit and prevents accidental misuse of context across phase boundaries.Additionally, a dedicated
eval::intern::Interneris introduced for the evaluation stage, which must be constructed from the MIR interner viaFromto preserve interned pointer identity across the MIR/eval boundary. Input construction for orchestrator tests is also migrated away from using the JSON decoder to directly building typedValuetrees using the heap allocator, removing a dependency on the type environment at input-construction time.The
compile_queryimplementation in the graph API is stubbed out withunimplemented!pending the HashQL API wire-up tracked in BE-537.🔗 Related links
🔍 What does this change?
EvalContexttoCodeGenerationContextand introduces a newCodeExecutionContextstruct that is produced fromCodeGenerationContextviaFrom, carrying only the fields needed at execution time.eval::intern::Interneras a dedicated interner for the evaluation stage, constructed fromhashql_mir::intern::Internerto preserve pointer identity.OrchestratorandPostgresCompilerto use the appropriate context type for their respective phases.Valuetree construction using heap-allocatedRcandStructBuilder, removing the dependency on the post-lowering type environment for building inputs.EntityQuery::compile_querywithunimplemented!and suppressesdead_codewarnings pending the full HashQL API integration.EvalDiagnosticCategoryenum to replace thegraph-feature-gatedGraphvariant with anOrchestratorvariant backed byOrchestratorDiagnosticCategory.Loweredby value (consuming it) and convert the MIR interner into the eval interner at the appropriate pipeline stage.🛡 What tests cover this?
eval_postgrescompile tests exercise the refactored context types and input construction.Interner::testingfor the new eval-stage interner.❓ How to test this?
cargo testacross thehashql-evalandhash-graph-apicrates.