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.
Interface
No new interfaces are introduced.
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 call ) 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
Classpath built successfully. Let's use it to compile and run a test harness.
Assistant
Compiled fine. Now let's write a test harness using TinkerGraph.
Assistant
Now let's recompile and re-test.
Assistant
Good, debug line added. Let's recompile and run.
Assistant
Good, confirms production removes CountStrategy. Let's redo the test harness properly with removeStrategies(CountStrategy.class).
Assistant
Now recompile and test.
Assistant
Now the result matches expected (2). Let's run all previous regression tests plus additional edge cases (or(), where(or()), repeat/until with ConnectiveStep parent edge cases, and non-Connective FilterStep cases to ensure no regression).
Assistant
Good, no debug lines left. Let's diff against original to review the final patch before applying to repo.
Assistant
This is the fix. Now let's apply it to the actual repository file.
Assistant
Good, memory backend is default. Let's try running the existing CountStrategyCoreTest via maven with offline mode, from hugegraph-core module referencing hugegraph-test's test suite runner.
Assistant
Now let's try running just the core-test execution offline, hopefully limited to CountStrategyCoreTest via
-Dtest.Assistant
Build succeeded (no errors). Now let's run just the CountStrategyCoreTest directly using JUnit, bypassing the Suite runner, to keep it fast.
Assistant
Confirmed: my fix is compiled into target/classes. Now let's run the CountStrategyCoreTest directly with JUnit.
Assistant
All 19 existing tests pass with the fix applied. Now let's add regression tests for the new ConnectiveStep scenarios described in the issue.
Assistant
Now let's replace lines 192-235 in the actual file.
Assistant
Looks correct. Let's replace the file and compile.
Assistant
Now let's recompile.
Assistant
Compiles cleanly. Let's re-run our quick checks and the existing test suite.
Assistant
All 19 existing tests still pass with the correct classpath. Now let's test more edge cases to ensure the new ConnectiveStep NotStep-wrapping logic is robust (e.g., mixed filter chains, has() steps, or() with multiple predicates in ConnectiveP, nested and/or).
Assistant
Confirmed - without the fix, the test fails (t2 mismatch: 1 vs 5). Let's restore the fix.
Assistant
Now let's add the regression tests to
CountStrategyCoreTest.javamatching the issue's suggested scenarios (adapted to the actual schema, since undefined labels throw exceptions in HugeGraph).Assistant
Now let's compile and run this test file.
Assistant
All 24 tests pass (19 original + 5 new). Let's also confirm these new tests actually fail without the fix (sanity check the tests are meaningful).
Assistant
Confirmed - 2 of the 5 new tests fail without the fix, proving the tests are meaningful regressions. Let's restore the fix and do a final full verification.
Assistant
All 24 tests pass with the fix restored. Let's view the final diff of the main fix file for a clean review.
Assistant
This looks clean. Let's also update the class-level javadoc comment to reflect the TINKERPOP-2911 alignment, for documentation clarity.
Assistant
Good. Let's recompile and rerun the full test suite once more to make sure everything still works.
Assistant
All 24 tests still pass. Now let's run the broader CoreTestSuite (or at least a wider set of related tests) to check for wider regressions, and also verify other test suites referencing count-related traversal features (e.g., in hugegraph-api or elsewhere) still compile fine.
Assistant
Confirmed these 2 failures are pre-existing and unrelated to my change. Let's restore my fix.
Assistant
Good, both pre-existing failures are unrelated to my fix (confirmed identical before/after). Let's run EdgeCoreTest and IndexLabelCoreTest as well for additional confidence, since they may exercise count()-based traversals too.
Assistant
Confirmed pre-existing and unrelated. Let's restore my fix.
Assistant
Let's do a final recompile to make sure everything is in order after all the stash operations.
Assistant
All good. Let's do a final review of the complete diff before submission.
Assistant
Good. Let's recompile once more and run the test to be safe after this cosmetic edit.
Assistant
All tests pass. Let's do a final check of the git status and clean up temp files.
Assistant
Let me review the checklist before submitting:
Checklist review:
-
If an error was reported in the issue description, I have successfully reproduced it. ✅ The issue didn't describe a specific runtime error but asked to align
HugeCountStrategywith upstream TINKERPOP-2911 ConnectiveStep fixes. I reproduced two concrete semantic bugs in the current ConnectiveStep handling:and(count().is(gt(0)), out().count().is(0))incorrectly collapsed the entireAndStep(dropping the sibling branch), returning 3 instead of the correct 2.
-
Assistant
The fix is complete and well-tested. Let's submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.