feat(tree): complete rust family runtime checklist
- add tree shell runtime artifact contracts and page/filetree/picker runtime reducers - sink tree.subtree.move write operation through Rust and formalize command event plans - harden file tree search projection contract and route thin-proxy boundaries - record completed harness tasks and move design docs into process/done
This commit is contained in:
@@ -26,6 +26,7 @@ pub struct TreeShellRendererInput {
|
||||
pub excluded_picker_ids: BTreeSet<String>,
|
||||
pub picker_state_reducer: Option<PickerStateReducerContract>,
|
||||
pub command_dispatcher: TreeShellCommandDispatcher,
|
||||
pub runtime_artifact: TreeShellRuntimeArtifactBoundary,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
@@ -35,6 +36,41 @@ pub struct TreeShellCommandDispatcher {
|
||||
pub command_names: BTreeSet<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct TreeShellRuntimeArtifactBoundary {
|
||||
pub contract_name: &'static str,
|
||||
pub input_fields: BTreeSet<&'static str>,
|
||||
pub output_channels: BTreeSet<&'static str>,
|
||||
pub event_kinds: BTreeSet<&'static str>,
|
||||
}
|
||||
|
||||
impl Default for TreeShellRuntimeArtifactBoundary {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
contract_name: "rust_tree_shell_runtime_artifact_v1",
|
||||
input_fields: BTreeSet::from([
|
||||
"rendererInput",
|
||||
"projectionItems",
|
||||
"expandedIds",
|
||||
"selectedRowIds",
|
||||
"activePickerItem",
|
||||
"focusedId",
|
||||
]),
|
||||
output_channels: BTreeSet::from(["domPatch", "intentEvent", "commandDispatchEvent"]),
|
||||
event_kinds: BTreeSet::from([
|
||||
"focus",
|
||||
"keyboard",
|
||||
"expandCollapse",
|
||||
"selection",
|
||||
"contextMenu",
|
||||
"dragDrop",
|
||||
"pick",
|
||||
]),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TreeShellRendererInput {
|
||||
pub fn page(input: PageTreeRendererInput) -> Self {
|
||||
Self {
|
||||
@@ -49,6 +85,7 @@ impl TreeShellRendererInput {
|
||||
excluded_picker_ids: BTreeSet::new(),
|
||||
picker_state_reducer: None,
|
||||
command_dispatcher: input.command_dispatcher,
|
||||
runtime_artifact: TreeShellRuntimeArtifactBoundary::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +102,7 @@ impl TreeShellRendererInput {
|
||||
excluded_picker_ids: BTreeSet::new(),
|
||||
picker_state_reducer: None,
|
||||
command_dispatcher: input.command_dispatcher,
|
||||
runtime_artifact: TreeShellRuntimeArtifactBoundary::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +119,7 @@ impl TreeShellRendererInput {
|
||||
excluded_picker_ids: input.excluded_picker_ids,
|
||||
picker_state_reducer: Some(PickerStateReducerContract::default()),
|
||||
command_dispatcher: input.command_dispatcher,
|
||||
runtime_artifact: TreeShellRuntimeArtifactBoundary::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,8 +152,8 @@ pub struct PickerRendererInput {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{
|
||||
FileTreeRendererInput, PageTreeRendererInput, PickerRendererInput, TreeShellCommandDispatcher,
|
||||
TreeShellRendererInput, TreeShellRendererMode,
|
||||
FileTreeRendererInput, PageTreeRendererInput, PickerRendererInput,
|
||||
TreeShellCommandDispatcher, TreeShellRendererInput, TreeShellRendererMode,
|
||||
};
|
||||
use crate::tree_shell::filetree_selection::FileTreeSelectionState;
|
||||
use std::collections::BTreeSet;
|
||||
@@ -158,7 +197,10 @@ mod tests {
|
||||
});
|
||||
assert_eq!(filetree.mode, TreeShellRendererMode::FileTree);
|
||||
assert_eq!(filetree.focused_id.as_deref(), Some("asset:a"));
|
||||
assert!(filetree.filetree_selection.selected_row_ids.contains("asset:a"));
|
||||
assert!(filetree
|
||||
.filetree_selection
|
||||
.selected_row_ids
|
||||
.contains("asset:a"));
|
||||
assert!(filetree.page_focus_keyboard_reducer.is_none());
|
||||
assert_eq!(
|
||||
filetree
|
||||
@@ -188,4 +230,36 @@ mod tests {
|
||||
Some("rust_picker_state_reducer_v1")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tree_shell_renderer_input_exposes_runtime_artifact_boundary() {
|
||||
let page = TreeShellRendererInput::page(PageTreeRendererInput {
|
||||
projection_item_ids: vec!["doc:root".into()],
|
||||
expanded_ids: set(&["doc:root"]),
|
||||
focused_id: Some("doc:root".into()),
|
||||
command_dispatcher: dispatcher(),
|
||||
});
|
||||
|
||||
let artifact = page.runtime_artifact;
|
||||
assert_eq!(
|
||||
artifact.contract_name,
|
||||
"rust_tree_shell_runtime_artifact_v1"
|
||||
);
|
||||
assert!(artifact.input_fields.contains("rendererInput"));
|
||||
assert!(artifact.input_fields.contains("projectionItems"));
|
||||
assert!(artifact.input_fields.contains("expandedIds"));
|
||||
assert!(artifact.input_fields.contains("selectedRowIds"));
|
||||
assert!(artifact.input_fields.contains("activePickerItem"));
|
||||
assert!(artifact.input_fields.contains("focusedId"));
|
||||
assert!(artifact.output_channels.contains("domPatch"));
|
||||
assert!(artifact.output_channels.contains("intentEvent"));
|
||||
assert!(artifact.output_channels.contains("commandDispatchEvent"));
|
||||
assert!(artifact.event_kinds.contains("focus"));
|
||||
assert!(artifact.event_kinds.contains("keyboard"));
|
||||
assert!(artifact.event_kinds.contains("expandCollapse"));
|
||||
assert!(artifact.event_kinds.contains("selection"));
|
||||
assert!(artifact.event_kinds.contains("contextMenu"));
|
||||
assert!(artifact.event_kinds.contains("dragDrop"));
|
||||
assert!(artifact.event_kinds.contains("pick"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user