Repository navigation
Commit 8f35274
fix(cypher): preserve partial WHERE and optional COUNT semantics (#5)
## Summary
- Preserve three-valued `WHERE` evaluation while only the seed alias is bound, so later aliases are not pruned early.
- Make `COUNT(variable)` ignore unbound optional matches.
- Adapt upstream Cypher work `458b0db1` through `6166934d`.
## Provenance and gates
- Agent Run: `luna-cbm-cypher-20260920-r1`; source revision `a43b2201`; worker commit `42ca613c`.
- Agent-Workflow reports a valid completion receipt. Independent review, evaluation, acceptance, and integration are pending.
- `git diff --check main...HEAD` passed. No tests were run for this PR request.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **Bug Fixes**
* WHERE filters now handle conditions involving relationship matches more accurately, including combinations of `AND`, `OR`, `NOT`, and `XOR`.
* `COUNT(variable)` now excludes rows where the variable is unbound, including after a `WITH` clause. `COUNT(*)` continues to count all rows.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Review follow-up
Addressed in 89e3ace.
1. **COUNT in WITH aggregation**: fixed. `binding_has_value` now sits above both accumulators, and `with_agg_accumulate` skips COUNT under the same condition as the RETURN path. New test `cypher_exec_with_optional_bound_terminal_count_ignores_unbound` checks that HandleOrder gets 0.
2. **Multi-alias function conditions in the early pass**: fixed. `eval_condition_partial` returns UNKNOWN when any function argument references an unbound variable, including when the first argument is a literal. New test `cypher_exec_where_coalesce_multi_alias` uses `coalesce(a.nosuch, b.name) = "LogError"`.
Both new tests fail without the cypher.c change (198 passed, 2 failed) and pass with it. `scripts/test.sh --suites cypher`: 200 passed. `make lint-ci lint-tidy-diff` passes.
Not changed: `COUNT(t.prop)` still counts a bound node whose property is missing. As noted in the review, this is not a regression.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 72faa8c commit 8f35274
3 files changed
Lines changed: 285 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2750 | 2750 | | |
2751 | 2751 | | |
2752 | 2752 | | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
2753 | 2850 | | |
2754 | 2851 | | |
2755 | 2852 | | |
| |||
3751 | 3848 | | |
3752 | 3849 | | |
3753 | 3850 | | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
3754 | 3855 | | |
3755 | 3856 | | |
3756 | 3857 | | |
| |||
3908 | 4009 | | |
3909 | 4010 | | |
3910 | 4011 | | |
| 4012 | + | |
| 4013 | + | |
| 4014 | + | |
| 4015 | + | |
| 4016 | + | |
| 4017 | + | |
| 4018 | + | |
| 4019 | + | |
| 4020 | + | |
| 4021 | + | |
| 4022 | + | |
| 4023 | + | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
3911 | 4031 | | |
3912 | 4032 | | |
3913 | 4033 | | |
3914 | 4034 | | |
3915 | 4035 | | |
3916 | 4036 | | |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
3917 | 4041 | | |
3918 | 4042 | | |
3919 | 4043 | | |
| |||
4347 | 4471 | | |
4348 | 4472 | | |
4349 | 4473 | | |
| 4474 | + | |
| 4475 | + | |
| 4476 | + | |
| 4477 | + | |
4350 | 4478 | | |
4351 | 4479 | | |
4352 | 4480 | | |
| |||
4885 | 5013 | | |
4886 | 5014 | | |
4887 | 5015 | | |
4888 | | - | |
| 5016 | + | |
4889 | 5017 | | |
4890 | 5018 | | |
4891 | 5019 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1673 | 1673 | | |
1674 | 1674 | | |
1675 | 1675 | | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
1676 | 1729 | | |
1677 | 1730 | | |
1678 | 1731 | | |
| |||
2078 | 2131 | | |
2079 | 2132 | | |
2080 | 2133 | | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
2084 | 2138 | | |
2085 | 2139 | | |
2086 | 2140 | | |
| |||
2828 | 2882 | | |
2829 | 2883 | | |
2830 | 2884 | | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
2831 | 2970 | | |
2832 | 2971 | | |
2833 | 2972 | | |
| |||
4368 | 4507 | | |
4369 | 4508 | | |
4370 | 4509 | | |
| 4510 | + | |
| 4511 | + | |
4371 | 4512 | | |
4372 | 4513 | | |
4373 | 4514 | | |
| |||
4418 | 4559 | | |
4419 | 4560 | | |
4420 | 4561 | | |
| 4562 | + | |
| 4563 | + | |
| 4564 | + | |
| 4565 | + | |
| 4566 | + | |
4421 | 4567 | | |
4422 | 4568 | | |
4423 | 4569 | | |
| |||
0 commit comments