Repository navigation
AIML-303: Extract SessionFilteringHelper from AssessService [STACKED] - #42
Closed
ChrisEdwards wants to merge 1 commit into
Closed
ChrisEdwards wants to merge 1 commit into
ChrisEdwards wants to merge 1 commit into
Conversation
Reduces AssessService complexity by extracting ~237 lines of session filtering logic into a dedicated helper class: - Move SessionFilteringResult record, fetchTracesWithEarlyTermination(), fetchAllTracesForSessionFiltering(), and buildSessionFilterPredicate() methods to new SessionFilteringHelper class - Add SessionFilteringHelperTest with comprehensive unit tests - Update AssessService to use helper via @PostConstruct initialization - Update AssessServiceTest to call initHelpers() after field injection Part of AIML-303 tool architecture standardization (PR 3).
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.
This is a stacked PR based on #41. Please review and merge #41 first, then rebase this PR onto
mainbefore merging.Dependency Context:
This PR builds on PR #41 (Response Classes). It continues the AIML-303 tool architecture standardization work by extracting session filtering logic into a dedicated helper class.
Why
AssessService is the largest service class at ~1177 lines. Session filtering logic (early termination optimization, predicate building, result handling) accounts for ~237 lines and represents a distinct concern that can be cleanly extracted.
Extraction benefits:
What
Created
SessionFilteringHelperclass with:SessionFilteringResultrecord for fetch resultsfetchTracesWithEarlyTermination()- optimized multi-page fetchingfetchAllTracesForSessionFiltering()- convenience wrapperbuildSessionFilterPredicate()- predicate construction for filteringUpdated
AssessService:@PostConstruct initHelpers()for helper initializationHow
Pure extraction refactoring - no behavior changes:
SessionFilteringResultrecord (made public for callers)fetchTracesWithEarlyTermination()(handles pagination, early termination, error recovery)fetchAllTracesForSessionFiltering()(delegates to above)buildSessionFilterPredicate()(combines agentSessionId + metadata filters)Helper instantiated via
@PostConstructafter@Valueinjection providesmaxTracesForSessionFiltering.Step-by-step walkthrough
SessionFilteringHelper.java (new ~260 lines)
SessionFilteringResultrecord with factory methodsfetchTracesWithEarlyTermination()- the main pagination/filtering logicfetchAllTracesForSessionFiltering()- simple wrapperbuildSessionFilterPredicate()- predicate constructionAssessService.java (modified, -237 lines net)
@PostConstructfor helper initializationsessionFilteringHelper.*SessionFilteringHelperTest.java (new ~385 lines)
fetchTracesWithEarlyTerminationedge casesbuildSessionFilterPredicatefilter combinationsSessionFilteringResultfactory methodsAssessServiceTest.java (modified)
assessService.initHelpers()call after field injectionTesting
17 new tests in SessionFilteringHelperTest covering:
387 total tests pass (all existing + new)
No behavior changes verified by unchanged AssessServiceTest results
Files Changed
src/main/java/.../helpers/SessionFilteringHelper.javasrc/main/java/.../AssessService.javasrc/test/java/.../helpers/SessionFilteringHelperTest.javasrc/test/java/.../AssessServiceTest.java