Skip to content

fix(tickets): search works together with the activity filter CU-17tkuw6c8t6 - #3344

Merged
hryhorii-chuhuievets merged 5 commits into
mainfrom
fix/ticket-search-with-activity-filter
Dec 4, 2026
Merged

hryhorii-chuhuievets merged 5 commits into
mainfrom
fix/ticket-search-with-activity-filter

Conversation

@hryhorii-chuhuievets

@hryhorii-chuhuievets hryhorii-chuhuievets commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The ticket list query failed with an internal error whenever a text search was combined with the activity filter (ACTIVE / STALE / AWAITING_EXTERNAL). Each of them worked alone.

Cause

CustomTicketRepositoryImpl.buildTicketQuery added the activity filter and the text search as two separate keyless $or criteria on the same Query. Spring Data allows one criterion per key, the keyless one included, so the second addCriteria threw InvalidMongoDbApiUsageException.

Fix

Both clauses are built first and added once: joined under a single $and when both are present, added as before when only one is. Search-only and activity-only queries keep their previous shape. Cursor paging already appends to an existing $and, so later pages work as well.

No public signature changes; consumers only need the lib version bump.

Tests

  • CustomTicketRepositoryFilterTest#reproducesBug_CU17tkuw6c8t6_...: red before the fix with the exception above.
  • CustomTicketRepositoryActivitySearchTest (15 cases): every activity value with search, per-status thresholds, numeric search, other filters with id restriction and owner scope, blank search, empty activity, cursor paging.
  • Full mvn test on the repo: 13,642 run, 0 failures, 0 errors, 739 skipped (gated integration tests).

Task: https://app.clickup.com/t/9013925967/17tkuw6c8t6

Change-Set: fix-ticket-search-with-activity-filter

🤖 Generated with Claude Code

https://claude.ai/code/session_018CWVXm1tMGFBMj9pkncv55

Change set flamingo-stack/openframe-oss-lib#3344: these pull requests are one change, reviewed together.

Linked work

  • …and 1 linked item not shown here

Linked by the Depends-On / Change-Set lines in these descriptions; this block is maintained by the hub.

hryhorii-chuhuievets and others added 5 commits December 4, 2026 11:38
…w6c8t6 (failing)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CWVXm1tMGFBMj9pkncv55
… (failing)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CWVXm1tMGFBMj9pkncv55
…w6c8t6

The activity filter and the text search each added a keyless $or criterion
to the same Query, which Spring Data rejects. When both are present they are
now joined under one $and; a single clause keeps its top-level $or shape.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CWVXm1tMGFBMj9pkncv55
…U-17tkuw6c8t6

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CWVXm1tMGFBMj9pkncv55
…th activity CU-17tkuw6c8t6

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CWVXm1tMGFBMj9pkncv55
@hryhorii-chuhuievets hryhorii-chuhuievets added the build Run the PR builds and publish snapshots (Java, npm preview); stays on until removed label Dec 4, 2026
@flamingo

flamingo Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

🦩 flamingo Code Review

✅ Tests and checks passed on this commit (3 lanes).

1 finding: 🔴 0 action required · 🟠 0 recommended · 🔵 1 informational

Advisory: findings do not block the merge.

Rules cited: OFJAVA-002

Files Lines Languages Tests Checks 🔴 Action required 🟠 Recommended 🔵 Informational
3 +311 / -9 Java (1 Maven lane) ✅ 3437 / 3437 green (437 skipped) ✅ 1 / 1 passed 0 0 1

🔵 Informational (1)

# Where Finding Flagged by
1 CustomTicketRepositoryImpl.java:270 activityCriteria return nests three method calls as arguments (Minor) OFJAVA-002

✅ What this change does well

  • CustomTicketRepositoryImpl.buildTicketQuery now collects the keyless activity and search criteria and combines them under a single $and, fixing the silent clobbering of one $or by the other.
  • CustomTicketRepositoryActivitySearchTest covers each branch of the new combination logic (activity only, search only, both, neither, and cursor interaction) by asserting the produced query Document shape.
  • CustomTicketRepositoryFilterTest adds a focused regression test (reproducesBug_CU17tkuw6c8t6_...) proving both the search text and lastActivityAt survive in the same query.
  • CustomTicketRepositoryImpl.java keeps the search-only and activity-only query shapes unchanged and only wraps the two clauses in $and when both are present.
  • CustomTicketRepositoryActivitySearchTest.java covers each activity value with search, the id-restriction and owner-scope paths and cursor paging.

Inline comments: 1 new

1 possible problem checked and ruled out
  • openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/CustomTicketRepositoryImpl.java:148 Ternary on keyless.size() in applyKeylessCriteria is not a named predicate: Lines 148-150 are a value-producing ternary assignment, not a compound boolean condition; OFJAVA-007 targets conditions extracted into named private predicate methods, and extracting keyless.size() == 1 would be a pedantic nit.

🧪 Tests and mutation

Tests per lane

Language Project Command Status Counts Time
Java (Maven) . mvn -B test -pl openframe-data-mongo-sync -am ✅ passed core 271 · data-mongo-common 115 · data-mongo-sync 3376 (405 skipped) · event-publishing 103 (32 skipped) · exception 9 · 0 failures 14.2 s

Checks

Check Kind Language Project Status Time
OpenGrep security Java (OpenGrep) . ✅ passed 15.2 s

All 6 mutants on the added lines of CustomTicketRepositoryImpl were killed; the 14 surviving and 22 uncovered mutants of the class are on lines this change did not touch.

405 skipped tests in openframe-data-mongo-sync are the gated integration tests, which do not run in a plain mvn test.

Mutation testing

This build has no PIT plugin, so each module is mutated from the command line with pit-adhoc.sh, changing nothing in the repository.

Module Classes Whole classes New lines only Time
openframe-data-mongo-sync CustomTicketRepositoryImpl 142 mutants, 106 killed (75%), 14 survived, 22 no coverage, test strength 88%, line coverage 79% 6 mutants: 6 killed 31 s

New code, its covering tests and the result

New code Covering tests Result
buildTicketQuery in CustomTicketRepositoryImpl, line 140 CustomTicketRepositoryActivitySearchTest (2), CustomTicketRepositoryFilterTest (1), 29 more killed
applyKeylessCriteria in CustomTicketRepositoryImpl, lines 145-148 CustomTicketRepositoryActivitySearchTest (1), CustomTicketRepositoryCursorTest (1), CustomTicketRepositoryFilterTest (1), 29 more killed
searchCriteria in CustomTicketRepositoryImpl, line 200 CustomTicketRepositoryActivitySearchTest (2), CustomTicketRepositoryFilterTest (1), 9 more killed
activityCriteria in CustomTicketRepositoryImpl, lines 253-270 CustomTicketRepositoryFilterTest (3), 29 more killed
The covering tests by name (4 methods)
  • CustomTicketRepositoryImpl.buildTicketQuery: CustomTicketRepositoryActivitySearchTest.buildTicketQuery_searchWithoutFilter_searchAloneOwnsTheTopLevelOr, CustomTicketRepositoryFilterTest.buildTicketQuery_ownerScopeAndSearch_bothClausesKept, CustomTicketRepositoryActivitySearchTest.buildTicketQuery_searchWithEmptyActivity_searchAloneOwnsTheTopLevelOr, and 29 more
  • CustomTicketRepositoryImpl.applyKeylessCriteria: CustomTicketRepositoryActivitySearchTest.buildTicketQuery_searchWithoutFilter_searchAloneOwnsTheTopLevelOr, CustomTicketRepositoryCursorTest.leavesFirstPageQueryUntouched, CustomTicketRepositoryFilterTest.buildTicketQuery_ownerScopeAndSearch_bothClausesKept, and 29 more
  • CustomTicketRepositoryImpl.searchCriteria: CustomTicketRepositoryActivitySearchTest.buildTicketQuery_searchWithoutFilter_searchAloneOwnsTheTopLevelOr, CustomTicketRepositoryFilterTest.buildTicketQuery_ownerScopeAndSearch_bothClausesKept, CustomTicketRepositoryActivitySearchTest.buildTicketQuery_searchWithEmptyActivity_searchAloneOwnsTheTopLevelOr, and 9 more
  • CustomTicketRepositoryImpl.activityCriteria: CustomTicketRepositoryFilterTest.buildTicketQuery_noOwnerScope_noOwnerClauses, CustomTicketRepositoryFilterTest.buildTicketQuery_ownerScopeWithoutOrganization_machineOnly, CustomTicketRepositoryFilterTest.buildTicketQuery_ownerScopeWithCutOffAndNoFilter_createdAtStartsAtTheCutOff, and 29 more
🤖 Prompt for AI agents: fix every finding
Address these code-review findings on pull request #3344 of flamingo-stack/openframe-oss-lib, most important first.
For each one, make the minimal change that resolves it and do not refactor unrelated code.
If you can show a finding is wrong, skip it and say why.

1. [Informational] openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/CustomTicketRepositoryImpl.java:270 activityCriteria return nests three method calls as arguments
   OFJAVA-002 forbids calling a method inside another call's argument list; this changed line nests `clauses.toArray(new Criteria[0])` inside `orOperator(...)` and the whole `new Criteria().orOperator(...)` inside `Optional.of(...)`. The rule is CI-enforced by PMD NoMethodCallAsArgument and the only exemptions are logger args, annotation values and enum constants. Extract the array and the criteria into named locals first.

Next: commit a suggestion, or hand a comment's prompt to your coding agent. React 👍 on a finding that helped and 👎 on one that is wrong: the reviewer learns from both.

Review again. New commits are not reviewed until you ask:

  • Review the new commits: only what was pushed since this review
  • Review the whole diff again: everything, including what was already reviewed

Or comment @flamingo-review (new commits) or @flamingo-review full (everything). Add the flamingo-review-always label to review every push.

Updated 2026-12-04 10:35 UTC · reviewed from Hryhorii Chuhuievets's machine

@flamingo

flamingo Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

🦩 flamingo Code Review / security

✅ No findings on the current head.

Advisory: findings do not block the merge.

Files Lines 🔴 Action required 🟠 Recommended 🔵 Informational
3 +311 / -9 0 0 0

Review again. New commits are not reviewed until you ask:

  • Security-check the new commits: only what was pushed since this security review
  • Security-check the whole diff again: everything, including what was already checked

Or comment @flamingo-review security (new commits) or @flamingo-review security full (everything). Add the flamingo-security-review-always label to security-review every push.

Updated 2026-12-04 12:30 UTC · reviewed from Hryhorii Chuhuievets's machine

@hryhorii-chuhuievets
hryhorii-chuhuievets added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit 63820ad Dec 4, 2026
39 checks passed
@hryhorii-chuhuievets
hryhorii-chuhuievets deleted the fix/ticket-search-with-activity-filter branch December 4, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Run the PR builds and publish snapshots (Java, npm preview); stays on until removed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants