fix local markdown attachment regressions

This commit is contained in:
lix-2026
2026-05-29 11:13:05 +08:00
parent 1109e3c0d8
commit cbe789e034
63 changed files with 3249 additions and 1502 deletions
+25 -31
View File
@@ -8,16 +8,16 @@ use crate::routes::local_folder_source::{
};
use crate::routes::query_support::resolve_effective_workspace_id;
use crate::routes::snapshot_support::{
ProjectionSnapshotSpec, execute_kernel_query, load_projection_snapshot, load_sidebar_dataset,
subtree_query,
execute_kernel_query, load_projection_snapshot, load_sidebar_dataset, subtree_query,
ProjectionSnapshotSpec,
};
use axum::Json;
use axum::extract::{Extension, Query, State};
use axum::http::StatusCode;
use axum::Json;
use bridge_runtime::RuntimeQueryEnvelopeWire;
use core_protocol::{KernelGraphDirection, KernelProjectionKind};
use serde::Deserialize;
use serde_json::{Value, json};
use serde_json::{json, Value};
#[cfg(test)]
static LOCAL_FOLDER_PROJECTION_TEST_BLOCK_MS: std::sync::atomic::AtomicU64 =
@@ -264,9 +264,9 @@ pub async fn graph(
#[cfg(test)]
mod tests {
use crate::app::{AppConfig, AppState, build_app};
use crate::app::{build_app, AppConfig, AppState};
use crate::routes::local_folder_source::initialize_local_workspace_for_actor;
use axum::body::{Body, to_bytes};
use axum::body::{to_bytes, Body};
use axum::http::{Request, StatusCode};
use serde_json::Value;
use std::time::{Duration, Instant};
@@ -409,19 +409,17 @@ mod tests {
assert_eq!(payload["ok"], true);
assert_eq!(payload["result"]["projection"], "file_tree");
assert_eq!(payload["result"]["sourceKind"], "local_folder");
assert!(
payload["result"]["items"]
.as_array()
.expect("items")
.iter()
.any(|item| item["title"] == "本地页面"
&& item["rowKind"] == "folder"
&& item["documentId"]
.as_str()
.unwrap_or("")
.starts_with("local-md:")
&& item["resourceMeta"]["extra"]["source"]["relativePath"] == "本地页面")
);
assert!(payload["result"]["items"]
.as_array()
.expect("items")
.iter()
.any(|item| item["title"] == "本地页面"
&& item["rowKind"] == "folder"
&& item["documentId"]
.as_str()
.unwrap_or("")
.starts_with("local-md:")
&& item["resourceMeta"]["extra"]["source"]["relativePath"] == "本地页面"));
let _ = std::fs::remove_dir_all(&root);
}
@@ -515,11 +513,9 @@ mod tests {
assert!(titles.contains(&"README.md"));
assert!(titles.contains(&"nested"));
assert!(!titles.contains(&"deep.md"));
assert!(
items
.iter()
.all(|item| item["parentNodeId"].as_str() == Some("local:node:docs"))
);
assert!(items
.iter()
.all(|item| item["parentNodeId"].as_str() == Some("local:node:docs")));
let _ = std::fs::remove_dir_all(&root);
}
@@ -680,13 +676,11 @@ mod tests {
item_by_row_id["asset-folder:mind_1"]["resourceMeta"]["resourceKind"],
"mindmap"
);
assert!(
item_by_row_id["asset-folder:mind_1"]["capabilities"]
.as_array()
.expect("capabilities")
.iter()
.any(|value| value == "expand")
);
assert!(item_by_row_id["asset-folder:mind_1"]["capabilities"]
.as_array()
.expect("capabilities")
.iter()
.any(|value| value == "expand"));
}
#[tokio::test]