-
Notifications
You must be signed in to change notification settings - Fork 142
chore(engine): test actors runner kv #3625
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
chore(engine): test actors runner kv #3625
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
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: |
PR Review: chore(engine): test actors runner kvOverviewThis PR adds comprehensive test coverage for the Key-Value (KV) store functionality in the Rivet Actors system. The tests are well-structured and cover CRUD operations, batch operations, drop functionality, and various edge cases. ✅ StrengthsTest Organization
Test Coverage
Code Quality
🔍 Issues & Suggestions1. Typo in Error Message (Minor)Location: .context("expected value to exist, got null")?;
2. TODO Comments Indicate Engine Behavior Issues (Documentation)Locations:
The tests contain TODO comments indicating that the engine returns empty arrays instead of arrays with null values for nonexistent keys: // TODO: Engine returns empty arrays for nonexistent keys instead of array with null
// Should return: keys: [key], values: [None]
// Currently returns: keys: [], values: []Recommendation:
3. Inconsistent Error Handling Patterns (Minor)Some actors use this pattern: let result = async { /* ... */ }.await;
let test_result = match result {
Result::Ok(r) => r,
Result::Err(e) => KvTestResult::Failure(e.to_string()),
};While others use simpler patterns. Consider standardizing on one approach. 4. Missing Anyhow Import Consistency (Style)Location: All new test files Per CLAUDE.md:
Current usage ( use anyhow::{Context, Result, anyhow, bail};5. Hard-Coded Magic Numbers (Maintainability)Examples:
Recommendation: Define constants at the top of the file: const BATCH_SIZE_SMALL: usize = 5;
const BATCH_SIZE_MEDIUM: usize = 10;
const KV_VALUE_SIZE_LIMIT: usize = 1024 * 1024; // 1MB6. Test Infrastructure Enhancements (Enhancement)The test infrastructure in
However, consider adding:
7. Potential Race Condition (Low Risk)Location: The let response: rp::KvResponseData = response_rx
.await
.map_err(|_| anyhow\!("KV get request response channel closed"))?;Recommendation: Add timeout wrapper: let response = tokio::time::timeout(
Duration::from_secs(30),
response_rx
)
.await
.map_err(|_| anyhow\!("KV request timed out after 30s"))??;8. Logging Message Capitalization (Style)Location: Multiple files Per CLAUDE.md:
Most messages follow this correctly, but verify consistency throughout. 9. Missing Test: Concurrent Operations (Coverage)The tests cover sequential operations well, but don't test concurrent KV operations from the same actor or multiple actors. Consider adding tests for:
10. Test Helpers Location (Organization)The 🔒 Security Considerations✅ No obvious security issues. The tests properly validate:
⚡ Performance Considerations✅ Tests are appropriately scoped:
Note: The 1MB test in 📊 Test ExecutionRecommendation: Per CLAUDE.md testing guidelines:
Example: cargo test actors_kv > /tmp/kv_tests.log 2>&1
grep -i "error\|panic\|fail" /tmp/kv_tests.logSummaryThis is a solid addition to the test suite with comprehensive coverage of KV functionality. The main areas for improvement are:
The test infrastructure additions (KV request channels, response handling) are well-designed and follow good practices. Overall, this PR significantly improves test coverage for the KV subsystem. Recommended ActionApprove with minor changes requested - The issues identified are mostly style/consistency improvements rather than functional problems. The test coverage and organization are excellent. |
8ce0a8c to
ff914ed
Compare
b9ccf81 to
4919fdc
Compare
4919fdc to
9a6ef9c
Compare
ff914ed to
11a1133
Compare
PR Review: KV Test Suite for Actor RunnerThis PR adds comprehensive test coverage for the key-value (KV) store functionality in the Rivet Actors test runner. Overall, this is excellent test coverage with well-structured, thorough tests. Below are my findings organized by category. Code Quality & Best Practices✅ Strengths
|
da6c8c3 to
10eacad
Compare
11a1133 to
98195c7
Compare
Merge activity
|

No description provided.