ISSUE DESCRIPTION [Improve] Align HugeCountStrategy with upstream TINKERPOP-2911…
- User
ISSUE DESCRIPTION
[Improve] Align HugeCountStrategy with upstream TINKERPOP-2911 ConnectiveStep fixes
Feature Description (功能描述)
Background
PR #2993 introduced
HugeCountStrategyto fix the negative-bound optimization issues behind #2930, #2931, and #2932.That fix was implemented by forking an older version of TinkerPop's
CountStrategyand adding HugeGraph-specific guards for negative bounds.However, the current local fork does not yet include the upstream follow-up fix for
ConnectiveStep/and()/or()handling fromTINKERPOP-2911.As a result, HugeGraph is now aligned for the negative-bound cases fixed in #2993, but it may still inherit older
CountStrategybehavior for some connective-filter patterns.Follow-up Scope
Port the upstream
TINKERPOP-2911changes forConnectiveStepintoHugeCountStrategy, and add regression coverage for connective traversal shapes.Suggested regression cases include:
__.and(__.out().count().is(0), __.in().count().is(0))__.or(__.out().count().is(0), __.in().count().is(0))__.where(__.or(__.out("none").out().count().is(0), __.has("none")))__.where(__.or(__.out("none").out().count().is(0), __.has("none").count().is(0)))
Expected Result
HugeCountStrategyshould behave consistently with the upstreamCountStrategyfixes aroundConnectiveStep- connective
and()/or()traversal shapes should no longer rely on older inherited behavior from the forked strategy - regression tests should cover the above traversal forms and protect against future drift
I’d be happy to follow up on this as a separate improvement issue and work on a later refinement PR.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Assistant
I’ll first locate
HugeCountStrategy, its tests, and the project’s TinkerPop dependency version. Then I’ll compare the fork against the upstreamTINKERPOP-2911implementation, patch only production code, and run the focused existing tests plus any applicable module checks. - Assistant
ripgrepis unavailable, so I’ll use recursivegrep. I’ll inspect the strategy source and nearby strategy tests, then identify the exact upstream commit/diff from the local dependency sources or online git history if available. - Assistant
The repository uses TinkerPop 3.5.1, so the local fork is necessary. I’ll read the complete strategy and discover test conventions for traversal optimization and count behavior.
- Assistant
I need the tail of
doStrategy; then I’ll fetch the corresponding modern upstreamCountStrategy.javaand diff it structurally against this fork. This should expose the preciseConnectiveStepchanges rather than guessing from traversal outcomes. - Assistant
The 3.6.2 source still matches the old behavior.
TINKERPOP-2911was a follow-up release fix, so I’ll compare several later tags and inspect the TinkerPop commit history for that issue identifier. - Assistant
The upstream 3.6.3 diff identifies the exact fix: a
ConnectiveStepchild must be wrapped locally innot()(using a clone), while an ordinary filter parent can replace the whole filter. The fork currently takes the older fallback path, which moves prior steps and can alterand()/or()child semantics. I’ll port the upstream helper and branch while retaining HugeGraph’s stronger negative-range guards. Per the environment constraint, I will not add or modify repository tests; I’ll use existing tests and temporary diagnostics only. - Assistant
python3is not installed, so no source change occurred. I also noticed pre-existing rootpom.xmlmodifications in the worktree; I will leave them untouched and ensure my own diff is limited to the strategy file. I’ll apply the two surgical replacements using the repository editor commands. - Assistant
The editor requires the target block to be in its current visible window. I’ll open around each location and apply the replacements there, then inspect the resulting diff against upstream.
- Assistant
The patch now matches the upstream algorithm: clone before clearing the child traversal, preserve parent labels, and distinguish connective children from whole-filter replacement. Next I’ll identify the smallest existing core test target and compile/test the module. I’ll also inspect whether Maven’s current working-tree setup can resolve dependencies without altering configuration.
- Assistant
hugegraph-corehas no local test sources; integration/unit tests live in a separate test module. I’ll first run a focused Maven compile for core with upstream dependencies built as needed. Because Java 25 can expose old Lombok/compiler incompatibilities, the pre-existing root POM changes may be environment scaffolding; I’ll report any such limitation distinctly from source correctness. - Assistant
Compilation caught a generic-inference difference caused by declaring the parent step as
Step<?, ?>; upstream intentionally uses a rawStepat this replacement point (the class already suppresses raw/unchecked warnings). I’ll align that declaration exactly with upstream and recompile. - Assistant
Core now compiles successfully. To verify the reported shapes without adding tests, I’ll retrieve upstream’s
TINKERPOP-2911regression expectations and create a temporary Java harness outside the repository. It will applyHugeCountStrategyto the suggested anonymous traversals and compare execution before/after on a small in-memory TinkerGraph if that dependency is available. - Assistant
Upstream’s tests confirm the exact expected rewrites for all four requested forms. Maven’s standalone dependency-classpath goal cannot resolve sibling reactor descriptors after compile, so I’ll use the already downloaded 3.5.1 jars and compiled classes directly. The temporary harness will assert structural equality (via traversal string forms) against upstream’s expected optimized traversals and will not touch repository files.
- Assistant
The temporary compile discovered an unrelated annotation processor from the broad local classpath and failed while loading JavaPoet. Since the harness needs no annotation processing, I’ll disable processors with
-proc:noneand rerun the same structural assertions. - Assistant
All four requested traversal forms now optimize exactly to upstream’s expected
not()shapes. I’ll do a final quality pass: inspect the entire diff, run Checkstyle for the core module (or its closest available validation), and confirm no generated/untracked files or accidental edits were introduced. I’ll preserve and separately identify the pre-existingpom.xmlchanges. - Assistant
The reactor-wide Checkstyle invocation failed before reaching core because generated PD gRPC sources already contain 51,875 violations; none reference the changed file. I’ll rerun Checkstyle with an include restricted to
HugeCountStrategy.java, which should skip unrelated generated files across prerequisite modules. I’ll also stage the pre-existing POM modification so the specialsubmitcommand (which submits only unstaged changes) does not include someone else’s environment edits.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.