Skip to content

feat(core): Support SimpleWaitingForChain #1845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Aug 6, 2025
Merged

feat(core): Support SimpleWaitingForChain #1845

merged 57 commits into from
Aug 6, 2025

Conversation

Ahoo-Wang
Copy link
Owner

No description provided.

Ahoo-Wang added 30 commits July 30, 2025 20:45
- Add WaitingForChain class to handle multiple waiting nodes in a chain
- Implement WaitingNode interface with different node types: Sent, Processed, Snapshot, and Projected
- Extend JsonSerializer with new toList function for deserializing lists
- Update String and JsonNode classes with new toList extension functions

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
…tion

- Enhance extractWaitStrategy to support both stage and chain strategies
- Remove unused toList extension functions
- Refactor WaitingForChain to use a Materialized class with JSON serialization
- Update WaitingNode to use JSON subtypes for polymorphic deserialization
- Add new WaitingNode types for different command stages

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Add swagger-annotations-jakarta dependency for API documentation
- Annotate WaitingNode interface with @Schema for stage property

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
# Conflicts:
#	wow-core/src/main/kotlin/me/ahoo/wow/command/wait/stage/WaitingForStage.kt
- Remove unnecessary interfaces and subclasses
- Consolidate waiting node types into a single data class
- Implement shouldNotify logic in WaitingNode
- Update WaitingForChain to use the new WaitingNode structure
- Remove unused imports and annotations

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
…lized

- Implement the shouldPropagate method in the WaitingForChain.Materialized class
- Add TODO placeholder for future implementation
- This change prepares for integrating the waiting chain with the command chain

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Introduce JsonTypeInfo and JsonSubTypes for WaitingNode- Add new interfaces and classes for WaitingNode polymorphism
- Update related files to support new WaitingNode structure

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
# Conflicts:
#	wow-api/src/main/kotlin/me/ahoo/wow/api/messaging/function/FunctionInfo.kt
#	wow-api/src/main/kotlin/me/ahoo/wow/api/messaging/function/FunctionInfoCapable.kt
- Replace FunctionInfoData with NamedFunctionInfoData in WaitingNode
- Improve shouldNotify function logic in WaitingNode
- Update WaitingSagaNode and WaitingTailNode to use NamedFunctionInfoData
- Remove unnecessary TODO implementations

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Add StringServerSentEventType object for better type safety
- Update sendSse function to use StringServerSentEventType for improved type reference

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Implement CompletedCapable interface in WaitingChain
- Add completed property to WaitingSagaNode and WaitingTailNode
- Annotate completed property with @JsonIgnore to prevent serialization issues

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Remove WaitingForChain.Materialized class
- Extend WaitingChain with WaitStrategy.Materialized
- Update propagate and shouldPropagate methods in WaitingChain
- Adjust WaitingSagaNode to use WaitingChain instead of Materialized
- Update WaitingForChain to use WaitingChain directly

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Add `next` property to WaitingChain interface with JsonInclude annotation
- Override `next` property in WaitingSagaNode class
- Add `next` property with value null in anonymous class extending WaitingChain
- Update JsonInclude annotations for better JSON serialization control

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Rename WaitingChain to SimpleWaitingChain
- Remove JsonTypeInfo and JsonSubTypes annotations
- Eliminate WaitingSagaNode and WaitingTailNode classes
- Update related imports and usages

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
…serialization

- Introduce WaitingChain interface with subtypes SimpleWaitingChain and WaitingTailNode
- Implement polymorphic behavior for different waiting chain types
- Add JSON serialization support for WaitingChain and its subtypes
- Refactor SimpleWaitingForChain to use the new WaitingChain structure

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Remove unnecessary empty lines
- Adjust indentation for better readability
- Simplify code structure in WaitingChain interface

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
…erface changes

- Add propagate function to SimpleWaitingChain class
- Update SimpleWaitingForChain class with new functionality
- Remove propagate function from WaitingChain interface
- Add CommandId interface implementation to SimpleWaitingChain

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
# Conflicts:
#	wow-core/src/main/kotlin/me/ahoo/wow/command/wait/CommandWaitNotifier.kt
- Remove redundant CommandId interface
- Rename commandId to waitCommandId for clarity
- Update propagate method to include waitCommandId
- Enhance SimpleWaitingForChain with next() implementation
- Update WaitingChain to handle waitCommandId propagation

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Simplify SimpleWaitingChain and WaitingTailNode classes
- Remove redundant code and interface implementations- Introduce FunctionMaterialized interface in WaitStrategy
- Update SimpleWaitingForChain to use new FunctionMaterialized interface
- Remove WaitingChain interface and related implementations

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Remove shouldPropagate and propagate overloaded methods from WaitStrategyPropagator
- Add these methods to a new Materialized interface
- Update WaitStrategy to use the new Materialized interface
- Simplify the overall structure and improve code organization

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
# Conflicts:
#	wow-core/src/main/kotlin/me/ahoo/wow/command/wait/WaitStrategy.kt
# Conflicts:
#	wow-core/src/main/kotlin/me/ahoo/wow/command/wait/WaitStrategy.kt
- Add wait function extraction and propagation methods to Header
- Implement SimpleWaitingChain and WaitingChainTail classes
- Update SimpleWaitingForChain to use new waiting chain structure
- Modify WaitingFors to check for empty waiting function
- Refactor WaitingForStage to use new wait function extraction

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Improve handling of main and tail waiting stages
- Use ConcurrentHashMap for efficient tail waiting management
- Add logic to ensure all tail waiting stages are completed before marking as complete
- Optimize next() method to handle both main and tail waiting signals

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Add support for simple waiting chain in addition to waiting for stage
- Implement new functions for extracting and propagating wait chain and stage
- Update ExtractedWaitStrategy to handle both simple chain and stage
- Refactor WaitingForStage to use new propagateWaitingStage function

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Remove duplicate COMMAND_WAIT_STAGE constant
- Move COMMAND_WAIT_STAGE constant to wow-core module
- Delete unused import of COMMAND_WAIT_PREFIX

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Rename WaitingForStageTest to WaitingForStageTest.kt
- Create new test files for SimpleWaitingChain and WaitingChainTail
- Update related imports and class names

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Implement comprehensive unit tests for SimpleWaitingForChain class
- Cover various scenarios including constructor, previous signal check, waiting, and next signal processing
- Test different signal stages and error handling

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Add new wait tail headers for command component
- Implement corresponding OpenAPI parameters for wait tail
- Update command common header parameters to include wait tail info

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Extract WaitStrategy from ServerRequest
- Support WaitingChainTail for SAGA handling
- Refactor getCommandStage to getWaitStage
- Update related test cases

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Remove unnecessary underscore in COMMAND_WAIT_TAIL_PREFIX
- Add synchronization block to ensure thread-safe access to tailWaiting map

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Simplify AggregateRequest waiting chain creation
- Enhance NamedFunctionInfo with isEmpty function and EMPTY companion object
- Add toWaitingChainTail extension function to CommandStage
- Improve SimpleWaitingForChain initialization and tail waiting handling
- Add tests for SimpleWaitingForChain with tail signals

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Add shouldWaitFunction flag to CommandStage
- Update waiting logic to use the new flag
- Refactor WaitingChainTail into a separate class
- Improve code readability and maintainability

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
…ForChain

- Add tests for WaitingChainTail.toWaitingChainTail() method
- Implement tests for SimpleWaitingForChain.chain() method
- Add test for tailWaitingCompleted when mainWaitingSignal is null
- Update tests for WaitingChainTail extraction from header

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Replace mutableMapOf with ConcurrentHashMap for tailWaiting
- Use computeIfAbsent to ensure thread-safe computation and insertion
- Remove unnecessary synchronization and duplicate code

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
- Add tests for various wait-related headers and their corresponding methods
- Test tenant ID and aggregate ID retrieval from headers and path variables
- Implement tests for wait timeout and local first functionality
- Add tests for SSE (Server-Sent Events) detection
- Implement tests for wait strategy extraction, including WaitingForStage and SimpleWaitingForChain

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
@Ahoo-Wang Ahoo-Wang added the enhancement New feature or request label Aug 6, 2025
- Remove unused import statement for CommandStage
- Apply code formatting to enhance readability

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
Copy link
Contributor

github-actions bot commented Aug 6, 2025

Test Results

1 512 tests  +37   1 495 ✅ +37   11m 45s ⏱️ -10s
  372 suites + 3      17 💤 ± 0 
  372 files   + 3       0 ❌ ± 0 

Results for commit 4f5bb48. ± Comparison against base commit abbd10b.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 95.32164% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.12%. Comparing base (abbd10b) to head (4f5bb48).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../ahoo/wow/command/wait/chain/SimpleWaitingChain.kt 80.00% 4 Missing ⚠️
...ahoo/wow/webflux/route/command/AggregateRequest.kt 94.28% 0 Missing and 2 partials ⚠️
.../me/ahoo/wow/command/wait/ExtractedWaitStrategy.kt 75.00% 0 Missing and 1 partial ⚠️
...me/ahoo/wow/command/wait/chain/WaitingChainTail.kt 96.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1845      +/-   ##
============================================
+ Coverage     91.04%   91.12%   +0.08%     
- Complexity     3723     3748      +25     
============================================
  Files           704      707       +3     
  Lines         12876    13026     +150     
  Branches        819      836      +17     
============================================
+ Hits          11723    11870     +147     
- Misses          760      763       +3     
  Partials        393      393              
Flag Coverage Δ
unittests 91.12% <95.32%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Ahoo-Wang Ahoo-Wang merged commit 4236f7c into main Aug 6, 2025
33 checks passed
@Ahoo-Wang Ahoo-Wang deleted the WaitingForChain branch August 6, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant