fix(core): a folder listed just as its create lands is listed from the database (B177)

This commit is contained in:
nvrl committed 2026-10-04 22:41:57 +02:00
1 parent 4f141c78ca
commit 0f3c06f982
5 files changed
+75 -5

No files matched your search

+31
View File
@@ -3282,6 +3282,37 @@ fn a_stand_in_keeps_its_access_once_its_create_has_landed() {
);
}
#[test]
fn a_stand_in_folder_stays_listed_once_its_create_has_landed() {
let db = Db::open_in_memory().unwrap();
db.upsert_node(&folder("parent", None, "My Files")).unwrap();
let parent = uid("parent").to_string();
let lid = db.add_local_row(&parent, "dir", true, 1).unwrap();
let local = local_uid(lid);
let stand_in = NodeUid::new(VolumeId::from("local"), LinkId::from(lid.to_string()));
let mut node = folder("new", Some("parent"), "dir");
node.uid = stand_in.clone();
db.upsert_node(&node).unwrap();
db.set_listed(&stand_in, true).unwrap();
let real = uid("real").to_string();
let (id, _) = db
.enqueue_op(&op_on(OP_MKDIR, &local, Some(&parent)))
.unwrap();
db.claim_next_due_op(1).unwrap().unwrap();
db.finish_create(id, None, &landing(&local, &real, &parent, "dir"), |_| None)
.unwrap();
// The tree still names the folder by its stand-in for a moment; a listing
// asked by it must not go to Drive, which has never heard of it.
assert!(
db.children_if_listed(&stand_in)
.unwrap()
.is_some_and(|kids| kids.is_empty())
);
db.set_listed(&stand_in, false).unwrap();
assert!(db.children_if_listed(&uid("real")).unwrap().is_none());
}
#[test]
fn a_node_queued_under_both_its_uids_is_sent_one_op_at_a_time() {
let db = Db::open_in_memory().unwrap();