chore(v1.1.9): clippy clean — workspace -D warnings
Surfaced + fixed during the F3 attestation:
- executor-core/sdk/queue.rs: drop redundant .map(|()| ()) call sites;
enqueue_blocking discards QueueMessageId via .map(|_id| ()) (intentional)
- executor-core/sdk/retry.rs: hoist use std::collections::hash_map::DefaultHasher
+ use std::hash::Hasher to the top of the file (clippy::items_after_statements);
replace `as i64` casts with i64::try_from + clear comment about jitter
bound (clippy::cast_possible_wrap)
- executor-core/sdk/invoke.rs: move _LIMITS_IS_COPY const before #[cfg(test)]
mod tests (clippy::items_after_test_module)
- manager-core/dispatcher.rs: dispatch_one_queue gains #[allow(too_many_lines)]
(it's the queue tick's whole logic — split makes it less readable than
the lint); .map(...).unwrap_or(default) → .map_or(default, ...)
- picloud/lib.rs: Limits { trigger_depth_max, ..Limits::default() } via
struct-update instead of let-mut-assign (clippy::field_reassign_with_default)
- tests: r#"..."# → r"..." where there are no `"` inside (clippy::needless_raw_string_hashes);
combine InvokeTarget::Name | InvokeTarget::Path arms with identical bodies
in sdk_invoke.rs (clippy::match_same_arms)
cargo fmt --all -- --check 2>&1 | tail -3: no output (exit 0)
cargo clippy --workspace --all-targets --all-features -- -D warnings:
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.41s
Workspace lib smoke: 432 passing (306 manager-core + 74 executor-core + 34 shared + 18 orchestrator-core).
DB-gated E2E (against docker compose postgres on localhost:15432):
queue_e2e: 4 ok / invoke_e2e: 4 ok / retry_e2e: 3 ok / migration_queue_messages: 4 ok / schema_snapshot: 1 ok
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,8 +45,9 @@ impl InvokeService for FakeInvokeService {
|
||||
let entries = self.scripts.lock().unwrap().clone();
|
||||
let hit = entries.iter().find(|(id, _app, name, _)| match &target {
|
||||
InvokeTarget::Id(t) => t == id,
|
||||
InvokeTarget::Name(t) => t == name,
|
||||
InvokeTarget::Path(t) => t == name, // tests stash route paths as names
|
||||
// Test stashes route paths in the `name` column, so Path
|
||||
// and Name match the same field.
|
||||
InvokeTarget::Name(t) | InvokeTarget::Path(t) => t == name,
|
||||
});
|
||||
let (id, app, name, source): (ScriptId, AppId, String, String) = hit
|
||||
.ok_or_else(|| InvokeError::NotFound(target.describe()))?
|
||||
@@ -241,7 +242,10 @@ async fn invoke_async_returns_execution_id_string() {
|
||||
.unwrap();
|
||||
// Body is a string — a UUID — surfaced as Json::String.
|
||||
let id = resp.body.as_str().expect("body should be a string");
|
||||
assert!(uuid::Uuid::parse_str(id).is_ok(), "expected UUID, got: {id}");
|
||||
assert!(
|
||||
uuid::Uuid::parse_str(id).is_ok(),
|
||||
"expected UUID, got: {id}"
|
||||
);
|
||||
let payloads = svc.async_payloads.lock().unwrap().clone();
|
||||
assert_eq!(payloads.len(), 1);
|
||||
assert_eq!(payloads[0], json!({ "x": 1 }));
|
||||
|
||||
@@ -46,11 +46,7 @@ impl QueueService for RecordingQueue {
|
||||
Ok(*self.depth.lock().unwrap())
|
||||
}
|
||||
|
||||
async fn depth_pending(
|
||||
&self,
|
||||
_cx: &SdkCallCx,
|
||||
_queue_name: &str,
|
||||
) -> Result<u64, QueueError> {
|
||||
async fn depth_pending(&self, _cx: &SdkCallCx, _queue_name: &str) -> Result<u64, QueueError> {
|
||||
Ok(*self.depth_pending.lock().unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ use std::sync::{Arc, Mutex};
|
||||
|
||||
use picloud_executor_core::{Engine, ExecRequest, InvocationType, Limits};
|
||||
use picloud_shared::{
|
||||
AppId, ExecutionId, NoopDeadLetterService, NoopDocsService, NoopEmailService,
|
||||
NoopEventEmitter, NoopFilesService, NoopHttpService, NoopInvokeService, NoopKvService,
|
||||
NoopModuleSource, NoopPubsubService, NoopQueueService, NoopSecretsService, NoopUsersService,
|
||||
RequestId, ScriptId, ScriptSandbox, Services,
|
||||
AppId, ExecutionId, NoopDeadLetterService, NoopDocsService, NoopEmailService, NoopEventEmitter,
|
||||
NoopFilesService, NoopHttpService, NoopInvokeService, NoopKvService, NoopModuleSource,
|
||||
NoopPubsubService, NoopQueueService, NoopSecretsService, NoopUsersService, RequestId, ScriptId,
|
||||
ScriptSandbox, Services,
|
||||
};
|
||||
use serde_json::Value;
|
||||
|
||||
@@ -61,11 +61,11 @@ fn baseline_request(app_id: AppId) -> ExecRequest {
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn retry_run_succeeds_first_try() {
|
||||
let engine = build_engine();
|
||||
let src = r#"
|
||||
let src = r"
|
||||
let p = retry::policy(#{ max_attempts: 3, base_ms: 1 });
|
||||
let v = retry::run(p, || 42);
|
||||
#{ statusCode: 200, body: v }
|
||||
"#
|
||||
"
|
||||
.to_string();
|
||||
let req = baseline_request(AppId::new());
|
||||
let resp = tokio::task::spawn_blocking(move || engine.execute(&src, req))
|
||||
|
||||
Reference in New Issue
Block a user