-
Notifications
You must be signed in to change notification settings - Fork 114
feat: add actor kv to runners #2638
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
feat: add actor kv to runners #2638
Conversation
c1393f3
to
33c172e
Compare
33c172e
to
fca7a80
Compare
3fb5f26
to
b48c234
Compare
fca7a80
to
9191ac2
Compare
b48c234
to
9544f05
Compare
933c939
to
9a19675
Compare
Claude finished @MasterPtato's task —— View job PR Review: feat: add actor kv to runnersI've completed a comprehensive code review focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
Architecture OverviewThis PR implements actor key-value storage by integrating FoundationDB-backed KV operations into the runner system. The key changes include:
Critical Issues Found🔴 Race Condition in Storage ValidationLocation: let total_size = self.get_subspace_size(subspace).await? as usize;
validate_entries(&entries, total_size)?; Issue: Size check happens before write operations, but concurrent writes can exceed storage limits between the check and actual write. This bypasses the 1GB storage quota enforcement. Impact: Actors can exceed their storage limit through concurrent operations. 🔴 Missing Actor Access ControlLocation: runner_protocol::ToManager::Kv(req) => {
let _ = self.actor_proxy_tx.send((
req.actor_id,
req.generation,
runner_protocol::ToActor::Kv(req),
));
} Issue: No validation that the requesting actor matches the KV operation's actor_id. Any actor could potentially access other actors' KV data if they know the actor ID. Impact: Cross-actor data access vulnerability if actor IDs are predictable or discoverable. 🟡 Performance: Blocking KV OperationsLocation: Impact: Delays in actor lifecycle management when KV operations are slow. Code Quality Issues1. Expensive Data CloningLocation: // TODO: Costly clone
let entries = entries.clone(); Issue: Multiple expensive clones in hot paths that could impact performance with large payloads. 2. Imprecise Size CalculationsLocation: pub fn len(&self) -> usize {
// Arbitrary 4 accounting for nesting overhead
self.0.iter().fold(0, |acc, x| acc + x.len()) + 4 * self.0.len()
} Issue: Size calculation includes "arbitrary" overhead that may not match actual storage usage, affecting quota validation accuracy. 3. Hard-coded LimitsLocation: const MAX_PUT_PAYLOAD_SIZE: usize = 976 * 1024; // Why 976 KiB specifically? Issue: Magic numbers should be documented or configurable per deployment. 4. TODO Comments Left Unresolved
Security Concerns1. Resource Exhaustion
2. Data Isolation
Performance Issues1. Synchronous ProcessingKV operations block the main actor observer loop instead of being processed asynchronously. 2. Multiple FDB TransactionsEach KV operation creates separate transactions instead of batching when possible. 3. Polling-based Size Estimation
Test Coverage GapCritical Finding: No unit tests found for the new KV functionality. The only testing appears to be the system test example in Missing test coverage for:
Database Migration AnalysisLocation: The migration looks clean with proper TTL settings and follows good ClickHouse practices. Positive Aspects
RecommendationsHigh Priority (Security & Correctness)
Medium Priority (Performance & Quality)
Low Priority (Code Quality)
SummaryThis is a well-architected implementation of actor KV storage with solid FoundationDB integration. The code quality is generally good with comprehensive validation and error handling. However, there are critical security and correctness issues that must be addressed:
Recommendation: Requires fixes for critical issues before merge, particularly the race condition and access control problems. Adding comprehensive tests is also essential. |
9a19675
to
846e5a4
Compare
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Claude finished @MasterPtato's task —— View job PR Review: feat: add actor kv to runnersI've completed a comprehensive code review focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
Architecture OverviewThis PR implements actor key-value storage by integrating FoundationDB-backed KV operations into the runner system. The key changes include:
Critical Issues Found🔴 Race Condition in Storage ValidationLocation: let total_size = self.get_subspace_size(subspace).await? as usize;
validate_entries(&entries, total_size)?; Issue: Size check happens before write operations, but concurrent writes can exceed storage limits between the check and actual write. This bypasses the 1GB storage quota enforcement. Impact: Actors can exceed their storage limit through concurrent operations. 🔴 Missing Actor Access ControlLocation: runner_protocol::ToManager::Kv(req) => {
let _ = self.actor_proxy_tx.send((
req.actor_id,
req.generation,
runner_protocol::ToActor::Kv(req),
));
} Issue: No validation that the requesting actor matches the KV operation's actor_id. Any actor could potentially access other actors' KV data if they know the actor ID. Impact: Cross-actor data access vulnerability if actor IDs are predictable or discoverable. 🟡 Performance: Blocking KV OperationsLocation: Impact: Delays in actor lifecycle management when KV operations are slow. Code Quality Issues1. Expensive Data CloningLocation: // TODO: Costly clone
let entries = entries.clone(); Issue: Multiple expensive clones in hot paths that could impact performance with large payloads. 2. Imprecise Size CalculationsLocation: pub fn len(&self) -> usize {
// Arbitrary 4 accounting for nesting overhead
self.0.iter().fold(0, |acc, x| acc + x.len()) + 4 * self.0.len()
} Issue: Size calculation includes "arbitrary" overhead that may not match actual storage usage, affecting quota validation accuracy. 3. Hard-coded LimitsLocation: const MAX_PUT_PAYLOAD_SIZE: usize = 976 * 1024; // Why 976 KiB specifically? Issue: Magic numbers should be documented or configurable per deployment. 4. TODO Comments Left Unresolved
Security Concerns1. Resource Exhaustion
2. Data Isolation
Performance Issues1. Synchronous ProcessingKV operations block the main actor observer loop instead of being processed asynchronously. 2. Multiple FDB TransactionsEach KV operation creates separate transactions instead of batching when possible. 3. Polling-based Size Estimation
Test Coverage GapCritical Finding: No unit tests found for the new KV functionality. The only testing appears to be the system test example in Missing test coverage for:
Database Migration AnalysisLocation: The migration looks clean with proper TTL settings and follows good ClickHouse practices. Positive Aspects
RecommendationsHigh Priority (Security & Correctness)
Medium Priority (Performance & Quality)
Low Priority (Code Quality)
SummaryThis is a well-architected implementation of actor KV storage with solid FoundationDB integration. The code quality is generally good with comprehensive validation and error handling. However, there are critical security and correctness issues that must be addressed:
Recommendation: Requires fixes for critical issues before merge, particularly the race condition and access control problems. Adding comprehensive tests is also essential. |
4801dea
to
618f8f4
Compare
846e5a4
to
7f5d1c3
Compare
Claude finished @MasterPtato's task —— View job PR Review: feat: add actor kv to runnersI've completed a comprehensive review of this PR focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
Architecture OverviewThis PR implements actor key-value storage by integrating FoundationDB-backed KV operations into the runner system. The key changes include:
Critical Issues Found🔴 Race Condition in Storage ValidationLocation: let total_size = self.get_subspace_size(subspace).await? as usize;
validate_entries(&entries, total_size)?; Issue: Size check happens before write operations, but concurrent writes can exceed storage limits between the check and actual write. This bypasses the 1GB storage quota enforcement. Impact: Actors can exceed their storage limit through concurrent operations. 🔴 Missing Actor Access ControlLocation: runner_protocol::ToManager::Kv(req) => {
let _ = self.actor_proxy_tx.send((
req.actor_id,
req.generation,
runner_protocol::ToActor::Kv(req),
));
} Issue: No validation that the requesting actor matches the KV operation's actor_id. Any actor could potentially access other actors' KV data if they know the actor ID. Impact: Cross-actor data access vulnerability if actor IDs are predictable or discoverable. 🟡 Performance: Blocking KV OperationsLocation: Impact: Delays in actor lifecycle management when KV operations are slow. Code Quality Issues1. Expensive Data CloningLocation: // TODO: Costly clone
let entries = entries.clone(); Issue: Multiple expensive clones in hot paths that could impact performance with large payloads. 2. Imprecise Size CalculationsLocation: pub fn len(&self) -> usize {
// Arbitrary 4 accounting for nesting overhead
self.0.iter().fold(0, |acc, x| acc + x.len()) + 4 * self.0.len()
} Issue: Size calculation includes "arbitrary" overhead that may not match actual storage usage, affecting quota validation accuracy. 3. Hard-coded LimitsLocation: const MAX_PUT_PAYLOAD_SIZE: usize = 976 * 1024; // Why 976 KiB specifically? Issue: Magic numbers should be documented or configurable per deployment. 4. TODO Comments Left Unresolved
Security Concerns1. Resource Exhaustion
2. Data Isolation
Performance Issues1. Synchronous ProcessingKV operations block the main actor observer loop instead of being processed asynchronously. 2. Multiple FDB TransactionsEach KV operation creates separate transactions instead of batching when possible. 3. Polling-based Size Estimation
Test Coverage GapCritical Finding: No unit tests found for the new KV functionality. The only testing appears to be the system test example in Missing test coverage for:
Database Migration AnalysisLocation: The migration looks clean with proper TTL settings and follows good ClickHouse practices. Positive Aspects
RecommendationsHigh Priority (Security & Correctness)
Medium Priority (Performance & Quality)
Low Priority (Code Quality)
SummaryThis is a well-architected implementation of actor KV storage with solid FoundationDB integration. The code quality is generally good with comprehensive validation and error handling. However, there are critical security and correctness issues that must be addressed:
Recommendation: Requires fixes for critical issues before merge, particularly the race condition and access control problems. Adding comprehensive tests is also essential. |
Claude finished @MasterPtato's task —— View job PR Review: feat: add actor kv to runnersI've completed a comprehensive code review focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
Architecture OverviewThis PR implements actor key-value storage by integrating FoundationDB-backed KV operations into the runner system. The key changes include:
Critical Issues Found🔴 Race Condition in Storage ValidationLocation: let total_size = self.get_subspace_size(subspace).await? as usize;
validate_entries(&entries, total_size)?; Issue: Size check happens before write operations, but concurrent writes can exceed storage limits between the check and actual write. This bypasses the 1GB storage quota enforcement. Impact: Actors can exceed their storage limit through concurrent operations. 🔴 Missing Actor Access ControlLocation: runner_protocol::ToManager::Kv(req) => {
let _ = self.actor_proxy_tx.send((
req.actor_id,
req.generation,
runner_protocol::ToActor::Kv(req),
));
} Issue: No validation that the requesting actor matches the KV operation's actor_id. Any actor could potentially access other actors' KV data if they know the actor ID. Impact: Cross-actor data access vulnerability if actor IDs are predictable or discoverable. 🟡 Performance: Blocking KV OperationsLocation: Impact: Delays in actor lifecycle management when KV operations are slow. Code Quality Issues1. Expensive Data CloningLocation: // TODO: Costly clone
let entries = entries.clone(); Issue: Multiple expensive clones in hot paths that could impact performance with large payloads. 2. Imprecise Size CalculationsLocation: pub fn len(&self) -> usize {
// Arbitrary 4 accounting for nesting overhead
self.0.iter().fold(0, |acc, x| acc + x.len()) + 4 * self.0.len()
} Issue: Size calculation includes "arbitrary" overhead that may not match actual storage usage, affecting quota validation accuracy. 3. Hard-coded LimitsLocation: const MAX_PUT_PAYLOAD_SIZE: usize = 976 * 1024; // Why 976 KiB specifically? Issue: Magic numbers should be documented or configurable per deployment. 4. TODO Comments Left Unresolved
Security Concerns1. Resource Exhaustion
2. Data Isolation
Performance Issues1. Synchronous ProcessingKV operations block the main actor observer loop instead of being processed asynchronously. 2. Multiple FDB TransactionsEach KV operation creates separate transactions instead of batching when possible. 3. Polling-based Size Estimation
Test Coverage GapCritical Finding: No unit tests found for the new KV functionality. The only testing appears to be the system test example in Missing test coverage for:
Database Migration AnalysisLocation: The migration looks clean with proper TTL settings and follows good ClickHouse practices. Positive Aspects
RecommendationsHigh Priority (Security & Correctness)
Medium Priority (Performance & Quality)
Low Priority (Code Quality)
SummaryThis is a well-architected implementation of actor KV storage with solid FoundationDB integration. The code quality is generally good with comprehensive validation and error handling. However, there are critical security and correctness issues that must be addressed:
Recommendation: Requires fixes for critical issues before merge, particularly the race condition and access control problems. Adding comprehensive tests is also essential. |
7f5d1c3
to
2b4037b
Compare
Claude finished @MasterPtato's task —— View job PR Review: feat: add actor kv to runnersI've completed a comprehensive code review focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
Architecture OverviewThis PR implements actor key-value storage by integrating FoundationDB-backed KV operations into the runner system. The key changes include:
Critical Issues Found🔴 Race Condition in Storage ValidationLocation: let total_size = self.get_subspace_size(subspace).await? as usize;
validate_entries(&entries, total_size)?; Issue: Size check happens before write operations, but concurrent writes can exceed storage limits between the check and actual write. This bypasses the 1GB storage quota enforcement. Impact: Actors can exceed their storage limit through concurrent operations. 🔴 Missing Actor Access ControlLocation: runner_protocol::ToManager::Kv(req) => {
let _ = self.actor_proxy_tx.send((
req.actor_id,
req.generation,
runner_protocol::ToActor::Kv(req),
));
} Issue: No validation that the requesting actor matches the KV operation's actor_id. Any actor could potentially access other actors' KV data if they know the actor ID. Impact: Cross-actor data access vulnerability if actor IDs are predictable or discoverable. 🟡 Performance: Blocking KV OperationsLocation: Impact: Delays in actor lifecycle management when KV operations are slow. Code Quality Issues1. Expensive Data CloningLocation: // TODO: Costly clone
let entries = entries.clone(); Issue: Multiple expensive clones in hot paths that could impact performance with large payloads. 2. Imprecise Size CalculationsLocation: pub fn len(&self) -> usize {
// Arbitrary 4 accounting for nesting overhead
self.0.iter().fold(0, |acc, x| acc + x.len()) + 4 * self.0.len()
} Issue: Size calculation includes "arbitrary" overhead that may not match actual storage usage, affecting quota validation accuracy. 3. Hard-coded LimitsLocation: const MAX_PUT_PAYLOAD_SIZE: usize = 976 * 1024; // Why 976 KiB specifically? Issue: Magic numbers should be documented or configurable per deployment. 4. TODO Comments Left Unresolved
Security Concerns1. Resource Exhaustion
2. Data Isolation
Performance Issues1. Synchronous ProcessingKV operations block the main actor observer loop instead of being processed asynchronously. 2. Multiple FDB TransactionsEach KV operation creates separate transactions instead of batching when possible. 3. Polling-based Size Estimation
Test Coverage GapCritical Finding: No unit tests found for the new KV functionality. The only testing appears to be the system test example in Missing test coverage for:
Database Migration AnalysisLocation: The migration looks clean with proper TTL settings and follows good ClickHouse practices. Positive Aspects
RecommendationsHigh Priority (Security & Correctness)
Medium Priority (Performance & Quality)
Low Priority (Code Quality)
SummaryThis is a well-architected implementation of actor KV storage with solid FoundationDB integration. The code quality is generally good with comprehensive validation and error handling. However, there are critical security and correctness issues that must be addressed:
Recommendation: Requires fixes for critical issues before merge, particularly the race condition and access control problems. Adding comprehensive tests is also essential. |
2b4037b
to
c73f767
Compare
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Claude finished @MasterPtato's task —— View job PR Review: feat: add actor kv to runnersI've conducted a comprehensive review of this PR focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
Architecture OverviewThis PR implements actor key-value storage by integrating FoundationDB-backed KV operations into the runner system. The key changes include:
Critical Issues Found🔴 Race Condition in Storage ValidationLocation: let total_size = self.get_subspace_size(subspace).await? as usize;
validate_entries(&entries, total_size)?; Issue: Size check happens before write operations, but concurrent writes can exceed storage limits between the check and actual write. This bypasses the 1GB storage quota enforcement. Impact: Actors can exceed their storage limit through concurrent operations. 🔴 Missing Actor Access ControlLocation: runner_protocol::ToManager::Kv(req) => {
let _ = self.actor_proxy_tx.send((
req.actor_id,
req.generation,
runner_protocol::ToActor::Kv(req),
));
} Issue: No validation that the requesting actor matches the KV operation's actor_id. Any actor could potentially access other actors' KV data if they know the actor ID. Impact: Cross-actor data access vulnerability if actor IDs are predictable or discoverable. 🟡 Performance: Blocking KV OperationsLocation: Impact: Delays in actor lifecycle management when KV operations are slow. Code Quality Issues1. Expensive Data CloningLocation: // TODO: Costly clone
let entries = entries.clone(); Issue: Multiple expensive clones in hot paths that could impact performance with large payloads. 2. Imprecise Size CalculationsLocation: pub fn len(&self) -> usize {
// Arbitrary 4 accounting for nesting overhead
self.0.iter().fold(0, |acc, x| acc + x.len()) + 4 * self.0.len()
} Issue: Size calculation includes "arbitrary" overhead that may not match actual storage usage, affecting quota validation accuracy. 3. Hard-coded LimitsLocation: const MAX_PUT_PAYLOAD_SIZE: usize = 976 * 1024; // Why 976 KiB specifically? Issue: Magic numbers should be documented or configurable per deployment. 4. TODO Comments Left Unresolved
Security Concerns1. Resource Exhaustion
2. Data Isolation
Performance Issues1. Synchronous ProcessingKV operations block the main actor observer loop instead of being processed asynchronously. 2. Multiple FDB TransactionsEach KV operation creates separate transactions instead of batching when possible. 3. Polling-based Size Estimation
Test Coverage GapCritical Finding: No unit tests found for the new KV functionality. The only testing appears to be the system test example in Missing test coverage for:
Database Migration AnalysisLocation: The migration looks clean with proper TTL settings and follows good ClickHouse practices. Positive Aspects
RecommendationsHigh Priority (Security & Correctness)
Medium Priority (Performance & Quality)
Low Priority (Code Quality)
SummaryThis is a well-architected implementation of actor KV storage with solid FoundationDB integration. The code quality is generally good with comprehensive validation and error handling. However, there are critical security and correctness issues that must be addressed:
Recommendation: Requires fixes for critical issues before merge, particularly the race condition and access control problems. Adding comprehensive tests is also essential. |
0bb001f
to
b2a0179
Compare
c73f767
to
ca77778
Compare
Claude encountered an error —— View job I'll analyze this and get back to you. |
Claude encountered an error —— View job I'll analyze this and get back to you. |
Changes