refactor(cypher): extract bounded-reentry runtime helpers (#987 Step 3)#1331
Merged
refactor(cypher): extract bounded-reentry runtime helpers (#987 Step 3)#1331
Conversation
…#987 Step 3) Move bounded-reentry data-frame execution helpers out of `gfql_unified.py` into a new `graphistry/compute/gfql/cypher/reentry/execution.py` module so the bounded-reentry contract assembled at compile time (`ReentryPlan`) and the matching data-frame stitching live next to each other. `_entity_projection_meta_entry` moves to `result_postprocess.py` next to `WholeRowProjectionMeta` since it is shared by the connected-OPTIONAL-MATCH and bounded-reentry paths. Pure-move refactor — no semantic change. `gfql_unified.py` shrinks by ~440 LOC; `gfql_unified` re-exports the moved private names via aliased imports so existing tests reaching `gfql_unified._compiled_query_reentry_state` continue to work. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wave-2 review nit: the subpackage docstring listed naming/scope/carry/rewrite but not the existing `runtime` (compile-time rewrites) or the new `execution` (data-frame stitching). Adds both for grep-navigability. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2099b7f to
c1cb0a4
Compare
Contributor
Author
CI status: 1 failure inherited from master tipAfter rebase onto
Both fail the same scenario: This is a master-side TCK xfail-contract pin that needs updating after #1328 widened direct-Cypher varlen WHERE admission (the scenario that previously raised Holding merge until master is green again. |
This was referenced May 7, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
replace bounded reentry hidden-column handshake with an explicit ReentryPlan) — Step 3 (move runtime stitching into a dedicated reentry module).graphistry/compute/gfql_unified.pyinto a newgraphistry/compute/gfql/cypher/reentry/execution.pymodule. No semantic change.gfql_unified.pyshrinks by ~440 LOC, comfortably hitting the issue's "low-hundreds LOC reduction" success criterion.What moved
To
graphistry/compute/gfql/cypher/reentry/execution.py(new):compiled_query_reentry_state— whole-row carry dispatch statecompiled_query_scalar_reentry_state— scalar-only prefix carrycompiled_query_freeform_reentry_state— free-form intermediate MATCH (Cypher/GFQL: free-form intermediate MATCH after WITH (LDBC SNB IC3 endpoint) #1263 single-row)freeform_broadcast_row_to_nodes— single-row broadcast (also reused per-row in Cypher/GFQL: admit multi-prefix-row free-form intermediate MATCH runtime path #1285 multi-row)union_scalar_reentry_results— concat per-row dispatchesapply_optional_reentry_null_fill— OPTIONAL re-entry null fillaligned_reentry_rows,reentry_carry_payload,ordered_reentry_start_nodes— supporting helpersreentry_validation_error+REENTRY_WHOLE_ROW_SUGGESTION,REENTRY_SCALAR_SUGGESTIONconstantsTo
graphistry/compute/gfql/cypher/result_postprocess.py:entity_projection_meta_entry— moved next toWholeRowProjectionMetasince it is shared by the connected-OPTIONAL-MATCH (_apply_optional_null_fill) and bounded-reentry whole-row paths.What stays
_execute_compiled_query_with_reentry(the dispatcher) stays ingfql_unified.py— it threads the recursive_execute_compiled_querycall inside the orchestration loop, so moving it would require introducing a callback indirection. Out of scope for a pure-move slice.gfql_unified._compiled_query_reentry_stateetc. via aliased re-imports, so existing tests that reach intographistry.compute.gfql_unifiedcontinue to work without modification.Pointers
graphistry/compute/gfql/cypher/reentry_plan.py(introduced in PR feat(cypher): ReentryPlan + multi-whole-row prefix WITH (#989 slices 4.1+4.3a) #1248).graphistry/compute/gfql/cypher/reentry/runtime.py(extracted in PR Refactor #1295: extract bounded reentry glue from lowering.py #1299; despite the name, this is compile-time).graphistry/compute/gfql/cypher/reentry/execution.py(this PR).Test plan
./bin/pytest.sh graphistry/tests/compute/test_gfql.py -k reentry— 6 passed, 3 skipped (cuDF only)./bin/pytest.sh graphistry/tests/compute/gfql/cypher/— 1202 passed, 89 skipped, 15 xfailed./bin/pytest.sh graphistry/tests/compute/test_gfql.py graphistry/tests/test_compute_chain.py graphistry/tests/compute/gfql/— 1963 passed, 123 skipped, 15 xfailed./bin/ruff.shon touched files — clean./bin/mypy.shon touched files — clean🤖 Generated with Claude Code