-
Notifications
You must be signed in to change notification settings - Fork 134
feat(gas): add batch listen #3478
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
base: 11-17-chore_gas_add_test_for_history_with_holes
Are you sure you want to change the base?
feat(gas): add batch listen #3478
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Pull Request Review: Batch Listen FeatureThis PR introduces batch signal listening functionality to the workflow engine, allowing workflows to receive multiple signals in a single operation. This is a significant enhancement that can improve throughput and reduce overhead when dealing with multiple signals. SummaryChanges: 1,215 additions, 732 deletions across 16 files Positive AspectsArchitecture & Design
Code Quality
Critical Issues1. Breaking Change: Macro-generated
|
25ece3d to
6ff29f6
Compare
5c9b75f to
0471792
Compare
PR Review: feat(gas): add batch listenSummaryThis PR introduces batch signal listening to the Gasoline workflow engine, allowing workflows to listen for and process multiple signals at once instead of one at a time. This is a significant architectural improvement that can reduce latency and improve throughput for workflows that process multiple signals. Code Quality & Best PracticesStrengths:
Issues & Suggestions:
Potential Bugs
Performance ConsiderationsImprovements:
Concerns:
Security Concerns
Test CoverageMissing:
Recommended Tests: // Test batch listen with multiple signals
#[tokio::test]
async fn test_listen_n_multiple_signals() {
// Send 5 signals, listen for 3, verify we get the oldest 3
}
// Test listen_n with limit larger than available signals
#[tokio::test]
async fn test_listen_n_limit_exceeds_available() {
// Send 2 signals, listen for 5, verify we get 2
}
// Test backward compatibility
#[tokio::test]
async fn test_old_signal_event_conversion() {
// Load workflow with old Signal events, verify they convert to Signals
}
// Test signal ordering across types
#[tokio::test]
async fn test_listen_n_mixed_signal_types() {
// Send signals of type A and B interleaved by time
// Verify they're received in chronological order
}Architecture & DesignPositive:
Questions:
Summary & RecommendationsThis is a well-structured PR that adds valuable batching capabilities to the workflow engine. However, it needs: Must Fix:
Should Fix:
Nice to Have:
The core implementation is solid, but the missing tests and potential edge cases around limits and ordering need to be addressed before merging. Generated by Claude Code |
Code ReviewSummaryThis PR adds batch signal listening capabilities to the Gasoline workflow engine, allowing workflows to receive multiple signals in a single operation instead of one at a time. This is a significant architectural improvement that should improve efficiency when dealing with high-volume signal processing. Architecture Changes✅ Well-designed changes:
Code Quality✅ Strengths:
Potential Issues1. EventType Mismatch in insert::signals_event (packages/gasoline/src/db/kv/keys/history.rs:1645)pub fn signals_event(/* ... */) -> Result<()> {
common(
subspace,
tx,
workflow_id,
location,
EventType::Signal, // ❌ Should be EventType::Signals
version,
create_ts,
)
}This appears to use Recommended fix: EventType::Signals, // Use the new batch signal type2. Missing Validation on Signal CountThe pub struct SignalsEvent {
pub names: Vec<String>,
pub bodies: Vec<Box<serde_json::value::RawValue>>,
}In the database deserialization code (packages/gasoline/src/db/kv/debug.rs:1545), there is a zip operation that could silently drop data if lengths do not match. Consider adding validation: pub struct SignalsEvent {
pub names: Vec<String>,
pub bodies: Vec<Box<serde_json::value::RawValue>>,
}
impl SignalsEvent {
pub fn new(names: Vec<String>, bodies: Vec<Box<serde_json::value::RawValue>>) -> Result<Self> {
ensure\!(names.len() == bodies.len(), "signals names and bodies must have same length");
ensure\!(\!names.is_empty(), "signals event must contain at least one signal");
Ok(Self { names, bodies })
}
}3. Removed CustomListener Without Clear Migration PathThe PR removes the
If any users were using
4. Potential Performance Issue: Sort After Parallel FetchIn .buffer_unordered(1024)
.try_collect::<Vec<_>>()
.await?;
// Sort by ts
signals.sort_by_key(|key| key.create_ts);
// Apply limit
Ok(signals.into_iter().take(limit).collect())The code fetches up to
Recommendation: Consider limiting the total fetch earlier or documenting the tradeoff. Performance Considerations✅ Good:
Security✅ No obvious security concerns
Test Coverage❌ Critical Gap: No Tests for Batch Listening The PR adds significant new functionality but I could not find any tests for:
Recommendation: Add tests covering:
Example test case: #[workflow_test]
async fn test_batch_signal_listen() {
// Publish 5 signals
// ctx.listen_n::<MySignal>(10) should return all 5
// Verify order matches timestamps
}Additional Observations
RecommendationsMust Fix:
Should Consider:
Nice to Have:
VerdictThis is a well-architected feature that makes logical sense for the workflow engine. However, it has a critical bug (wrong EventType) and lacks test coverage. Once these issues are addressed, this will be a solid improvement. Status: Needs Changes 🔴 The EventType bug could cause production issues with history replay, and the lack of tests makes it risky to merge. Please address the critical issues before merging. |
6ff29f6 to
dba469c
Compare
0471792 to
f508120
Compare
PR Review: Add Batch ListenOverviewThis PR introduces batch signal listening capabilities to the Gasoline workflow engine, allowing workflows to receive multiple signals in a single operation. Strengths1. Well-Structured API Changes
2. Comprehensive Database Implementation
3. Good Error Handling
4. Logging and Observability
Concerns1. Breaking API Change Recommendations:
2. Potential Index Corruption 🔴 Recommendations:
3. Empty Vec Semantics
Recommendation: Document when empty vecs are expected vs errors 4. Test Coverage Gaps 🟡
5. Performance 💭 6. Magic Number 🟡 7. Removed EventData::Empty Security & Safety✅ No security concerns ConclusionWell-implemented feature! Main concerns:
Recommendation: Add breaking change docs and batch tests before merging. Overall: Approve with comments 🎉 |
PR Review: feat(gas): add batch listenThis PR introduces batch signal listening to the Gasoline workflow engine, allowing workflows to receive multiple signals in a single operation. This is a significant performance optimization. Architecture ChangesCore API Changes:
Database Layer:
History Management:
Code Quality - Strengths
Areas for Improvement
Potential Bugs
PerformancePositive:
Concerns:
SecurityNo significant issues. Proper conflict ranges prevent races, signal ack prevents double-delivery. Test CoverageMissing: No test files in PR. Critical tests needed:
Best PracticesFollows CLAUDE.md conventions well (structured logging, lowercase messages, anyhow::Result, proper timestamps). Minor: Some functions exceed reasonable length (180 lines). Consider extracting helpers. Final RecommendationAPPROVE with minor recommendations Well-architected change with meaningful performance improvements. Code quality is high and follows conventions. Before merging:
Nice work! The parallel signal fetching is particularly well done. |
dba469c to
2a53bcf
Compare
More templates
@rivetkit/cloudflare-workers
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
633c857 to
bea62a4
Compare
22947c1 to
4d81dfd
Compare
Code Review: feat(gas): add batch listenThis PR adds batch signal listening capabilities to Gasoline (the workflow engine), allowing workflows to receive multiple signals in a single operation. Overall, this is a well-structured feature addition. Summary of Changes
Positives
Issues & Suggestions1. Potential Data Inconsistency in
|
PR Review: feat(gas): add batch listenSummaryThis PR adds batch signal listening capabilities to the gasoline workflow engine. The changes transition from single signal listening ( ✅ Positive Aspects
|
bea62a4 to
f9664d9
Compare
PR Review: Add Batch Listen (feat(gas): add batch listen)SummaryThis PR introduces batch signal listening to the Gasoline workflow engine, allowing workflows to receive multiple signals at once instead of processing them one at a time. This is a significant enhancement that can improve throughput for workflows handling multiple concurrent signals. Code Quality & Best Practices ✅Strengths:
Observations:
Potential Bugs & Issues
|
7034a04 to
7d477c8
Compare
f9664d9 to
a7d5ffd
Compare
PR Review: feat(gas): add batch listenSummaryThis PR introduces batch signal listening functionality to the Gasoline workflow engine, allowing workflows to receive multiple signals at once instead of one at a time. This is a significant architectural change that affects the core signal handling mechanisms. Code Quality & ArchitectureStrengths
Areas of Concern1. Breaking API Change in Listen trait (High Severity)The Listen::listen signature changed from async fn listen(ctx: &mut ListenCtx) -> WorkflowResult to async fn listen(ctx: &mut ListenCtx, limit: usize) -> WorkflowResult<Vec> Issue: This is a breaking change for any custom implementations of the Listen trait outside the codebase. The #[signal] macro was updated to generate the new signature, but any hand-written implementations will break. Recommendation: Consider deprecation path or document this as a breaking change in release notes. 2. Inconsistent Error Handling (Medium Severity)In workflow.rs:703-709, the .context() error message for an empty vec case could be more helpful for debugging. Recommendation: Use a more specific error or add debug assertions. 3. Removed CustomListener Trait (Medium Severity)The PR removes the CustomListener trait and custom_listener method without explanation. Files affected:
Recommendation: Document why this was removed. 4. History Storage Complexity (Medium Severity)The new Signals event type stores multiple signals with indexed storage. The deserialization logic in db/kv/debug.rs has checks that assume indexes arrive in order (0, 1, 2...). Recommendation: Add documentation about ordering guarantees. 5. Missing Test Coverage (High Severity)No new tests were added for the batch listen functionality. Missing test scenarios:
Recommendation: Add comprehensive tests in tests/workflows/signal_test.rs. Performance ConsiderationsPositive Impact
Potential Concerns
Migration & CompatibilityBreaking Changes
Questions
Recommendations SummaryMust Fix (High Priority)
Should Fix (Medium Priority)
ConclusionThis is a solid architectural improvement that enables important workflow batching capabilities. The implementation is generally well-structured, but needs test coverage, documentation of breaking changes, and clarification on database migration/compatibility. The code quality is good and follows the existing patterns in the codebase. Overall Assessment: Please address the test coverage and breaking change documentation before merging. |
Code Review: feat(gas): add batch listenOverviewThis PR adds batch listening capability to the Gasoline workflow engine, allowing workflows to receive multiple signals in a single operation. This is a significant enhancement that improves efficiency for workflows that need to process multiple signals. ✅ Strengths
|
a7d5ffd to
41442d3
Compare
7d477c8 to
21b69e8
Compare
21b69e8 to
cb268ef
Compare
41442d3 to
3f3140e
Compare
Pull Request Review: feat(gas): add batch listenOverviewThis PR adds batch listening functionality to the Gasoline workflow engine, allowing workflows to receive multiple signals in a single operation. Code QualityStrengths: Well-structured refactoring with consistent naming conventions Minor Issues:
Performance Considerations
Potential Bugs
Test CoverageMissing tests for listen_n, signal ordering, batch history replay, and edge cases Breaking Changes
SummaryMust Fix: Two critical bugs with index ordering and error handling This is a solid feature but needs critical bugs fixed before merge. Review generated by Claude Code |

No description provided.