feat: 收口 Rust Web 3000 主链

This commit is contained in:
lix-2026
2026-05-11 13:16:34 +08:00
parent 7f3f7d4e2f
commit 17c003976b
61 changed files with 2090 additions and 2256 deletions
@@ -372,6 +372,18 @@ fn convex_command_args_for_plan(plan: &RuntimeCommandExecutionPlan) -> Value {
map.remove("domainEventPlans");
}
}
if plan.command_name == "mindmap.command.apply" {
if let Value::Object(map) = &mut args {
// Convex mindmaps:applyCommand 仍只接收 blob substrate 写入所需字段;
// rootNodeId/projectionRevision/canonicalCommand 属于 Rust command envelope 语义。
map.remove("rootNodeId");
map.remove("projectionRevision");
map.remove("canonicalCommand");
if let Some(document_id) = map.remove("documentId") {
map.insert("docId".into(), document_id);
}
}
}
args
}
@@ -835,6 +847,45 @@ mod tests {
);
}
#[test]
fn convex_command_args_adapts_mindmap_command_apply_for_legacy_mutation() {
let plan = RuntimeCommandExecutionPlan {
command_name: "mindmap.command.apply".into(),
command_id: "cmd_mindmap_1".into(),
function_name: "mindmaps:applyCommand".into(),
workspace_id: Some("ws_1".into()),
request_id: "req_1".into(),
trace_id: "trace_1".into(),
actor_id: "actor_1".into(),
idempotency_key: None,
source: json!({}),
payload_json: "{}".into(),
args_json: json!({
"documentId": "doc_1",
"mindmapId": "mind_1",
"rootNodeId": "root",
"commands": [
{"type": "renameNode", "mapId": "mind_1", "nodeId": "root", "title": "KMIND 已编辑"}
],
"projectionRevision": 3,
"canonicalCommand": "mindmap.command.apply",
}),
};
let args = convex_command_args_for_plan(&plan);
assert_eq!(
args,
json!({
"docId": "doc_1",
"mindmapId": "mind_1",
"commands": [
{"type": "renameNode", "mapId": "mind_1", "nodeId": "root", "title": "KMIND 已编辑"}
],
})
);
}
#[test]
fn build_authorization_prefers_forwarded_authorization() {
let mut headers = HeaderMap::new();