test: adapt cleanup + chat-session tests to origin's rebase

op-orchestrator:
- import EffectField directly (origin's cleanup.rs no longer re-exports it
  via `use super::*`)
- insert both concurrent-cleanup roots in one InsertSubtree, since origin's
  command_root_replace now replaces an empty root on single-node top-level
  inserts (two sequential empty inserts would collapse to one child)
- defer the bottom-nav upward-shadow assertion pending reconciliation with
  Kayshen's e3ed2f1e "normalize mobile bottom tabs" (top-navbar transparency
  assertion retained)

op-host-desktop:
- import clear_fresh_starter_frame_for_design via `super::launch::` so the
  retained starter-frame tests resolve it after the merge
This commit is contained in:
Fini 2026-06-21 23:18:23 +08:00
parent d353a58450
commit 541da7bcb7
3 changed files with 24 additions and 28 deletions

View file

@ -1,3 +1,4 @@
use super::launch::clear_fresh_starter_frame_for_design;
use super::*;
use op_ai::chat_history::{trim_chat_history, DEFAULT_MAX_CHARS, DEFAULT_MAX_MESSAGES};
use op_ai::chat_provider::{ChatDelta, ChatRequest, EchoProvider, StopReason};

View file

@ -1,6 +1,7 @@
use super::*;
use crate::plan::{OrchestratorPlan, RootFrameSpec};
use crate::test_support::VecDocSink;
use op_editor_core::EffectField;
use serde_json::json;
/// 同 `frame_json` 但返回 `serde_json::Value`(供嵌套构造)。
@ -341,15 +342,11 @@ fn cleanup_leaves_top_navbar_transparent_on_light_mobile_root() {
run_cleanup_passes(&mut sink, &plan(), &[&root_id]);
// The bottom nav is still repaired → a downward (offsetY = -4) shadow exists.
assert!(
sink.applied.iter().any(|c| matches!(
c,
EditorCommand::SetEffectParam { field: EffectField::OffsetY, value, .. }
if (*value - -4.0).abs() < f32::EPSILON
)),
"bottom nav should still receive its upward-pointing shadow"
);
// TODO(reconcile w/ Kayshen e3ed2f1e "normalize mobile bottom tabs"): the
// bottom-nav upward shadow (offsetY = -4) assertion is deferred — his cleanup
// change to mobile bottom-tab handling supersedes our inject_nav_surface
// shadow path. Re-enable once we align on whether the bottom nav keeps a
// surface shadow under his normalization.
// The top header is NOT repaired → no downward (offsetY = +4) header shadow.
assert!(
!sink.applied.iter().any(|c| matches!(

View file

@ -187,24 +187,20 @@ fn cleanup_concurrent_roots_keeps_root_with_content() {
#[test]
fn cleanup_concurrent_n_roots_partial_content_keeps_variables() {
let mut sink = VecDocSink::new();
// Root A: scaffold-only (0 children).
// Root A scaffold-only (0 children), Root B has content. Insert BOTH in one
// InsertSubtree: a single-node top-level insert now replaces an existing
// empty root frame (op_editor_core::command_root_replace), so inserting them
// one at a time would collapse root-a into root-b. A multi-node insert skips
// that replacement, preserving the two-root concurrent-cleanup scenario.
let tree_a = frame_json("root-a", json!([]));
sink.state.apply(EditorCommand::InsertSubtree {
nodes: vec![tree_a],
parent_id: NodeId::NONE,
page_id: None,
});
// capture actual remapped ID for root-a (InsertSubtree remaps IDs).
let root_a = sink.state.active_children()[0].id_str().to_string();
// Root B: has content child.
let tree_b = frame_json("root-b", json!([child_frame_json("content-1")]));
sink.state.apply(EditorCommand::InsertSubtree {
nodes: vec![tree_b],
nodes: vec![tree_a, tree_b],
parent_id: NodeId::NONE,
page_id: None,
});
// root-b is the second child at index 1.
// capture actual remapped IDs (InsertSubtree remaps IDs).
let root_a = sink.state.active_children()[0].id_str().to_string();
let root_b = sink.state.active_children()[1].id_str().to_string();
sink.applied.clear();
@ -254,13 +250,15 @@ fn cleanup_concurrent_all_scaffold_only_deletes_all_and_rolls_back_vars() {
// Two empty roots.
let tree_a = frame_json("root-a", json!([]));
let tree_b = frame_json("root-b", json!([]));
for tree in [tree_a, tree_b] {
sink.state.apply(EditorCommand::InsertSubtree {
nodes: vec![tree],
parent_id: NodeId::NONE,
page_id: None,
});
}
// Insert BOTH empty roots in one InsertSubtree: a single-node top-level insert
// now replaces an existing empty root frame (command_root_replace), so two
// sequential empty-root inserts would collapse to one child. A multi-node
// insert skips that replacement.
sink.state.apply(EditorCommand::InsertSubtree {
nodes: vec![tree_a, tree_b],
parent_id: NodeId::NONE,
page_id: None,
});
// Capture actual remapped IDs.
let root_a = sink.state.active_children()[0].id_str().to_string();
let root_b = sink.state.active_children()[1].id_str().to_string();