docs(epic-1): record verified retrospective completion evidence
This commit is contained in:
1 parent
c6805e2345
commit
ce5b9af5ab
25 files changed
+3116
No files matched your search
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"before_draft": 1,
|
||||
"after_draft": 2,
|
||||
"saved_version": 2,
|
||||
"published_unchanged": true,
|
||||
"error": null
|
||||
}
|
||||
@@ -0,0 +1,906 @@
|
||||
diff --git a/apps/admin-api/tests/integration.rs b/apps/admin-api/tests/integration.rs
|
||||
index eb3215b..a6ff2f7 100644
|
||||
--- a/apps/admin-api/tests/integration.rs
|
||||
+++ b/apps/admin-api/tests/integration.rs
|
||||
@@ -1,5 +1,6 @@
|
||||
mod integration {
|
||||
mod agent_catalog;
|
||||
+ mod agent_catalog_edit;
|
||||
mod auth_rate_limit;
|
||||
mod common;
|
||||
mod community_access_usage;
|
||||
diff --git a/apps/admin-api/tests/integration/agent_catalog_edit.rs b/apps/admin-api/tests/integration/agent_catalog_edit.rs
|
||||
new file mode 100644
|
||||
index 0000000..1986044
|
||||
--- /dev/null
|
||||
+++ b/apps/admin-api/tests/integration/agent_catalog_edit.rs
|
||||
@@ -0,0 +1,889 @@
|
||||
+use super::common::*;
|
||||
+
|
||||
+use crank_core::{Workspace, WorkspaceId, WorkspaceStatus};
|
||||
+use crank_registry::{CreateWorkspaceRequest, PostgresRegistry};
|
||||
+use serde_json::{Value, json};
|
||||
+use serial_test::serial;
|
||||
+use time::OffsetDateTime;
|
||||
+
|
||||
+const DEFAULT_WORKSPACE_ID: &str = "ws_default";
|
||||
+
|
||||
+fn binding(operation_id: &str, tool_name: &str, tool_title: &str) -> Value {
|
||||
+ json!({
|
||||
+ "operation_id": operation_id,
|
||||
+ "operation_version": 1,
|
||||
+ "tool_name": tool_name,
|
||||
+ "tool_title": tool_title,
|
||||
+ "tool_description_override": null,
|
||||
+ "enabled": true
|
||||
+ })
|
||||
+}
|
||||
+
|
||||
+async fn create_draft_operation(
|
||||
+ client: &reqwest::Client,
|
||||
+ base_url: &TestServer,
|
||||
+ upstream: &str,
|
||||
+ name: &str,
|
||||
+) -> String {
|
||||
+ let operation = assert_success_json(
|
||||
+ client
|
||||
+ .post(format!("{base_url}/operations"))
|
||||
+ .json(&test_operation_payload(upstream, name))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ operation["operation_id"].as_str().unwrap().to_owned()
|
||||
+}
|
||||
+
|
||||
+async fn create_published_operation(
|
||||
+ client: &reqwest::Client,
|
||||
+ base_url: &TestServer,
|
||||
+ upstream: &str,
|
||||
+ name: &str,
|
||||
+) -> String {
|
||||
+ let operation_id = create_draft_operation(client, base_url, upstream, name).await;
|
||||
+ let etag = operation_etag(client, base_url, &operation_id).await;
|
||||
+ assert_success_json(
|
||||
+ client
|
||||
+ .post(format!("{base_url}/operations/{operation_id}/publish"))
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!({ "version": 1 }))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ operation_id
|
||||
+}
|
||||
+
|
||||
+async fn create_published_agent(
|
||||
+ client: &reqwest::Client,
|
||||
+ base_url: &TestServer,
|
||||
+ slug: &str,
|
||||
+ operation_id: &str,
|
||||
+ tool_name: &str,
|
||||
+) -> (String, Value) {
|
||||
+ let agent = assert_success_json(
|
||||
+ client
|
||||
+ .post(format!("{base_url}/agents"))
|
||||
+ .json(&json!({
|
||||
+ "slug": slug,
|
||||
+ "display_name": slug,
|
||||
+ "description": "agent catalog edit fixture",
|
||||
+ "instructions": { "system_prompt": "Use only published bindings" },
|
||||
+ "tool_selection_policy": {}
|
||||
+ }))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ let agent_id = agent["agent_id"].as_str().unwrap().to_owned();
|
||||
+
|
||||
+ let etag = agent_etag(client, base_url, &agent_id).await;
|
||||
+ assert_success_json(
|
||||
+ client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/bindings"))
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!([binding(operation_id, tool_name, "Base Tool")]))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let etag = agent_etag(client, base_url, &agent_id).await;
|
||||
+ assert_success_json(
|
||||
+ client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/publish"))
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!({ "version": 1 }))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let published_v1 = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}/versions/1"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ (agent_id, published_v1)
|
||||
+}
|
||||
+
|
||||
+async fn agent_version_count(db: &PostgresRegistry, agent_id: &str) -> i64 {
|
||||
+ sqlx::query_scalar("select count(*) from agent_versions where agent_id = $1")
|
||||
+ .bind(agent_id)
|
||||
+ .fetch_one(db.pool())
|
||||
+ .await
|
||||
+ .unwrap()
|
||||
+}
|
||||
+
|
||||
+async fn assert_no_durable_draft(
|
||||
+ client: &reqwest::Client,
|
||||
+ db: &PostgresRegistry,
|
||||
+ base_url: &TestServer,
|
||||
+ agent_id: &str,
|
||||
+ published_v1: &Value,
|
||||
+) {
|
||||
+ let summary = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ assert_eq!(
|
||||
+ summary["current_draft_version"], 1,
|
||||
+ "a rejected edit must not fork a Draft Version: {summary}"
|
||||
+ );
|
||||
+ assert_eq!(summary["latest_published_version"], 1, "{summary}");
|
||||
+ assert_eq!(summary["status"], "published", "{summary}");
|
||||
+ assert_eq!(
|
||||
+ agent_version_count(db, agent_id).await,
|
||||
+ 1,
|
||||
+ "a rejected edit must not persist a new Agent Version row"
|
||||
+ );
|
||||
+
|
||||
+ let published_after = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}/versions/1"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ assert_eq!(
|
||||
+ &published_after, published_v1,
|
||||
+ "the Published snapshot and its bindings must stay unchanged after a rejected edit"
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
+#[serial]
|
||||
+async fn published_agent_first_edit_forks_one_draft_and_keeps_published_snapshot() {
|
||||
+ let registry = test_registry().await;
|
||||
+ let db = registry.clone();
|
||||
+ let storage_root = test_storage_root("agent_catalog_edit_first");
|
||||
+ let upstream_base_url = spawn_upstream_server().await;
|
||||
+ let base_url = spawn_admin_api(build_test_app(registry, storage_root)).await;
|
||||
+ let client = authorized_client(&base_url).await;
|
||||
+
|
||||
+ let operation_id =
|
||||
+ create_published_operation(&client, &base_url, &upstream_base_url, "edit_first_tool").await;
|
||||
+ let (agent_id, published_v1) = create_published_agent(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ "edit-first",
|
||||
+ &operation_id,
|
||||
+ "edit_first_tool",
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let summary_before = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ assert_eq!(summary_before["current_draft_version"], 1);
|
||||
+ assert_eq!(summary_before["latest_published_version"], 1);
|
||||
+ assert_eq!(summary_before["status"], "published");
|
||||
+
|
||||
+ let desired_policy = json!({
|
||||
+ "mode": "search",
|
||||
+ "groups": [{
|
||||
+ "id": "crm-group",
|
||||
+ "name": "CRM",
|
||||
+ "description": "CRM tools",
|
||||
+ "tool_names": ["edit_first_tool"]
|
||||
+ }],
|
||||
+ "search": { "max_results": 5 }
|
||||
+ });
|
||||
+
|
||||
+ let edit_etag = agent_etag(&client, &base_url, &agent_id).await;
|
||||
+ let response = client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/bindings"))
|
||||
+ .header(reqwest::header::IF_MATCH, edit_etag)
|
||||
+ .json(&json!({
|
||||
+ "bindings": [binding(&operation_id, "edit_first_tool", "Edited Tool")],
|
||||
+ "tool_selection_policy": desired_policy
|
||||
+ }))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let status = response.status();
|
||||
+ let body = response.json::<Value>().await.unwrap();
|
||||
+ assert_eq!(
|
||||
+ status,
|
||||
+ reqwest::StatusCode::OK,
|
||||
+ "the first edit of a Published Agent must fork and save under the original If-Match: {body}"
|
||||
+ );
|
||||
+ assert_eq!(body["version"], 2, "{body}");
|
||||
+
|
||||
+ let summary_after = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ assert_eq!(summary_after["current_draft_version"], 2, "{summary_after}");
|
||||
+ assert_eq!(
|
||||
+ summary_after["latest_published_version"], 1,
|
||||
+ "{summary_after}"
|
||||
+ );
|
||||
+ assert_eq!(summary_after["status"], "published", "{summary_after}");
|
||||
+
|
||||
+ assert_eq!(
|
||||
+ agent_version_count(&db, &agent_id).await,
|
||||
+ 2,
|
||||
+ "the first edit must create exactly one additional Draft Version"
|
||||
+ );
|
||||
+
|
||||
+ let draft = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}/versions/2"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ assert_eq!(draft["status"], "draft", "{draft}");
|
||||
+ assert_eq!(
|
||||
+ draft["snapshot"]["instructions"],
|
||||
+ published_v1["snapshot"]["instructions"]
|
||||
+ );
|
||||
+ assert_eq!(draft["bindings"].as_array().unwrap().len(), 1, "{draft}");
|
||||
+ assert_eq!(draft["bindings"][0]["tool_title"], "Edited Tool", "{draft}");
|
||||
+ assert_eq!(
|
||||
+ draft["snapshot"]["tool_selection_policy"]["mode"], "search",
|
||||
+ "{draft}"
|
||||
+ );
|
||||
+ assert_eq!(
|
||||
+ draft["snapshot"]["tool_selection_policy"]["search"]["max_results"], 5,
|
||||
+ "{draft}"
|
||||
+ );
|
||||
+
|
||||
+ let published_after = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}/versions/1"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ assert_eq!(
|
||||
+ published_after, published_v1,
|
||||
+ "the Published v1 snapshot must not change when the Draft is forked"
|
||||
+ );
|
||||
+
|
||||
+ let next_etag = agent_etag(&client, &base_url, &agent_id).await;
|
||||
+ let second_response = client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/bindings"))
|
||||
+ .header(reqwest::header::IF_MATCH, next_etag)
|
||||
+ .json(&json!({
|
||||
+ "bindings": [binding(&operation_id, "edit_first_tool", "Edited Again")],
|
||||
+ "tool_selection_policy": desired_policy
|
||||
+ }))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let second_status = second_response.status();
|
||||
+ let second_body = second_response.text().await.unwrap();
|
||||
+ assert_eq!(
|
||||
+ second_status,
|
||||
+ reqwest::StatusCode::OK,
|
||||
+ "a subsequent valid edit on the Draft must succeed: {second_body}"
|
||||
+ );
|
||||
+ assert_eq!(
|
||||
+ agent_version_count(&db, &agent_id).await,
|
||||
+ 2,
|
||||
+ "a subsequent valid edit must stay on the existing Draft v2"
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
+#[serial]
|
||||
+async fn rejected_invalid_policy_leaves_no_durable_draft() {
|
||||
+ let registry = test_registry().await;
|
||||
+ let db = registry.clone();
|
||||
+ let storage_root = test_storage_root("agent_catalog_edit_invalid_policy");
|
||||
+ let upstream_base_url = spawn_upstream_server().await;
|
||||
+ let base_url = spawn_admin_api(build_test_app(registry, storage_root)).await;
|
||||
+ let client = authorized_client(&base_url).await;
|
||||
+
|
||||
+ let operation_id =
|
||||
+ create_published_operation(&client, &base_url, &upstream_base_url, "edit_policy_tool")
|
||||
+ .await;
|
||||
+ let (agent_id, published_v1) = create_published_agent(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ "edit-policy",
|
||||
+ &operation_id,
|
||||
+ "edit_policy_tool",
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let etag = agent_etag(&client, &base_url, &agent_id).await;
|
||||
+ let response = client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/bindings"))
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!({
|
||||
+ "bindings": [],
|
||||
+ "tool_selection_policy": {
|
||||
+ "mode": "direct",
|
||||
+ "groups": [{
|
||||
+ "id": "group-1",
|
||||
+ "name": "Group",
|
||||
+ "description": "groups require search mode",
|
||||
+ "tool_names": []
|
||||
+ }]
|
||||
+ }
|
||||
+ }))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let status = response.status();
|
||||
+ let body = response.text().await.unwrap();
|
||||
+ assert_eq!(
|
||||
+ status,
|
||||
+ reqwest::StatusCode::BAD_REQUEST,
|
||||
+ "a grouping policy in direct mode must be rejected: {body}"
|
||||
+ );
|
||||
+
|
||||
+ assert_no_durable_draft(&client, &db, &base_url, &agent_id, &published_v1).await;
|
||||
+}
|
||||
+
|
||||
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
+#[serial]
|
||||
+async fn rejected_unpublished_operation_leaves_no_durable_draft() {
|
||||
+ let registry = test_registry().await;
|
||||
+ let db = registry.clone();
|
||||
+ let storage_root = test_storage_root("agent_catalog_edit_draft_op");
|
||||
+ let upstream_base_url = spawn_upstream_server().await;
|
||||
+ let base_url = spawn_admin_api(build_test_app(registry, storage_root)).await;
|
||||
+ let client = authorized_client(&base_url).await;
|
||||
+
|
||||
+ let live_operation =
|
||||
+ create_published_operation(&client, &base_url, &upstream_base_url, "edit_live_tool").await;
|
||||
+ let (agent_id, published_v1) = create_published_agent(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ "edit-draft-op",
|
||||
+ &live_operation,
|
||||
+ "edit_live_tool",
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let draft_operation =
|
||||
+ create_draft_operation(&client, &base_url, &upstream_base_url, "edit_draft_tool").await;
|
||||
+
|
||||
+ let etag = agent_etag(&client, &base_url, &agent_id).await;
|
||||
+ let response = client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/bindings"))
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!([binding(
|
||||
+ &draft_operation,
|
||||
+ "edit_draft_tool",
|
||||
+ "Draft Tool"
|
||||
+ )]))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let status = response.status();
|
||||
+ let body = response.text().await.unwrap();
|
||||
+ assert_eq!(
|
||||
+ status,
|
||||
+ reqwest::StatusCode::UNPROCESSABLE_ENTITY,
|
||||
+ "binding an unpublished Operation must be rejected: {body}"
|
||||
+ );
|
||||
+ let body: Value = serde_json::from_str(&body).unwrap();
|
||||
+ assert_eq!(
|
||||
+ body["error"]["code"], "agent_binding_not_published",
|
||||
+ "{body}"
|
||||
+ );
|
||||
+
|
||||
+ assert_no_durable_draft(&client, &db, &base_url, &agent_id, &published_v1).await;
|
||||
+}
|
||||
+
|
||||
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
+#[serial]
|
||||
+async fn rejected_archived_operation_leaves_no_durable_draft() {
|
||||
+ let registry = test_registry().await;
|
||||
+ let db = registry.clone();
|
||||
+ let storage_root = test_storage_root("agent_catalog_edit_archived_op");
|
||||
+ let upstream_base_url = spawn_upstream_server().await;
|
||||
+ let base_url = spawn_admin_api(build_test_app(registry, storage_root)).await;
|
||||
+ let client = authorized_client(&base_url).await;
|
||||
+
|
||||
+ let live_operation = create_published_operation(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ &upstream_base_url,
|
||||
+ "edit_live_tool_arch",
|
||||
+ )
|
||||
+ .await;
|
||||
+ let (agent_id, published_v1) = create_published_agent(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ "edit-archived-op",
|
||||
+ &live_operation,
|
||||
+ "edit_live_tool_arch",
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let archived_operation =
|
||||
+ create_published_operation(&client, &base_url, &upstream_base_url, "edit_archived_tool")
|
||||
+ .await;
|
||||
+ let operation_etag = operation_etag(&client, &base_url, &archived_operation).await;
|
||||
+ let archived = client
|
||||
+ .post(format!(
|
||||
+ "{base_url}/operations/{archived_operation}/archive"
|
||||
+ ))
|
||||
+ .header(reqwest::header::IF_MATCH, operation_etag)
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let archived_status = archived.status();
|
||||
+ let archived_body = archived.text().await.unwrap();
|
||||
+ assert!(archived_status.is_success(), "{archived_body}");
|
||||
+
|
||||
+ let etag = agent_etag(&client, &base_url, &agent_id).await;
|
||||
+ let response = client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/bindings"))
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!([binding(
|
||||
+ &archived_operation,
|
||||
+ "edit_archived_tool",
|
||||
+ "Archived Tool"
|
||||
+ )]))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let status = response.status();
|
||||
+ let body = response.text().await.unwrap();
|
||||
+ assert_eq!(
|
||||
+ status,
|
||||
+ reqwest::StatusCode::UNPROCESSABLE_ENTITY,
|
||||
+ "binding an archived Operation must be rejected: {body}"
|
||||
+ );
|
||||
+ let body: Value = serde_json::from_str(&body).unwrap();
|
||||
+ assert_eq!(
|
||||
+ body["error"]["code"], "agent_binding_archived_operation",
|
||||
+ "{body}"
|
||||
+ );
|
||||
+
|
||||
+ assert_no_durable_draft(&client, &db, &base_url, &agent_id, &published_v1).await;
|
||||
+}
|
||||
+
|
||||
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
+#[serial]
|
||||
+async fn rejected_foreign_operation_leaves_no_durable_draft() {
|
||||
+ let registry = test_registry().await;
|
||||
+ let db = registry.clone();
|
||||
+ let storage_root = test_storage_root("agent_catalog_edit_foreign_op");
|
||||
+ let upstream_base_url = spawn_upstream_server().await;
|
||||
+ let base_url = spawn_admin_api(build_test_app(registry.clone(), storage_root)).await;
|
||||
+ let client = authorized_client(&base_url).await;
|
||||
+
|
||||
+ let live_operation = create_published_operation(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ &upstream_base_url,
|
||||
+ "edit_live_tool_foreign",
|
||||
+ )
|
||||
+ .await;
|
||||
+ let (agent_id, published_v1) = create_published_agent(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ "edit-foreign-op",
|
||||
+ &live_operation,
|
||||
+ "edit_live_tool_foreign",
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let foreign_workspace = WorkspaceId::new("ws_agent_edit_foreign");
|
||||
+ let now = OffsetDateTime::now_utc();
|
||||
+ db.create_workspace(CreateWorkspaceRequest {
|
||||
+ workspace: &Workspace {
|
||||
+ id: foreign_workspace.clone(),
|
||||
+ slug: "agent-edit-foreign".to_owned(),
|
||||
+ display_name: "Agent Edit Foreign".to_owned(),
|
||||
+ status: WorkspaceStatus::Active,
|
||||
+ settings: json!({}),
|
||||
+ created_at: now,
|
||||
+ updated_at: now,
|
||||
+ },
|
||||
+ })
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+
|
||||
+ let foreign_service = test_service(
|
||||
+ db.clone(),
|
||||
+ test_storage_root("agent_catalog_edit_foreign_service"),
|
||||
+ test_auth_settings(),
|
||||
+ test_secret_crypto(),
|
||||
+ );
|
||||
+ let foreign_operation = foreign_service
|
||||
+ .create_operation(
|
||||
+ &foreign_workspace,
|
||||
+ test_operation_payload(&upstream_base_url, "edit_foreign_tool"),
|
||||
+ )
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let foreign_operation_id = foreign_operation.operation_id;
|
||||
+
|
||||
+ let etag = agent_etag(&client, &base_url, &agent_id).await;
|
||||
+ let response = client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/bindings"))
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!([binding(
|
||||
+ &foreign_operation_id,
|
||||
+ "edit_foreign_tool",
|
||||
+ "Foreign Tool"
|
||||
+ )]))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let status = response.status();
|
||||
+ let body = response.text().await.unwrap();
|
||||
+ assert_eq!(
|
||||
+ status,
|
||||
+ reqwest::StatusCode::NOT_FOUND,
|
||||
+ "binding an Operation from another workspace must be rejected: {body}"
|
||||
+ );
|
||||
+ let body: Value = serde_json::from_str(&body).unwrap();
|
||||
+ assert_eq!(
|
||||
+ body["error"]["code"], "agent_binding_scope_denied",
|
||||
+ "{body}"
|
||||
+ );
|
||||
+
|
||||
+ assert_no_durable_draft(&client, &db, &base_url, &agent_id, &published_v1).await;
|
||||
+}
|
||||
+
|
||||
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
+#[serial]
|
||||
+async fn concurrent_first_edits_with_same_etag_have_one_winner() {
|
||||
+ let registry = test_registry().await;
|
||||
+ let db = registry.clone();
|
||||
+ let storage_root = test_storage_root("agent_catalog_edit_concurrent");
|
||||
+ let upstream_base_url = spawn_upstream_server().await;
|
||||
+ let base_url = spawn_admin_api(build_test_app(registry, storage_root)).await;
|
||||
+ let client = authorized_client(&base_url).await;
|
||||
+
|
||||
+ let operation_id =
|
||||
+ create_published_operation(&client, &base_url, &upstream_base_url, "edit_race_tool").await;
|
||||
+ let (agent_id, published_v1) = create_published_agent(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ "edit-race",
|
||||
+ &operation_id,
|
||||
+ "edit_race_tool",
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ // Single original precondition taken once from the Published state.
|
||||
+ let original_etag = agent_etag(&client, &base_url, &agent_id).await;
|
||||
+ let endpoint = format!("{base_url}/agents/{agent_id}/bindings");
|
||||
+ let payload_a = json!([binding(&operation_id, "edit_race_tool", "Race Winner A")]);
|
||||
+ let payload_b = json!([binding(&operation_id, "edit_race_tool", "Race Winner B")]);
|
||||
+
|
||||
+ let spawn_edit = |payload: Value, etag: String, endpoint: String| {
|
||||
+ let client = client.clone();
|
||||
+ tokio::spawn(async move {
|
||||
+ let response = client
|
||||
+ .post(endpoint)
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&payload)
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let status = response.status();
|
||||
+ let body = response.json::<Value>().await.unwrap();
|
||||
+ (status, body)
|
||||
+ })
|
||||
+ };
|
||||
+
|
||||
+ let first = spawn_edit(payload_a, original_etag.clone(), endpoint.clone());
|
||||
+ let second = spawn_edit(payload_b, original_etag, endpoint);
|
||||
+ let (first, second) = tokio::join!(first, second);
|
||||
+ let results = vec![first.unwrap(), second.unwrap()];
|
||||
+
|
||||
+ let successes = results
|
||||
+ .iter()
|
||||
+ .filter(|(status, _)| status.is_success())
|
||||
+ .count();
|
||||
+ let conflicts = results
|
||||
+ .iter()
|
||||
+ .filter(|(status, _)| *status == reqwest::StatusCode::CONFLICT)
|
||||
+ .count();
|
||||
+ assert_eq!(
|
||||
+ successes, 1,
|
||||
+ "exactly one concurrent first edit must win: {results:?}"
|
||||
+ );
|
||||
+ assert_eq!(
|
||||
+ conflicts, 1,
|
||||
+ "the losing concurrent first edit must report a stable conflict: {results:?}"
|
||||
+ );
|
||||
+
|
||||
+ let conflict_body = results
|
||||
+ .iter()
|
||||
+ .find(|(status, _)| *status == reqwest::StatusCode::CONFLICT)
|
||||
+ .map(|(_, body)| body)
|
||||
+ .unwrap();
|
||||
+ assert_eq!(
|
||||
+ conflict_body["error"]["code"], "agent_stale_revision",
|
||||
+ "{conflict_body}"
|
||||
+ );
|
||||
+
|
||||
+ let summary = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ assert_eq!(summary["current_draft_version"], 2, "{summary}");
|
||||
+ assert_eq!(summary["latest_published_version"], 1, "{summary}");
|
||||
+ assert_eq!(
|
||||
+ agent_version_count(&db, &agent_id).await,
|
||||
+ 2,
|
||||
+ "the losing concurrent edit must not fork a second Draft"
|
||||
+ );
|
||||
+
|
||||
+ let published_after = assert_success_json(
|
||||
+ client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}/versions/1"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap(),
|
||||
+ )
|
||||
+ .await;
|
||||
+ assert_eq!(published_after, published_v1);
|
||||
+}
|
||||
+
|
||||
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
+#[serial]
|
||||
+async fn first_edit_after_operation_archive_leaves_no_durable_draft() {
|
||||
+ let registry = test_registry().await;
|
||||
+ let db = registry.clone();
|
||||
+ let storage_root = test_storage_root("agent_catalog_edit_archive_ordering");
|
||||
+ let upstream_base_url = spawn_upstream_server().await;
|
||||
+ let base_url = spawn_admin_api(build_test_app(registry, storage_root)).await;
|
||||
+ let client = authorized_client(&base_url).await;
|
||||
+
|
||||
+ let live_operation =
|
||||
+ create_published_operation(&client, &base_url, &upstream_base_url, "edit_order_live").await;
|
||||
+ let (agent_id, published_v1) = create_published_agent(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ "edit-order",
|
||||
+ &live_operation,
|
||||
+ "edit_order_live",
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let archived_operation = create_published_operation(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ &upstream_base_url,
|
||||
+ "edit_order_archived",
|
||||
+ )
|
||||
+ .await;
|
||||
+ let operation_etag = operation_etag(&client, &base_url, &archived_operation).await;
|
||||
+ let archived = client
|
||||
+ .post(format!(
|
||||
+ "{base_url}/operations/{archived_operation}/archive"
|
||||
+ ))
|
||||
+ .header(reqwest::header::IF_MATCH, operation_etag)
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let archived_status = archived.status();
|
||||
+ let archived_body = archived.text().await.unwrap();
|
||||
+ assert!(archived_status.is_success(), "{archived_body}");
|
||||
+
|
||||
+ let etag = agent_etag(&client, &base_url, &agent_id).await;
|
||||
+ let response = client
|
||||
+ .post(format!("{base_url}/agents/{agent_id}/bindings"))
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!([binding(
|
||||
+ &archived_operation,
|
||||
+ "edit_order_archived",
|
||||
+ "Archived Order Tool"
|
||||
+ )]))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let status = response.status();
|
||||
+ let body = response.text().await.unwrap();
|
||||
+ assert!(
|
||||
+ status.is_client_error(),
|
||||
+ "a first edit that references an archived Operation must be rejected: {status}: {body}"
|
||||
+ );
|
||||
+
|
||||
+ assert_no_durable_draft(&client, &db, &base_url, &agent_id, &published_v1).await;
|
||||
+}
|
||||
+
|
||||
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
+#[serial]
|
||||
+async fn first_edit_rejects_when_operation_archives_during_save() {
|
||||
+ let registry = test_registry().await;
|
||||
+ let db = registry.clone();
|
||||
+ let storage_root = test_storage_root("agent_catalog_edit_archive_race");
|
||||
+ let upstream_base_url = spawn_upstream_server().await;
|
||||
+ let base_url = spawn_admin_api(build_test_app(registry, storage_root)).await;
|
||||
+ let client = authorized_client(&base_url).await;
|
||||
+
|
||||
+ let live_operation =
|
||||
+ create_published_operation(&client, &base_url, &upstream_base_url, "edit_race_live").await;
|
||||
+ let (agent_id, published_v1) = create_published_agent(
|
||||
+ &client,
|
||||
+ &base_url,
|
||||
+ "edit-archive-race",
|
||||
+ &live_operation,
|
||||
+ "edit_race_live",
|
||||
+ )
|
||||
+ .await;
|
||||
+
|
||||
+ let target_operation =
|
||||
+ create_published_operation(&client, &base_url, &upstream_base_url, "edit_race_target")
|
||||
+ .await;
|
||||
+
|
||||
+ // Read the edit precondition before taking the Operation lock; Agent detail
|
||||
+ // may itself inspect bound Operations.
|
||||
+ let etag_response = client
|
||||
+ .get(format!("{base_url}/agents/{agent_id}"))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let etag_status = etag_response.status();
|
||||
+ let etag = etag_response
|
||||
+ .headers()
|
||||
+ .get(reqwest::header::ETAG)
|
||||
+ .and_then(|value| value.to_str().ok())
|
||||
+ .map(str::to_owned);
|
||||
+ let etag_body = etag_response.text().await.unwrap();
|
||||
+ assert_eq!(
|
||||
+ etag_status,
|
||||
+ reqwest::StatusCode::OK,
|
||||
+ "reading the Agent ETag before the archive race must succeed: {etag_body}"
|
||||
+ );
|
||||
+ let etag = etag.expect("Agent detail must expose an ETag");
|
||||
+
|
||||
+ // Use an independent pool for the holder and pg_stat_activity monitor. The
|
||||
+ // fixture registry has one connection, which the request needs to reach the
|
||||
+ // Operation lock wait.
|
||||
+ let lock_registry =
|
||||
+ PostgresRegistry::connect_with_options((*db.pool().connect_options()).clone())
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+
|
||||
+ // Hold the target Operation row lock from a separate connection so the edit
|
||||
+ // transaction cannot complete its binding write until the archive wins.
|
||||
+ let mut holder = lock_registry.pool().begin().await.unwrap();
|
||||
+ sqlx::query("select id from operations where workspace_id = $1 and id = $2 for update")
|
||||
+ .bind(DEFAULT_WORKSPACE_ID)
|
||||
+ .bind(&target_operation)
|
||||
+ .fetch_one(&mut *holder)
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let holder_pid: i32 = sqlx::query_scalar("select pg_backend_pid()")
|
||||
+ .fetch_one(&mut *holder)
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let edit_client = client.clone();
|
||||
+ let endpoint = format!("{base_url}/agents/{agent_id}/bindings");
|
||||
+ let edit_target = target_operation.clone();
|
||||
+ let edit = tokio::spawn(async move {
|
||||
+ let response = edit_client
|
||||
+ .post(endpoint)
|
||||
+ .header(reqwest::header::IF_MATCH, etag)
|
||||
+ .json(&json!([binding(
|
||||
+ &edit_target,
|
||||
+ "edit_race_target",
|
||||
+ "Archive Race Tool"
|
||||
+ )]))
|
||||
+ .send()
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ let status = response.status();
|
||||
+ let body = response.text().await.unwrap();
|
||||
+ (status, body)
|
||||
+ });
|
||||
+
|
||||
+ // Wait for PostgreSQL to report the request blocked by this exact holder.
|
||||
+ // If the request completes first (the baseline CAS path), keep going so the
|
||||
+ // durable-draft assertion below reports that regression directly.
|
||||
+ let lock_wait = async {
|
||||
+ loop {
|
||||
+ if edit.is_finished() {
|
||||
+ return false;
|
||||
+ }
|
||||
+ let blocked: bool = sqlx::query_scalar(
|
||||
+ "select exists (
|
||||
+ select 1
|
||||
+ from pg_stat_activity
|
||||
+ where wait_event_type = 'Lock'
|
||||
+ and $1 = any(pg_blocking_pids(pid))
|
||||
+ and query ilike '%select status from operations%'
|
||||
+ )",
|
||||
+ )
|
||||
+ .bind(holder_pid)
|
||||
+ .fetch_one(lock_registry.pool())
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ if blocked {
|
||||
+ return true;
|
||||
+ }
|
||||
+ tokio::task::yield_now().await;
|
||||
+ }
|
||||
+ };
|
||||
+ let saw_operation_lock_wait =
|
||||
+ match tokio::time::timeout(std::time::Duration::from_secs(10), lock_wait).await {
|
||||
+ Ok(saw_wait) => saw_wait,
|
||||
+ Err(_) => {
|
||||
+ edit.abort();
|
||||
+ holder.rollback().await.unwrap();
|
||||
+ let _ = edit.await;
|
||||
+ panic!("timed out waiting for the edit to block on the held Operation row lock");
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ sqlx::query(
|
||||
+ "update operations
|
||||
+ set status = 'archived', updated_at = now()
|
||||
+ where workspace_id = $1 and id = $2",
|
||||
+ )
|
||||
+ .bind(DEFAULT_WORKSPACE_ID)
|
||||
+ .bind(&target_operation)
|
||||
+ .execute(&mut *holder)
|
||||
+ .await
|
||||
+ .unwrap();
|
||||
+ holder.commit().await.unwrap();
|
||||
+
|
||||
+ let (status, body) = edit.await.unwrap();
|
||||
+ assert!(
|
||||
+ status.is_client_error(),
|
||||
+ "an edit racing an Operation archive must be rejected: {status}: {body}"
|
||||
+ );
|
||||
+
|
||||
+ assert_no_durable_draft(&client, &db, &base_url, &agent_id, &published_v1).await;
|
||||
+ assert!(
|
||||
+ saw_operation_lock_wait,
|
||||
+ "a corrected save path must wait on the holder's Operation row lock before archive commits"
|
||||
+ );
|
||||
+}
|
||||
@@ -0,0 +1,3 @@
|
||||
Running tests/integration.rs (local-build/red-target/debug/deps/integration-1fc3e84c91321bef)
|
||||
running 8 tests
|
||||
test result: FAILED. 0 passed; 8 failed; 0 ignored; 0 measured; 140 filtered out; finished in 53.48s
|
||||
@@ -0,0 +1,11 @@
|
||||
error: vendor/sqlx-core/LICENSE-APACHE:1: forbidden marker `commercial` # community-scope: allow=commercial
|
||||
error: vendor/sqlx-core/src/migrate.rs:1: forbidden marker `tenant` # community-scope: allow=tenant
|
||||
error: vendor/sqlx-core/src/pool/options.rs:1: forbidden marker `billing` # community-scope: allow=billing
|
||||
Ran 22 tests in 5.096s
|
||||
FAILED (failures=1)
|
||||
Community scope check failed:
|
||||
error: vendor/sqlx-core/LICENSE-APACHE:162: forbidden marker `commercial` # community-scope: allow=commercial
|
||||
error: vendor/sqlx-core/src/config/migrate.rs:40: forbidden marker `tenant` # community-scope: allow=tenant
|
||||
error: vendor/sqlx-core/src/config/reference.toml:178: forbidden marker `tenant` # community-scope: allow=tenant
|
||||
error: vendor/sqlx-core/src/migrate/migrator.rs:101: forbidden marker `tenant` # community-scope: allow=tenant
|
||||
error: vendor/sqlx-core/src/pool/options.rs:299: forbidden marker `billing` # community-scope: allow=billing
|
||||
@@ -0,0 +1,2 @@
|
||||
Running 17 tests using 1 worker
|
||||
17 passed (58.6s)
|
||||
@@ -0,0 +1,31 @@
|
||||
Running 17 tests using 1 worker
|
||||
::error file=tests/e2e/onboarding.spec.js,title=[chromium] › tests/e2e/onboarding.spec.js:189:1 › onboarding error exposes safe support correlation and retries without a client completion bypass,line=215,col=48:: 1) [chromium] › tests/e2e/onboarding.spec.js:189:1 › onboarding error exposes safe support correlation and retries without a client completion bypass
|
||||
Error: locator.click: Test timeout of 45000ms exceeded.
|
||||
Call log:
|
||||
- waiting for getByTestId('onboarding-refresh')
|
||||
- locator resolved to <button type="button" class="onboarding-link-button" data-testid="onboarding-refresh">Refresh progress</button>
|
||||
- attempting click action
|
||||
2 × waiting for element to be visible, enabled and stable
|
||||
- element is not visible
|
||||
- retrying click action
|
||||
- waiting 20ms
|
||||
2 × waiting for element to be visible, enabled and stable
|
||||
- element is not visible
|
||||
- retrying click action
|
||||
- waiting 100ms
|
||||
101 × waiting for element to be visible, enabled and stable
|
||||
- element is not visible
|
||||
- retrying click action
|
||||
- waiting 500ms
|
||||
|
||||
|
||||
213 | await page.getByTestId('onboarding-trigger').click();
|
||||
214 | fail = true;
|
||||
> 215 | await page.getByTestId('onboarding-refresh').click();
|
||||
| ^
|
||||
216 | const alert = page.getByRole('alert');
|
||||
217 | await expect(alert).toContainText('onboarding_unavailable');
|
||||
218 | await expect(alert).toContainText('req_onboarding_retry');
|
||||
at apps/ui/tests/e2e/onboarding.spec.js:215:48
|
||||
1 flaky
|
||||
16 passed (2.5m)
|
||||
@@ -0,0 +1,43 @@
|
||||
# Итоговое ревью исправлений Epic 1
|
||||
|
||||
Три независимых reviewer layer завершены: blind hunter, edge cases, verification gaps. Verification-gap layer: `No verification gaps found.` Каждый finding оценён отдельно до группировки. Blind hunter ошибочно вычислил floor без min(..., 10); все 30 выданных findings всё равно рассмотрены.
|
||||
|
||||
| ID | Verdict | Route | Evidence / решение |
|
||||
|---|---|---|---|
|
||||
| B01 | medium | patch | Ссылка sqlx-red.patch ещё не разрешается; exact patch сохранён вне репозитория и включается в completion evidence. |
|
||||
| B02 | medium | patch | Ссылка sqlx-accepted.patch ещё не разрешается; принятый exact patch сохранён и включается в completion evidence. |
|
||||
| B03 | medium | patch | В Git пока лишь excerpts SQLx; добавляются sanitized RED и clean GREEN summaries, raw-log SHA и commands/exit. Raw logs не публикуются целиком согласно evidence policy. |
|
||||
| B04 | medium | patch | Digest metadata пока вне Git; source archive/intermediate hashes и artifact hashes добавляются в index. |
|
||||
| B05 | medium | patch | Versioned completion index на момент review ещё собирается; добавляется после реального gate и final UI. |
|
||||
| B06 | medium | patch | Run records пока вне Git; итоговый index добавляет source/config revisions, environment, command, exit, counts и digests. |
|
||||
| B07 | false | reject | 100755 сохранён из crates.io archive, исполняемый бит не влияет на cargo compilation. Нормализация vendor modes создаст ненужный provenance diff; ordinary harm не показан. |
|
||||
| B08 | false | reject | Canonical Rust workspace задаётся apps/* и crates/*; в корневых tests только Python tooling, корневых Rust benches/examples нет. Vendor — отдельный upstream package. Потеря текущего source gate не показана. |
|
||||
| B09 | false | reject | Предположенный root Rust source отсутствует в workspace; scanner tests проверяют реально принятые apps/crates и untracked source. Тест несуществующей области не нужен. |
|
||||
| B10 | false | reject | Probe применяется только к ephemeral playwright-stack; teardown удаляет crank-e2e-postgres вместе со всеми synthetic Agents. Описанного накопления при установленном способе запуска нет. |
|
||||
| B11 | false | reject | Stack teardown выполняется также при failed probe через finally у runner. Probe browser.close также finally; записи уходят с fixture DB. |
|
||||
| B12 | false | reject | Документ явно требует default-port stack. Эта диагностическая проверка не обещает произвольную deployment configuration; недоступный адрес завершает её ошибкой. |
|
||||
| B13 | false | reject | Это открытые synthetic fixture credentials из playwright-stack.sh, не секреты. User-facing login проверяется на стандартной fixture конфигурации. |
|
||||
| B14 | false | reject | Свежий stack имеет опубликованный fixture Agent; копируются exact published Operation references, имени source Agent в oracle нет. Любой такой Agent подходит для проверки собственного fork. |
|
||||
| B15 | false | reject | Fixtures на свежем stack содержат Published bindings; полный Rust regression независимо утверждает nonempty bindings и фактический title в Draft. Пустая fixture здесь не наблюдается. |
|
||||
| B16 | low | reject | Ошибка версии прервёт probe при version.bindings.map, PASS не получится. Улучшение диагностики редкого отсутствующего fixture потребовало бы дополнительного guard; correctness defect отсутствует. |
|
||||
| B17 | false | reject | Оба Published reads сериализуются одним API/serde и JSONB; в данном snapshot порядок стабилен. Counterexample перестановки ключей на этом пути отсутствует. |
|
||||
| B18 | false | reject | Oracle mode/max_results и сохранённые bindings закрепляют atomic fork/save; groups persistence использует ту же целиком сериализованную policy, дополнительные group search проверены operations_agents. Поведенческий дефект не показан. |
|
||||
| B19 | false | reject | First response version=2, summary current_draft=2, version_count=2 и Published immutable закреплены. Второй edit проверяет успешность и отсутствие новой версии; возврат неправильной версии не показан. |
|
||||
| B20 | false | reject | Сохранение binding title непосредственно проверено при первом edit; существующий Draft использует прежний strict transaction/save путь. Дополнительный identical assertion не закрывает найденный дефект. |
|
||||
| B21 | false | reject | Race oracle требует ровно один success, один stable agent_stale_revision conflict, ровно один Draft и Published unchanged. Общий save oracle проверяет contents отдельно; гипотетическая подмена winning payload не установлена. |
|
||||
| B22 | false | reject | SQL text используется лишь для наблюдения именно нужного lock waiter вместе с независимым holder PID и pg_blocking_pids. Изменение lock protocol должно требовать обновления fixture; ложное зелёное ожидание исключено. |
|
||||
| B23 | false | reject | Archive-race AC — rejection without durable mutation; точный validation error vs serialized archive conflict зависит от победителя. Любой client rejection допустим при отдельном unchanged oracle. |
|
||||
| B24 | false | reject | Pre-archived rejection проверяет client error и exact unchanged Agent/versions. Retrospective finding касается durable fork на rejected references, не нового error-code контракта. |
|
||||
| B25 | false | reject | Browser probe передаёт legacy bindings array без tool_selection_policy на первом fork; default-preserving production branch unchanged, выбирается из Published current snapshot. No-policy путь не отсутствует. |
|
||||
| B26 | false | reject | Concurrent losing original ETag проходит после winning fork и проверяет именно agent_stale_revision, то есть stale state current Draft=2 vs expected=1. Та же locked CAS не зависит от одновременности arrival. |
|
||||
| B27 | false | reject | Runtime matrix покрывает 429, core test removes retry_after_ms; Admin/MCP parity проецирует все affected codes, live POST503 доказывает transport→history без retry. Отдельный live429 — дублирование слоёв, не непроверенный branch. |
|
||||
| B28 | false | reject | 408 покрыт runtime method/dispatch/status matrix и common normalization/projection. Live503 покрывает тот же status→uncertainty seam; уникального HTTP408 branch не показано. |
|
||||
| B29 | false | reject | ResponseTooLarge включён behavioral runtime matrix вместе с invalid response, не только core normalization. Общая Admin/MCP projection проверена, adapter dispatch evidence существовало до изменения. |
|
||||
| B30 | false | reject | Документ уже требует verified upstream fix перед удалением patch и rebase при upgrade; конкретного upstream issue пока нет. Создавать фиктивную ссылку или новую ownership abstraction не требуется. |
|
||||
| E01 | low | reject | Overflow i32 действительно возможен после 2147483647 Published versions, но тот же unchecked +1/to_db_version существовал до изменения в ensure_editable_agent_version. В ordinary lifecycle недостижимо; новый guard/branch больше прямой коррекции, по правилам low rejected. |
|
||||
| E02 | false | reject | Probe fixture очищается при finally teardown всего ephemeral stack и его контейнера/БД; накопление записей в поддерживаемом запуске не происходит. |
|
||||
| E03 | medium | patch | Completion evidence на момент review ещё собирается; claim закрывается versioned index и проверкой links/digests после current gate. |
|
||||
|
||||
B01–B06/E03 имеют общий root cause: versioned completion bundle ещё не сохранён во время review; исправление — итоговый index и immutable summaries/patches. Продуктовые изменения дополнительного patch не требуют. Deferred entries не добавлены. Minor upstream integer limit сохранён как limitation исходного lifecycle, не новый defect Epic 1.
|
||||
|
||||
После review обнаружен flaky в исходном onboarding E2E test: unconditional toggle закрывал уже auto-opened checklist. Минимальное изменение использует соседний conditional pattern и visible assertion; ведущий проверил state.open/performRefresh и diff. Targeted 3 повторения без retries зелёные; final 17 cases также без retries. Rust source/tests/scripts/Cargo совпадают с полной проверенной ревизией. Первоначальный flaky запуск сохранён отдельной записью. B01–B06/E03 закрыты сохранённым index и integrity validation.
|
||||
@@ -0,0 +1,250 @@
|
||||
diff --git a/crates/crank-runtime/tests/execution_certainty.rs b/crates/crank-runtime/tests/execution_certainty.rs
|
||||
new file mode 100644
|
||||
index 0000000..9c8a4a6
|
||||
--- /dev/null
|
||||
+++ b/crates/crank-runtime/tests/execution_certainty.rs
|
||||
@@ -0,0 +1,244 @@
|
||||
+use std::collections::BTreeMap;
|
||||
+
|
||||
+use crank_core::{
|
||||
+ CorrelationContext, DispatchEvidence, ExecutionErrorCode, ExecutionFailure, HttpMethod,
|
||||
+ OutcomeCertainty, Protocol, ProtocolAdapterError, RestTarget, Retryability, Target,
|
||||
+ ToolDescription,
|
||||
+};
|
||||
+use crank_mapping::MappingSet;
|
||||
+use crank_runtime::{RuntimeError, RuntimeOperation, normalize_runtime_error_for_operation};
|
||||
+use crank_schema::{Schema, SchemaKind};
|
||||
+
|
||||
+const MUTATING_METHODS: [HttpMethod; 4] = [
|
||||
+ HttpMethod::Post,
|
||||
+ HttpMethod::Put,
|
||||
+ HttpMethod::Patch,
|
||||
+ HttpMethod::Delete,
|
||||
+];
|
||||
+const READ_METHODS: [HttpMethod; 2] = [HttpMethod::Get, HttpMethod::Head];
|
||||
+const UNCERTAIN_STATUSES: [u16; 4] = [408, 429, 500, 503];
|
||||
+
|
||||
+#[test]
|
||||
+fn ambiguous_upstream_failures_are_unknown_only_for_dispatched_mutations() {
|
||||
+ let mut failures = Vec::new();
|
||||
+ for method in MUTATING_METHODS.into_iter().chain(READ_METHODS) {
|
||||
+ for dispatch in [
|
||||
+ DispatchEvidence::MayHaveDispatched,
|
||||
+ DispatchEvidence::NotDispatched,
|
||||
+ ] {
|
||||
+ for status in UNCERTAIN_STATUSES {
|
||||
+ let error = RuntimeError::ProtocolAdapter(ProtocolAdapterError::UnexpectedStatus {
|
||||
+ status,
|
||||
+ dispatch,
|
||||
+ });
|
||||
+ if let Err(failure) = assert_normalization(
|
||||
+ method,
|
||||
+ &error,
|
||||
+ is_ambiguous_mutation(method, dispatch),
|
||||
+ Some(status),
|
||||
+ format!("{method:?} status {status} {dispatch:?}"),
|
||||
+ ) {
|
||||
+ failures.push(failure);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for adapter in [
|
||||
+ ProtocolAdapterError::ResponseTooLarge { dispatch },
|
||||
+ ProtocolAdapterError::InvalidResponse { dispatch },
|
||||
+ ] {
|
||||
+ let error = RuntimeError::ProtocolAdapter(adapter);
|
||||
+ if let Err(failure) = assert_normalization(
|
||||
+ method,
|
||||
+ &error,
|
||||
+ is_ambiguous_mutation(method, dispatch),
|
||||
+ None,
|
||||
+ format!("{method:?} {error:?}"),
|
||||
+ ) {
|
||||
+ failures.push(failure);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ assert!(
|
||||
+ failures.is_empty(),
|
||||
+ "unexpected normalization rows:\n{}",
|
||||
+ failures.join("\n")
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+#[test]
|
||||
+fn nonambiguous_statuses_keep_their_existing_descriptor() {
|
||||
+ let mut failures = Vec::new();
|
||||
+ for method in MUTATING_METHODS.into_iter().chain(READ_METHODS) {
|
||||
+ for status in [401, 404] {
|
||||
+ let error = RuntimeError::ProtocolAdapter(ProtocolAdapterError::UnexpectedStatus {
|
||||
+ status,
|
||||
+ dispatch: DispatchEvidence::MayHaveDispatched,
|
||||
+ });
|
||||
+ if let Err(failure) = assert_normalization(
|
||||
+ method,
|
||||
+ &error,
|
||||
+ false,
|
||||
+ Some(status),
|
||||
+ format!("{method:?} nonambiguous status {status}"),
|
||||
+ ) {
|
||||
+ failures.push(failure);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ assert!(
|
||||
+ failures.is_empty(),
|
||||
+ "unexpected normalization rows:\n{}",
|
||||
+ failures.join("\n")
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+#[test]
|
||||
+fn dispatch_uncertainty_allowlist_covers_uncertain_upstream_codes_and_drops_retry_delay() {
|
||||
+ let uncertain_codes = [
|
||||
+ ExecutionErrorCode::UpstreamRateLimited,
|
||||
+ ExecutionErrorCode::UpstreamServerError,
|
||||
+ ExecutionErrorCode::UpstreamResponseTooLarge,
|
||||
+ ExecutionErrorCode::UpstreamStatusError,
|
||||
+ ];
|
||||
+ let mut failures = Vec::new();
|
||||
+ for code in uncertain_codes {
|
||||
+ let failure = ExecutionFailure::new(code, CorrelationContext::generate());
|
||||
+ let failure = if matches!(code.retryability(), Retryability::AfterDelay) {
|
||||
+ failure
|
||||
+ .try_with_retry_after_ms(1_000)
|
||||
+ .expect("retry delay is valid for the original descriptor")
|
||||
+ } else {
|
||||
+ failure
|
||||
+ }
|
||||
+ .with_dispatch_uncertainty();
|
||||
+
|
||||
+ if failure.error_code() != code
|
||||
+ || failure.retryability() != Retryability::ManualReconcile
|
||||
+ || failure.outcome_certainty() != OutcomeCertainty::OutcomeUnknown
|
||||
+ || failure.retry_after_ms().is_some()
|
||||
+ {
|
||||
+ failures.push(format!(
|
||||
+ "{code:?}: actual code={:?}, retryability={:?}, certainty={:?}, retry_after_ms={:?}",
|
||||
+ failure.error_code(),
|
||||
+ failure.retryability(),
|
||||
+ failure.outcome_certainty(),
|
||||
+ failure.retry_after_ms(),
|
||||
+ ));
|
||||
+ }
|
||||
+ }
|
||||
+ assert!(
|
||||
+ failures.is_empty(),
|
||||
+ "uncertain code allowlist failures:\n{}",
|
||||
+ failures.join("\n")
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+fn assert_normalization(
|
||||
+ method: HttpMethod,
|
||||
+ error: &RuntimeError,
|
||||
+ unknown: bool,
|
||||
+ status: Option<u16>,
|
||||
+ context: String,
|
||||
+) -> Result<(), String> {
|
||||
+ let correlation = CorrelationContext::generate();
|
||||
+ let failure = normalize_runtime_error_for_operation(error, &correlation, &operation(method));
|
||||
+ let code = expected_code(error);
|
||||
+ let expected = ExecutionFailure::new(code, correlation.clone());
|
||||
+ let expected_retryability = if unknown {
|
||||
+ Retryability::ManualReconcile
|
||||
+ } else {
|
||||
+ expected.retryability()
|
||||
+ };
|
||||
+ let expected_certainty = if unknown {
|
||||
+ OutcomeCertainty::OutcomeUnknown
|
||||
+ } else {
|
||||
+ expected.outcome_certainty()
|
||||
+ };
|
||||
+
|
||||
+ if failure.error_code() != code
|
||||
+ || failure.retryability() != expected_retryability
|
||||
+ || failure.outcome_certainty() != expected_certainty
|
||||
+ || failure.upstream_status() != status
|
||||
+ || failure.retry_after_ms().is_some()
|
||||
+ {
|
||||
+ return Err(format!(
|
||||
+ "{context}: code={:?} (expected {code:?}), retryability={:?} (expected {expected_retryability:?}), certainty={:?} (expected {expected_certainty:?}), upstream_status={:?} (expected {status:?}), retry_after_ms={:?}",
|
||||
+ failure.error_code(),
|
||||
+ failure.retryability(),
|
||||
+ failure.outcome_certainty(),
|
||||
+ failure.upstream_status(),
|
||||
+ failure.retry_after_ms(),
|
||||
+ ));
|
||||
+ }
|
||||
+ Ok(())
|
||||
+}
|
||||
+
|
||||
+fn expected_code(error: &RuntimeError) -> ExecutionErrorCode {
|
||||
+ match error {
|
||||
+ RuntimeError::ProtocolAdapter(ProtocolAdapterError::UnexpectedStatus {
|
||||
+ status, ..
|
||||
+ }) => match status {
|
||||
+ 401 | 403 => ExecutionErrorCode::UpstreamAuthError,
|
||||
+ 404 => ExecutionErrorCode::UpstreamNotFound,
|
||||
+ 408 | 429 => ExecutionErrorCode::UpstreamRateLimited,
|
||||
+ 500..=599 => ExecutionErrorCode::UpstreamServerError,
|
||||
+ _ => ExecutionErrorCode::UpstreamStatusError,
|
||||
+ },
|
||||
+ RuntimeError::ProtocolAdapter(ProtocolAdapterError::ResponseTooLarge { .. }) => {
|
||||
+ ExecutionErrorCode::UpstreamResponseTooLarge
|
||||
+ }
|
||||
+ RuntimeError::ProtocolAdapter(ProtocolAdapterError::InvalidResponse { .. }) => {
|
||||
+ ExecutionErrorCode::UpstreamStatusError
|
||||
+ }
|
||||
+ other => panic!("unexpected test fixture: {other:?}"),
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+fn is_ambiguous_mutation(method: HttpMethod, dispatch: DispatchEvidence) -> bool {
|
||||
+ MUTATING_METHODS.contains(&method) && dispatch == DispatchEvidence::MayHaveDispatched
|
||||
+}
|
||||
+
|
||||
+fn operation(method: HttpMethod) -> RuntimeOperation {
|
||||
+ RuntimeOperation {
|
||||
+ operation_id: crank_core::OperationId::new("certainty_test"),
|
||||
+ operation_version: 1,
|
||||
+ tool_name: "certainty_test".to_owned(),
|
||||
+ protocol: Protocol::Rest,
|
||||
+ target: Target::Rest(RestTarget {
|
||||
+ base_url: "https://example.invalid".to_owned(),
|
||||
+ method,
|
||||
+ path_template: "/items".to_owned(),
|
||||
+ static_headers: BTreeMap::new(),
|
||||
+ request_contract: None,
|
||||
+ response_contract: Vec::new(),
|
||||
+ multipart_field_mime_types: BTreeMap::new(),
|
||||
+ }),
|
||||
+ input_schema: empty_schema(),
|
||||
+ output_schema: empty_schema(),
|
||||
+ input_mapping: MappingSet::default(),
|
||||
+ output_mapping: MappingSet::default(),
|
||||
+ execution_config: crank_core::ExecutionConfig::default(),
|
||||
+ tool_description: ToolDescription {
|
||||
+ title: "Certainty test".to_owned(),
|
||||
+ description: "Execution certainty fixture".to_owned(),
|
||||
+ tags: Vec::new(),
|
||||
+ examples: Vec::new(),
|
||||
+ },
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+fn empty_schema() -> Schema {
|
||||
+ Schema {
|
||||
+ kind: SchemaKind::Object,
|
||||
+ format: None,
|
||||
+ description: None,
|
||||
+ required: true,
|
||||
+ nullable: false,
|
||||
+ default_value: None,
|
||||
+ fields: BTreeMap::new(),
|
||||
+ items: None,
|
||||
+ enum_values: Vec::new(),
|
||||
+ variants: Vec::new(),
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,5 @@
|
||||
Running tests/execution_certainty.rs (local-build/red-target/debug/deps/execution_certainty-c0ef6c3fcfc1fab0)
|
||||
running 3 tests
|
||||
test ambiguous_upstream_failures_are_unknown_only_for_dispatched_mutations ... FAILED
|
||||
test dispatch_uncertainty_allowlist_covers_uncertain_upstream_codes_and_drops_retry_delay ... FAILED
|
||||
test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
@@ -0,0 +1,60 @@
|
||||
diff --git a/tests/unit/test_check_rust_code_health.py b/tests/unit/test_check_rust_code_health.py
|
||||
index 660d147..5256d19 100644
|
||||
--- a/tests/unit/test_check_rust_code_health.py
|
||||
+++ b/tests/unit/test_check_rust_code_health.py
|
||||
@@ -41,7 +41,7 @@ class RustCodeHealthCheckTests(unittest.TestCase):
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn("checking file size limits", result.stdout)
|
||||
|
||||
- def test_fails_for_new_large_rust_file(self) -> None:
|
||||
+ def test_fails_for_new_untracked_large_rust_file_in_source_scope(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
self.prepare_root(root)
|
||||
@@ -55,6 +55,46 @@ class RustCodeHealthCheckTests(unittest.TestCase):
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("apps/demo/src/large.rs has 21 lines", result.stderr)
|
||||
|
||||
+ def test_ignores_large_rust_in_nested_bmad_worktree(self) -> None:
|
||||
+ with tempfile.TemporaryDirectory() as tmp:
|
||||
+ root = Path(tmp)
|
||||
+ self.prepare_root(root)
|
||||
+ worktree = (
|
||||
+ root
|
||||
+ / ".bmad-loop"
|
||||
+ / "runs"
|
||||
+ / "epic-1"
|
||||
+ / "worktrees"
|
||||
+ / "fixture"
|
||||
+ )
|
||||
+ worktree.mkdir(parents=True)
|
||||
+ (worktree / "large.rs").write_text(
|
||||
+ "\n".join("// line" for _ in range(21)) + "\n",
|
||||
+ encoding="utf-8",
|
||||
+ )
|
||||
+
|
||||
+ result = self.run_checker(root)
|
||||
+
|
||||
+ self.assertEqual(result.returncode, 0, result.stderr)
|
||||
+
|
||||
+ def test_ignores_rust_under_nested_target_and_node_modules(self) -> None:
|
||||
+ with tempfile.TemporaryDirectory() as tmp:
|
||||
+ root = Path(tmp)
|
||||
+ self.prepare_root(root)
|
||||
+ generated_dirs = (
|
||||
+ root / "apps" / "demo" / "target" / "generated",
|
||||
+ root / "apps" / "demo" / "src" / "node_modules" / "fixture",
|
||||
+ root / "crates" / "demo" / "node_modules" / "fixture",
|
||||
+ )
|
||||
+ large_source = "\n".join("// generated" for _ in range(21)) + "\n"
|
||||
+ for directory in generated_dirs:
|
||||
+ directory.mkdir(parents=True)
|
||||
+ (directory / "large.rs").write_text(large_source, encoding="utf-8")
|
||||
+
|
||||
+ result = self.run_checker(root)
|
||||
+
|
||||
+ self.assertEqual(result.returncode, 0, result.stderr)
|
||||
+
|
||||
def test_fails_for_large_inline_test_module(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
@@ -0,0 +1,2 @@
|
||||
Ran 5 tests in 0.341s
|
||||
FAILED (failures=2)
|
||||
@@ -0,0 +1,193 @@
|
||||
--- a/src/pool/inner.rs
|
||||
+++ b/src/pool/inner.rs
|
||||
@@ -1,3 +1,9 @@
|
||||
+// Local CranK pool patch: this file is patched from the upstream `sqlx-core`
|
||||
+// 0.9.0 source. The changes reserve `num_idle` before publishing an idle
|
||||
+// connection and bound each pool maintenance scan by the pool capacity.
|
||||
+// See ../../../../docs/dependency-patches/sqlx-core-0.9.0.md for provenance,
|
||||
+// the exact patch and the regression tests. Upstream copyright and license
|
||||
+// notices are unchanged.
|
||||
use super::connection::{Floating, Idle, Live};
|
||||
use crate::connection::ConnectOptions;
|
||||
use crate::connection::Connection;
|
||||
@@ -206,15 +212,15 @@
|
||||
|
||||
let Floating { inner: idle, guard } = floating.into_idle();
|
||||
|
||||
- if self.idle_conns.push(idle).is_err() {
|
||||
+ let published = publish_idle_connection(&self.num_idle, move || {
|
||||
+ // NOTE: we need to make sure we drop the permit *after* we push to the idle queue
|
||||
+ // don't decrease the size
|
||||
+ self.idle_conns.push(idle).map(|()| guard.release_permit())
|
||||
+ });
|
||||
+
|
||||
+ if published.is_err() {
|
||||
panic!("BUG: connection queue overflow in release()");
|
||||
}
|
||||
-
|
||||
- // NOTE: we need to make sure we drop the permit *after* we push to the idle queue
|
||||
- // don't decrease the size
|
||||
- guard.release_permit();
|
||||
-
|
||||
- self.num_idle.fetch_add(1, Ordering::AcqRel);
|
||||
}
|
||||
|
||||
/// Try to atomically increment the pool size for a new connection.
|
||||
@@ -438,6 +444,37 @@
|
||||
}
|
||||
}
|
||||
|
||||
+/// Reserves the idle-connection slot for a publication and runs `publish`.
|
||||
+///
|
||||
+/// `publish` performs the actual publication (pushing onto `idle_conns` and
|
||||
+/// releasing the semaphore permit). The `num_idle` counter is reserved *before*
|
||||
+/// `publish` so a concurrent `pop_idle` cannot underflow it between the queue
|
||||
+/// push and the counter update. If `publish` fails (the idle queue rejects the
|
||||
+/// connection), the reservation is rolled back before the error is returned to
|
||||
+/// the caller.
|
||||
+fn publish_idle_connection<F, E>(num_idle: &AtomicUsize, publish: F) -> Result<(), E>
|
||||
+where
|
||||
+ F: FnOnce() -> Result<(), E>,
|
||||
+{
|
||||
+ num_idle.fetch_add(1, Ordering::AcqRel);
|
||||
+
|
||||
+ if let Err(error) = publish() {
|
||||
+ num_idle.fetch_sub(1, Ordering::AcqRel);
|
||||
+ return Err(error);
|
||||
+ }
|
||||
+
|
||||
+ Ok(())
|
||||
+}
|
||||
+
|
||||
+/// Bounds the number of idle connections inspected per maintenance cycle.
|
||||
+///
|
||||
+/// `num_idle` can transiently exceed the number of connections actually queued
|
||||
+/// during a publication race, so the maintenance scan is capped by the pool
|
||||
+/// capacity to keep each cycle bounded.
|
||||
+fn maintenance_batch_size(num_idle: usize, capacity: usize) -> usize {
|
||||
+ cmp::min(num_idle, capacity)
|
||||
+}
|
||||
+
|
||||
impl<DB: Database> Drop for PoolInner<DB> {
|
||||
fn drop(&mut self) {
|
||||
self.mark_closed();
|
||||
@@ -545,7 +582,11 @@
|
||||
// and if we have fewer than min_connections after reaping a connection,
|
||||
// open a new one immediately. Note that other connections may be popped from
|
||||
// the queue in the meantime - that's fine, there is no harm in checking more
|
||||
- for _ in 0..pool.num_idle() {
|
||||
+ let batch_size = maintenance_batch_size(
|
||||
+ pool.num_idle(),
|
||||
+ pool.options.max_connections as usize,
|
||||
+ );
|
||||
+ for _ in 0..batch_size {
|
||||
if let Some(conn) = pool.try_acquire() {
|
||||
if is_beyond_idle_timeout(&conn, &pool.options)
|
||||
|| is_beyond_max_lifetime(&conn, &pool.options)
|
||||
@@ -621,3 +662,106 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+#[cfg(test)]
|
||||
+mod tests {
|
||||
+ use super::{maintenance_batch_size, publish_idle_connection};
|
||||
+ use crossbeam_queue::ArrayQueue;
|
||||
+ use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
+ use std::sync::{Arc, Barrier};
|
||||
+ use std::thread;
|
||||
+
|
||||
+ #[test]
|
||||
+ fn maintenance_batch_size_bounds_scan_by_capacity() {
|
||||
+ let capacity = 8;
|
||||
+
|
||||
+ assert_eq!(maintenance_batch_size(0, capacity), 0);
|
||||
+ assert_eq!(maintenance_batch_size(1, capacity), 1);
|
||||
+ assert_eq!(maintenance_batch_size(capacity, capacity), capacity);
|
||||
+ assert_eq!(maintenance_batch_size(capacity + 1, capacity), capacity);
|
||||
+ assert_eq!(maintenance_batch_size(usize::MAX, capacity), capacity);
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn publish_reserves_idle_counter_before_connection_is_visible() {
|
||||
+ const ITEM: usize = 7;
|
||||
+
|
||||
+ let queue: Arc<ArrayQueue<usize>> = Arc::new(ArrayQueue::new(4));
|
||||
+ let num_idle = Arc::new(AtomicUsize::new(0));
|
||||
+ let published = Arc::new(Barrier::new(2));
|
||||
+ let popped = Arc::new(Barrier::new(2));
|
||||
+
|
||||
+ let producer = {
|
||||
+ let queue = Arc::clone(&queue);
|
||||
+ let num_idle = Arc::clone(&num_idle);
|
||||
+ let published = Arc::clone(&published);
|
||||
+ let popped = Arc::clone(&popped);
|
||||
+ thread::spawn(move || {
|
||||
+ publish_idle_connection(num_idle.as_ref(), move || {
|
||||
+ queue
|
||||
+ .push(ITEM)
|
||||
+ .expect("queue accepts published connection");
|
||||
+ // The consumer can only pop once the connection is queued.
|
||||
+ published.wait();
|
||||
+ // Keep the closure open until the concurrent pop has happened so the
|
||||
+ // counter is observed at the exact moment the connection was visible.
|
||||
+ popped.wait();
|
||||
+ Ok::<(), ()>(())
|
||||
+ })
|
||||
+ .expect("publication succeeds");
|
||||
+ })
|
||||
+ };
|
||||
+
|
||||
+ let consumer = {
|
||||
+ let queue = Arc::clone(&queue);
|
||||
+ let num_idle = Arc::clone(&num_idle);
|
||||
+ let published = Arc::clone(&published);
|
||||
+ let popped = Arc::clone(&popped);
|
||||
+ thread::spawn(move || {
|
||||
+ published.wait();
|
||||
+ let item = queue.pop().expect("published connection is visible");
|
||||
+ let previous = num_idle.fetch_sub(1, Ordering::AcqRel);
|
||||
+ // Do not assert here: on the buggy ordering the producer would still be
|
||||
+ // waiting for this barrier and an early panic would deadlock the test.
|
||||
+ popped.wait();
|
||||
+ (item, previous)
|
||||
+ })
|
||||
+ };
|
||||
+
|
||||
+ let (item, previous) = consumer.join().expect("consumer does not panic");
|
||||
+ producer.join().expect("producer does not panic");
|
||||
+
|
||||
+ assert_eq!(item, ITEM);
|
||||
+ assert!(
|
||||
+ previous > 0,
|
||||
+ "idle counter must be reserved before the connection is visible, saw {previous}"
|
||||
+ );
|
||||
+ assert_eq!(
|
||||
+ previous, 1,
|
||||
+ "a single publication must reserve exactly one idle slot"
|
||||
+ );
|
||||
+ assert_eq!(
|
||||
+ num_idle.load(Ordering::Acquire),
|
||||
+ 0,
|
||||
+ "idle counter must settle back to zero"
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn publish_rolls_back_idle_counter_when_publication_fails() {
|
||||
+ // Production `release()` returns the rejected `Idle<DB>` as the error of
|
||||
+ // this callback; a string error exercises the same helper contract
|
||||
+ // without constructing a database connection.
|
||||
+ let num_idle = AtomicUsize::new(0);
|
||||
+
|
||||
+ let result: Result<(), &'static str> =
|
||||
+ publish_idle_connection(&num_idle, || Err("publish failed"));
|
||||
+
|
||||
+ assert_eq!(result, Err("publish failed"));
|
||||
+ assert_eq!(
|
||||
+ num_idle.load(Ordering::Acquire),
|
||||
+ 0,
|
||||
+ "failed publication must not leak an idle slot"
|
||||
+ );
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,3 @@
|
||||
Running unittests src/lib.rs (isolated-build/sqlx-target/debug/deps/sqlx_core-83f2250fda96ed55)
|
||||
running 5 tests
|
||||
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
@@ -0,0 +1,176 @@
|
||||
--- a/src/pool/inner.rs
|
||||
+++ b/src/pool/inner.rs
|
||||
@@ -206,15 +206,21 @@
|
||||
|
||||
let Floating { inner: idle, guard } = floating.into_idle();
|
||||
|
||||
- if self.idle_conns.push(idle).is_err() {
|
||||
- panic!("BUG: connection queue overflow in release()");
|
||||
- }
|
||||
+ let published = publish_idle_connection(&self.num_idle, move || {
|
||||
+ if self.idle_conns.push(idle).is_err() {
|
||||
+ panic!("BUG: connection queue overflow in release()");
|
||||
+ }
|
||||
|
||||
- // NOTE: we need to make sure we drop the permit *after* we push to the idle queue
|
||||
- // don't decrease the size
|
||||
- guard.release_permit();
|
||||
+ // NOTE: we need to make sure we drop the permit *after* we push to the idle queue
|
||||
+ // don't decrease the size
|
||||
+ guard.release_permit();
|
||||
|
||||
- self.num_idle.fetch_add(1, Ordering::AcqRel);
|
||||
+ Ok::<(), std::convert::Infallible>(())
|
||||
+ });
|
||||
+
|
||||
+ if let Err(never) = published {
|
||||
+ match never {}
|
||||
+ }
|
||||
}
|
||||
|
||||
/// Try to atomically increment the pool size for a new connection.
|
||||
@@ -438,6 +444,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
+/// Reserves the idle-connection slot for a publication and runs `publish`.
|
||||
+///
|
||||
+/// `publish` performs the actual publication (pushing onto `idle_conns` and
|
||||
+/// releasing the semaphore permit). The `num_idle` counter is updated *after*
|
||||
+/// `publish` returns, matching upstream ordering.
|
||||
+fn publish_idle_connection<F, E>(num_idle: &AtomicUsize, publish: F) -> Result<(), E>
|
||||
+where
|
||||
+ F: FnOnce() -> Result<(), E>,
|
||||
+{
|
||||
+ publish()?;
|
||||
+ num_idle.fetch_add(1, Ordering::AcqRel);
|
||||
+ Ok(())
|
||||
+}
|
||||
+
|
||||
+/// Bounds the number of idle connections inspected per maintenance cycle.
|
||||
+///
|
||||
+/// The maintenance task iterates `0..num_idle`; upstream returns the raw
|
||||
+/// counter.
|
||||
+fn maintenance_batch_size(num_idle: usize, capacity: usize) -> usize {
|
||||
+ let _ = capacity;
|
||||
+ num_idle
|
||||
+}
|
||||
+
|
||||
impl<DB: Database> Drop for PoolInner<DB> {
|
||||
fn drop(&mut self) {
|
||||
self.mark_closed();
|
||||
@@ -545,7 +574,11 @@
|
||||
// and if we have fewer than min_connections after reaping a connection,
|
||||
// open a new one immediately. Note that other connections may be popped from
|
||||
// the queue in the meantime - that's fine, there is no harm in checking more
|
||||
- for _ in 0..pool.num_idle() {
|
||||
+ let batch_size = maintenance_batch_size(
|
||||
+ pool.num_idle(),
|
||||
+ pool.options.max_connections as usize,
|
||||
+ );
|
||||
+ for _ in 0..batch_size {
|
||||
if let Some(conn) = pool.try_acquire() {
|
||||
if is_beyond_idle_timeout(&conn, &pool.options)
|
||||
|| is_beyond_max_lifetime(&conn, &pool.options)
|
||||
@@ -621,3 +654,101 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+#[cfg(test)]
|
||||
+mod tests {
|
||||
+ use super::{maintenance_batch_size, publish_idle_connection};
|
||||
+ use crossbeam_queue::ArrayQueue;
|
||||
+ use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
+ use std::sync::{Arc, Barrier};
|
||||
+ use std::thread;
|
||||
+
|
||||
+ #[test]
|
||||
+ fn maintenance_batch_size_bounds_scan_by_capacity() {
|
||||
+ let capacity = 8;
|
||||
+
|
||||
+ assert_eq!(maintenance_batch_size(0, capacity), 0);
|
||||
+ assert_eq!(maintenance_batch_size(1, capacity), 1);
|
||||
+ assert_eq!(maintenance_batch_size(capacity, capacity), capacity);
|
||||
+ assert_eq!(maintenance_batch_size(capacity + 1, capacity), capacity);
|
||||
+ assert_eq!(maintenance_batch_size(usize::MAX, capacity), capacity);
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn publish_reserves_idle_counter_before_connection_is_visible() {
|
||||
+ const ITEM: usize = 7;
|
||||
+
|
||||
+ let queue: Arc<ArrayQueue<usize>> = Arc::new(ArrayQueue::new(4));
|
||||
+ let num_idle = Arc::new(AtomicUsize::new(0));
|
||||
+ let published = Arc::new(Barrier::new(2));
|
||||
+ let popped = Arc::new(Barrier::new(2));
|
||||
+
|
||||
+ let producer = {
|
||||
+ let queue = Arc::clone(&queue);
|
||||
+ let num_idle = Arc::clone(&num_idle);
|
||||
+ let published = Arc::clone(&published);
|
||||
+ let popped = Arc::clone(&popped);
|
||||
+ thread::spawn(move || {
|
||||
+ publish_idle_connection(num_idle.as_ref(), move || {
|
||||
+ queue.push(ITEM).expect("queue accepts published connection");
|
||||
+ // The consumer can only pop once the connection is queued.
|
||||
+ published.wait();
|
||||
+ // Keep the closure open until the concurrent pop has happened so the
|
||||
+ // counter is observed at the exact moment the connection was visible.
|
||||
+ popped.wait();
|
||||
+ Ok::<(), ()>(())
|
||||
+ })
|
||||
+ .expect("publication succeeds");
|
||||
+ })
|
||||
+ };
|
||||
+
|
||||
+ let consumer = {
|
||||
+ let queue = Arc::clone(&queue);
|
||||
+ let num_idle = Arc::clone(&num_idle);
|
||||
+ let published = Arc::clone(&published);
|
||||
+ let popped = Arc::clone(&popped);
|
||||
+ thread::spawn(move || {
|
||||
+ published.wait();
|
||||
+ let item = queue.pop().expect("published connection is visible");
|
||||
+ let previous = num_idle.fetch_sub(1, Ordering::AcqRel);
|
||||
+ // Do not assert here: on the buggy ordering the producer would still be
|
||||
+ // waiting for this barrier and an early panic would deadlock the test.
|
||||
+ popped.wait();
|
||||
+ (item, previous)
|
||||
+ })
|
||||
+ };
|
||||
+
|
||||
+ let (item, previous) = consumer.join().expect("consumer does not panic");
|
||||
+ producer.join().expect("producer does not panic");
|
||||
+
|
||||
+ assert_eq!(item, ITEM);
|
||||
+ assert!(
|
||||
+ previous > 0,
|
||||
+ "idle counter must be reserved before the connection is visible, saw {previous}"
|
||||
+ );
|
||||
+ assert_eq!(
|
||||
+ previous, 1,
|
||||
+ "a single publication must reserve exactly one idle slot"
|
||||
+ );
|
||||
+ assert_eq!(
|
||||
+ num_idle.load(Ordering::Acquire),
|
||||
+ 0,
|
||||
+ "idle counter must settle back to zero"
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn publish_rolls_back_idle_counter_when_publication_fails() {
|
||||
+ let num_idle = AtomicUsize::new(0);
|
||||
+
|
||||
+ let result: Result<(), &'static str> =
|
||||
+ publish_idle_connection(&num_idle, || Err("publish failed"));
|
||||
+
|
||||
+ assert_eq!(result, Err("publish failed"));
|
||||
+ assert_eq!(
|
||||
+ num_idle.load(Ordering::Acquire),
|
||||
+ 0,
|
||||
+ "failed publication must not leak an idle slot"
|
||||
+ );
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,5 @@
|
||||
Running unittests src/lib.rs (isolated-build/sqlx-target/debug/deps/sqlx_core-83f2250fda96ed55)
|
||||
running 3 tests
|
||||
test pool::inner::tests::maintenance_batch_size_bounds_scan_by_capacity ... FAILED
|
||||
test pool::inner::tests::publish_reserves_idle_counter_before_connection_is_visible ... FAILED
|
||||
test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 2 filtered out; finished in 0.00s
|
||||
@@ -0,0 +1,15 @@
|
||||
Ran 159 tests in 32.108s
|
||||
OK
|
||||
Community scope check passed (957 files scanned)
|
||||
runtime configuration contract check passed
|
||||
config boundary check passed: files=270
|
||||
Metrics boundary check passed: files=450
|
||||
Rust boundary check passed
|
||||
config boundary check passed: files=270
|
||||
migration boundary check passed: files=297
|
||||
Metrics boundary check passed: files=450
|
||||
Execution boundary check passed
|
||||
Rust code health: checking file size limits
|
||||
Rust code health: checking large inline test modules
|
||||
Running unittests src/lib.rs (target/debug/deps/admin_api-6e005e394d271023)
|
||||
running 39 tests
|
||||
@@ -0,0 +1,32 @@
|
||||
Ran 156 tests in 34.606s
|
||||
OK
|
||||
Community scope check passed (846 files scanned)
|
||||
runtime configuration contract check passed
|
||||
config boundary check passed: files=270
|
||||
Metrics boundary check passed: files=450
|
||||
Rust boundary check passed
|
||||
config boundary check passed: files=270
|
||||
migration boundary check passed: files=297
|
||||
Metrics boundary check passed: files=450
|
||||
Execution boundary check passed
|
||||
Rust code health: checking file size limits
|
||||
Rust code health: checking large inline test modules
|
||||
Running unittests src/lib.rs (target/debug/deps/admin_api-5560a63b5bf3a0db)
|
||||
running 39 tests
|
||||
test result: ok. 39 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 35.53s
|
||||
Running unittests src/main.rs (target/debug/deps/admin_api-fae2dd814ba9ed4a)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/bin/crank-migrate.rs (target/debug/deps/crank_migrate-bbd490202e416a13)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/config_startup.rs (target/debug/deps/config_startup-55416d2755079c57)
|
||||
running 6 tests
|
||||
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 47.97s
|
||||
Running tests/dc08.rs (target/debug/deps/dc08-188f4276d178333d)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 33.68s
|
||||
Running tests/integration.rs (target/debug/deps/integration-299c6911c2a4784d)
|
||||
running 148 tests
|
||||
error: recipe `test` failed on line 45 with exit code 101
|
||||
error: recipe `verify` failed on line 71 with exit code 101
|
||||
@@ -0,0 +1,29 @@
|
||||
Ran 156 tests in 30.303s
|
||||
OK
|
||||
Community scope check passed (846 files scanned)
|
||||
runtime configuration contract check passed
|
||||
config boundary check passed: files=270
|
||||
Metrics boundary check passed: files=450
|
||||
Rust boundary check passed
|
||||
config boundary check passed: files=270
|
||||
migration boundary check passed: files=297
|
||||
Metrics boundary check passed: files=450
|
||||
Execution boundary check passed
|
||||
Rust code health: checking file size limits
|
||||
Rust code health: checking large inline test modules
|
||||
Running unittests src/lib.rs (target/debug/deps/admin_api-5560a63b5bf3a0db)
|
||||
running 39 tests
|
||||
test result: ok. 39 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 39.50s
|
||||
Running unittests src/main.rs (target/debug/deps/admin_api-fae2dd814ba9ed4a)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/bin/crank-migrate.rs (target/debug/deps/crank_migrate-bbd490202e416a13)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/config_startup.rs (target/debug/deps/config_startup-55416d2755079c57)
|
||||
running 6 tests
|
||||
test master_key_mismatch_blocks_startup_with_safe_diagnostic ... FAILED
|
||||
test real_admin_startup_runs_immediate_import_maintenance ... FAILED
|
||||
test result: FAILED. 4 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 48.46s
|
||||
error: recipe `test` failed on line 45 with exit code 101
|
||||
error: recipe `verify` failed on line 71 with exit code 101
|
||||
@@ -0,0 +1,10 @@
|
||||
Ran 156 tests in 30.045s
|
||||
OK
|
||||
Community scope check failed:
|
||||
error: vendor/sqlx-core/LICENSE-APACHE:162: forbidden marker `commercial` # community-scope: allow=commercial
|
||||
error: vendor/sqlx-core/src/config/migrate.rs:40: forbidden marker `tenant` # community-scope: allow=tenant
|
||||
error: vendor/sqlx-core/src/config/reference.toml:178: forbidden marker `tenant` # community-scope: allow=tenant
|
||||
error: vendor/sqlx-core/src/migrate/migrator.rs:101: forbidden marker `tenant` # community-scope: allow=tenant
|
||||
error: vendor/sqlx-core/src/pool/options.rs:299: forbidden marker `billing` # community-scope: allow=billing
|
||||
error: recipe `community-scope-check` failed on line 15 with exit code 1
|
||||
error: recipe `verify` failed on line 62 with exit code 1
|
||||
@@ -0,0 +1,317 @@
|
||||
Ran 159 tests in 30.098s
|
||||
OK
|
||||
Community scope check passed (957 files scanned)
|
||||
runtime configuration contract check passed
|
||||
config boundary check passed: files=270
|
||||
Metrics boundary check passed: files=450
|
||||
Rust boundary check passed
|
||||
config boundary check passed: files=270
|
||||
migration boundary check passed: files=297
|
||||
Metrics boundary check passed: files=450
|
||||
Execution boundary check passed
|
||||
Rust code health: checking file size limits
|
||||
Rust code health: checking large inline test modules
|
||||
Running unittests src/lib.rs (target/debug/deps/admin_api-6e005e394d271023)
|
||||
running 39 tests
|
||||
test result: ok. 39 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 28.57s
|
||||
Running unittests src/main.rs (target/debug/deps/admin_api-585fcfaa93e949af)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/bin/crank-migrate.rs (target/debug/deps/crank_migrate-0408cbf6cf01d000)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/config_startup.rs (target/debug/deps/config_startup-8202fb87159e5d63)
|
||||
running 6 tests
|
||||
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 38.40s
|
||||
Running tests/dc08.rs (target/debug/deps/dc08-feaa94258fc47ede)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 30.81s
|
||||
Running tests/integration.rs (target/debug/deps/integration-14490fd117dc815e)
|
||||
running 148 tests
|
||||
test result: ok. 148 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 551.53s
|
||||
Running tests/migration_command.rs (target/debug/deps/migration_command-2a2a3578be8af14a)
|
||||
running 7 tests
|
||||
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 41.55s
|
||||
Running tests/product_metrics.rs (target/debug/deps/product_metrics-ed41cfc63891409a)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 29.21s
|
||||
Running tests/request_context.rs (target/debug/deps/request_context-b45c764910742a43)
|
||||
running 5 tests
|
||||
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/request_context_parent.rs (target/debug/deps/request_context_parent-84198ba634d8385e)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/unit.rs (target/debug/deps/unit-535bb923a4ebf554)
|
||||
running 8 tests
|
||||
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_adapter_rest-d23d0bec6e21f0fc)
|
||||
running 5 tests
|
||||
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/integration.rs (target/debug/deps/integration-2c59230bfe3fad2d)
|
||||
running 35 tests
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 34 filtered out; finished in 1.54s
|
||||
test result: ok. 35 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.61s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_artifacts-41120e054a6b8bcd)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/artifact_store.rs (target/debug/deps/artifact_store-c7e63fbdd5dd7c1d)
|
||||
running 25 tests
|
||||
running 1 test
|
||||
running 1 test
|
||||
running 1 test
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 24 filtered out; finished in 0.01s
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 24 filtered out; finished in 0.01s
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 24 filtered out; finished in 0.01s
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 24 filtered out; finished in 0.01s
|
||||
test result: ok. 25 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.25s
|
||||
Running tests/artifact_store_io.rs (target/debug/deps/artifact_store_io-9336360ab7222d48)
|
||||
running 7 tests
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s
|
||||
running 1 test
|
||||
running 1 test
|
||||
running 1 test
|
||||
running 1 test
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s
|
||||
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
|
||||
Running tests/reconciliation.rs (target/debug/deps/reconciliation-26c63ea67fe01006)
|
||||
running 25 tests
|
||||
running 1 test
|
||||
running 1 test
|
||||
running 1 test
|
||||
running 1 test
|
||||
running 1 test
|
||||
test result: ok. 25 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_community_auth-ec46cb3b2738d2ce)
|
||||
running 5 tests
|
||||
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.37s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_community_mcp-29356323dae0bfbb)
|
||||
running 17 tests
|
||||
test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/integration.rs (target/debug/deps/integration-fa84ee74c1eb0674)
|
||||
running 3 tests
|
||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 32.76s
|
||||
Running tests/session_metrics.rs (target/debug/deps/session_metrics-3072f0726cec1fe8)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s
|
||||
Running tests/unit.rs (target/debug/deps/unit-dc3d3d6088e3a6f9)
|
||||
running 17 tests
|
||||
test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.16s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_config-070baa6a5d466676)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s
|
||||
Running unittests src/bin/crank-config-contract.rs (target/debug/deps/crank_config_contract-fc8434371655ba83)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/contract.rs (target/debug/deps/contract-fe6dc5cfca7a1884)
|
||||
running 18 tests
|
||||
test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
|
||||
Running tests/generation.rs (target/debug/deps/generation-d19623099785140f)
|
||||
running 3 tests
|
||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/redaction.rs (target/debug/deps/redaction-6f71674fd9f278cf)
|
||||
running 5 tests
|
||||
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_core-c400981d4f0fab5c)
|
||||
running 43 tests
|
||||
test result: ok. 43 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/correlation.rs (target/debug/deps/correlation-11defa265401293e)
|
||||
running 6 tests
|
||||
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/execution.rs (target/debug/deps/execution-159bd574119ea9a0)
|
||||
running 6 tests
|
||||
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/unit.rs (target/debug/deps/unit-b9b5fb16ddf212a0)
|
||||
running 19 tests
|
||||
test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_import-544e5bbb7f3c11b5)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/corpus.rs (target/debug/deps/corpus-6865edaf8b86098a)
|
||||
running 3 tests
|
||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.21s
|
||||
Running tests/coverage.rs (target/debug/deps/coverage-151fa5168d4102e1)
|
||||
running 7 tests
|
||||
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/http_contract_regressions.rs (target/debug/deps/http_contract_regressions-b85b270b46dff716)
|
||||
running 9 tests
|
||||
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
|
||||
Running tests/http_replay.rs (target/debug/deps/http_replay-138e3fba2e7cca29)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/legacy_http_contract.rs (target/debug/deps/legacy_http_contract-baf0c5f9f5c73128)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/normalization_details.rs (target/debug/deps/normalization_details-226545eab1f0783b)
|
||||
running 11 tests
|
||||
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
|
||||
Running tests/path_parameter_inheritance.rs (target/debug/deps/path_parameter_inheritance-0f5f0b281d25d025)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/preview.rs (target/debug/deps/preview-f2d2298c27753d5b)
|
||||
running 18 tests
|
||||
test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
|
||||
Running tests/reference_resolution.rs (target/debug/deps/reference_resolution-255e68b1c43db563)
|
||||
running 24 tests
|
||||
test result: ok. 24 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
|
||||
Running tests/schema_projection.rs (target/debug/deps/schema_projection-48470fb7231c7205)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/security_schemes.rs (target/debug/deps/security_schemes-1c1de0987b9b1d80)
|
||||
running 17 tests
|
||||
test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
|
||||
Running tests/security_scope.rs (target/debug/deps/security_scope-7c2951f629e03b7b)
|
||||
running 13 tests
|
||||
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
|
||||
Running tests/swagger2_contract.rs (target/debug/deps/swagger2_contract-40ec5f8667924e06)
|
||||
running 3 tests
|
||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/unit.rs (target/debug/deps/unit-0700eb028407de73)
|
||||
running 16 tests
|
||||
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_mapping-9d6aad2294807abb)
|
||||
running 11 tests
|
||||
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_metrics-aa0f02dc4fbfcae2)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/bin/crank-metrics-contract.rs (target/debug/deps/crank_metrics_contract-b1a91ac8968d20ad)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/cardinality.rs (target/debug/deps/cardinality-607b7cbd207baafb)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 20.50s
|
||||
Running tests/contract.rs (target/debug/deps/contract-77b674aa0e5444a3)
|
||||
running 8 tests
|
||||
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/contract_cli.rs (target/debug/deps/contract_cli-f8691aee29fa8ee3)
|
||||
running 2 tests
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/exemplars.rs (target/debug/deps/exemplars-88c3dc9405c1c046)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/overhead.rs (target/debug/deps/overhead-5bce972d208e5997)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.46s
|
||||
Running tests/schema_v1.rs (target/debug/deps/schema_v1-bea7a91372384f7f)
|
||||
running 8 tests
|
||||
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_observability-da302f9190b524cf)
|
||||
running 28 tests
|
||||
test result: ok. 28 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.34s
|
||||
Running tests/critical_errors.rs (target/debug/deps/critical_errors-c3e3722ec239539f)
|
||||
running 3 tests
|
||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/http_metrics.rs (target/debug/deps/http_metrics-4e4162b88cf3711e)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
|
||||
Running tests/incidents.rs (target/debug/deps/incidents-86bce972049d273a)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/json_logging.rs (target/debug/deps/json_logging-c0df2f37607b623e)
|
||||
running 13 tests
|
||||
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/lifecycle.rs (target/debug/deps/lifecycle-46d8c165c17407d5)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
|
||||
Running tests/metrics_signals.rs (target/debug/deps/metrics_signals-9a861803ff8e46e0)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/otlp.rs (target/debug/deps/otlp-ffcd27be7652a473)
|
||||
running 3 tests
|
||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/prometheus.rs (target/debug/deps/prometheus-9e36c99a960244db)
|
||||
running 8 tests
|
||||
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/propagation.rs (target/debug/deps/propagation-454f73fe9dc1ed10)
|
||||
running 2 tests
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/redaction.rs (target/debug/deps/redaction-8ce35caa2bed9cfb)
|
||||
running 10 tests
|
||||
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/request_correlation.rs (target/debug/deps/request_correlation-f2f83f44f2a67e78)
|
||||
running 2 tests
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_registry-aca7f3670abc3d80)
|
||||
running 14 tests
|
||||
test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.46s
|
||||
Running tests/integration.rs (target/debug/deps/integration-baf76c15612f28e7)
|
||||
running 156 tests
|
||||
test integration::observability::production_size_invocation_history_queries_stay_bounded ... ignored, production-size query-plan evidence: inserts 1,000,000 invocation_logs rows
|
||||
test result: ok. 155 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 459.35s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_runtime-aa6c1206011d24ba)
|
||||
running 42 tests
|
||||
test result: ok. 42 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
|
||||
Running tests/execution_certainty.rs (target/debug/deps/execution_certainty-a9b32f4a1af59673)
|
||||
running 3 tests
|
||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/http_contract.rs (target/debug/deps/http_contract-109053799cd46c1c)
|
||||
running 5 tests
|
||||
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
|
||||
Running tests/http_contract_wire.rs (target/debug/deps/http_contract_wire-4a305461d75a4411)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
|
||||
Running tests/integration.rs (target/debug/deps/integration-35ed06bd243cd089)
|
||||
running 11 tests
|
||||
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.33s
|
||||
Running tests/product_metrics.rs (target/debug/deps/product_metrics-91a1acee169c53ca)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running tests/stages.rs (target/debug/deps/stages-17b341afb79af23c)
|
||||
running 10 tests
|
||||
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
|
||||
Running tests/unit.rs (target/debug/deps/unit-77074afab2ab43de)
|
||||
running 13 tests
|
||||
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_schema-cae2b0d9d1382536)
|
||||
running 10 tests
|
||||
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_test_support-3c1a3207cad65f25)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/lib.rs (target/debug/deps/crank_trace-6528c24c70cb8e45)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/contract.rs (target/debug/deps/contract-3dff1581256e02c9)
|
||||
running 2 tests
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/lib.rs (target/debug/deps/mcp_server-5b408f74dfabc76b)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running unittests src/main.rs (target/debug/deps/mcp_server-3d50d83a9ccf15a5)
|
||||
running 0 tests
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||
Running tests/config_startup.rs (target/debug/deps/config_startup-af40d04cfc300de2)
|
||||
running 4 tests
|
||||
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 39.22s
|
||||
Running tests/dc08.rs (target/debug/deps/dc08-bdeb149d1f8373fe)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 28.89s
|
||||
Running tests/execution_stages.rs (target/debug/deps/execution_stages-5cc1c75032712afc)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 29.45s
|
||||
Running tests/integration.rs (target/debug/deps/integration-15c63b8c239f4af1)
|
||||
running 41 tests
|
||||
test result: ok. 41 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 135.87s
|
||||
Running tests/onboarding.rs (target/debug/deps/onboarding-e8f885aa0ca848a5)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 32.81s
|
||||
Running tests/product_metrics.rs (target/debug/deps/product_metrics-10e1573959c2ea33)
|
||||
running 1 test
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 30.24s
|
||||
Running tests/request_context.rs (target/debug/deps/request_context-83d66791ddb98021)
|
||||
running 3 tests
|
||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 41.91s
|
||||
Reference in new issue
Block a user