Compare commits

..
55 changed files with 2209 additions and 1526 deletions
+6 -60
View File
@@ -340,18 +340,6 @@ pub(crate) fn diagnostic(source: &str, error: Error) -> Diagnostic {
},
}
}
pub(crate) fn diagnostic_with_issue(
source: &str,
error: Error,
issue: Option<validation::Issue>,
) -> Diagnostic {
let mut result = diagnostic(source, error);
if let Some(issue) = issue {
result.object_id = issue.element;
result.field = issue.field;
}
result
}
fn reserved(word: &str) -> bool {
crate::reserved_alias(word)
|| declaration_kind(word).is_some()
@@ -634,7 +622,6 @@ fn parse_document(source: &str, limits: ParseLimits) -> Result<ParsedDocument, V
if tokens.get(1).is_some_and(|t| t.text(source) == "2") {
return v2_source::parse(source, tokens, limits);
}
let mut migration_issue = None;
Parser {
source,
tokens,
@@ -642,8 +629,8 @@ fn parse_document(source: &str, limits: ParseLimits) -> Result<ParsedDocument, V
value_depth: 0,
limits,
}
.document(&mut migration_issue)
.map_err(|e| vec![diagnostic_with_issue(source, e, migration_issue)])
.document()
.map_err(|e| vec![diagnostic(source, e)])
}
fn offset_for(source: &str, line: usize, column: usize) -> usize {
let mut offset = 0;
@@ -1462,10 +1449,7 @@ impl Parser<'_> {
},
}
}
fn document(
&mut self,
migration_issue: &mut Option<validation::Issue>,
) -> Result<ParsedDocument, Error> {
fn document(&mut self) -> Result<ParsedDocument, Error> {
let unit = self.unit(true, false)?;
let header = unit.header.expect("entry header");
let mut aliases = BTreeMap::from([(header.project.alias.clone(), header.project.id)]);
@@ -1492,14 +1476,9 @@ impl Parser<'_> {
.map(|(key, span)| ((d.id, key.clone()), span.start)),
);
}
let decoded = resolve_declarations(
header.project,
&unit.declarations,
&aliases,
self.limits,
migration_issue,
)
.map_err(|(_, error)| error)?;
let decoded =
resolve_declarations(header.project, &unit.declarations, &aliases, self.limits)
.map_err(|(_, error)| error)?;
Ok(ParsedDocument {
project: decoded.project,
migration: decoded.migration,
@@ -1703,7 +1682,6 @@ pub(crate) fn resolve_declarations(
declarations: &[Declaration],
aliases: &BTreeMap<String, Id>,
limits: ParseLimits,
migration_issue: &mut Option<validation::Issue>,
) -> Result<crate::persistence::DecodeResult, (usize, Error)> {
let legacy = project.schema_version == 3;
let mut legacy_elements = serde_json::Map::new();
@@ -2011,38 +1989,6 @@ pub(crate) fn resolve_declarations(
crate::persistence::migrate_v6(project, limits)
})
.map_err(|error| {
// These frozen admission checks formerly ran in final validation.
// Keep their diagnostic code and reference location after moving
// them before schema normalization.
if let crate::persistence::FileError::Model { issues, .. } = &error
&& let Some(issue) = issues.first()
&& let Some(code) = match issue.code.as_str() {
"diagram_layer" => Some("diagram_layer"),
"view_options" => Some("view_options"),
_ => None,
}
{
let index = issue
.element
.and_then(|id| declarations.iter().position(|d| d.id == id))
.unwrap_or(usize::MAX);
let offset = declarations.get(index).map_or(0, |d| {
issue
.field
.as_ref()
.and_then(|field| d.field_spans.get(field))
.map_or(d.offset, |span| span.start)
});
*migration_issue = Some(issue.clone());
return (
index,
Error {
code,
offset,
message: issue.message.clone(),
},
);
}
(
usize::MAX,
Error {
+3 -9
View File
@@ -69,8 +69,8 @@ impl Project4 {
}
crate::persistence::check_pre6_relations(self.relations.values())?;
crate::persistence::check_pre6_elements(self.elements.values())?;
let mut project = Project {
schema_version: self.schema_version,
Ok(Project {
schema_version: SCHEMA_VERSION,
id: self.id,
alias: self.alias,
name: self.name,
@@ -84,11 +84,7 @@ impl Project4 {
.into_iter()
.map(|(id, trace)| (id, trace.into()))
.collect(),
};
// Schema3's adapter also enters here, without calling `finish`.
crate::persistence::check_pre7_diagram_admission(&project)?;
project.schema_version = SCHEMA_VERSION;
Ok(project)
})
}
}
@@ -108,8 +104,6 @@ pub(crate) fn review_defaults(project: &Project, report: &mut MigrationReport) {
}
pub(crate) fn finish(mut project: Project, limits: ParseLimits) -> Result<DecodeResult, FileError> {
// Source4 enters here directly rather than through `Project4`.
crate::persistence::check_pre7_diagram_admission(&project)?;
crate::persistence::check_pre6_relations(project.relations.values())?;
crate::persistence::check_pre6_elements(project.elements.values())?;
project.schema_version = SCHEMA_VERSION;
-46
View File
@@ -341,50 +341,6 @@ pub(crate) fn check_pre6_baseline(baseline: &SemanticBaseline) -> Result<(), Fil
}
Ok(())
}
/// Frozen sources 3–6 admit opposite-layer placements and visibility references
/// only in Traceability. Check before migration discards the advertised version;
/// current ordinary projections may retain these records as latent presentation.
pub(crate) fn check_pre7_diagram_admission(project: &Project) -> Result<(), FileError> {
let mut issues = Vec::new();
for diagram in project.diagrams.values() {
let option_issues = if diagram.projection == ProjectionKind::Traceability {
crate::view_options::validate_options_cross_layer(project, &diagram.view_options)
} else {
crate::view_options::validate_options(project, diagram.layer, &diagram.view_options)
};
for issue in option_issues {
validation::error(
&mut issues,
diagram.id,
"view_options",
issue.field,
issue.message,
);
}
for node in diagram.nodes.values() {
if !project.elements.get(&node.element).is_some_and(|element| {
diagram.projection == ProjectionKind::Traceability
|| element.layer() == diagram.layer
}) {
validation::error(
&mut issues,
node.id,
"diagram_layer",
"element",
"Diagram nodes reference existing elements in the selected layer.",
);
}
}
}
if let Some(issue) = issues.into_iter().next() {
return Err(FileError::Model {
message: issue.message.clone(),
issues: vec![issue],
});
}
Ok(())
}
pub(crate) fn migrate_v5(
mut project: Project,
limits: crate::language::ParseLimits,
@@ -392,7 +348,6 @@ pub(crate) fn migrate_v5(
if project.schema_version != 5 {
return Err(FileError::Invalid("Expected schema_version 5.".into()));
}
check_pre7_diagram_admission(&project)?;
check_pre6_relations(project.relations.values())?;
check_pre6_elements(project.elements.values())?;
for baseline in project
@@ -465,7 +420,6 @@ pub(crate) fn migrate_v6(
if project.schema_version != 6 {
return Err(FileError::Invalid("Expected schema_version 6.".into()));
}
check_pre7_diagram_admission(&project)?;
reject_source7_fields(&serde_json::to_value(&project)?).map_err(FileError::Invalid)?;
limits.check_model(&project).map_err(FileError::Limit)?;
project.schema_version = SCHEMA_VERSION;
-1
View File
@@ -85,7 +85,6 @@ pub(crate) fn parents(p: &Project, d: &Diagram) -> BTreeMap<Id, Option<Id>> {
.filter(|n| {
p.elements.get(&n.element).is_some_and(|e| {
e.kind() != Kind::Port
&& (d.projection == ProjectionKind::Traceability || e.layer() == d.layer)
&& d.projection.includes(e.kind())
&& d.projection
.state_machine()
-11
View File
@@ -589,17 +589,6 @@ fn apply_command(
.map(|d| d.id)
.ok_or_else(missing)?;
if source != *diagram {
let destination = &p.diagrams[diagram];
let element = p.diagrams[&source].nodes[node].element;
if destination.projection != ProjectionKind::Traceability
&& p.elements
.get(&element)
.is_none_or(|e| e.layer() != destination.layer)
{
return Err(ModelError(
"Move the placement to a view in its layer or a traceability view.".into(),
));
}
let placement = p
.diagrams
.get_mut(&source)
+10 -20
View File
@@ -573,26 +573,16 @@ fn compile_once(
span,
}),
};
let mut migration_issue = None;
let decoded = language::resolve_declarations(
header.project,
&declarations,
&aliases,
limits.model,
&mut migration_issue,
)
.map_err(|(index, error)| {
let path = declaration_paths.get(index).unwrap_or(&bundle.entry);
vec![SourceDiagnostic {
path: path.clone(),
diagnostic: language::diagnostic_with_issue(
&bundle.files[path],
error,
migration_issue,
),
related: Vec::new(),
}]
})?;
let decoded =
language::resolve_declarations(header.project, &declarations, &aliases, limits.model)
.map_err(|(index, error)| {
let path = declaration_paths.get(index).unwrap_or(&bundle.entry);
vec![SourceDiagnostic {
path: path.clone(),
diagnostic: language::diagnostic(&bundle.files[path], error),
related: Vec::new(),
}]
})?;
let diagnostics = model_diagnostics(bundle, &index, &decoded.project);
let errors: Vec<_> = diagnostics
.iter()
+7 -12
View File
@@ -620,14 +620,11 @@ pub fn validate(p: &Project) -> Vec<Issue> {
text(&mut out, d.id, "name", &d.name);
text(&mut out, d.id, "description", &d.description);
crate::scenario_layout::validate_diagram(p, d, &mut out);
// Ordinary projections are reversible filters over the same authored view.
// Retain opposite-layer visibility choices when leaving Traceability.
let option_issues =
if d.projection.state_machine().is_none() && d.projection.scenario().is_none() {
crate::view_options::validate_options_cross_layer(p, &d.view_options)
} else {
crate::view_options::validate_options(p, d.layer, &d.view_options)
};
let option_issues = if d.projection == ProjectionKind::Traceability {
crate::view_options::validate_options_cross_layer(p, &d.view_options)
} else {
crate::view_options::validate_options(p, d.layer, &d.view_options)
};
for issue in option_issues {
error(&mut out, d.id, "view_options", issue.field, issue.message);
}
@@ -801,10 +798,8 @@ pub fn validate(p: &Project) -> Vec<Issue> {
);
}
match p.elements.get(&n.element) {
Some(e)
if (d.projection.state_machine().is_none()
&& d.projection.scenario().is_none())
|| e.layer() == d.layer => {}
Some(e) if d.projection == ProjectionKind::Traceability || e.layer() == d.layer => {
}
_ => error(
&mut out,
n.id,
+1 -3
View File
@@ -218,9 +218,7 @@ pub fn validate_options(p: &Project, layer: Layer, options: &ViewOptions) -> Vec
validate_options_in(p, Some(layer), options)
}
/// Ordinary saved views retain references from either architecture layer so
/// projection changes preserve authored visibility choices. Projection decides
/// which layer is visible; typed State/Scenario views use layer-scoped validation.
/// Traceability views admit references from either architecture layer.
pub fn validate_options_cross_layer(p: &Project, options: &ViewOptions) -> Vec<OptionError> {
validate_options_in(p, None, options)
}
@@ -1,205 +0,0 @@
//! Current latent presentation must not broaden frozen source/JSON admission.
use oa_core::{view_options::*, *};
fn legacy_json(project: &Project, version: u32) -> Vec<u8> {
let mut value = serde_json::to_value(project).unwrap();
value["schema_version"] = version.into();
for diagram in value["diagrams"].as_object_mut().unwrap().values_mut() {
let fields = diagram.as_object_mut().unwrap();
fields.remove("layout");
if version < 6 {
fields.remove("view_options");
}
}
serde_json::to_vec(&value).unwrap()
}
fn model_issue(error: persistence::FileError) -> validation::Issue {
match error {
persistence::FileError::Model { mut issues, .. } => issues.remove(0),
other => panic!("Expected a located model issue, got {other:?}"),
}
}
#[test]
fn frozen_3_through_6_reject_cross_layer_nodes_but_keep_mixed_traceability() {
let node_id = Id::parse_str("00000000-0000-4000-8000-000000000004").unwrap();
for version in 3..=6 {
let source = format!(
"arcadia {version}; project compat \"Compatibility\" id \"00000000-0000-4000-8000-000000000001\" {{\n\
sa_function work \"Counterpart\" id \"00000000-0000-4000-8000-000000000002\" {{}}\n\
diagram view \"OA concern\" id \"00000000-0000-4000-8000-000000000003\" {{ layer Oa; projection Traceability; }}\n\
node occurrence id \"00000000-0000-4000-8000-000000000004\" {{ diagram @view; element @work; }}\n}}"
);
let mixed = language::parse(&source).unwrap();
assert_eq!(
persistence::decode(&legacy_json(&mixed, version)).unwrap(),
mixed
);
let ordinary = source.replace("projection Traceability", "projection Overview");
let same_layer = ordinary.replace("layer Oa", "layer Sa");
let ordinary_project = language::parse(&same_layer).unwrap();
assert_eq!(
persistence::decode(&legacy_json(&ordinary_project, version)).unwrap(),
ordinary_project
);
let errors = language::parse(&ordinary).unwrap_err();
// Source3 already reported migration errors with the offending location.
let code = if version == 3 {
"migration_error"
} else {
"diagram_layer"
};
assert!(
errors.iter().any(|error| error.code == code
&& error.line == 4
&& error.message.contains("selected layer")),
"{version}: {errors:?}"
);
let mut latent = mixed.clone();
let diagram = latent.diagrams.values_mut().next().unwrap();
diagram.projection = ProjectionKind::Overview;
let node = diagram.nodes.values().next().unwrap().id;
assert_eq!(node, node_id);
if version >= 4 {
let diagnostic = errors
.iter()
.find(|error| error.code == "diagram_layer")
.unwrap();
assert_eq!(diagnostic.object_id, Some(node_id));
assert_eq!(diagnostic.field.as_deref(), Some("element"));
let bundle = source_project::SourceBundle {
entry: "model.arcadia".into(),
files: std::collections::BTreeMap::from([("model.arcadia".into(), ordinary)]),
};
let errors =
source_project::compile_bundle(&bundle, source_project::ProjectLimits::default())
.unwrap_err();
let diagnostic = &errors
.iter()
.find(|error| error.diagnostic.code == "diagram_layer")
.unwrap()
.diagnostic;
assert_eq!(diagnostic.object_id, Some(node_id));
assert_eq!(diagnostic.field.as_deref(), Some("element"));
}
let issue = model_issue(persistence::decode(&legacy_json(&latent, version)).unwrap_err());
assert_eq!(issue.code, "diagram_layer");
assert_eq!(issue.element, Some(node));
assert_eq!(issue.field.as_deref(), Some("element"));
// The exact same record is valid under the current presentation contract.
assert_eq!(language::parse(&language::format(&latent)).unwrap(), latent);
assert_eq!(
persistence::decode(&serde_json::to_vec(&latent).unwrap()).unwrap(),
latent
);
let mut dangling = mixed;
dangling
.diagrams
.values_mut()
.next()
.unwrap()
.nodes
.values_mut()
.next()
.unwrap()
.element = Id::parse_str("00000000-0000-4000-8000-000000000005").unwrap();
let issue = model_issue(persistence::decode(&legacy_json(&dangling, version)).unwrap_err());
assert_eq!(issue.code, "diagram_layer");
assert_eq!(issue.element, Some(node));
assert_eq!(issue.field.as_deref(), Some("element"));
}
}
#[test]
fn frozen_6_checks_every_layer_sensitive_saved_selector_before_upgrade() {
let mut project = Project::empty();
let a = project
.add_element(Kind::Activity, Layer::Oa, "A", None)
.unwrap();
let b = project
.add_element(Kind::Activity, Layer::Oa, "B", None)
.unwrap();
let edge = project.relate(RelationKind::Interaction, "Interaction", a, b);
let category = project
.add_element(Kind::ExchangeCategory, Layer::Oa, "Work category", None)
.unwrap();
let participant_category = project
.add_element(
Kind::ExchangeCategory,
Layer::Oa,
"Participant category",
None,
)
.unwrap();
*project
.elements
.get_mut(&participant_category)
.unwrap()
.shared_mut()
.unwrap() = SharedBody::ExchangeCategory {
family: ExchangeFamily::Participant,
exchanges: vec![],
};
let context = project
.add_element(Kind::Process, Layer::Oa, "Process", None)
.unwrap();
let diagram = project.ensure_diagram(Layer::Sa);
for (field, options) in [
(
"hidden_edges",
ViewOptions {
hidden_edges: vec![edge],
..Default::default()
},
),
(
"work_categories",
ViewOptions {
work_categories: CategorySelection::Any(vec![category]),
..Default::default()
},
),
(
"participant_categories",
ViewOptions {
participant_categories: CategorySelection::Any(vec![participant_category]),
..Default::default()
},
),
(
"work_contexts",
ViewOptions {
work_contexts: ContextSelection::Any(vec![context]),
..Default::default()
},
),
] {
project.diagrams.get_mut(&diagram).unwrap().view_options = options;
let issue = model_issue(persistence::decode(&legacy_json(&project, 6)).unwrap_err());
assert_eq!(issue.code, "view_options");
assert_eq!(issue.element, Some(diagram));
assert_eq!(issue.field.as_deref(), Some(field));
let current_source = language::format(&project);
assert_eq!(language::parse(&current_source).unwrap(), project);
let source6 = current_source.replacen("arcadia 7;", "arcadia 6;", 1);
let errors = language::parse(&source6).unwrap_err();
let diagnostic = errors
.iter()
.find(|error| error.code == "view_options")
.unwrap();
assert_eq!(diagnostic.object_id, Some(diagram));
assert_eq!(diagnostic.field.as_deref(), Some(field));
project.diagrams.get_mut(&diagram).unwrap().projection = ProjectionKind::Traceability;
assert_eq!(
persistence::decode(&legacy_json(&project, 6)).unwrap(),
project
);
let source6 = language::format(&project).replacen("arcadia 7;", "arcadia 6;", 1);
assert_eq!(language::parse(&source6).unwrap(), project);
project.diagrams.get_mut(&diagram).unwrap().projection = ProjectionKind::Overview;
}
}
@@ -1,156 +0,0 @@
use oa_core::{source_project::*, view_options::*, *};
fn fixture(layer: Layer) -> (Project, Id, Id, Id, Id) {
let mut p = Project::empty();
let oa = p
.add_element(Kind::Activity, Layer::Oa, "Assess alarm", None)
.unwrap();
let oa2 = p
.add_element(Kind::Activity, Layer::Oa, "Respond", None)
.unwrap();
let sa = p
.add_element(Kind::Function, Layer::Sa, "Assess alarm", None)
.unwrap();
let edge = p.relate(RelationKind::Interaction, "Alarm", oa, oa2);
let category = p
.add_element(Kind::ExchangeCategory, Layer::Oa, "Alarm data", None)
.unwrap();
*p.elements.get_mut(&category).unwrap().shared_mut().unwrap() = SharedBody::ExchangeCategory {
family: ExchangeFamily::Work,
exchanges: vec![edge],
};
let context = p
.add_element(Kind::Process, Layer::Oa, "Alarm handling", None)
.unwrap();
let d = p.ensure_diagram(layer);
p.diagrams.get_mut(&d).unwrap().projection = ProjectionKind::Traceability;
for (i, element) in [oa, oa2, sa].into_iter().enumerate() {
p.place(
d,
element,
Position {
x: 300. * i as f32,
y: 40.,
},
);
}
p.diagrams.get_mut(&d).unwrap().view_options = ViewOptions {
hidden_edges: vec![edge],
work_categories: CategorySelection::Any(vec![category]),
work_contexts: ContextSelection::Any(vec![context]),
..Default::default()
};
validate_candidate(&p).unwrap();
(p, d, oa, sa, category)
}
#[test]
fn projection_switching_preserves_complete_model_history_and_all_serializations() {
for layer in [Layer::Oa, Layer::Sa] {
let (baseline, diagram, _, _, _) = fixture(layer);
for projection in [
ProjectionKind::Overview,
ProjectionKind::Decomposition,
ProjectionKind::Allocation,
ProjectionKind::FunctionalDataflow,
ProjectionKind::Capabilities,
] {
let mut expected = baseline.clone();
expected.diagrams.get_mut(&diagram).unwrap().projection = projection;
let mut session = Session::new(baseline.clone());
session
.execute(Command::EditDiagram(
diagram,
expected.diagrams[&diagram].clone(),
))
.unwrap();
assert_eq!(session.project(), &expected);
let view = projection::project_view(session.project(), diagram);
assert!(
view.nodes
.iter()
.all(|n| expected.elements[&n.element].layer() == layer)
);
assert_eq!(
view,
projection::project_view_with_index(&expected, diagram, &ViewIndex::new(&expected))
);
let source = language::format(&expected);
assert_eq!(language::parse(&source).unwrap(), expected);
assert_eq!(
persistence::decode(&serde_json::to_vec(&expected).unwrap()).unwrap(),
expected
);
let bundle = format_bundle(&expected);
assert_eq!(
compile_bundle(&bundle, ProjectLimits::default())
.unwrap()
.decoded
.project,
expected
);
session.undo();
assert_eq!(session.project(), &baseline);
assert!(!session.can_undo());
session.redo();
assert_eq!(session.project(), &expected);
session
.execute(Command::EditDiagram(
diagram,
baseline.diagrams[&diagram].clone(),
))
.unwrap();
assert_eq!(session.project(), &baseline);
assert_eq!(
projection::project_view(session.project(), diagram),
projection::project_view(&baseline, diagram)
);
}
}
}
#[test]
fn projection_switching_does_not_admit_missing_elements_or_invalid_filter_kinds() {
let (mut p, d, oa, _, category) = fixture(Layer::Sa);
p.diagrams.get_mut(&d).unwrap().projection = ProjectionKind::Allocation;
validate_candidate(&p).unwrap();
let valid = p.clone();
let node = p.diagrams[&d]
.nodes
.values()
.find(|n| n.element == oa)
.unwrap()
.id;
p.diagrams
.get_mut(&d)
.unwrap()
.nodes
.get_mut(&node)
.unwrap()
.element = Id::new_v4();
assert!(validate_candidate(&p).is_err());
p = valid.clone();
p.diagrams.get_mut(&d).unwrap().view_options.work_categories = CategorySelection::Any(vec![oa]);
assert!(validate_candidate(&p).is_err());
p = valid;
p.elements.remove(&category);
assert!(validate_candidate(&p).is_err());
}
#[test]
fn projection_switching_keeps_typed_state_membership_strict() {
let (mut p, d, _, _, _) = fixture(Layer::Sa);
let system = p
.add_element(Kind::System, Layer::Sa, "System", None)
.unwrap();
let machine = p
.add_element(Kind::StateMachine, Layer::Sa, "Modes", Some(system))
.unwrap();
p.diagrams.get_mut(&d).unwrap().projection = ProjectionKind::StateMachine { machine };
assert!(
validation::validate(&p)
.iter()
.any(|i| i.code == "state_diagram_member")
);
assert!(validate_candidate(&p).is_err());
}
+1 -12
View File
@@ -67,18 +67,7 @@ fn source6_traceability_default_keeps_both_layers_and_indexed_projection_matches
.any(|e| e.id == interaction)
);
p.diagrams.get_mut(&d).unwrap().projection = ProjectionKind::Overview;
validate_candidate(&p).unwrap();
let ordinary = projection::project_view_with_index(&p, d, &index);
assert!(
ordinary
.nodes
.iter()
.all(|n| p.elements[&n.element].layer() == Layer::Oa)
);
assert!(ordinary.edges.iter().any(|e| e.id == interaction));
assert!(!ordinary.edges.iter().any(|e| e.id == fe));
assert_eq!(p.diagrams[&d].nodes.len(), 4);
assert_eq!(p.diagrams[&d].view_options.hidden_edges, vec![fe]);
assert!(validate_candidate(&p).is_err());
p.diagrams.get_mut(&d).unwrap().projection = ProjectionKind::Traceability;
p.diagrams.get_mut(&d).unwrap().view_options.relation_kinds = RelationKinds::Only(vec![]);
assert!(
+54 -4
View File
@@ -210,7 +210,6 @@ impl SemanticPlan {
pub fn project(&self) -> &Project {
&self.candidate
}
#[cfg(test)]
pub fn index(&self) -> &ViewIndex {
&self.index
}
@@ -485,6 +484,57 @@ pub struct PresentationContext {
pub target: Option<TargetPresentation>,
}
impl PresentationContext {
fn header_visible(self, header: Rect, outgoing: bool) -> bool {
if !outgoing {
return self.viewport.contains(header);
}
// Leaving a performer must not require fitting the entire work card
// inside the camera. Retain a 24px grab region so the result stays
// directly reachable; geometry/model admission is independent.
let width = (header.position.x + header.size.width)
.min(self.viewport.position.x + self.viewport.size.width)
- header.position.x.max(self.viewport.position.x);
let height = (header.position.y + header.size.height)
.min(self.viewport.position.y + self.viewport.size.height)
- header.position.y.max(self.viewport.position.y);
width * self.zoom >= 24. && height * self.zoom >= 24.
}
}
#[test]
fn outgoing_header_retains_a_grab_region_without_requiring_full_camera_containment() {
let context = PresentationContext {
viewport: Rect {
position: Position { x: 0., y: 0. },
size: Size {
width: 800.,
height: 400.,
},
},
zoom: 0.75,
target: None,
};
let mut header = Rect {
position: Position { x: -100., y: 30. },
size: Size {
width: 224.,
height: 62.,
},
};
assert!(context.header_visible(header, true));
assert!(!context.header_visible(header, false));
header.position.x = -192.; // exactly 32 world pixels = 24 logical pixels
assert!(context.header_visible(header, true));
header.position.x -= 1.;
assert!(!context.header_visible(header, true));
header.position.x = 0.;
header.position.y = 368.;
assert!(context.header_visible(header, true));
header.position.y += 1.;
assert!(!context.header_visible(header, true));
}
#[derive(Debug)]
pub struct PlacementPlan {
pub diagram: Diagram,
@@ -496,8 +546,8 @@ pub struct PlacementPlan {
commands: Vec<Command>,
}
/// `requested` is the original selected placement position plus pointer motion
/// in the frozen transform (therefore preserving the press offset). Snap only
/// `requested` preserves the frozen pointer offset unless the caller proposes
/// bounded outward clearance for an outgoing drop. Snap only
/// this root; apply the resulting identical delta to captured Q and its routes.
/// No whole Project clone, validator or semantic ViewIndex rebuild occurs here.
pub fn place(
@@ -577,7 +627,7 @@ pub fn place(
height: selected.size.height.min(62.),
},
};
if !presentation.viewport.contains(header) {
if !presentation.header_visible(header, plan.destination == Destination::OutsidePerformers) {
return Err(Refusal::LayoutRequired(
"Make room or adjust the view, then drag again.".into(),
));
@@ -188,7 +188,7 @@ pub fn place(
};
geometry::check_rigid(&plan.before_expanded, &expanded, &plan.placements, delta)?;
scenes?;
geometry::check_headers(&view, &plan.selected, presentation.viewport)?;
geometry::check_headers(&view, &plan.selected, presentation, false)?;
Ok(PlacementPlan {
diagram,
view,
@@ -398,7 +398,12 @@ pub fn place(
&expanded,
)?;
geometry::check_rigid(&scope.0.before_expanded, &expanded, scope.affected(), delta)?;
geometry::check_headers(&view, scope.selected(), presentation.viewport)?;
geometry::check_headers(
&view,
scope.selected(),
presentation,
plan.destination == Destination::OutsidePerformers,
)?;
Ok(PlacementPlan {
diagram,
view,
@@ -170,7 +170,8 @@ pub(super) fn check_rigid(
pub(super) fn check_headers(
view: &ProjectedView,
selected: &BTreeMap<Id, Id>,
viewport: Rect,
presentation: PresentationContext,
outgoing: bool,
) -> Result<(), Refusal> {
for (id, element) in selected {
let node = view
@@ -185,7 +186,7 @@ pub(super) fn check_headers(
height: node.size.height.min(62.),
},
};
if !viewport.contains(header) {
if !presentation.header_visible(header, outgoing) {
return Err(Refusal::LayoutRequired(
"Make room or adjust the view, then drag again.".into(),
));
+24 -76
View File
@@ -4,8 +4,6 @@ pub(crate) mod architecture_authoring;
mod architecture_authoring_tests;
#[cfg(test)]
mod behavior_removal_tests;
#[cfg(test)]
mod canvas_selection_tests;
mod checkpoints;
#[cfg(test)]
mod diagram_focus_tests;
@@ -383,7 +381,6 @@ pub enum Message {
Behavior(crate::behavior::Event),
Layer(Layer),
Select(Id),
CanvasSelect(crate::route_edit::Context, Id),
EditProperties(Id),
SelectNode(Id),
DiagramSelection(multiselect::Event),
@@ -1174,13 +1171,7 @@ impl App {
if id != self.selected {
self.selected_attachment = None;
}
if self.selected == id
&& !process_preview
&& self
.project()
.layer_of(id)
.is_none_or(|layer| layer == self.layer)
{
if self.selected == id && !process_preview {
return;
}
if !self.apply() {
@@ -1226,24 +1217,6 @@ impl App {
}
self.refresh_draft();
}
/// Inspect an already validated canvas target without following its model layer.
fn inspect_canvas_target(&mut self, id: Id) -> bool {
if self.selected == id {
return true;
}
if !self.project().contains(id) || !self.apply() {
return false;
}
if !self.project().contains(id) {
return false;
}
self.selected = id;
self.selected_node = None;
self.selected_attachment = None;
self.selected_bend = None;
self.refresh_draft();
true
}
fn reveal_explorer_selection(&mut self) {
if let Some(group) = self.explorer_index.group(self.selected) {
self.explorer_groups_collapsed.remove(&group);
@@ -1390,11 +1363,6 @@ impl App {
{
return Task::none();
}
if let Message::CanvasSelect(captured, _) = &message
&& (self.page != Page::Diagram || self.route_context() != Some(*captured))
{
return Task::none();
}
// Selection can change without advancing the captured canvas context.
if let Message::Route(
crate::route_edit::Event::Commit(captured, changed, ..)
@@ -2150,7 +2118,6 @@ impl App {
Message::Command(Command::Layout(diagram)) => self.saved_scenario_diagram(*diagram),
Message::Projection(projection) => active || projection.scenario().is_some(),
Message::SelectNode(_)
| Message::CanvasSelect(..)
| Message::PlaceSelected
| Message::HideSelected
| Message::ToggleCollapse
@@ -2751,10 +2718,10 @@ impl App {
e.kind() != Kind::Port && d.projection.includes(e.kind())
})
});
if show_in_mixed_view || menu.request.canvas.is_some() {
if !self.inspect_canvas_target(menu.request.object) {
return Task::none();
}
if show_in_mixed_view {
self.selected = menu.request.object;
self.selected_attachment = None;
self.refresh_draft();
} else {
self.select(menu.request.object);
}
@@ -2766,15 +2733,7 @@ impl App {
}
self.reconcile_multiselect();
self.selected_bend = menu.request.bend.map(|i| (menu.request.object, i));
let action = match *action {
Message::EditProperties(id)
if menu.request.canvas.is_some() && id == menu.request.object =>
{
Message::InspectorTab(crate::navigation::InspectorTab::Properties)
}
action => action,
};
return self.update(action);
return self.update(*action);
}
Message::CreateContextElement(kind, child) => {
self.create_kind = kind;
@@ -2930,14 +2889,6 @@ impl App {
self.status = "Property draft reverted".into();
}
Message::Select(id) => self.select(id),
Message::CanvasSelect(context, id) => {
let view = project_view(self.project(), context.diagram);
if view.ports.iter().any(|port| port.element == id)
|| view.edges.iter().any(|edge| edge.id == id)
{
self.inspect_canvas_target(id);
}
}
Message::DiagramSelection(event) => self.multiselect_event(event),
Message::EditProperties(id) => {
self.select(id);
@@ -3385,7 +3336,7 @@ impl App {
self.workflow = Some(crate::workflow::Workflow::relationship_kind(
self.project(),
self.selected,
self.project().layer_of(self.selected).unwrap_or(self.layer),
self.layer,
kind,
incoming,
));
@@ -4411,18 +4362,13 @@ impl App {
self.status = "Select an SA function or participant, then choose a typed port action in Properties.".into();
return;
}
let creation_layer = if child {
self.project().layer_of(self.selected).unwrap_or(self.layer)
} else {
self.layer
};
let allocated = child
&& self.create_kind.is_work()
&& self
.project()
.elements
.get(&self.selected)
.is_some_and(|e| e.layer() == creation_layer && e.kind().is_performer());
.is_some_and(|e| e.layer() == self.layer && e.kind().is_performer());
let parent = if child && !allocated {
Some(self.selected)
} else {
@@ -4430,7 +4376,7 @@ impl App {
};
let Some(e) = self.project().make_element(
self.create_kind,
creation_layer,
self.layer,
&format!("New {}", self.create_kind.label().to_lowercase()),
parent,
) else {
@@ -4459,16 +4405,16 @@ impl App {
.project()
.diagrams
.values()
.find(|d| d.layer == creation_layer && d.projection == preferred)
.find(|d| d.layer == self.layer && d.projection == preferred)
.map(|d| d.id);
if diagram_target.is_none() {
let view = Id::new_v4();
commands.push(Command::CreateDiagram(Diagram {
id: view,
alias: self.project().fresh_alias("engineering_view", "view", view),
name: format!("{} {preferred}", creation_layer),
name: format!("{} {preferred}", self.layer),
description: String::new(),
layer: creation_layer,
layer: self.layer,
projection: preferred,
layout: None,
routes: Vec::new(),
@@ -4601,13 +4547,7 @@ impl App {
));
}
if self.execute(Command::Batch(commands)) {
let changed_view = self.active_diagram != diagram_target;
self.active_diagram = diagram_target;
if changed_view
&& let Some(view) = diagram_target.and_then(|id| self.project().diagrams.get(&id))
{
self.layer = view.layer;
}
self.selected = id;
self.inspector_tab = crate::navigation::InspectorTab::Properties;
self.refresh_draft();
@@ -4621,7 +4561,7 @@ impl App {
self.workflow = Some(crate::workflow::Workflow::relationship(
self.project(),
self.selected,
self.project().layer_of(self.selected).unwrap_or(self.layer),
self.layer,
));
}
fn add_trace(&mut self) {
@@ -5146,9 +5086,17 @@ impl App {
&project_view(self.project(), context.diagram),
id,
);
if !self.inspect_canvas_target(id) {
self.connection = Some(session);
return;
if session.tool == crate::connection_tool::Tool::Allocation
&& self.project().diagrams[&context.diagram].projection
== ProjectionKind::Traceability
{
// Mixed views can allocate either perspective. Choosing
// a visible source must not navigate to its preferred view.
self.selected = id;
self.selected_attachment = None;
self.refresh_draft();
} else {
self.select(id);
}
self.status = if session.candidates.is_empty() {
"No compatible targets are visible. Expand containers or show a compatible endpoint in this view; Esc cancels drawing.".into()
+40 -5
View File
@@ -14,6 +14,8 @@ use std::{
sync::Arc,
};
mod clearance;
pub const FINISH_EDIT: &str =
"Finish or cancel the current edit before selecting or moving elements.";
@@ -56,6 +58,7 @@ pub struct Target {
#[derive(Debug, Clone)]
pub struct Frozen {
pub targets: Vec<Target>,
pub moving: Vec<Rectangle>,
cards: Vec<Rectangle>,
controls: Vec<Rectangle>,
edges: Vec<(Point, Point)>,
@@ -82,14 +85,16 @@ impl Frozen {
) -> Self {
let mut targets = Vec::new();
let mut cards = Vec::new();
let mut moving = Vec::new();
for n in &view.nodes {
if affected.contains_key(&n.id) {
continue;
}
let region = Rectangle::new(
Point::new(n.position.x, n.position.y),
iced::Size::new(n.size.width, n.size.height),
);
if affected.contains_key(&n.id) {
moving.push(region);
continue;
}
let Some(e) = project.elements.get(&n.element) else {
cards.push(region);
continue;
@@ -172,6 +177,7 @@ impl Frozen {
}
Self {
targets,
moving,
cards,
controls,
edges,
@@ -407,7 +413,6 @@ impl Candidate {
Self::Performers(p) => &p.accepted,
}
}
#[cfg(test)]
pub fn index(&self) -> &view_options::ViewIndex {
match self {
Self::Singleton(p) => p.index(),
@@ -525,6 +530,8 @@ pub(crate) struct Feedback {
pub inspection_targets: Vec<usize>,
pub text: String,
pub refused: bool,
/// Pointer-following outline only; it never authorizes a model change.
pub ghost_delta: Option<Vector>,
}
impl Feedback {
pub fn inspection_identity(&self) -> String {
@@ -1055,7 +1062,26 @@ impl App {
viewport: stamp.viewport(), zoom: stamp.zoom,
target: target.map(|i| plan::TargetPresentation { placement: active.frozen.as_ref().unwrap().targets[i].placement }),
};
let placed = candidate.place(requested, presentation).map_err(|r| refusal(&r))?;
let exact = candidate.place(requested, presentation);
let placed = if destination == plan::Destination::OutsidePerformers
&& matches!(&exact, Err(plan::Refusal::LayoutRequired(_)))
{
let affected = match &active.prepared {
Prepared::Singleton(scope) => Some(&scope.placements),
Prepared::Assignment(scope) => Some(scope.affected()),
_ => None,
};
affected.and_then(|affected| {
clearance::requests(
(self.project(), self.document.view_index()),
(candidate.project(), candidate.index()), stamp.context.diagram,
affected, *anchor, requested,
(stamp.world(press.start), stamp.world(pointer.unwrap())),
).into_iter().find_map(|position| candidate.place(position, presentation).ok())
}).map_or(exact, Ok)
} else {
exact
}.map_err(|r| refusal(&r))?;
let label = candidate.label();
if release {
if let Some(command) = candidate.finish(self.project(), &placed).map_err(|r| refusal(&r))? {
@@ -1082,6 +1108,14 @@ impl App {
} else {
let inspection_targets = active.inspection_targets.clone();
let frozen = active.frozen.clone();
// A rejected intermediate position is not a return gesture. Keep the
// last admitted scene and show current motion separately; release
// always recomputes admission and never commits this retained view.
if refused && in_bounds && preview.is_none() {
preview = self.allocation_drag.preview.take();
}
let ghost_delta = (refused && in_bounds)
.then(|| (pointer.unwrap() - press.start) * (1. / stamp.zoom));
self.allocation_drag.active = Some(active);
self.allocation_drag.preview = preview;
self.allocation_drag.feedback = Some(Feedback {
@@ -1092,6 +1126,7 @@ impl App {
inspection_targets,
text,
refused,
ghost_delta,
});
}
}
@@ -0,0 +1,595 @@
//! Bounded outgoing clearance proposals. The ordinary placement and semantic
//! validators still decide whether any proposal may be previewed or committed.
use iced::Point;
use oa_core::{Id, NodePlacement, Position, Project, projection, view_options::ViewIndex};
use std::collections::{BTreeMap, BTreeSet};
const GRID: f32 = 10.;
const GAP: f32 = 10.;
#[derive(Clone, Copy)]
struct Bounds {
left: f32,
top: f32,
right: f32,
bottom: f32,
}
impl Bounds {
fn node(node: &projection::ProjectedNode) -> Option<Self> {
let result = Self {
left: node.position.x,
top: node.position.y,
right: node.position.x + node.size.width,
bottom: node.position.y + node.size.height,
};
([result.left, result.top, result.right, result.bottom]
.iter()
.all(|value| value.is_finite())
&& result.right > result.left
&& result.bottom > result.top)
.then_some(result)
}
fn union(self, other: Self) -> Self {
Self {
left: self.left.min(other.left),
top: self.top.min(other.top),
right: self.right.max(other.right),
bottom: self.bottom.max(other.bottom),
}
}
fn overlaps(self, other: Self) -> bool {
self.left < other.right
&& other.left < self.right
&& self.top < other.bottom
&& other.top < self.bottom
}
}
/// Called only after an OutsidePerformers candidate fails ordinary placement.
/// Coordinates use the frozen world transform. The entire affected footprint
/// receives one anchor translation; this never moves or packs other cards.
pub(super) fn requests(
accepted: (&Project, &ViewIndex),
candidate: (&Project, &ViewIndex),
diagram: Id,
affected: &BTreeMap<Id, NodePlacement>,
anchor: Id,
requested: Position,
motion: (Point, Point),
) -> Vec<Position> {
let (accepted, accepted_index) = accepted;
let (candidate, candidate_index) = candidate;
let (start, pointer) = motion;
if ![
requested.x,
requested.y,
start.x,
start.y,
pointer.x,
pointer.y,
]
.iter()
.all(|value| value.is_finite())
{
return Vec::new();
}
let (Some(original), Some(base), Some(anchor)) = (
accepted.diagrams.get(&diagram),
candidate.diagrams.get(&diagram),
affected.get(&anchor),
) else {
return Vec::new();
};
let snapped = Position {
x: (requested.x / GRID).round() * GRID,
y: (requested.y / GRID).round() * GRID,
};
let delta = Position {
x: snapped.x - anchor.position.x,
y: snapped.y - anchor.position.y,
};
let before = projection::project_diagram_with_index(accepted, original, accepted_index);
let before_nodes: BTreeMap<_, _> = before.nodes.iter().map(|node| (node.id, node)).collect();
let mut sources = BTreeSet::new();
for node in before
.nodes
.iter()
.filter(|node| affected.contains_key(&node.id))
{
let mut parent = node.visual_parent;
let mut seen = BTreeSet::new();
while let Some(id) = parent {
if !seen.insert(id) {
return Vec::new();
}
let Some(node) = before_nodes.get(&id) else {
break;
};
if !affected.contains_key(&id)
&& accepted
.elements
.get(&node.element)
.is_some_and(|element| element.kind().is_performer())
{
sources.insert(id);
}
parent = node.visual_parent;
}
}
if sources.is_empty() {
return Vec::new();
}
// Projection after responsibility removal supplies the former performer's
// remaining enclosure, including other allocated work. Projecting the moved
// block also includes the full visible descendant enclosure of every root.
let mut moved = base.clone();
for (id, captured) in affected {
let Some(node) = moved.nodes.get_mut(id) else {
return Vec::new();
};
node.position = Position {
x: captured.position.x + delta.x,
y: captured.position.y + delta.y,
};
if ![
node.position.x,
node.position.y,
node.size.width,
node.size.height,
]
.iter()
.all(|value| value.is_finite())
{
return Vec::new();
}
}
let after = projection::project_diagram_with_index(candidate, &moved, candidate_index);
let mut footprint: Option<Bounds> = None;
for node in after
.nodes
.iter()
.filter(|node| affected.contains_key(&node.id))
{
let Some(bounds) = Bounds::node(node) else {
return Vec::new();
};
footprint = Some(footprint.map_or(bounds, |previous| previous.union(bounds)));
}
let Some(footprint) = footprint else {
return Vec::new();
};
let mut overlaps = Vec::new();
for node in after.nodes.iter().filter(|node| sources.contains(&node.id)) {
let (Some(old), Some(current)) = (Bounds::node(before_nodes[&node.id]), Bounds::node(node))
else {
return Vec::new();
};
if footprint.overlaps(current) {
overlaps.push((old, current));
}
}
if overlaps.is_empty() {
return Vec::new();
}
// Each entry is a half-plane actually crossed by the pointer. At a corner,
// prefer the boundary reached first on the press-to-pointer segment. The
// direction index is a stable tie-break, independent of placement UUIDs.
let mut crossings = [None::<f32>; 4];
for (old, _) in &overlaps {
for (direction, initial, final_, boundary, outward) in [
(
0,
start.x,
pointer.x,
old.left,
pointer.x < old.left && start.x >= old.left,
),
(
1,
start.x,
pointer.x,
old.right,
pointer.x >= old.right && start.x < old.right,
),
(
2,
start.y,
pointer.y,
old.top,
pointer.y < old.top && start.y >= old.top,
),
(
3,
start.y,
pointer.y,
old.bottom,
pointer.y >= old.bottom && start.y < old.bottom,
),
] {
if outward {
let fraction = (boundary - initial) / (final_ - initial);
if fraction.is_finite() && (0. ..=1.).contains(&fraction) {
crossings[direction] =
Some(crossings[direction].map_or(fraction, |old| old.min(fraction)));
}
}
}
}
let mut directions: Vec<_> = crossings
.into_iter()
.enumerate()
.filter_map(|(direction, fraction)| fraction.map(|fraction| (direction, fraction)))
.collect();
directions.sort_by(|a, b| a.1.total_cmp(&b.1).then(a.0.cmp(&b.0)));
let mut result = Vec::new();
for (direction, _) in directions {
let mut corrected = snapped;
match direction {
0 => {
let edge = overlaps
.iter()
.map(|(_, current)| current.left)
.fold(f32::INFINITY, f32::min);
corrected.x = ((snapped.x + edge - GAP - footprint.right) / GRID).floor() * GRID;
}
1 => {
let edge = overlaps
.iter()
.map(|(_, current)| current.right)
.fold(f32::NEG_INFINITY, f32::max);
corrected.x = ((snapped.x + edge + GAP - footprint.left) / GRID).ceil() * GRID;
}
2 => {
let edge = overlaps
.iter()
.map(|(_, current)| current.top)
.fold(f32::INFINITY, f32::min);
corrected.y = ((snapped.y + edge - GAP - footprint.bottom) / GRID).floor() * GRID;
}
3 => {
let edge = overlaps
.iter()
.map(|(_, current)| current.bottom)
.fold(f32::NEG_INFINITY, f32::max);
corrected.y = ((snapped.y + edge + GAP - footprint.top) / GRID).ceil() * GRID;
}
_ => unreachable!(),
}
if corrected.x.is_finite() && corrected.y.is_finite() && !result.contains(&corrected) {
result.push(corrected);
}
}
result
}
#[cfg(test)]
mod tests {
use super::*;
use crate::allocation_drag as plan;
use oa_core::{Kind, Layer, ProjectionKind, RelationKind, Size};
struct Fixture {
project: Project,
diagram: Id,
performer: Id,
work: Id,
node: Id,
}
fn xy(x: f32, y: f32) -> Position {
Position { x, y }
}
fn fixture(layer: Layer) -> Fixture {
let mut project = Project::empty();
let (performer, work) = match layer {
Layer::Oa => (Kind::Entity, Kind::Activity),
Layer::Sa => (Kind::System, Kind::Function),
};
let performer = project
.add_element(performer, layer, "Performer", None)
.unwrap();
let work = project.add_element(work, layer, "Work", None).unwrap();
let diagram = project.ensure_diagram(layer);
project.diagrams.get_mut(&diagram).unwrap().projection = ProjectionKind::Allocation;
let performer = project.place(diagram, performer, xy(100., 100.));
project
.diagrams
.get_mut(&diagram)
.unwrap()
.nodes
.get_mut(&performer)
.unwrap()
.size = Size {
width: 400.,
height: 250.,
};
let node = project.place(diagram, work, xy(160., 180.));
let owner = project.diagrams[&diagram].nodes[&performer].element;
project.relate(RelationKind::Allocation, "Responsibility", owner, work);
Fixture {
project,
diagram,
performer,
work,
node,
}
}
fn semantic(f: &Fixture) -> (plan::Scope, plan::SemanticPlan) {
let scope = plan::capture(&f.project, f.diagram, f.work, f.node).unwrap();
let semantic = plan::plan_semantics(
&f.project,
&scope,
plan::Destination::OutsidePerformers,
&BTreeMap::new(),
)
.unwrap();
(scope, semantic)
}
fn presentation() -> plan::PresentationContext {
plan::PresentationContext {
viewport: plan::Rect {
position: xy(-2000., -2000.),
size: Size {
width: 5000.,
height: 5000.,
},
},
zoom: 1.,
target: None,
}
}
#[test]
fn each_outgoing_edge_clears_the_source_and_passes_ordinary_placement() {
for layer in [Layer::Oa, Layer::Sa] {
let f = fixture(layer);
let (scope, semantic) = semantic(&f);
for (start, pointer, requested, expected) in [
(
Point::new(170., 210.),
Point::new(99., 210.),
xy(89., 180.),
xy(-140., 180.),
),
(
Point::new(340., 210.),
Point::new(501., 210.),
xy(321., 180.),
xy(510., 180.),
),
(
Point::new(200., 190.),
Point::new(200., 99.),
xy(160., 89.),
xy(160., -10.),
),
(
Point::new(200., 260.),
Point::new(200., 351.),
xy(160., 271.),
xy(160., 360.),
),
] {
assert!(matches!(
plan::place(&semantic, requested, presentation()),
Err(plan::Refusal::LayoutRequired(_))
));
let proposed = requests(
(&f.project, &ViewIndex::new(&f.project)),
(semantic.project(), semantic.index()),
f.diagram,
&scope.placements,
f.node,
requested,
(start, pointer),
);
assert_eq!(proposed, vec![expected]);
let placed = plan::place(&semantic, proposed[0], presentation()).unwrap();
assert!(
plan::finish(&semantic, &f.project, &placed)
.unwrap()
.is_some()
);
}
}
}
#[test]
fn source_shrink_uses_candidate_enclosure_not_frozen_target() {
let mut f = fixture(Layer::Oa);
f.project
.diagrams
.get_mut(&f.diagram)
.unwrap()
.nodes
.get_mut(&f.performer)
.unwrap()
.size = Size {
width: 224.,
height: 94.,
};
let (scope, semantic) = semantic(&f);
let proposed = requests(
(&f.project, &ViewIndex::new(&f.project)),
(semantic.project(), semantic.index()),
f.diagram,
&scope.placements,
f.node,
xy(229., 180.),
(Point::new(340., 210.), Point::new(409., 210.)),
);
assert_eq!(proposed, vec![xy(340., 180.)]);
plan::place(&semantic, proposed[0], presentation()).unwrap();
}
#[test]
fn corner_order_follows_boundary_crossing_and_is_deterministic() {
let f = fixture(Layer::Sa);
let (scope, semantic) = semantic(&f);
// Right crossed at 160/161 of the segment; bottom at 90/91.
let args = (
xy(321., 271.),
Point::new(340., 260.),
Point::new(501., 351.),
);
let proposed = requests(
(&f.project, &ViewIndex::new(&f.project)),
(semantic.project(), semantic.index()),
f.diagram,
&scope.placements,
f.node,
args.0,
(args.1, args.2),
);
assert_eq!(proposed, vec![xy(320., 360.), xy(510., 270.)]);
assert_eq!(
proposed,
requests(
(&f.project, &ViewIndex::new(&f.project)),
(semantic.project(), semantic.index()),
f.diagram,
&scope.placements,
f.node,
args.0,
(args.1, args.2)
)
);
}
#[test]
fn no_crossing_no_overlap_no_source_and_nonfinite_requests_are_empty() {
let f = fixture(Layer::Oa);
let (scope, semantic) = semantic(&f);
for (requested, pointer) in [
(xy(170., 180.), Point::new(210., 210.)),
(xy(700., 180.), Point::new(740., 210.)),
(xy(f32::NAN, 180.), Point::new(99., 210.)),
(xy(89., 180.), Point::new(f32::INFINITY, 210.)),
] {
assert!(
requests(
(&f.project, &ViewIndex::new(&f.project)),
(semantic.project(), semantic.index()),
f.diagram,
&scope.placements,
f.node,
requested,
(Point::new(200., 210.), pointer)
)
.is_empty()
);
}
assert!(
requests(
(semantic.project(), semantic.index()),
(semantic.project(), semantic.index()),
f.diagram,
&scope.placements,
f.node,
xy(89., 180.),
(Point::new(200., 210.), Point::new(99., 210.))
)
.is_empty()
);
}
#[test]
fn descendant_footprint_controls_clearance_without_mutating_projects() {
for layer in [Layer::Oa, Layer::Sa] {
let mut f = fixture(layer);
let kind = f.project.elements[&f.work].kind();
let child = f
.project
.add_element(kind, layer, "Child", Some(f.work))
.unwrap();
let child_node = f.project.place(f.diagram, child, xy(240., 270.));
// First-child allocation transfer is normally performed by commands;
// this fixture expresses the resulting leaf allocation directly.
f.project.relations.clear();
let owner = f.project.diagrams[&f.diagram].nodes[&f.performer].element;
f.project.relate(
RelationKind::Allocation,
"Leaf responsibility",
owner,
child,
);
let (scope, semantic) = semantic(&f);
assert!(scope.placements.contains_key(&child_node));
let before = f.project.clone();
let candidate = semantic.project().clone();
let proposed = requests(
(&f.project, &ViewIndex::new(&f.project)),
(&candidate, semantic.index()),
f.diagram,
&scope.placements,
f.node,
xy(89., 180.),
(Point::new(170., 210.), Point::new(99., 210.)),
);
assert_eq!(proposed, vec![xy(-240., 180.)]);
let placed = plan::place(&semantic, proposed[0], presentation()).unwrap();
let root = &placed.diagram.nodes[&f.node];
let child = &placed.diagram.nodes[&child_node];
assert_eq!(child.position.x - root.position.x, 80.);
assert_eq!(child.position.y - root.position.y, 90.);
assert_eq!(f.project, before);
assert_eq!(semantic.project(), &candidate);
}
}
#[test]
fn independent_selected_roots_keep_one_rigid_group_translation() {
for layer in [Layer::Oa, Layer::Sa] {
let mut f = fixture(layer);
let kind = f.project.elements[&f.work].kind();
let second = f
.project
.add_element(kind, layer, "Second work", None)
.unwrap();
let second_node = f.project.place(f.diagram, second, xy(240., 300.));
let owner = f.project.diagrams[&f.diagram].nodes[&f.performer].element;
f.project.relate(
RelationKind::Allocation,
"Second responsibility",
owner,
second,
);
let selected = BTreeMap::from([(f.node, f.work), (second_node, second)]);
let scope =
plan::assignment::capture(&f.project, f.diagram, &selected, f.node).unwrap();
let semantic = plan::assignment::plan_semantics(
&scope,
plan::Destination::OutsidePerformers,
&BTreeMap::new(),
)
.unwrap();
let proposed = requests(
(&f.project, &ViewIndex::new(&f.project)),
(semantic.project(), semantic.index()),
f.diagram,
scope.affected(),
f.node,
xy(89., 180.),
(Point::new(170., 210.), Point::new(99., 210.)),
);
assert_eq!(proposed, vec![xy(-220., 180.)]);
let placed = plan::assignment::place(&semantic, proposed[0], presentation()).unwrap();
let root = &placed.diagram.nodes[&f.node];
let second = &placed.diagram.nodes[&second_node];
assert_eq!(second.position.x - root.position.x, 80.);
assert_eq!(second.position.y - root.position.y, 120.);
assert!(
plan::assignment::finish(&semantic, &f.project, &placed)
.unwrap()
.is_some()
);
}
}
}
@@ -30,6 +30,117 @@ async fn mount() -> (Fixture, Mounted) {
mounted.settle(&mut f.app).await;
(f, mounted)
}
#[tokio::test]
async fn actual_tree_outgoing_boundary_motion_preview_release_and_cancel() {
for layer in [Layer::Oa, Layer::Sa] {
let mut f = outgoing_fixture(layer);
f.app.layer = layer;
f.app.window_size = iced::Size::new(1440., 900.);
let _ = f.app.update(Message::Select(f.work));
let mut mounted = Mounted::new(&mut f.app).await;
f.app.zoom = 0.75;
f.app.pan = Vector::new(20., 15.);
f.app.fit_to_view = false;
mounted.settle(&mut f.app).await;
let original = f.app.project().clone();
let source = f.app.document.bundle().clone();
let from = at(&mut mounted, &f, xy(660., 225.));
mounted
.batch(
&mut f.app,
&[
Input::Mouse(mouse::Event::CursorMoved { position: from }),
Input::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)),
],
mouse::Cursor::Available(from),
)
.await;
// Separate input/update/layout turns expose the held boundary transition
// that a one-batch distant drop cannot exercise.
for x in [620., 560., 510., 499., 490.] {
let to = at(&mut mounted, &f, xy(x, 225.));
mounted
.batch(
&mut f.app,
&[Input::Mouse(mouse::Event::CursorMoved { position: to })],
mouse::Cursor::Available(to),
)
.await;
assert_eq!(f.app.project(), &original);
assert_eq!(f.app.document.bundle(), &source);
assert!(
!f.app.allocation_drag.feedback.as_ref().unwrap().refused,
"{layer:?} x={x}: {}",
f.app.status
);
assert!(f.app.allocation_drag.preview.is_some());
let _ = mounted.pixels(&f.app);
}
let expected = f
.app
.allocation_drag
.preview
.as_ref()
.unwrap()
.placement
.diagram
.clone();
let to = at(&mut mounted, &f, xy(490., 225.));
mounted
.batch(
&mut f.app,
&[Input::Mouse(mouse::Event::ButtonReleased(
mouse::Button::Left,
))],
mouse::Cursor::Available(to),
)
.await;
assert_eq!(&f.app.project().diagrams[&f.diagram], &expected);
assert!(
!f.app
.project()
.relations
.values()
.any(|r| r.kind() == RelationKind::Allocation && r.target() == f.work)
);
let _ = f.app.update(Message::Undo);
mounted.settle(&mut f.app).await;
assert_eq!(f.app.document.bundle(), &source);
let from = at(&mut mounted, &f, xy(660., 225.));
let to = at(&mut mounted, &f, xy(490., 225.));
mounted
.batch(
&mut f.app,
&[
Input::Mouse(mouse::Event::CursorMoved { position: from }),
Input::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)),
Input::Mouse(mouse::Event::CursorMoved { position: to }),
],
mouse::Cursor::Available(to),
)
.await;
mounted
.batch(
&mut f.app,
&[key(keyboard::key::Named::Escape)],
mouse::Cursor::Available(to),
)
.await;
mounted
.batch(
&mut f.app,
&[Input::Mouse(mouse::Event::ButtonReleased(
mouse::Button::Left,
))],
mouse::Cursor::Available(to),
)
.await;
assert_eq!(f.app.document.bundle(), &source);
assert!(f.app.allocation_drag.preview.is_none());
assert!(!f.app.document.can_undo());
}
}
fn canvas_bounds(mounted: &mut Mounted, app: &App) -> Rectangle {
mounted
.geometry(app)
@@ -89,10 +200,7 @@ async fn refused_click_keeps_field(mounted: &mut Mounted, f: &mut Fixture, field
);
assert!(!messages.iter().any(|m| matches!(
m,
Message::Select(_)
| Message::CanvasSelect(..)
| Message::SelectNode(_)
| Message::MoveNode(..)
Message::Select(_) | Message::SelectNode(_) | Message::MoveNode(..)
)));
assert_eq!(f.app.document.bundle(), &before);
assert_eq!((f.app.selected, f.app.selected_node), selected);
@@ -484,6 +592,7 @@ async fn actual_app_tree_exact_incoming_drag_keeps_destination_visible_and_canva
if pan.y == -100. {
// A genuine clipping refusal in the same held gesture, then
// recovery at the original exact point: no camera rebasing.
let retained = f.app.allocation_drag.preview.clone().unwrap();
let clipped = at(&mut mounted, &f, xy(160., 110.));
mounted
.batch(
@@ -495,7 +604,19 @@ async fn actual_app_tree_exact_incoming_drag_keeps_destination_visible_and_canva
)
.await;
assert!(f.app.allocation_drag.feedback.as_ref().unwrap().refused);
assert!(f.app.allocation_drag.preview.is_none());
assert!(Arc::ptr_eq(
f.app.allocation_drag.preview.as_ref().unwrap(),
&retained
));
assert!(
f.app
.allocation_drag
.feedback
.as_ref()
.unwrap()
.ghost_delta
.is_some()
);
assert_eq!(canvas_bounds(&mut mounted, &f.app), canvas);
assert_eq!(destination_bounds(&mut mounted, &f.app), slot);
assert_eq!(f.app.project(), &before);
@@ -237,10 +237,7 @@ fn mounted_dirty_property_press_does_not_select_apply_or_destroy_draft() {
));
assert!(!events.iter().any(|m| matches!(
m,
Message::Select(_)
| Message::CanvasSelect(..)
| Message::SelectNode(_)
| Message::MoveNode(..)
Message::Select(_) | Message::SelectNode(_) | Message::MoveNode(..)
)));
send(&mut f.app, events);
assert_eq!((f.app.selected, f.app.selected_node), selection);
@@ -1242,6 +1239,7 @@ fn destination_identity_does_not_describe_blocked_or_outside_viewport_as_unalloc
inspection_targets: vec![],
text: "A card blocks this drop".into(),
refused: true,
ghost_delta: None,
};
assert_eq!(feedback.destination_identity(), "No eligible destination");
feedback.text = "Release inside the captured canvas".into();
@@ -1249,3 +1247,361 @@ fn destination_identity_does_not_describe_blocked_or_outside_viewport_as_unalloc
feedback.refused = false;
assert_eq!(feedback.destination_identity(), "Outside performers");
}
fn outgoing_fixture(layer: Layer) -> Fixture {
let mut f = fixture(layer);
drag(&mut f, screen(xy(160., 190.)));
let mut project = f.app.project().clone();
let d = project.diagrams.get_mut(&f.diagram).unwrap();
let performer = d.nodes.values_mut().find(|n| n.element == f.a).unwrap();
performer.position = xy(500., 100.);
performer.size = Size {
width: 300.,
height: 300.,
};
d.nodes.get_mut(&f.node).unwrap().position = xy(540., 190.);
replace(&mut f, project);
f
}
#[test]
fn outgoing_boundary_drop_clears_source_without_changing_other_placements() {
for layer in [Layer::Oa, Layer::Sa] {
let mut f = outgoing_fixture(layer);
let before = f.app.project().clone();
let source = f.app.document.bundle().clone();
let from = screen(xy(660., 225.));
let to = screen(xy(490., 225.));
let mut events = batch(&f.app, from, to);
let release = events.pop().unwrap();
send(&mut f.app, events);
let feedback = f.app.allocation_drag.feedback.as_ref().unwrap();
assert!(!feedback.refused, "{}", feedback.text);
let preview = f.app.allocation_drag.preview.as_ref().unwrap();
let expected_diagram = preview.placement.diagram.clone();
let work = &expected_diagram.nodes[&f.node];
assert!(work.position.x + work.size.width <= 490.);
assert_eq!(work.position.y, 190.);
for (id, node) in &before.diagrams[&f.diagram].nodes {
if *id != f.node {
assert_eq!(&expected_diagram.nodes[id], node);
}
}
assert_eq!(f.app.project(), &before);
assert_eq!(f.app.document.bundle(), &source);
let _ = f.app.update(release);
assert_eq!(&f.app.project().diagrams[&f.diagram], &expected_diagram);
assert!(
!f.app
.project()
.relations
.values()
.any(|r| r.kind() == RelationKind::Allocation && r.target() == f.work)
);
let after = f.app.project().clone();
let saved = f.app.document.bundle().clone();
let _ = f.app.update(Message::Undo);
assert_eq!(f.app.project(), &before);
assert_eq!(f.app.document.bundle(), &source);
assert!(!f.app.document.can_undo());
let _ = f.app.update(Message::Redo);
assert_eq!(f.app.project(), &after);
assert_eq!(f.app.document.bundle(), &saved);
}
}
#[test]
fn outgoing_clearance_collision_refuses_release_without_source_or_history_mutation() {
for layer in [Layer::Oa, Layer::Sa] {
let mut f = outgoing_fixture(layer);
let mut project = f.app.project().clone();
let obstacle = project
.add_element(
project.elements[&f.work].kind(),
layer,
"Unrelated work",
None,
)
.unwrap();
let obstacle_node = project.place(f.diagram, obstacle, xy(240., 190.));
replace(&mut f, project);
// A refused release must preserve an existing redo branch, too.
let _ = f.app.update(Message::Command(Command::Rename(
f.work,
"Temporary".into(),
)));
let _ = f.app.update(Message::Undo);
let before = f.app.project().clone();
let source = f.app.document.bundle().clone();
let snapshot = f.app.document.snapshot();
let revision = f.app.document.revision();
let from = screen(xy(660., 225.));
let to = screen(xy(490., 225.));
let mut events = batch(&f.app, from, to);
let release = events.pop().unwrap();
send(&mut f.app, events);
let active = f.app.allocation_drag.active.as_ref().unwrap();
let p = &active.press;
let frozen = active.frozen.as_ref().unwrap();
let owner = frozen.targets.iter().find(|t| t.element == f.a).unwrap();
assert_eq!(p.start, from);
assert!(contains(owner.region, p.stamp.world(from)));
assert!(p.stamp.world(to).x < owner.region.x);
assert_eq!(
frozen.resolve(p.stamp, Some(to), false),
Hit::Destination(plan::Destination::OutsidePerformers, None),
"The pointer must reach empty canvas, not be occluded by the obstacle"
);
let candidate = active
.cache
.iter()
.find(|(destination, _)| *destination == plan::Destination::OutsidePerformers)
.unwrap()
.1
.as_ref()
.unwrap();
let affected = match &active.prepared {
Prepared::Singleton(scope) => &scope.placements,
Prepared::Assignment(scope) => scope.affected(),
_ => panic!("expected assignment gesture"),
};
let requested = xy(370., 190.);
let presentation = plan::PresentationContext {
viewport: p.stamp.viewport(),
zoom: p.stamp.zoom,
target: None,
};
assert!(matches!(
candidate.place(requested, presentation),
Err(plan::Refusal::LayoutRequired(_))
));
let proposed = clearance::requests(
(f.app.project(), f.app.document.view_index()),
(candidate.project(), candidate.index()),
f.diagram,
affected,
f.node,
requested,
(p.stamp.world(from), p.stamp.world(to)),
);
assert_eq!(
proposed.len(),
1,
"a genuine left crossing must propose clearance"
);
assert!(proposed[0].x < requested.x);
let work = &before.diagrams[&f.diagram].nodes[&f.node];
let obstacle = &before.diagrams[&f.diagram].nodes[&obstacle_node];
assert!(obstacle.position.x + obstacle.size.width < 490.);
assert!(proposed[0].x + work.size.width <= owner.region.x - 10.);
assert!(proposed[0].x < obstacle.position.x + obstacle.size.width);
assert!(obstacle.position.x < proposed[0].x + work.size.width);
assert_eq!(proposed[0].y, obstacle.position.y);
assert!(matches!(
candidate.place(proposed[0], presentation),
Err(plan::Refusal::LayoutRequired(message)) if message.contains("overlapping cards")
));
let feedback = f.app.allocation_drag.feedback.as_ref().unwrap();
assert!(feedback.refused, "{}", feedback.text);
assert!(feedback.ghost_delta.is_some());
assert!(f.app.allocation_drag.preview.is_none());
assert_eq!(f.app.project(), &before);
assert_eq!(f.app.document.bundle(), &source);
assert!(Arc::ptr_eq(&snapshot, &f.app.document.snapshot()));
let _ = f.app.update(release);
assert!(
f.app.status.contains("overlapping cards"),
"{}",
f.app.status
);
assert!(f.app.allocation_drag.active.is_none());
assert!(f.app.allocation_drag.preview.is_none());
assert_eq!(f.app.project(), &before);
assert_eq!(f.app.document.bundle(), &source);
assert_eq!(f.app.document.revision(), revision);
assert!(Arc::ptr_eq(&snapshot, &f.app.document.snapshot()));
assert!(!f.app.document.can_undo());
assert!(f.app.document.can_redo());
}
}
#[test]
fn outgoing_clearance_preserves_source_enclosure_and_allocated_sibling() {
for layer in [Layer::Oa, Layer::Sa] {
let mut f = outgoing_fixture(layer);
let mut project = f.app.project().clone();
let sibling = project
.add_element(
project.elements[&f.work].kind(),
layer,
"Remaining work",
None,
)
.unwrap();
let sibling_node = project.place(f.diagram, sibling, xy(540., 450.));
let allocation = project.relate(
RelationKind::Allocation,
"Keep responsibility",
f.a,
sibling,
);
replace(&mut f, project);
let before = f.app.project().clone();
let source = f.app.document.bundle().clone();
let view = projection::project_view(&before, f.diagram);
let owner = view.nodes.iter().find(|n| n.element == f.a).unwrap();
let bottom = owner.position.y + owner.size.height;
let stored_owner = &before.diagrams[&f.diagram].nodes[&owner.id];
assert!(
bottom > stored_owner.position.y + stored_owner.size.height,
"The retained sibling must enlarge the projected source enclosure"
);
let from = screen(xy(660., 225.));
let to = screen(xy(660., bottom + 1.));
let mut events = batch(&f.app, from, to);
let release = events.pop().unwrap();
send(&mut f.app, events);
let active = f.app.allocation_drag.active.as_ref().unwrap();
let p = &active.press;
let frozen = active.frozen.as_ref().unwrap();
let target = frozen.targets.iter().find(|t| t.element == f.a).unwrap();
assert_eq!(p.start, from);
assert!(contains(target.region, p.stamp.world(from)));
assert!(p.stamp.world(to).y >= target.region.y + target.region.height);
assert_eq!(
frozen.resolve(p.stamp, Some(to), false),
Hit::Destination(plan::Destination::OutsidePerformers, None)
);
let preview = f.app.allocation_drag.preview.as_ref().expect(&f.app.status);
assert!(!f.app.allocation_drag.feedback.as_ref().unwrap().refused);
let requested = xy(540., 190. + to.y - from.y);
assert!(matches!(
preview.candidate.place(
requested,
plan::PresentationContext {
viewport: p.stamp.viewport(),
zoom: p.stamp.zoom,
target: None,
}
),
Err(plan::Refusal::LayoutRequired(_))
));
let moved = &preview.placement.diagram.nodes[&f.node];
assert_eq!(moved.position.x, 540.);
assert!(moved.position.y >= bottom + 10.);
assert!(moved.position.y > requested.y);
assert_eq!(
preview
.placement
.view
.nodes
.iter()
.find(|n| n.id == owner.id)
.unwrap(),
owner
);
let remaining = preview
.placement
.view
.nodes
.iter()
.find(|n| n.id == sibling_node)
.unwrap();
assert_eq!(remaining.visual_parent, Some(owner.id));
assert_eq!(
remaining.position,
before.diagrams[&f.diagram].nodes[&sibling_node].position
);
assert_eq!(
&preview.project().relations[&allocation],
&before.relations[&allocation]
);
for (id, node) in &before.diagrams[&f.diagram].nodes {
if *id != f.node {
assert_eq!(&preview.placement.diagram.nodes[id], node);
}
}
let mut expected = preview.project().clone();
expected
.diagrams
.insert(f.diagram, preview.placement.diagram.clone());
assert_eq!(f.app.project(), &before);
assert_eq!(f.app.document.bundle(), &source);
let _ = f.app.update(release);
assert_eq!(f.app.project(), &expected, "{}", f.app.status);
assert_eq!(f.app.document.revision(), 1);
assert_eq!(
validation::effective_performer(f.app.project(), f.work),
None
);
assert_eq!(
validation::effective_performer(f.app.project(), sibling),
Some(f.a)
);
assert_eq!(
&f.app.project().relations[&allocation],
&before.relations[&allocation]
);
let after = f.app.document.bundle().clone();
let _ = f.app.update(Message::Undo);
assert_eq!(f.app.project(), &before);
assert_eq!(f.app.document.bundle(), &source);
assert!(!f.app.document.can_undo());
let _ = f.app.update(Message::Redo);
assert_eq!(f.app.project(), &expected);
assert_eq!(f.app.document.bundle(), &after);
}
}
#[test]
fn refused_motion_retains_last_scene_but_release_never_commits_it() {
let mut f = outgoing_fixture(Layer::Sa);
let mut project = f.app.project().clone();
let obstacle = project
.add_element(Kind::Function, Layer::Sa, "Unrelated work", None)
.unwrap();
project.place(f.diagram, obstacle, xy(1250., 120.));
replace(&mut f, project);
let original = f.app.project().clone();
let source = f.app.document.bundle().clone();
let p = admit_press(&mut f);
let clear = screen(xy(450., 225.));
let _ = f.app.update(Message::WorkDrag(Event::Preview(
p.stamp,
p.token,
Some(clear),
)));
let last = f.app.allocation_drag.preview.clone().expect(&f.app.status);
// Another work card blocks this location: the prior legal outgoing scene is display
// state only, and must not become a fallback command on release.
let blocked = screen(xy(1260., 130.));
let _ = f.app.update(Message::WorkDrag(Event::Preview(
p.stamp,
p.token,
Some(blocked),
)));
assert!(f.app.allocation_drag.feedback.as_ref().unwrap().refused);
assert!(
f.app
.allocation_drag
.feedback
.as_ref()
.unwrap()
.ghost_delta
.is_some()
);
assert!(Arc::ptr_eq(
f.app.allocation_drag.preview.as_ref().unwrap(),
&last
));
let _ = f.app.update(Message::WorkDrag(Event::Release(
p.stamp,
p.token,
Some(blocked),
)));
assert_eq!(f.app.project(), &original);
assert_eq!(f.app.document.bundle(), &source);
assert!(!f.app.document.can_undo());
assert!(f.app.allocation_drag.preview.is_none());
}
@@ -1,6 +1,5 @@
//! Compact neutral tool palette. Tool state never changes its allocated width.
use super::*;
use crate::connection_tool::Tool;
use iced::{
Point, Rectangle, Size, Theme, mouse,
widget::{
@@ -12,7 +11,7 @@ use iced::{
#[derive(Clone, Copy)]
enum Icon {
Element(Kind),
Connection(Tool),
Arrow,
Existing,
Select,
Collapse(bool),
@@ -77,59 +76,10 @@ impl canvas::Program<Message> for Icon {
);
}
}
Self::Connection(connection) => match connection {
// The OA and SA work-flow tools share a visual family; they
// never coexist in a palette. Keep their small glyph legible.
Tool::Interaction | Tool::FunctionalExchange => {
for x in [1., 11.] {
f.stroke(
&Path::rounded_rectangle(
Point::new(x, 5.),
Size::new(4., 6.),
1.5.into(),
),
stroke,
);
}
f.stroke(&line(&[(5., 8.), (10., 8.)]), stroke);
f.stroke(&line(&[(7.5, 5.5), (10., 8.), (7.5, 10.5)]), stroke);
}
Tool::CommunicationMean => {
// Participant endpoints, without implying a fixed direction.
for x in [1., 11.] {
f.stroke(
&Path::rectangle(Point::new(x, 4.), Size::new(4., 8.)),
stroke,
);
}
f.stroke(&line(&[(5., 8.), (11., 8.)]), stroke);
}
Tool::BoundaryExchange => {
// Ports on facing participant boundaries. Standard exchanges
// are unoriented, so the generic tool has no arrowhead.
for x in [2., 14.] {
f.stroke(&line(&[(x, 2.), (x, 14.)]), stroke);
}
for x in [1., 12.] {
f.stroke(
&Path::rectangle(Point::new(x, 6.), Size::new(3., 4.)),
stroke,
);
}
f.stroke(&line(&[(4., 8.), (12., 8.)]), stroke);
}
Tool::Allocation => {
// Work enters a performer: allocation can appear as nesting
// rather than a relationship line in allocated-work views.
f.stroke(&line(&[(1., 2.), (1., 14.), (15., 14.), (15., 2.)]), stroke);
f.stroke(
&Path::rounded_rectangle(Point::new(5., 9.), Size::new(6., 3.), 1.into()),
stroke,
);
f.stroke(&line(&[(8., 1.), (8., 7.)]), stroke);
f.stroke(&line(&[(5., 4.), (8., 7.), (11., 4.)]), stroke);
}
},
Self::Arrow => {
f.stroke(&line(&[(1., 8.), (14., 8.), (10., 4.)]), stroke);
f.stroke(&line(&[(14., 8.), (10., 12.)]), stroke);
}
Self::Existing => {
f.stroke(
&Path::rectangle(Point::new(1., 1.), Size::new(10., 10.)),
@@ -284,7 +234,7 @@ pub fn view(app: &App) -> Element<'_, Message> {
}
content = content.push(tool(
app,
Icon::Connection(*connection),
Icon::Arrow,
connection.label(),
Message::Connection(crate::connection_edit::Event::Choose(Some(*connection))),
app.connection
@@ -1,544 +0,0 @@
//! Canvas inspection retains the displayed mixed-layer surface; navigation follows the model.
use super::*;
use crate::diagram_usage::Target;
use crate::model_menu::{Event as MenuEvent, Request};
struct Fixture {
app: App,
diagram: Id,
process: Id,
placement: Id,
edge: Id,
}
fn fixture() -> Fixture {
let mut p = Project::empty();
let process = p
.add_element(Kind::Process, Layer::Oa, "Operational process", None)
.unwrap();
let capability = p
.add_element(Kind::Capability, Layer::Oa, "Operational capability", None)
.unwrap();
let edge = p.relate(
RelationKind::ChainInvolvement,
"Enables",
process,
capability,
);
p.ensure_diagram(Layer::Oa);
let diagram = p.ensure_diagram(Layer::Sa);
p.diagrams.get_mut(&diagram).unwrap().projection = ProjectionKind::Traceability;
let placement = p.place(diagram, process, Position { x: 0., y: 0. });
p.place(diagram, capability, Position { x: 500., y: 0. });
let mut app = App::with_project(p);
app.page = Page::Diagram;
app.layer = Layer::Sa;
app.active_diagram = Some(diagram);
app.selected = diagram;
app.refresh_draft();
app.reconcile_multiselect();
assert!(
project_view(app.project(), diagram)
.edges
.iter()
.any(|e| e.id == edge)
);
Fixture {
app,
diagram,
process,
placement,
edge,
}
}
fn assert_surface(f: &Fixture) {
assert_eq!(f.app.page, Page::Diagram);
assert_eq!(f.app.layer, Layer::Sa);
assert_eq!(f.app.active_diagram, Some(f.diagram));
}
#[test]
fn mixed_projection_switch_restores_all_authored_content_and_one_step_history() {
let mut f = fixture();
let before = f.app.document.snapshot();
let mut expected = before.decoded.project.clone();
expected.diagrams.get_mut(&f.diagram).unwrap().projection = ProjectionKind::Allocation;
let _ = f
.app
.update(Message::Projection(ProjectionKind::Allocation));
assert_surface(&f);
assert_eq!(f.app.project(), &expected);
assert!(project_view(f.app.project(), f.diagram).nodes.is_empty());
assert_eq!(f.app.project().diagrams[&f.diagram].nodes.len(), 2);
let switched = f.app.document.snapshot();
let _ = f.app.update(Message::Undo);
assert_eq!(f.app.project(), &before.decoded.project);
assert_eq!(f.app.document.bundle(), &before.bundle);
assert!(!f.app.document.can_undo());
let _ = f.app.update(Message::Redo);
assert_eq!(f.app.project(), &switched.decoded.project);
assert_eq!(f.app.document.bundle(), &switched.bundle);
let _ = f
.app
.update(Message::Projection(ProjectionKind::Traceability));
assert_surface(&f);
assert_eq!(f.app.project(), &before.decoded.project);
assert!(
project_view(f.app.project(), f.diagram)
.edges
.iter()
.any(|e| e.id == f.edge)
);
}
#[test]
fn mixed_canvas_edge_and_group_inspection_preserve_surface_and_history() {
for grouped in [false, true] {
let mut f = fixture();
let before = f.app.document.snapshot();
let revision = f.app.document.revision();
if grouped {
let _ = f
.app
.update(Message::DiagramSelection(multiselect::Event::Choose(
f.app.multiselect_context().unwrap(),
Target::Placement(f.placement),
multiselect::Choice::Replace,
)));
}
let message = if grouped {
Message::DiagramSelection(multiselect::Event::Choose(
f.app.multiselect_context().unwrap(),
Target::Edge(f.edge),
multiselect::Choice::Add,
))
} else {
Message::CanvasSelect(f.app.route_context().unwrap(), f.edge)
};
let _ = f.app.update(message);
assert_surface(&f);
assert_eq!(f.app.selected, f.edge);
assert_eq!(f.app.draft.as_ref().unwrap().original, f.edge);
assert_eq!(
f.app.multiselect_snapshot().unwrap().primary(),
Some(&Target::Edge(f.edge))
);
assert_eq!(
f.app.multiselect_snapshot().unwrap().targets().len(),
if grouped { 2 } else { 1 }
);
assert_eq!(f.app.project(), &before.decoded.project);
assert_eq!(f.app.document.bundle(), &before.bundle);
assert_eq!(f.app.document.revision(), revision);
assert!(!f.app.document.can_undo());
}
}
fn invoke(f: &mut Fixture, object: Id, placement: Option<Id>, action: Message) {
let mut request = Request::object(object, iced::Point::ORIGIN);
request.canvas = f.app.route_context();
request.placement = placement;
let _ = f.app.update(Message::Menu(MenuEvent::Open(request)));
let token = f.app.model_menu.as_ref().unwrap().token;
let _ = f
.app
.update(Message::Menu(MenuEvent::Invoke(token, Box::new(action))));
}
#[test]
fn mixed_canvas_context_properties_and_hide_keep_the_captured_surface() {
let mut f = fixture();
let edge = f.edge;
invoke(&mut f, edge, None, Message::EditProperties(edge));
assert_surface(&f);
assert_eq!(f.app.selected, edge);
assert!(!f.app.document.can_undo());
let before = f.app.document.snapshot();
let process = f.process;
let placement = f.placement;
invoke(&mut f, process, Some(placement), Message::HideSelected);
assert_surface(&f);
assert!(
!f.app.project().diagrams[&f.diagram]
.nodes
.contains_key(&placement)
);
assert!(f.app.project().elements.contains_key(&process));
let _ = f.app.update(Message::Undo);
assert_eq!(f.app.project(), &before.decoded.project);
assert_eq!(f.app.document.bundle(), &before.bundle);
}
#[test]
fn mixed_canvas_explicit_navigation_still_follows_the_target_layer() {
let mut f = fixture();
let process = f.process;
let edge = f.edge;
invoke(&mut f, edge, None, Message::Select(process));
assert_eq!(f.app.selected, process);
assert_eq!(f.app.layer, Layer::Oa);
assert_ne!(f.app.active_diagram, Some(f.diagram));
}
#[test]
fn explicit_navigation_to_the_inspected_cross_layer_object_follows_its_layer() {
let mut f = fixture();
let _ = f.app.update(Message::CanvasSelect(
f.app.route_context().unwrap(),
f.edge,
));
assert_surface(&f);
assert_eq!(f.app.selected, f.edge);
let before = f.app.document.snapshot();
let _ = f.app.update(Message::Select(f.edge));
assert_eq!(f.app.selected, f.edge);
assert_eq!(f.app.layer, Layer::Oa);
assert_ne!(f.app.active_diagram, Some(f.diagram));
assert_eq!(f.app.project(), &before.decoded.project);
assert_eq!(f.app.document.bundle(), &before.bundle);
assert!(!f.app.document.can_undo());
}
#[test]
fn mixed_canvas_invalid_draft_and_stale_packets_preserve_selection() {
let mut f = fixture();
let context = f.app.route_context().unwrap();
let _ = f.app.update(Message::Field("/id".into(), "-".into()));
let draft = serde_json::to_value(f.app.draft.as_ref().unwrap().recovery_snapshot()).unwrap();
let _ = f.app.update(Message::CanvasSelect(context, f.edge));
assert_eq!(f.app.selected, f.diagram);
assert_surface(&f);
assert_eq!(
serde_json::to_value(f.app.draft.as_ref().unwrap().recovery_snapshot()).unwrap(),
draft
);
let _ = f
.app
.update(Message::DiagramSelection(multiselect::Event::Choose(
f.app.multiselect_context().unwrap(),
Target::Edge(f.edge),
multiselect::Choice::Replace,
)));
assert_eq!(f.app.selected, f.diagram);
assert_eq!(
serde_json::to_value(f.app.draft.as_ref().unwrap().recovery_snapshot()).unwrap(),
draft
);
let _ = f.app.update(Message::RevertProperties);
f.app.canvas_epoch += 1;
let _ = f.app.update(Message::CanvasSelect(context, f.edge));
assert_eq!(f.app.selected, f.diagram);
assert!(!f.app.document.can_undo());
}
#[test]
fn cross_layer_port_inspection_and_connection_start_retain_the_view() {
let mut p = Project::empty();
let owner = p
.add_element(Kind::Function, Layer::Sa, "Send", None)
.unwrap();
let port = Id::new_v4();
let element = make_port(
&p,
port,
owner,
"Output",
PortContract::FunctionOutput {
outgoing_items: vec![],
},
)
.unwrap();
p.elements.insert(port, element);
p.ensure_diagram(Layer::Sa);
let diagram = p.ensure_diagram(Layer::Oa);
p.diagrams.get_mut(&diagram).unwrap().projection = ProjectionKind::Traceability;
let placement = p.place(diagram, owner, Position { x: 0., y: 0. });
let mut app = App::with_project(p);
app.page = Page::Diagram;
app.layer = Layer::Oa;
app.active_diagram = Some(diagram);
app.selected = diagram;
app.refresh_draft();
app.reconcile_multiselect();
assert!(
project_view(app.project(), diagram)
.ports
.iter()
.any(|p| p.element == port)
);
let _ = app.update(Message::CanvasSelect(app.route_context().unwrap(), port));
assert_eq!(app.selected, port);
assert_eq!(app.active_diagram, Some(diagram));
assert_eq!(app.layer, Layer::Oa);
assert_eq!(
app.multiselect_snapshot().unwrap().primary(),
Some(&Target::Port { port, placement })
);
// Reset inspection so the endpoint path cannot pass by selecting the same ID.
app.selected = diagram;
app.refresh_draft();
let context = app.route_context().unwrap();
// Mixed canvases can retain a tool from either perspective.
app.connection = Some(crate::connection_edit::Session::new(
app.project(),
&project_view(app.project(), diagram),
context,
crate::connection_tool::Tool::FunctionalExchange,
));
let _ = app.update(Message::Connection(
crate::connection_edit::Event::Endpoint(context, port),
));
assert_eq!(app.selected, port);
assert_eq!(app.layer, Layer::Oa);
assert_eq!(app.active_diagram, Some(diagram));
assert_eq!(app.connection.as_ref().unwrap().source, Some(port));
assert!(!app.document.can_undo());
}
fn authoring_fixture(performer: bool) -> (Fixture, Id) {
let mut f = fixture();
let mut project = f.app.project().clone();
let owner = project
.add_element(
if performer {
Kind::Entity
} else {
Kind::Activity
},
Layer::Oa,
"Operational owner",
None,
)
.unwrap();
let target = project
.add_element(Kind::Activity, Layer::Oa, "Operational target", None)
.unwrap();
let placement = project.place(f.diagram, owner, Position { x: 0., y: 400. });
project.place(f.diagram, target, Position { x: 500., y: 400. });
f.app = App::with_project(project);
f.app.page = Page::Diagram;
f.app.layer = Layer::Sa;
f.app.active_diagram = Some(f.diagram);
f.app.selected = f.diagram;
f.app.refresh_draft();
f.app.reconcile_multiselect();
f.process = owner;
f.placement = placement;
(f, target)
}
fn assert_source_pair(app: &App) {
let compiled = oa_core::source_project::compile_bundle(
app.document.bundle(),
oa_core::source_project::ProjectLimits::default(),
)
.unwrap();
assert_eq!(&compiled.decoded.project, app.project());
assert_eq!(&compiled.bundle, app.document.bundle());
}
#[test]
fn mixed_canvas_relationship_actions_keep_operational_source_and_commit_one_step() {
for context_action in [false, true] {
let (mut f, target) = authoring_fixture(false);
let before = f.app.document.snapshot();
let owner = f.process;
let placement = f.placement;
if context_action {
invoke(
&mut f,
owner,
Some(placement),
Message::AddRelationKind(RelationKind::Interaction, false),
);
} else {
let _ = f.app.update(Message::SelectNode(placement));
let _ = f.app.update(Message::AddRelation);
}
assert_surface(&f);
let Some(crate::workflow::Workflow::Relation(relation)) = &f.app.workflow else {
panic!("relationship form did not open: {}", f.app.status);
};
assert_eq!(
relation.source.as_ref().map(|source| source.id),
Some(owner)
);
assert_eq!(relation.kind, RelationKind::Interaction);
let saved = f
.app
.workflow
.as_ref()
.unwrap()
.recovery_snapshot()
.unwrap();
assert_eq!(saved["Relation"]["layer"], "Oa");
let _ = f
.app
.update(Message::Workflow(crate::workflow::Event::Target(Choice {
id: target,
label: "Operational target".into(),
})));
let _ = f
.app
.update(Message::Workflow(crate::workflow::Event::Apply));
assert!(f.app.workflow.is_none(), "{}", f.app.status);
let created: Vec<_> = f
.app
.project()
.relations
.values()
.filter(|relation| !before.decoded.project.relations.contains_key(&relation.id))
.collect();
assert_eq!(created.len(), 1);
assert_eq!(
(created[0].kind(), created[0].source(), created[0].target()),
(RelationKind::Interaction, owner, target)
);
assert_source_pair(&f.app);
let _ = f.app.update(Message::Undo);
assert_eq!(f.app.project(), &before.decoded.project);
assert_eq!(f.app.document.bundle(), &before.bundle);
assert!(!f.app.document.can_undo());
}
}
#[test]
fn mixed_canvas_add_child_command_uses_parent_layer_for_containment_and_allocation() {
for performer in [false, true] {
let (mut f, _) = authoring_fixture(performer);
let before = f.app.document.snapshot();
let owner = f.process;
let placement = f.placement;
invoke(
&mut f,
owner,
Some(placement),
Message::CreateContextElement(Kind::Activity, true),
);
assert_surface(&f);
let created: Vec<_> = f
.app
.project()
.elements
.values()
.filter(|element| !before.decoded.project.elements.contains_key(&element.id))
.collect();
assert_eq!(created.len(), 1, "{}", f.app.status);
let child = created[0].id;
assert_eq!(created[0].kind(), Kind::Activity);
assert_eq!(created[0].layer(), Layer::Oa);
assert_eq!(
created[0].parent,
if performer { None } else { Some(owner) }
);
let allocations: Vec<_> = f
.app
.project()
.relations
.values()
.filter(|relation| !before.decoded.project.relations.contains_key(&relation.id))
.collect();
assert_eq!(allocations.len(), usize::from(performer));
if performer {
assert_eq!(
(
allocations[0].kind(),
allocations[0].source(),
allocations[0].target()
),
(RelationKind::Allocation, owner, child)
);
}
assert!(
f.app.project().diagrams[&f.diagram]
.nodes
.values()
.any(|node| node.element == child)
);
assert_source_pair(&f.app);
let _ = f.app.update(Message::Undo);
assert_eq!(f.app.project(), &before.decoded.project);
assert_eq!(f.app.document.bundle(), &before.bundle);
assert!(!f.app.document.can_undo());
}
}
#[test]
fn mixed_canvas_root_creation_still_uses_the_active_perspective() {
let (mut f, _) = authoring_fixture(false);
let _ = f.app.update(Message::SelectNode(f.placement));
let before = f.app.document.snapshot();
let _ = f
.app
.update(Message::CreateContextElement(Kind::Function, false));
assert_surface(&f);
let created: Vec<_> = f
.app
.project()
.elements
.values()
.filter(|element| !before.decoded.project.elements.contains_key(&element.id))
.collect();
assert_eq!(created.len(), 1, "{}", f.app.status);
assert_eq!(created[0].kind(), Kind::Function);
assert_eq!(created[0].layer(), Layer::Sa);
assert_eq!(created[0].parent, None);
assert_source_pair(&f.app);
let _ = f.app.update(Message::Undo);
assert_eq!(f.app.project(), &before.decoded.project);
assert_eq!(f.app.document.bundle(), &before.bundle);
}
#[test]
fn child_creation_navigates_to_a_parent_layer_preferred_view_only_when_needed() {
for existing_preferred in [false, true] {
let (mut f, _) = authoring_fixture(false);
let mut project = f.app.project().clone();
for diagram in project
.diagrams
.values_mut()
.filter(|d| d.layer == Layer::Oa)
{
diagram.projection = if existing_preferred {
ProjectionKind::Allocation
} else {
ProjectionKind::Overview
};
}
project.diagrams.get_mut(&f.diagram).unwrap().projection = ProjectionKind::Capabilities;
f.app = App::with_project(project);
let _ = f.app.update(Message::Select(f.process));
let _ = f.app.update(Message::Diagram(Choice {
id: f.diagram,
label: "System capabilities".into(),
}));
assert_eq!(f.app.selected, f.process);
assert_eq!(f.app.layer, Layer::Sa);
assert_eq!(f.app.active_diagram, Some(f.diagram));
let before = f.app.document.snapshot();
let _ = f
.app
.update(Message::CreateContextElement(Kind::Activity, true));
assert_eq!(f.app.layer, Layer::Oa, "{}", f.app.status);
let diagram = f.app.active_diagram.unwrap();
assert_ne!(diagram, f.diagram);
assert_eq!(f.app.project().diagrams[&diagram].layer, Layer::Oa);
assert_eq!(
f.app.project().diagrams[&diagram].projection,
ProjectionKind::Allocation
);
assert_eq!(
f.app.project().diagrams.len(),
before.decoded.project.diagrams.len() + usize::from(!existing_preferred)
);
assert_eq!(
f.app.project().elements[&f.app.selected].parent,
Some(f.process)
);
assert_source_pair(&f.app);
let _ = f.app.update(Message::Undo);
assert_eq!(f.app.project(), &before.decoded.project);
assert_eq!(f.app.document.bundle(), &before.bundle);
}
}
+6 -9
View File
@@ -993,10 +993,7 @@ impl canvas::Program<Message> for DiagramCanvas<'_> {
world,
));
}
return Some(
Action::publish(Message::CanvasSelect(self.context, port.element))
.and_capture(),
);
return Some(Action::publish(Message::Select(port.element)).and_capture());
}
if let Some(id) = self.hit(view, p) {
let position = self
@@ -1013,7 +1010,7 @@ impl canvas::Program<Message> for DiagramCanvas<'_> {
.hit_label(&scene.routed, p)
.or_else(|| self.hit_association_label(&scene.routed, p))
{
Some(Action::publish(Message::CanvasSelect(self.context, id)).and_capture())
Some(Action::publish(Message::Select(id)).and_capture())
} else if let Some((id, segment)) = self.hit_edge(&scene.routed, p) {
if id == self.selected
&& self.editable
@@ -1029,7 +1026,7 @@ impl canvas::Program<Message> for DiagramCanvas<'_> {
self.begin_route(state, world, Handle::Bend(index), route);
Some(Action::capture())
} else {
Some(Action::publish(Message::CanvasSelect(self.context, id)).and_capture())
Some(Action::publish(Message::Select(id)).and_capture())
}
} else {
state.pan_start = Some((mouse::Button::Left, p));
@@ -2444,7 +2441,7 @@ mod tests {
.unwrap()
.into_inner()
.0;
assert!(matches!(selected,Some(Message::CanvasSelect(_, id)) if id==port.element));
assert!(matches!(selected,Some(Message::Select(id)) if id==port.element));
let request = canvas.context_request(
&state,
click,
@@ -3057,7 +3054,7 @@ mod tests {
let mut state = State::default();
assert_eq!(canvas.hit_association_label(&routed, at), Some(edge));
assert!(
matches!(pointer(&canvas,&mut state,mouse::Event::ButtonPressed(mouse::Button::Left),at),Some(Message::CanvasSelect(_, id)) if id==edge)
matches!(pointer(&canvas,&mut state,mouse::Event::ButtonPressed(mouse::Button::Left),at),Some(Message::Select(id)) if id==edge)
);
assert!(
state.route_drag.is_none(),
@@ -3107,7 +3104,7 @@ mod tests {
let center = scene.routed.edges[&edge].label.center;
let screen = point(center) + canvas.pan;
assert!(
matches!(pointer(&canvas,&mut state,mouse::Event::ButtonPressed(mouse::Button::Left),screen),Some(Message::CanvasSelect(_, id)) if id==edge)
matches!(pointer(&canvas,&mut state,mouse::Event::ButtonPressed(mouse::Button::Left),screen),Some(Message::Select(id)) if id==edge)
);
canvas.selected = edge;
pointer(
@@ -179,7 +179,7 @@ fn coalesced_port_drag_commits_once_through_app_and_source_history() {
zoom,
);
assert_eq!(messages.len(), 2);
assert!(matches!(&messages[0],Message::CanvasSelect(_, id)if *id==output));
assert!(matches!(&messages[0],Message::Select(id)if *id==output));
assert!(
matches!(&messages[1],Message::PortAnchor(port_edit::Event::Commit(_,_,anchor))if anchor.port==output&&anchor.side==PortAnchorSide::Top)
);
@@ -251,7 +251,7 @@ fn menu_captured_motion_must_not_turn_following_click_into_old_port_drag() {
b,
);
let picked = match &press {
Message::CanvasSelect(_, id) => Some(*id),
Message::Select(id) => Some(*id),
_ => None,
};
let release_debug = format!("{release:?}");
@@ -300,7 +300,7 @@ fn drag_from_already_selected_stationary_port_keeps_source_between_batches() {
.filter_map(|e| event(&c, &mut state, e, b))
.collect();
assert!(
matches!(messages.first(),Some(Message::CanvasSelect(_, id)) if *id==output),
matches!(messages.first(),Some(Message::Select(id)) if *id==output),
"Stationary source was lost between batches: {messages:?}"
);
assert!(
@@ -165,7 +165,7 @@ fn nested_owner_palette_selection_drag_and_context_menu_pick_the_same_port() {
.unwrap()
.into_inner()
.0;
assert!(matches!(press, Some(Message::CanvasSelect(_, id)) if id == port.element));
assert!(matches!(press, Some(Message::Select(id)) if id == port.element));
assert_eq!(state.port_drag.as_ref().unwrap().anchor.port, port.element);
let menu = canvas.context_request(&state, at, bounds);
assert_eq!(menu.object, port.element);
+1 -1
View File
@@ -375,7 +375,7 @@ mod tests {
messages.extend(message);
}
}
assert!(matches!(messages.first(), Some(Message::CanvasSelect(_, id)) if *id == port));
assert!(matches!(messages.first(), Some(Message::Select(id)) if *id == port));
assert!(
matches!(messages.last(), Some(Message::PortAnchor(crate::port_edit::Event::Commit(_, _, anchor))) if anchor.port == port && anchor.side == PortAnchorSide::Top)
);
@@ -243,6 +243,21 @@ impl canvas::Program<Message> for WorkFeedback<'_> {
let Some(frozen) = &feedback.frozen else {
return vec![];
};
if let Some(delta) = feedback.ghost_delta {
for region in &frozen.moving {
let top = Point::new(
(region.x + delta.x) * self.0.zoom + self.0.pan.x,
(region.y + delta.y) * self.0.zoom + self.0.pan.y,
);
frame.stroke(
&Path::rectangle(
top,
iced::Size::new(region.width * self.0.zoom, region.height * self.0.zoom),
),
Stroke::default().with_color(color).with_width(2.),
);
}
}
for index in &feedback.targets {
let target = &frozen.targets[*index];
let region = target.region;
-1
View File
@@ -322,7 +322,6 @@ fn article(topic: Topic) -> Article {
"Show a correspondence between OA and SA",
&[
"Choose OA ↔ SA traceability in View content. Changing this setting does not create counterparts or add their placements, so an existing single-layer diagram can initially look unchanged.",
"Switching back to Architecture or another single-layer projection shows only that view's layer. The other layer's placements, routing and saved visibility remain stored; return to OA ↔ SA traceability to show them again, subject to the view's filters. Selecting a displayed card, port or line and opening its Properties keeps the current view and perspective.",
"Use Review layer traces to inspect named Operational and System endpoints and the meaning of their link. This opens the model's layer-trace list with no search restriction; traces between relationships are reviewed here rather than drawn between element cards.",
"In the chosen architecture view, use Add existing elements. The chooser offers compatible elements from both layers. Select an existing endpoint and click its position in the canvas; repeat for the other end if needed. This adds a placement, not a new semantic element or trace. For port correspondences, place the ports' owners.",
"The view shows correspondence lines alongside ordinary relationships. The shown-line count reflects the current projection and visibility settings, not trace coverage. If a line is hidden, use View visibility and inspect Saved view visibility; placing an endpoint does not remove explicit hides or filters.",
@@ -372,150 +372,3 @@ async fn source6_http_explicit_communication_ports_preview_apply_and_restart_pre
assert_pair(&reopened);
server.stop().await;
}
#[tokio::test]
async fn mixed_traceability_projection_roundtrip_preserves_dormant_http_state() {
let f = fixture();
let mut model = compile_bundle(&f.bundle, ProjectLimits::default())
.unwrap()
.decoded
.project;
let view = model.diagrams.get_mut(&f.diagram).unwrap();
view.layer = Layer::Sa;
view.projection = ProjectionKind::Traceability;
// The OA placements and category are intentionally opposite the view's layer.
view.view_options.hidden_edges = vec![f.mean];
for (index, element) in f.sa.into_iter().enumerate() {
model.place(
f.diagram,
element,
Position {
x: index as f32 * 400.,
y: 300.,
},
);
}
let mut bundle = f.bundle.clone();
bundle.files.insert(
bundle.entry.clone(),
format!(
"// Authored source-6 engineering rationale\n{}",
oa_core::language::format(&model).replacen(
"{\n",
"{\n include \"notes.arcadia\";\n",
1
)
),
);
let directory = tempfile::tempdir().unwrap();
let server = TestServer::start(directory.path(), None).await;
let original = import(&server, &bundle).await;
assert_pair(&original);
let resource = original.resource_id;
let mixed = oa_core::projection::project_view(&original.model, f.diagram);
assert!(
f.oa.iter()
.chain(&f.sa)
.all(|id| mixed.nodes.iter().any(|n| n.element == *id))
);
let mut ordinary = original.model.diagrams[&f.diagram].clone();
ordinary.projection = ProjectionKind::Allocation;
let response = transact(
&server,
&original,
vec![Command::EditDiagram(f.diagram, ordinary.clone())],
)
.await;
let status = response.status();
let etag = response
.headers()
.get("etag")
.map(|v| v.to_str().unwrap().to_owned());
let result: Value = response.json().await.unwrap();
assert_eq!(status, StatusCode::OK, "{result}");
assert_eq!(result["changed"], true);
assert_eq!(result["dry_run"], false);
assert_eq!(result["revision"], original.revision + 1);
let changed = server.get(resource).await;
assert_eq!(etag.as_deref(), Some(changed.etag().as_str()));
let mut expected = original.model.clone();
expected.diagrams.insert(f.diagram, ordinary.clone());
assert_eq!(
changed.model, expected,
"only the projection changes; dormant state is retained"
);
assert_pair(&changed);
assert_eq!(
changed.source_project.files["notes.arcadia"],
bundle.files["notes.arcadia"]
);
assert!(
changed.source_project.files[&bundle.entry]
.starts_with("// Authored source-6 engineering rationale\n")
);
let projected = oa_core::projection::project_view(&changed.model, f.diagram);
assert!(projected.nodes.iter().all(|n| !f.oa.contains(&n.element)));
assert!(
f.sa.iter()
.all(|id| projected.nodes.iter().any(|n| n.element == *id))
);
// A dormant option still must name an existing category. Rejection must not
// advance the ETag or rewrite either side of the persisted model/source pair.
let disk = directory.path().join(format!("{resource}.json"));
let accepted_bytes = std::fs::read(&disk).unwrap();
ordinary.view_options.participant_categories = CategorySelection::Any(vec![Id::new_v4()]);
let rejected = transact(
&server,
&changed,
vec![Command::EditDiagram(f.diagram, ordinary)],
)
.await;
assert_eq!(rejected.status(), StatusCode::UNPROCESSABLE_ENTITY);
let retained = server.get(resource).await;
assert_eq!(retained.etag(), changed.etag());
assert_eq!(
serde_json::to_value(&retained).unwrap(),
serde_json::to_value(&changed).unwrap()
);
assert_eq!(std::fs::read(&disk).unwrap(), accepted_bytes);
server.stop().await;
let server = TestServer::start(directory.path(), None).await;
let reopened = server.get(resource).await;
assert_eq!(
serde_json::to_value(&reopened).unwrap(),
serde_json::to_value(&changed).unwrap()
);
assert_pair(&reopened);
let response = transact(
&server,
&reopened,
vec![Command::EditDiagram(
f.diagram,
original.model.diagrams[&f.diagram].clone(),
)],
)
.await;
let status = response.status();
let result: Value = response.json().await.unwrap();
assert_eq!(status, StatusCode::OK, "{result}");
assert_eq!(result["changed"], true);
assert_eq!(result["revision"], changed.revision + 1);
let restored = server.get(resource).await;
assert_eq!(restored.model, original.model);
assert_pair(&restored);
assert_eq!(
restored.source_project.files["notes.arcadia"],
bundle.files["notes.arcadia"]
);
let projected = oa_core::projection::project_view(&restored.model, f.diagram);
assert!(
f.oa.iter()
.chain(&f.sa)
.all(|id| projected.nodes.iter().any(|n| n.element == *id))
);
assert!(!projected.edges.iter().any(|edge| edge.id == f.mean));
server.stop().await;
}
+1 -1
View File
@@ -147,7 +147,7 @@ schemas["ViewOptions"] = obj({
"coverage": {**ref("Coverage"), "default": "All"},
"work_contexts": {**ref("ContextSelection"), "default": "All"},
"exchange_labels": {**ref("ExchangeLabels"), "default": "Name"}}, [])
schemas["ViewOptions"]["description"] = "Presentation only. Independent predicates intersect; category members union within a family. Only([]) hides all relations and traces. Any([]) remains an explicit empty selection. String projections preserve both-layer hidden/category/context references and latent placements; only Traceability renders both layers. Typed StateMachine/Scenario views retain layer-scoped admission. Filtering preserves unfiltered automatic port positions."
schemas["ViewOptions"]["description"] = "Presentation only. Independent predicates intersect; category members union within a family. Only([]) hides all relations and traces. Any([]) remains an explicit empty selection. Traceability permits both-layer hidden/category/context references; ordinary projections require the diagram layer. Filtering preserves unfiltered automatic port positions."
schemas["Diagram"]["properties"]["view_options"] = {**ref("ViewOptions"), "default": {}}
def upsert_variant(variants, name, value):
+2 -9
View File
@@ -570,15 +570,8 @@ retain their identities and contracts; migration does not silently replace them.
``coverage`` and ``work_contexts``, and ``Name`` for ``exchange_labels``.
``{"Only":[]}`` hides all relation and trace lines; ``{"Any":[]}`` preserves
an explicit empty category/context selection. Category members union within
each family, and independent filters intersect. String projections permit saved
references and placements from both layers. Only ``Traceability`` renders both;
other string projections filter to the diagram's declared layer. ``EditDiagram``
may change between these projections without deleting latent placements, routes
or visibility choices. Returning to Traceability restores their applicability.
Typed StateMachine/Scenario views retain their strict membership and layer checks.
Missing objects, wrong reference kinds/families and duplicate selections remain
invalid. Frozen versions 1–6 keep their prior layer admission before migration;
older version-7 implementations may reject these newly accepted ordinary views.
each family, and independent filters intersect. ``Traceability`` permits
references from both layers; ordinary projections require the diagram's layer.
These presentation choices preserve semantic records, routes, placements and
the automatic port positions derived from unfiltered eligible exchanges.
+13 -1
View File
@@ -2702,7 +2702,19 @@ performer change with diagram placement. The preview MUST identify the
destination and preserve readable work and destination identity. Destination
identity is shown outside the canvas, independently of explanatory or refusal
text. The outlined target's hit region remains fixed throughout the gesture;
feedback MUST NOT obscure the work or change its pointer-relative placement.
feedback MUST NOT obscure the work. Preserve pointer-relative placement when
the requested position is valid. When an outgoing drop would leave work
overlapping its former performer, the editor MAY propose a minimal grid-aligned
translation through a crossed performer boundary, with one grid unit of
clearance. It MUST preview that exact position, translate the complete affected
work group rigidly, and recheck all semantic and collision constraints on release.
It MUST NOT move unrelated placements or search arbitrary free space. If no
proposal is valid, a pointer-following outline MAY accompany the last valid
preview; that retained preview MUST NOT authorize a refused release.
Outgoing work headers MAY be partly outside the viewport provided each retains
at least a 24-by-24 logical-pixel grab region. Releasing the pointer outside the
viewport still cancels. Other assignment and Arrange gestures retain their
complete-header visibility requirement.
A clean click selects without applying unrelated drafts. A refused work press
with an unapplied property draft MUST preserve its text, caret and focused
editor. An accepted drag is one atomic model/source/history transaction:
+15 -21
View File
@@ -409,12 +409,8 @@ filters rather than widening them to All.
Traceability views retain their established two-layer projection: default options
preserve eligible OA and SA lines. Their hidden-edge, category and context
references may therefore select either layer. Ordinary string projections retain
these references from either layer as saved presentation choices; they still
render only their declared layer. Switching projections MUST preserve those
choices, including explicit empty selections. Existing-object, reference-kind,
family and uniqueness constraints still apply. Typed StateMachine and Scenario
views retain layer-scoped reference admission. A filter never hides the other
references may therefore select either layer. All ordinary projections require
these references in the declared diagram layer. A filter never hides the other
layer merely because the Traceability diagram has an OA or SA layer label.
Versions 1–5 reject the new relation, category constructor, diagram field (even
@@ -1077,20 +1073,6 @@ capabilities with their involvement, exploitation, include, extend and
generalization links. Decomposition and Overview retain general containment;
Overview also exposes all relationships. These string projections hide
inapplicable placements without deleting them or changing semantic records.
This includes opposite-layer placements retained after leaving Traceability.
Changing between string projections changes only the projection value; placement
identities, positions, sizes, collapsed state, port anchors, routes and visibility
choices remain authored. Returning to Traceability restores their applicability.
Ordinary views MUST NOT render opposite-layer nodes, parents, ports or lines.
This current-version admission correction does not broaden frozen source/JSON
versions 1–6: their layer-scoped placement and visibility checks remain required
before migration. Earlier version-7 implementations can reject ordinary views
containing these retained opposite-layer records.
The explicit RelocateNode operation moves a placement to a different diagram
only when its element belongs to the destination layer or the destination is
Traceability. Retaining an existing hidden placement through a projection change
does not authorize a relocation that immediately hides it in another layer.
A StateMachine projection MUST reference an existing StateMachine in the
diagram's layer. Its placements MUST refer to that machine, its Regions, or
@@ -2146,7 +2128,19 @@ performer change with diagram placement. The preview MUST identify the
destination and preserve readable work and destination identity. Destination
identity is shown outside the canvas, independently of explanatory or refusal
text. The outlined target's hit region remains fixed throughout the gesture;
feedback MUST NOT obscure the work or change its pointer-relative placement.
feedback MUST NOT obscure the work. Preserve pointer-relative placement when
the requested position is valid. When an outgoing drop would leave work
overlapping its former performer, the editor MAY propose a minimal grid-aligned
translation through a crossed performer boundary, with one grid unit of
clearance. It MUST preview that exact position, translate the complete affected
work group rigidly, and recheck all semantic and collision constraints on release.
It MUST NOT move unrelated placements or search arbitrary free space. If no
proposal is valid, a pointer-following outline MAY accompany the last valid
preview; that retained preview MUST NOT authorize a refused release.
Outgoing work headers MAY be partly outside the viewport provided each retains
at least a 24-by-24 logical-pixel grab region. Releasing the pointer outside the
viewport still cancels. Other assignment and Arrange gestures retain their
complete-header visibility requirement.
A clean click selects without applying unrelated drafts. A refused work press
with an unapplied property draft MUST preserve its text, caret and focused
editor. An accepted drag is one atomic model/source/history transaction:
+1 -1
View File
@@ -12490,7 +12490,7 @@
},
"required": [],
"additionalProperties": false,
"description": "Presentation only. Independent predicates intersect; category members union within a family. Only([]) hides all relations and traces. Any([]) remains an explicit empty selection. String projections preserve both-layer hidden/category/context references and latent placements; only Traceability renders both layers. Typed StateMachine/Scenario views retain layer-scoped admission. Filtering preserves unfiltered automatic port positions."
"description": "Presentation only. Independent predicates intersect; category members union within a family. Only([]) hides all relations and traces. Any([]) remains an explicit empty selection. Traceability permits both-layer hidden/category/context references; ordinary projections require the diagram layer. Filtering preserves unfiltered automatic port positions."
},
"CommunicationPortChoice": {
"oneOf": [
-11
View File
@@ -1,11 +0,0 @@
# Connection tool icons
Branch candidate for [#41](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/41), based on published Windows preview source `715036e132677dd2bc2fb37ed316d93dc9987aec`. This is not integrated or native acceptance.
The reported collapsed palette repeats one arrow for three different tools. Extend the existing Rust/Iced canvas glyphs at their actual 16×16 size: work endpoints plus an arrow for Interaction/Functional exchange, neutral participant endpoints for Communication means, facing component ports for Boundary exchange, and work entering a performer for Allocation. The first pair never coexist in one perspective. Unoriented generic tools must not imply a fixed direction.
Letter badges were rejected as language-dependent and cramped. Different arrow/dash styles risk confusing tool identity with relation direction. Native endpoint/container shapes fit the existing icon system without font or asset dependencies. Preserve button dimensions, explicit labels/tooltips, ordering, messages, availability and selection rules.
Independent source critique found no blocker and confirmed the tool semantics and Iced API use. Actual-size legibility remains unverified, particularly the exchange arrow, port details and possible download/import interpretation of Allocation. Verify enabled, disabled, hovered and selected palettes in both perspectives, expansion/collapse, tool activation, representative relation creation and cancellation. Existing keyboard/accessibility behavior must be checked, not inferred from hover labels. Reuse semantic connection tests; geometry hashes alone are not an identification or usability evaluator.
Linux remains excluded by the existing user pause. Live ownership and integration status belong to the linked issue.
+88
View File
@@ -0,0 +1,88 @@
# Outgoing allocation dragging
Scope: [issue 40](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/40),
based on published Windows source `715036e132677dd2bc2fb37ed316d93dc9987aec`.
This contribution is not integrated release acceptance. User requirements remain
in `PROJECT_GOAL.md`; this note records a revision to derived interaction policy.
## Reproduction and cause
The released executable SHA256
`2c03bd6cc3f1110c219e4f57ab94874a121590f83779239a93289b7170664399`
opened a copied Allocation/Process companion fixture on Windows. At 1440x900,
72% Fit, the OA assign view's X-receive was dragged from window (486,546) to
(365,546), just beyond A's left edge. It remained assigned at its original
position, reporting enlarged card overlap. A control drag to (625,572) removed
assignment; Undo restored the original scene. These are actual native end-state
observations; intermediate jitter was diagnosed from source, not frame capture.
Frozen targets resolve from the pointer, while placement retains its grab
offset. The pointer therefore leaves its performer before the full work card
does. Former parent/child intersection becomes unrelated overlap after removing
allocation. Refused motion previously cleared the preview and redrew the saved
scene. Additionally, whole-header viewport containment rejects a useful outgoing
position in the fitted reproduction even when its model geometry is valid.
## Selected policy
Try exact snapped pointer placement first. Only an outgoing assignment candidate
with a placement refusal may propose bounded source clearance: move the entire
captured work footprint through a crossed frozen source boundary, clearing the
post-removal source enclosure by one 10-world-unit grid cell. Consider at most
four directions, ordered by press-to-pointer boundary-crossing fraction and a
fixed direction tie-break. Existing placement, collision, semantic, exact-command
and source/history admission remain authoritative. No neighbor is moved, no
general packing/search occurs, and no semantic refusal is overridden.
The accepted/candidate semantic indexes are reused during fallback projections.
Outgoing headers may be partly clipped but each must retain a 24x24 logical-pixel
grab region. Other assignment and Arrange visibility rules remain unchanged.
The exact corrected candidate is previewed; release recomputes it. Blocked
in-bounds motion retains its last admitted scene and adds an orange pointer
outline. This display state confers no permission to commit on refused release.
Cancel, outside release and gesture invalidation retire it normally.
Rejected alternatives: retaining a moving outline alone leaves the boundary
dead band; allowing unrelated overlap makes unassigned work look allocated;
general auto-layout changes unrelated placement and makes drag intent harder to
predict. The previous unconditional pointer-offset rule is narrowed in
`docs/language.rst` and its HTML copy. Real neighboring-card collisions and
insufficient visible grab area can still refuse a drop.
## Verification status
Independent source diagnosis and repair critique found no semantic/stale/cancel
bypass. Review exposed the remaining whole-header camera restriction and an
obsolete retained-preview assertion; both were revised. Added checks cover
OA/SA boundary clearance, corners, source shrinkage, rigid descendants/groups,
real App frame-by-frame input, exact source/history, cancellation, blocked release
and outgoing grab-area boundaries. At clean source
`1a669130fb6d2b65279aab3847e966a1a282c191`, the Windows allocation-drag
suite passes 121 tests (none failed or ignored; 1,424 filtered out), strict
desktop all-target Clippy passes, and the normal desktop development build
passes. [Raw results and reproduction commands](experiments/drag-out-20260925/README.md)
preserve the source, platform, failed attempts and exact scope. These checks do
not prove native usability. Computer Use was stopped with the physical Escape
key before the changed executable could be inspected. Fitted-view dragging,
clipped-card identification/regrabbing, native Undo/Redo and Save/reopen remain
unverified. The issue remains open; no integration or release acceptance follows
from the targeted gates.
Test-only successor `24b1eab07d306d8cb091bb46f7daf9f027a8f1c0` additionally
checks an actual fallback blocked by unrelated work, including preservation of
an existing redo branch, and an outgoing move while an allocated sibling keeps
the source enclosure expanded. Both run for OA and SA. All 123 allocation-drag
tests and strict desktop Clippy pass at that successor. Fresh independent review
confirms those tests exercise their claimed invariants, with no material source
finding in this scope. The same linked evidence includes the new logs and review;
production code and native-acceptance limits remain unchanged.
The first build attempt failed before tests because the sparse checkout omitted
`build/windows_manifest.rs`; restoring the tracked build directory corrected the
checkout. The local drive initially had about 22 MB free. Git sparse checkout and
Cargo's package-scoped cleanup of inactive desktop artifacts recovered capacity.
Automatic review rejected recursive deletion of the extracted preview; it was
left intact. No published package or unique evidence was deleted.
The second attempt also exposed omitted tracked harness fixtures and a `Self`
typo in a standalone test helper; both were corrected before the passing run.
That failed compiler process was terminated after its errors were captured.
@@ -0,0 +1 @@
*.log -text
@@ -0,0 +1,91 @@
# Small architecture diagram CPU investigation
Question: does core projection/routing explain [issue 44's low FPS](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/44)
with roughly eight architecture cards? This experiment narrows that question;
it neither reproduces native frame rate nor establishes a complete cause.
## Workload and source
The screenshot uses names from `examples/release1`. Its exact model, projection,
camera and authored geometry are unavailable. The probe loads the unchanged
`examples/release1/model.json`, measures its five saved views, and constructs a
clearly labeled eight-card SA Overview approximation using those semantic
elements. Approximate coordinates and stable placement IDs are in the probe;
it has 8 projected nodes, 6 ports and 13 projected edges. It is not a recovered
copy of the user's diagram. All data changes occur in memory.
Source: `24b1eab07d306d8cb091bb46f7daf9f027a8f1c0`; core, manifest and lockfile
are unchanged from the drag contribution's `1a669130` production source.
Windows 10.0.26200, Rust 1.98.1, x86_64-pc-windows-gnullvm, LLVM-MinGW
20260908 UCRT, reported CPU Intel Core i7-10870H with 4 exposed cores/threads.
The probe was optimized with `-O` and linked to the existing **unoptimized
development-profile core library** used by the completed desktop test build.
This distinction matters: optimizing the driver does not optimize that library.
The desktop test process had completed before measurement; no Cargo compilation
was started until after measurement. Other operating-system workloads were not
controlled, so outliers are retained rather than interpreted as stable capacity.
## Method and results
Each phase gets 3 warmups and 40 timed samples, with returned values passed to
`black_box`. Reported p50/p95 select sorted index `ceil((n-1)*p)` as implemented
in the source. Returned output destruction is outside each timed phase. Diagram
movement uses a deterministic small delta sequence and the existing descendant
and authored-route translation APIs. Index creation, projection, routing, and
combined movement preparation are measured separately. The probe does not model
allocation transaction admission or an Iced frame.
For the eight-card approximation, `performance-01.log` records:
| Phase | p50 ms | p95 ms | max ms |
| --- | ---: | ---: | ---: |
| Reused-index projection | 0.3885 | 0.7550 | 1.2965 |
| Fresh-index projection | 1.7135 | 2.7022 | 4.2204 |
| Settled routing | 2.4525 | 4.4617 | 4.7735 |
| Moved routing | 3.1907 | 4.4781 | 4.5672 |
| Movement preparation + projection + routing | 4.2640 | 6.8259 | 8.8052 |
This workload does not expose severe core latency sufficient by itself to
explain very low FPS. It does not rule out different authored routes, allocation
admission, hardware/rendering, or the user's exact scene. Repeated fresh-index
projection has a measurable cost, but no change is justified solely by this
small sample. No FPS or performance-fix claim follows.
## Source observations and next discriminating measurement
Independent read-only hot-path review found that `DiagramCanvas::scene` already
caches projection and routing by semantic context and transient geometry.
Ordinary node movement changes preview geometry and routes the full view;
route gestures use `route_edge_preview`. Ordinary hover need not reroute.
`diagram/port_labels.rs` requests redraw on every mouse event, including when
no tooltip is visible. `DiagramCanvas::draw` rebuilds geometry and each dot-grid
circle on every draw. At a 1900x660 canvas this yields about 2,240 circles at
zoom 1 and 6,528 at minimum spacing. Scene caching does not cache that geometry.
`views.rs` also performs an unindexed `project_view` during app view rebuilding;
legacy node-motion redraw does not itself require that full UI rebuild.
Next, measure actual canvas draw/frame costs independently for idle hover, pan,
ordinary node drag and allocation drag, with grid generation separated from
node/edge/text rendering and frame presentation. Compare the same scene/camera
and renderer before changing production code. Native automation was stopped
with Escape; no GPU/frame measurement was attempted in this experiment. Live
ownership and subsequent results belong to issue 44.
## Reproduction
Build `oa-core` at the identified source with the stated Windows toolchain, then
compile this standalone probe against that exact library and matching dependency
directory. For a fresh standard Cargo development build:
```powershell
cargo build --locked -p oa-core
rustc --edition=2024 -O harness/experiments/architecture-perf-20260925/architecture_perf_probe.rs --extern oa_core=target/debug/liboa_core.rlib -L dependency=target/debug/deps -C linker=clang.exe -o architecture_perf_probe.exe
./architecture_perf_probe.exe examples/release1/model.json 40
```
The actual run linked `target/debug/deps/liboa_core-2f3c5174cb6398fd.rlib`
and used the same dependency directory. Set the linker/runtime PATH as required
by the Windows toolchain. Compiler flags, core profile, machine load and fixture
all affect timings; preserve them when comparing candidates. This standalone
probe is experimental evidence, not a production dependency or a timing test.
@@ -0,0 +1,166 @@
//! Local-only CPU diagnosis. Does not measure native FPS, canvas redraw, or GPU.
//! Usage: architecture_perf_probe.exe PATH_TO_RELEASE1_MODEL_JSON [SAMPLES=40]
use oa_core::{persistence, projection, routing, view_options::ViewIndex, *};
use std::{collections::BTreeMap, hint::black_box, time::Instant};
fn measure<T>(label: &str, samples: usize, mut f: impl FnMut(usize) -> T) {
for i in 0..3 {
black_box(f(i));
}
let mut ms = Vec::with_capacity(samples);
for i in 0..samples {
let start = Instant::now();
let output = black_box(f(i));
ms.push(start.elapsed().as_secs_f64() * 1000.0);
drop(output); // Exclude destruction consistently from each timed phase.
}
ms.sort_by(f64::total_cmp);
let percentile = |p: f64| ms[((samples - 1) as f64 * p).ceil() as usize];
println!(
"{label}: n={samples} p50_ms={:.4} p95_ms={:.4} max_ms={:.4}",
percentile(0.5),
percentile(0.95),
ms[samples - 1]
);
}
fn probe(p: &Project, d: &Diagram, samples: usize) {
let index = ViewIndex::new(p);
let view = projection::project_diagram_with_index(p, d, &index);
println!(
"\nview={} projection={:?} nodes={} ports={} edges={}",
d.name,
d.projection,
view.nodes.len(),
view.ports.len(),
view.edges.len()
);
measure("index_new", samples, |_| ViewIndex::new(black_box(p)));
measure("projection_reused_index", samples, |_| {
projection::project_diagram_with_index(black_box(p), black_box(d), black_box(&index))
});
measure("projection_fresh_index", samples, |_| {
projection::project_diagram(black_box(p), black_box(d))
});
measure("routing_settled", samples, |_| {
routing::route_diagram(black_box(p), black_box(d), black_box(&view))
});
// Deterministic slight motion of the first root card. Includes the same
// descendant/route translation as legacy single-card canvas drag. This is
// presentation-only, not the allocation transaction pipeline.
let Some(root) = view.nodes.iter().find(|n| n.visual_parent.is_none()) else {
return;
};
println!("moving_root={} element={}", root.id, p.named(root.element));
let mut moved = projection::descendant_nodes(p, d.id, root.id);
moved.push(root.id);
let make_moved = |i: usize| {
let delta = Position {
x: (i % 21) as f32 * 3.0,
y: (i % 11) as f32 * 2.0,
};
let mut preview = d.clone();
let deltas = moved
.iter()
.map(|id| (*id, delta))
.collect::<BTreeMap<_, _>>();
for route in projection::translated_routes(p, d, &deltas) {
if let Some(stored) = preview.routes.iter_mut().find(|r| r.edge == route.edge) {
*stored = route;
} else {
preview.routes.push(route);
}
}
for id in &moved {
if let Some(n) = preview.nodes.get_mut(id) {
n.position.x += delta.x;
n.position.y += delta.y;
}
}
preview
};
let previews = (0..samples.max(3)).map(make_moved).collect::<Vec<_>>();
let projected = previews
.iter()
.map(|d| projection::project_diagram_with_index(p, d, &index))
.collect::<Vec<_>>();
measure("moved_projection", samples, |i| {
projection::project_diagram_with_index(p, black_box(&previews[i]), &index)
});
measure("moved_routing", samples, |i| {
routing::route_diagram(p, black_box(&previews[i]), black_box(&projected[i]))
});
measure("moved_prepare_projection_routing", samples, |i| {
let preview = make_moved(i);
let view = projection::project_diagram_with_index(p, &preview, &index);
routing::route_diagram(p, &preview, &view)
});
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = std::env::args().collect::<Vec<_>>();
let path = args
.get(1)
.ok_or("usage: architecture_perf_probe PATH [SAMPLES]")?;
let samples = args
.get(2)
.map(|s| s.parse::<usize>())
.transpose()?
.unwrap_or(40)
.max(1);
let p = persistence::decode(&std::fs::read(path)?)?;
println!(
"CPU-only probe; samples={samples}; fixture={path}; elements={} relations={}",
p.elements.len(),
p.relations.len()
);
for d in p.diagrams.values() {
probe(&p, d, samples);
}
// Approximation of the reported eight-card screenshot, not an exact repro:
// fixture semantics, Overview projection, synthetic positions/card sizes.
let mut approx = p.clone();
let id: Id = "f0440000-0000-4000-8000-000000000001".parse()?;
approx.diagrams.insert(
id,
Diagram {
id,
alias: "fps44_approx_overview".into(),
name: "APPROXIMATION eight-card SA Overview".into(),
description: "Synthetic positions, not user geometry".into(),
layer: Layer::Sa,
projection: ProjectionKind::Overview,
view_options: Default::default(),
nodes: BTreeMap::new(),
routes: vec![],
layout: None,
},
);
for (ordinal, (alias, x, y)) in [
("sa_assessment_procedure", 30., 240.),
("sa_triage", 510., 240.),
("sa_control", 990., 240.),
("sa_technician", 530., 440.),
("sa_assess", 1490., 240.),
("sa_repair", 1030., 440.),
("sa_confirm", 1530., 440.),
("sa_reset", 30., 440.),
]
.into_iter()
.enumerate()
{
let element = approx
.elements
.values()
.find(|e| e.alias == alias)
.ok_or_else(|| format!("missing alias {alias}"))?
.id;
let generated = approx.place(id, element, Position { x, y });
let diagram = approx.diagrams.get_mut(&id).unwrap();
let mut node = diagram.nodes.remove(&generated).unwrap();
node.id = format!("f0440000-0000-4000-8000-{:012}", ordinal + 2).parse()?;
diagram.nodes.insert(node.id, node);
}
probe(&approx, &approx.diagrams[&id], samples);
Ok(())
}
@@ -0,0 +1,11 @@
{
"source": "24b1eab07d306d8cb091bb46f7daf9f027a8f1c0",
"core_profile": "dev unoptimized",
"driver_optimization": "rustc -O",
"samples_per_phase": 40,
"warmups_per_phase": 3,
"rlib_sha256": "E10C81BF28A33CD0FB6C4C26884CFFA480EF05328E78BCDB138DD4B635B2531C",
"fixture_sha256": "EF0EF4006C3E09D5DB6E1B621256B3F7D6642F3A7B09CC34607CFBCCA830C727",
"driver_exe_sha256": "4C66E9CDE4F08D6DFD2A0DC3DBF1A80B97E340F3F22CA001A76301F06F47C2E2",
"native_fps_measured": false
}
@@ -0,0 +1,61 @@
CPU-only probe; samples=40; fixture=.local/drag-out-01a0d6fd/examples/release1/model.json; elements=94 relations=62
view=1 · OA responsibility and repair traffic projection=Allocation nodes=6 ports=0 edges=3
index_new: n=40 p50_ms=1.0106 p95_ms=2.0583 max_ms=2.0910
projection_reused_index: n=40 p50_ms=0.5702 p95_ms=1.2320 max_ms=1.3490
projection_fresh_index: n=40 p50_ms=1.5505 p95_ms=3.6681 max_ms=5.1533
routing_settled: n=40 p50_ms=0.1944 p95_ms=0.3391 max_ms=0.4246
moving_root=3191e05c-1c7f-5f0e-beb0-5f3bded54c48 element=Control room
moved_projection: n=40 p50_ms=0.4848 p95_ms=1.2745 max_ms=1.5797
moved_routing: n=40 p50_ms=0.1994 p95_ms=0.7971 max_ms=1.1414
moved_prepare_projection_routing: n=40 p50_ms=0.9250 p95_ms=2.6847 max_ms=10.4908
view=5 · SA pressure supervision projection=StateMachine { machine: 132b3f28-3f88-5327-9868-8c8b645ed412 } nodes=5 ports=0 edges=3
index_new: n=40 p50_ms=0.9602 p95_ms=2.1394 max_ms=2.4512
projection_reused_index: n=40 p50_ms=0.1697 p95_ms=0.7629 max_ms=1.1780
projection_fresh_index: n=40 p50_ms=1.1189 p95_ms=2.6324 max_ms=3.3912
routing_settled: n=40 p50_ms=0.7063 p95_ms=1.0812 max_ms=1.1149
moving_root=a676fbb9-0833-59a8-98cf-a10d8f4b7434 element=Pressure supervision
moved_projection: n=40 p50_ms=0.1565 p95_ms=0.3445 max_ms=0.3790
moved_routing: n=40 p50_ms=0.6113 p95_ms=1.3199 max_ms=1.3733
moved_prepare_projection_routing: n=40 p50_ms=0.8259 p95_ms=1.7640 max_ms=2.1752
view=2 · SA service boundary and functions projection=Allocation nodes=6 ports=6 edges=3
index_new: n=40 p50_ms=0.7820 p95_ms=3.4180 max_ms=6.8439
projection_reused_index: n=40 p50_ms=0.7938 p95_ms=1.9946 max_ms=2.1411
projection_fresh_index: n=40 p50_ms=2.0597 p95_ms=3.4554 max_ms=3.6616
routing_settled: n=40 p50_ms=0.1478 p95_ms=0.7886 max_ms=1.0081
moving_root=8345c76a-8d85-5c31-902e-ec1cd33ed4a3 element=Pressure coordination service
moved_projection: n=40 p50_ms=0.6914 p95_ms=1.5286 max_ms=1.8658
moved_routing: n=40 p50_ms=0.1862 p95_ms=0.5658 max_ms=2.8924
moved_prepare_projection_routing: n=40 p50_ms=1.1724 p95_ms=3.1806 max_ms=4.2620
view=4 · SA mission and included capability projection=Capabilities nodes=4 ports=1 edges=3
index_new: n=40 p50_ms=0.6879 p95_ms=1.3582 max_ms=1.5266
projection_reused_index: n=40 p50_ms=0.1562 p95_ms=0.6767 max_ms=1.0102
projection_fresh_index: n=40 p50_ms=1.2929 p95_ms=2.3543 max_ms=4.0762
routing_settled: n=40 p50_ms=0.2553 p95_ms=1.4389 max_ms=1.6677
moving_root=069a3fb3-077c-59d8-91da-27b0665143c7 element=Assess an alarm
moved_projection: n=40 p50_ms=0.1243 p95_ms=0.1928 max_ms=0.2212
moved_routing: n=40 p50_ms=0.2271 p95_ms=0.6733 max_ms=1.2408
moved_prepare_projection_routing: n=40 p50_ms=0.5542 p95_ms=1.3344 max_ms=1.8957
view=3 · SA service conversation only projection=Allocation nodes=6 ports=6 edges=1
index_new: n=40 p50_ms=0.9618 p95_ms=1.6890 max_ms=2.0995
projection_reused_index: n=40 p50_ms=0.6661 p95_ms=2.3388 max_ms=2.6429
projection_fresh_index: n=40 p50_ms=2.3913 p95_ms=4.1941 max_ms=4.8120
routing_settled: n=40 p50_ms=0.0660 p95_ms=0.2156 max_ms=0.6289
moving_root=40210589-69f7-5209-b329-10bb83cf615c element=Field technician
moved_projection: n=40 p50_ms=0.5527 p95_ms=1.1239 max_ms=1.1362
moved_routing: n=40 p50_ms=0.0495 p95_ms=0.1771 max_ms=0.2209
moved_prepare_projection_routing: n=40 p50_ms=0.7963 p95_ms=4.1835 max_ms=6.7551
view=APPROXIMATION eight-card SA Overview projection=Overview nodes=8 ports=6 edges=13
index_new: n=40 p50_ms=0.7487 p95_ms=1.9597 max_ms=2.2005
projection_reused_index: n=40 p50_ms=0.3885 p95_ms=0.7550 max_ms=1.2965
projection_fresh_index: n=40 p50_ms=1.7135 p95_ms=2.7022 max_ms=4.2204
routing_settled: n=40 p50_ms=2.4525 p95_ms=4.4617 max_ms=4.7735
moving_root=f0440000-0000-4000-8000-000000000002 element=Assess an alarm procedure
moved_projection: n=40 p50_ms=0.4691 p95_ms=0.8354 max_ms=1.0408
moved_routing: n=40 p50_ms=3.1907 p95_ms=4.4781 max_ms=4.5672
moved_prepare_projection_routing: n=40 p50_ms=4.2640 p95_ms=6.8259 max_ms=8.8052
@@ -0,0 +1 @@
*.log -text
@@ -0,0 +1,74 @@
# Outgoing allocation drag evidence
Contribution source: `1a669130fb6d2b65279aab3847e966a1a282c191`, based on
published preview `715036e132677dd2bc2fb37ed316d93dc9987aec`.
This is branch-specific Windows evidence for [issue 40](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/40).
It is not acceptance of an integrated release or the complete application.
The [decision and native baseline](../../drag-out-20260925.md) explain the repair.
## Environment and commands
Windows 10.0.26200, Rust/Cargo 1.98.1, host/target
`x86_64-pc-windows-gnullvm`, LLVM 22.1.8, LLVM-MinGW 20260908 UCRT linker
`clang.exe`, `CARGO_BUILD_JOBS=1`, `CARGO_INCREMENTAL=0`, default development
profile. Run at the identified source with the Windows GNU LLVM toolchain and
its linker/runtime available on PATH. A sparse checkout must include `build`
and `harness/fixtures` as well as crates. The actual commands were:
```powershell
cargo test --locked --offline -p oa-desktop allocation_drag -- --test-threads=1
cargo clippy --locked --offline -p oa-desktop --all-targets -- -D warnings
cargo build --locked --offline -p oa-desktop --bin arcadia-studio
```
Offline commands require dependencies already cached. A fresh environment must
fetch the locked dependencies first. Raw logs retain original absolute paths;
these paths identify this run, not required directories on another machine.
## Results and boundaries
- Test-only successor `24b1eab07d306d8cb091bb46f7daf9f027a8f1c0` adds two
OA/SA App regressions: a clearance proposal blocked by unrelated work and an
outgoing move with a retained sibling enlarging the source enclosure.
`tests-04.log` passes all 123 allocation-drag tests (zero failed/ignored,
1,424 filtered) in 54.86s; `clippy-02.log` passes the same strict command in
1m27s. Production inputs are unchanged from `1a669130`; its normal binary
remains the native candidate. [Independent review](independent-review.md)
covers the source, new test design and evidence limits.
- `tests-03.log`: 121 passed, zero failed/ignored, 1,424 filtered; 35.33 seconds
test execution. This is the allocation-drag subset, not the full desktop suite.
- `clippy-01.log`: strict desktop all-target Clippy passed in 4m30s.
- `build-01.log`: normal GUI build passed in 5m16s. The resulting local executable
SHA256 is `9bda1a6a1d24fdc98c7a8822400c12fea9afe1de828a82ba9273f03b99e47c07`.
It was staged with the published preview's `libunwind.dll` and started, but
Computer Use was stopped before any changed-binary native observation.
- `context.json`: recorded source/toolchain, passing test-log and baseline-image
hashes, and clean source after the test run.
- `tests-01.log`: compilation failed before tests because `build/windows_manifest.rs`
was excluded from the initial sparse checkout.
- `tests-02.log`: compilation failed before tests because harness fixture files
were excluded and a standalone test helper used `Self` instead of `Fixture`.
The compiler was terminated after reporting errors; its interrupted exit is
preserved. The missing tracked files and typo were repaired before run 03.
The tests exercise source-clearance proposals, OA/SA App event sequences,
preview/release agreement, exact source/history, cancellation, and retained
preview without commit authority on refused release. Existing collision and
semantic checks still govern all proposals. Independent source review found the
whole-header viewport restriction and obsolete preview assertion; both were
corrected before the passing run. This is source/test review, not native review.
`baseline-left-refusal.png` is an unmodified actual native capture from the
published preview executable, SHA256
`2c03bd6cc3f1110c219e4f57ab94874a121590f83779239a93289b7170664399`.
In the copied Allocation companion fixture, OA assign view at 1440x900 content
and Fit 72%, dragging X from window (486,546) to (365,546) leaves allocation and
placement unchanged and reports overlap. A control drag to (625,572) removes
allocation, and Undo restores it. Intermediate jitter was diagnosed from source;
this image is end-state evidence only.
Changed-binary native acceptance is still required: repeat the short fitted-view
drag, identify and regrab the partially clipped card, check refused-motion
feedback, Cancel and Undo/Redo, save the full bundle, close and reopen in a fresh
process, and verify identity/allocation/placement and unchanged sibling data for
OA and SA. Linux/WSL remains deferred by the user. No published package changed.
Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

@@ -0,0 +1,5 @@
Compiling iced_widget v0.14.2 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\vendor\iced_widget)
Compiling iced v0.14.0
Compiling oa-core v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-core)
Compiling oa-desktop v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop)
Finished `dev` profile [unoptimized] target(s) in 5m 16s
@@ -0,0 +1,6 @@
Compiling oa-core v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-core)
Checking iced_widget v0.14.2 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\vendor\iced_widget)
Compiling oa-server v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-server)
Compiling oa-desktop v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop)
Checking iced v0.14.0
Finished `dev` profile [unoptimized] target(s) in 4m 30s
@@ -0,0 +1,2 @@
Checking oa-desktop v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop)
Finished `dev` profile [unoptimized] target(s) in 1m 27s
@@ -0,0 +1,20 @@
{
"source": "1a669130fb6d2b65279aab3847e966a1a282c191",
"platform": "Microsoft Windows 10.0.26200",
"compiler": [
"rustc 1.98.1 (48a229cea 2026-09-01)",
"binary: rustc",
"commit-hash: 48a229ceaefd4985c50990b14116b6d856af0985",
"commit-date: 2026-09-01",
"host: x86_64-pc-windows-gnullvm",
"release: 1.98.1",
"LLVM version: 22.1.8"
],
"cargo": "cargo 1.98.1 (797e8a9bc 2026-08-05)",
"test_log_sha256": "8EB57F522FA0DCCA327DC13C67A9C1B14F5FAB09C5599C108C0BA6D875C78886",
"baseline_image_sha256": "AAF162619582018D1197D255B4BA1122747AA22703D8DEDFC7FCEFCB42AEFE38",
"target": "x86_64-pc-windows-gnullvm",
"incremental": "0",
"jobs": "1",
"working_tree_clean_after_test": true
}
@@ -0,0 +1,33 @@
# Independent source and evidence review
Fresh read-only GPT-6 Astra review, 2026-09-25. Production source
`1a669130fb6d2b65279aab3847e966a1a282c191`; test-only successor
`24b1eab07d306d8cb091bb46f7daf9f027a8f1c0`. No GUI actions or test execution
were performed by this reviewer.
No material correctness finding in the bounded scope:
- The outgoing collision regression in `app/allocation_drag_tests.rs` proves a
real source-boundary crossing and unobscured OutsidePerformers target, a
nonempty clearance proposal, and intersection with unrelated work. Ordinary
placement rejects that proposal. Release preserves project, source bundle,
revision, snapshot identity and redo availability.
- The retained-sibling regression first requires exact requested placement to
fail. The admitted correction clears the enlarged source enclosure while
preserving its projection, sibling allocation/placement and all other stored
placements. Preview/release and source Undo/Redo comparisons are exact.
- In `app/allocation_drag.rs`, clearance remains downstream of semantic
admission and retries ordinary placement. Release recomputes placement and
passes through `finish` and document execution. No collision, stale-state or
retained-preview commit bypass was found.
- The committed passing log's bytes and SHA256 match `context.json`; the
baseline image hash also matches. Logs support 121 passing tests, strict
Clippy and normal development build for the production source. They do not
establish execution of the two successor tests; consult the linked raw logs
and README for subsequent execution evidence.
The review supports the source policy and test design, not native usability.
The 24x24 visible-header threshold alone does not prove readable identity or
practical regrabbing. Changed-binary fitted-view dragging, feedback, recovery
and Save/reopen remain unverified. This review is not the broad final
requirements/domain/UX/release review required by `PROJECT_GOAL.md`.
@@ -0,0 +1,12 @@
{
"source": "24b1eab07d306d8cb091bb46f7daf9f027a8f1c0",
"production_source": "1a669130fb6d2b65279aab3847e966a1a282c191",
"test_log": "tests-04.log",
"test_log_sha256": "C98E0F70D60788B484146B3C8785891888BA696130ACC4BFD7D30DA570E6B1E1",
"passed": 123,
"failed": 0,
"ignored": 0,
"filtered": 1424,
"native_candidate_sha256": "9BDA1A6A1D24FDC98C7A8822400C12FEA9AFE1DE828A82BA9273F03B99E47C07",
"native_acceptance": "unverified"
}
@@ -0,0 +1,8 @@
Compiling oa-core v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-core)
error: couldn't read `crates\oa-core\../../build/windows_manifest.rs`: The system cannot find the path specified. (os error 3)
--> crates\oa-core\build.rs:1:1
|
1 | include!("../../build/windows_manifest.rs");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: could not compile `oa-core` (build script) due to 1 previous error
@@ -0,0 +1,68 @@
Compiling oa-core v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-core)
Compiling oa-server v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-server)
Compiling iced_widget v0.14.2 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\vendor\iced_widget)
Compiling oa-desktop v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop)
Compiling iced v0.14.0
error: couldn't read `C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop/../../harness/fixtures/interface-operation-probe/output/boundary-only.json`: The system cannot find the path specified. (os error 3)
--> crates\oa-desktop\src\app\reference_authoring\tests\mounted.rs:755:37
|
755 | let mut p = persistence::decode(include_bytes!(concat!(
| _____________________________________^
756 | | env!("CARGO_MANIFEST_DIR"),
757 | | "/../../harness/fixtures/interface-operation-probe/output/boundary-only.json"
758 | | )))
| |______^
error: couldn't read `C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop/../../harness/fixtures/interface-operation-probe/output/boundary-only.json`: The system cannot find the path specified. (os error 3)
--> crates\oa-desktop\src\behavior\scenario\usage\tests.rs:235:37
|
235 | let mut p = persistence::decode(include_bytes!(concat!(
| _____________________________________^
236 | | env!("CARGO_MANIFEST_DIR"),
237 | | "/../../harness/fixtures/interface-operation-probe/output/boundary-only.json"
238 | | )))
| |______^
error: couldn't read `C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop/../../harness/fixtures/interface-operation-probe/output/boundary-only.json`: The system cannot find the path specified. (os error 3)
--> crates\oa-desktop\src\behavior\scenario_operation_tests.rs:6:25
|
6 | persistence::decode(include_bytes!(concat!(
| _________________________^
7 | | env!("CARGO_MANIFEST_DIR"),
8 | | "/../../harness/fixtures/interface-operation-probe/output/boundary-only.json"
9 | | )))
| |______^
error: couldn't read `C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop/../../harness/fixtures/source7-native/base/expected-baseline.json`: The system cannot find the path specified. (os error 3)
--> crates\oa-desktop\src\behavior\topology\contextual_routing.rs:61:29
|
61 | persistence::decode(include_bytes!(concat!(
| _____________________________^
62 | | env!("CARGO_MANIFEST_DIR"),
63 | | "/../../harness/fixtures/source7-native/base/expected-baseline.json"
64 | | )))
| |__________^
error: couldn't read `C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop/../../harness/fixtures/interface-operation-probe/output/boundary-only.json`: The system cannot find the path specified. (os error 3)
--> crates\oa-desktop\src\semantic_review\source7_tests.rs:5:25
|
5 | persistence::decode(include_bytes!(concat!(
| _________________________^
6 | | env!("CARGO_MANIFEST_DIR"),
7 | | "/../../harness/fixtures/interface-operation-probe/output/boundary-only.json"
8 | | )))
| |______^
error[E0411]: cannot find struct, variant or union type `Self` in this scope
--> crates\oa-desktop\src\app\allocation_drag\clearance.rs:314:9
|
287 | fn fixture(layer: Layer) -> Fixture {
| ------- `Self` not allowed in a function
...
314 | Self {
| ^^^^ `Self` is only available in impls, traits, and type definitions
error: could not compile `oa-desktop` (bin "arcadia-studio" test) due to 6 previous errors
Caused by:
process didn't exit successfully: `C:\Users\User\Documents\Git\ARCADIA-Studio\.local\toolchain\rustup\toolchains\stable-x86_64-pc-windows-gnullvm\bin\rustc.exe --crate-name arcadia_studio --edition=2024 crates\oa-desktop\src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C embed-bitcode=no --test --check-cfg cfg(docsrs,test) --check-cfg "cfg(feature, values())" -C metadata=5e2096130f19ead2 -C extra-filename=-c5b42126ba36cd38 --out-dir C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps -C linker=clang.exe -C strip=debuginfo -L dependency=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps --extern axum=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libaxum-ccc7aea466db9258.rlib --extern iced=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libiced-594f7d417d69ed72.rlib --extern iced_runtime=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libiced_runtime-4d31a36fe5cef0b0.rlib --extern oa_core=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\liboa_core-2f3c5174cb6398fd.rlib --extern oa_server=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\liboa_server-bb42169ca297f969.rlib --extern reqwest=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libreqwest-31ac987472fa8038.rlib --extern rfd=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\librfd-17cc7ba2db223d7b.rlib --extern serde=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libserde-60a32311146a42e4.rlib --extern serde_json=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libserde_json-da2c4f333fc47818.rlib --extern tempfile=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libtempfile-86aac28d6be16d2f.rlib --extern tokio=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libtokio-5e0ca96735e3073a.rlib --extern unicode_segmentation=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\libunicode_segmentation-85698043f7780858.rlib -L native=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\build\ring-5f8d2d20440f09b4\out -L native=C:\Users\User\Documents\Git\ARCADIA-Studio\.local\toolchain\cargo\registry\src\index.crates.io-1949cf8c6b5b557f\windows_x86_64_gnullvm-0.52.6\lib -C link-arg=C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\build\oa-desktop-307d320bbc13ccd5\out\normal-user-manifest.o` (exit code: 0xffffffff)
@@ -0,0 +1,130 @@
Blocking waiting for file lock on build directory
Compiling oa-desktop v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop)
Finished `test` profile [unoptimized] target(s) in 8m 13s
Running unittests src\main.rs (C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\arcadia_studio-c5b42126ba36cd38.exe)
running 121 tests
test allocation_drag::outgoing_header_retains_a_grab_region_without_requiring_full_camera_containment ... ok
test allocation_drag::tests::allocation_artifact_and_manual_trace_cascades_are_named_and_refused ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_detects_hidden_moved_child_and_stationary_enclosure_growth ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_distributed_oa_sa_exact_scope_routes_source_history_and_anchor ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_noop_stale_tamper_target_and_all_selected_headers ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_performer_closure_does_not_acquire_incidental_semantic_root ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_existing_overlap_but_refuses_its_growth ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_roles_and_does_not_invent_unplaced_descendants ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_unrelated_folded_interior_diagnostic_boundary ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_simultaneous_roots_may_enter_each_others_vacated_bounds ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_validates_all_original_members_before_normalizing ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_checks_original_identity_and_visibility_before_normalization ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_distributed_parent_refuses_but_its_independent_leaves_can_reassign ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_finish_rejects_stale_project_and_each_tampered_result ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_normalizes_parent_child_and_assigns_unplaced_leaf_once ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_requires_non_anchor_selected_header_inside_viewport ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_unresolved_oa_role_leaf_accepts_explicit_target_but_not_outside ... ok
test allocation_drag::tests::assignment_tests::group_assignment_accumulates_stable_ids_and_aliases_without_partial_reuse ... ok
test allocation_drag::tests::assignment_tests::group_assignment_collateral_surviving_constraint_refuses_whole_semantic_candidate ... ok
test allocation_drag::tests::assignment_tests::group_assignment_deletes_only_own_routes_across_views_and_keeps_internal_flow ... ok
test allocation_drag::tests::assignment_tests::group_assignment_independent_performers_preserves_already_correct_provenance ... ok
test allocation_drag::tests::assignment_tests::group_assignment_source_failure_preserves_existing_history_and_retry_ids ... ok
test allocation_drag::tests::assignment_tests::group_assignment_unfolds_only_changed_destination_and_refuses_newly_exposed_overlap ... ok
test allocation_drag::tests::assignment_tests::group_assignment_uses_vacated_space_and_one_complete_route_owner_map ... ok
test allocation_drag::tests::assignment_tests::group_assignment_zero_delta_changes_semantics_once_and_then_is_noop ... ok
test allocation_drag::tests::cache_plan_uses_candidate_index_and_same_pixel_different_target_changes_preview ... ok
test allocation_drag::tests::collapsed_target_unfold_is_explicit_and_no_other_fold_changes ... ok
test allocation_drag::tests::direct_exit_revealing_another_role_performer_has_truthful_refusal ... ok
test allocation_drag::tests::explicit_different_performer_retains_advisory_role_warning ... ok
test allocation_drag::tests::folded_subtree_cannot_hide_new_collision ... ok
test allocation_drag::tests::geometry_refuses_new_overlap_bounds_and_invisible_headers_and_preserves_existing_overlap ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_detects_moved_folded_child_collision ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_detects_stationary_enclosure_growth_collision ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_distributed_root_and_performer_can_translate_rigidly ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_unrelated_folded_interiors_are_outside_diagnostic_domain ... ok
test allocation_drag::tests::malformed_scope_wrong_projection_duplicate_placement_and_stable_id_collision_refuse ... ok
test allocation_drag::tests::mixed_p_x_y_refuses_semantic_and_arrange_instead_of_stretching_destination ... ok
test allocation_drag::tests::oa_communication_incompleteness_remains_advisory_without_collateral_loss ... ok
test allocation_drag::tests::oa_sa_incoming_between_outgoing_preserve_identity_source_history_and_other_views ... ok
test allocation_drag::tests::oa_sa_one_leaf_move_refuses_when_ancestor_regrouping_introduces_unrelated_overlap ... ok
test allocation_drag::tests::oa_sa_one_leaf_reassignment_and_outward_move_regroup_ancestors_without_moving_sibling ... ok
test allocation_drag::tests::oa_sa_populated_collapsed_target_accepts_room_and_refuses_collision_without_relocating_contents ... ok
test allocation_drag::tests::oa_sa_state_owned_action_and_availability_reject_reassignment_atomically ... ok
test allocation_drag::tests::oa_sa_unfolding_prior_hidden_overlap_refuses_even_when_insertion_does_not_collide ... ok
test allocation_drag::tests::own_deleted_allocation_routes_may_disappear_in_every_diagram_only ... ok
test allocation_drag::tests::role_only_same_effective_performer_is_semantic_noop_and_outgoing_refuses ... ok
test allocation_drag::tests::sa_port_and_deferred_exchange_allocation_cascade_refuses_and_retarget_is_invalid ... ok
test allocation_drag::tests::same_performer_readability_preserves_snapped_noop_and_allocation_identity ... ok
test allocation_drag::tests::scope_detects_first_child_allocation_and_role_transfer_and_finish_rejects_live_edits ... ok
test allocation_drag::tests::selected_header_visibility_allows_viewport_edge_but_refuses_clipping ... ok
test allocation_drag::tests::snapped_noop_returns_no_command_and_keeps_source_revision_and_redo ... ok
test allocation_drag::tests::source_budget_refusal_keeps_project_bundle_history_and_retry_identity_exact ... ok
test allocation_drag::tests::surviving_constraint_mutation_is_refused_even_when_core_candidate_is_valid ... ok
test allocation_drag::tests::target_presentation_requires_accepted_identity_and_selected_header_visibility ... ok
test allocation_drag::tests::toolbar_identity_allows_exact_incoming_placement_at_old_label_overlap ... ok
test allocation_drag::tests::uniform_folded_grandchild_and_unplaced_scope_moves_exactly_q_and_all_l_oa_sa ... ok
test allocation_drag::tests::uniform_role_only_and_mixed_direct_role_composites_same_target_do_not_allocate ... ok
test allocation_drag::tests::uniformly_unassigned_composite_creates_only_stable_leaf_allocations_including_unplaced ... ok
test allocation_drag::tests::unrequested_view_option_cleanup_is_not_whitelisted ... ok
test allocation_drag::tests::unresolved_role_leaf_can_arrange_or_accept_explicit_target_without_guessing ... ok
test app::allocation_drag::clearance::tests::corner_order_follows_boundary_crossing_and_is_deterministic ... ok
test app::allocation_drag::clearance::tests::descendant_footprint_controls_clearance_without_mutating_projects ... ok
test app::allocation_drag::clearance::tests::each_outgoing_edge_clears_the_source_and_passes_ordinary_placement ... ok
test app::allocation_drag::clearance::tests::independent_selected_roots_keep_one_rigid_group_translation ... ok
test app::allocation_drag::clearance::tests::no_crossing_no_overlap_no_source_and_nonfinite_requests_are_empty ... ok
test app::allocation_drag::clearance::tests::source_shrink_uses_candidate_enclosure_not_frozen_target ... ok
test app::allocation_drag::tests::actual_canvas_origin_change_cancels_held_work_before_any_legacy_release ... ok
test app::allocation_drag::tests::arrange_is_one_gesture_and_snapped_noop_preserves_redo_and_source ... ok
test app::allocation_drag::tests::candidate_semantics_are_cached_per_destination_with_stable_ids_and_own_index ... ok
test app::allocation_drag::tests::destination_identity_does_not_describe_blocked_or_outside_viewport_as_unallocation ... ok
test app::allocation_drag::tests::frozen_collapsed_target_uses_only_visible_header_and_port_edge_controls_occlude ... ok
test app::allocation_drag::tests::frozen_targets_use_half_open_semantic_priority_and_refuse_incomparable_overlap ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_dirty_description_retains_focus_and_middle_caret_for_next_key ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_dirty_name_retains_focus_and_middle_caret_for_next_key ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_exact_incoming_drag_keeps_destination_visible_and_canvas_stable ... ok
test app::allocation_drag::tests::full_tree::actual_keyboard_arrange_shortcut_consumes_once_escape_cancels_and_dirty_owner_refuses ... ok
test app::allocation_drag::tests::full_tree::actual_rendered_canvas_pixels_do_not_change_when_toolbar_feedback_text_changes ... ok
test app::allocation_drag::tests::full_tree::actual_toolbar_hover_inspects_last_full_name_without_authorizing_an_outside_drop ... ok
test app::allocation_drag::tests::full_tree::actual_tree_outgoing_boundary_motion_preview_release_and_cancel ... ok
test app::allocation_drag::tests::full_tree::control_focus::dirty_selected_pin_outer_ring_keeps_real_name_focus_and_caret ... ok
test app::allocation_drag::tests::group::allocation_bare_moves_cannot_bypass_armed_active_or_retired_lifetime ... ok
test app::allocation_drag::tests::group::completed_text_apply_rejects_old_allocation_packets_without_retiring_a_new_drag ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_after_cancel_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_context_mismatches_preserve_the_current_session ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_current_restart_and_pair_commit_after_tool_boundary ... ok
test app::allocation_drag::tests::group::group_arrange_work_and_performer_anchors_preserve_every_responsibility ... ok
test app::allocation_drag::tests::group::group_assignment_split_rebuild_preserves_primary_and_commits_one_complete_candidate ... ok
test app::allocation_drag::tests::group::group_out_and_back_assigns_at_zero_delta_then_true_noop_preserves_redo ... ok
test app::allocation_drag::tests::group::group_selection_aba_and_old_press_cannot_retire_a_new_token ... ok
test app::allocation_drag::tests::group::group_source_refusal_retains_primary_source_and_both_history_paths ... ok
test app::allocation_drag::tests::group::idle_group_press_rejects_selection_generation_aba_with_unchanged_other_stamps ... ok
test app::allocation_drag::tests::group::ordinary_off_grid_performer_out_and_back_is_noop_with_redo ... ok
test app::allocation_drag::tests::group::route_lifetime::captured_route_context_fields_independently_reject_before_retirement ... ok
test app::allocation_drag::tests::group::route_lifetime::current_route_commits_without_session_preserve_exact_route_history ... ok
test app::allocation_drag::tests::group::route_lifetime::same_context_route_attachment_after_selection_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::same_context_route_commit_after_selection_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::stale_route_attachment_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::stale_route_commit_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::unsupported_group_click_collapses_but_threshold_crossing_never_becomes_click ... ok
test app::allocation_drag::tests::modal_roundtrip_equal_fit_undo_resize_and_focus_retire_press_before_replay ... ok
test app::allocation_drag::tests::mounted_clean_stationary_selects_exact_work_without_revision_or_legacy_apply ... ok
test app::allocation_drag::tests::mounted_dirty_port_press_cannot_fall_through_to_applying_port_selection ... ok
test app::allocation_drag::tests::mounted_dirty_property_press_does_not_select_apply_or_destroy_draft ... ok
test app::allocation_drag::tests::mounted_oa_sa_ordered_incoming_between_outgoing_are_exact_single_history_steps ... ok
test app::allocation_drag::tests::mounted_role_only_outgoing_refusal_retains_placement_and_same_performer_creates_no_allocation ... ok
test app::allocation_drag::tests::mounted_uniform_parent_moves_hidden_placements_and_assigns_only_leaves ... ok
test app::allocation_drag::tests::navigation_union::old_chooser_envelopes_preserve_a_current_canvas_gesture ... ok
test app::allocation_drag::tests::navigation_union::stale_gesture_packets_preserve_navigation_and_a_new_live_cancel_still_works ... ok
test app::allocation_drag::tests::oa_sa_clipped_selected_header_refuses_preview_release_and_retries_without_partial_source_or_history ... ok
test app::allocation_drag::tests::oa_sa_toolbar_identity_accepts_exact_receiver_and_collapsed_header_drag ... ok
test app::allocation_drag::tests::outgoing_boundary_drop_clears_source_without_changing_other_placements ... ok
test app::allocation_drag::tests::outside_release_is_cancel_and_does_not_remove_an_assignment ... ok
test app::allocation_drag::tests::pending_behavior_draft_refuses_actual_work_press_and_equal_document_replacement_retires_packet ... ok
test app::allocation_drag::tests::refused_motion_retains_last_scene_but_release_never_commits_it ... ok
test app::allocation_drag::tests::release_uses_ordered_native_position_before_later_motion_in_same_batch ... ok
test app::allocation_drag::tests::same_snapped_position_on_opposite_shared_border_rebuilds_semantics_even_if_layout_refuses ... ok
test app::allocation_drag::tests::source_and_modal_admission_reject_prebuilt_clean_press_without_selecting ... ok
test app::allocation_drag::tests::source_refusal_is_atomic_and_a_new_gesture_can_retry_against_live_revision ... ok
test app::allocation_drag::tests::stale_packets_do_not_cancel_a_newer_token_and_each_release_is_consumed_once ... ok
test app::allocation_drag::tests::toolbar_destination_names_transformed_target_whose_header_is_clipped ... ok
test app::allocation_drag::tests::toolbar_status_leaves_transformed_top_edge_work_header_readable ... ok
test result: ok. 121 passed; 0 failed; 0 ignored; 0 measured; 1424 filtered out; finished in 35.33s
@@ -0,0 +1,131 @@
Compiling oa-desktop v0.2.0 (C:\Users\User\Documents\Git\ARCADIA-Studio\.local\drag-out-01a0d6fd\crates\oa-desktop)
Finished `test` profile [unoptimized] target(s) in 6m 05s
Running unittests src\main.rs (C:/Users/User/Documents/Git/ARCADIA-Studio/target\debug\deps\arcadia_studio-c5b42126ba36cd38.exe)
running 123 tests
test allocation_drag::outgoing_header_retains_a_grab_region_without_requiring_full_camera_containment ... ok
test allocation_drag::tests::allocation_artifact_and_manual_trace_cascades_are_named_and_refused ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_detects_hidden_moved_child_and_stationary_enclosure_growth ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_distributed_oa_sa_exact_scope_routes_source_history_and_anchor ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_noop_stale_tamper_target_and_all_selected_headers ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_performer_closure_does_not_acquire_incidental_semantic_root ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_existing_overlap_but_refuses_its_growth ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_roles_and_does_not_invent_unplaced_descendants ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_preserves_unrelated_folded_interior_diagnostic_boundary ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_simultaneous_roots_may_enter_each_others_vacated_bounds ... ok
test allocation_drag::tests::arrange_tests::explicit_arrange_validates_all_original_members_before_normalizing ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_checks_original_identity_and_visibility_before_normalization ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_distributed_parent_refuses_but_its_independent_leaves_can_reassign ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_finish_rejects_stale_project_and_each_tampered_result ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_normalizes_parent_child_and_assigns_unplaced_leaf_once ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_requires_non_anchor_selected_header_inside_viewport ... ok
test allocation_drag::tests::assignment_boundary_tests::group_assignment_unresolved_oa_role_leaf_accepts_explicit_target_but_not_outside ... ok
test allocation_drag::tests::assignment_tests::group_assignment_accumulates_stable_ids_and_aliases_without_partial_reuse ... ok
test allocation_drag::tests::assignment_tests::group_assignment_collateral_surviving_constraint_refuses_whole_semantic_candidate ... ok
test allocation_drag::tests::assignment_tests::group_assignment_deletes_only_own_routes_across_views_and_keeps_internal_flow ... ok
test allocation_drag::tests::assignment_tests::group_assignment_independent_performers_preserves_already_correct_provenance ... ok
test allocation_drag::tests::assignment_tests::group_assignment_source_failure_preserves_existing_history_and_retry_ids ... ok
test allocation_drag::tests::assignment_tests::group_assignment_unfolds_only_changed_destination_and_refuses_newly_exposed_overlap ... ok
test allocation_drag::tests::assignment_tests::group_assignment_uses_vacated_space_and_one_complete_route_owner_map ... ok
test allocation_drag::tests::assignment_tests::group_assignment_zero_delta_changes_semantics_once_and_then_is_noop ... ok
test allocation_drag::tests::cache_plan_uses_candidate_index_and_same_pixel_different_target_changes_preview ... ok
test allocation_drag::tests::collapsed_target_unfold_is_explicit_and_no_other_fold_changes ... ok
test allocation_drag::tests::direct_exit_revealing_another_role_performer_has_truthful_refusal ... ok
test allocation_drag::tests::explicit_different_performer_retains_advisory_role_warning ... ok
test allocation_drag::tests::folded_subtree_cannot_hide_new_collision ... ok
test allocation_drag::tests::geometry_refuses_new_overlap_bounds_and_invisible_headers_and_preserves_existing_overlap ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_detects_moved_folded_child_collision ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_detects_stationary_enclosure_growth_collision ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_distributed_root_and_performer_can_translate_rigidly ... ok
test allocation_drag::tests::group_arrange_experiment::mixed_arrange_experiment_unrelated_folded_interiors_are_outside_diagnostic_domain ... ok
test allocation_drag::tests::malformed_scope_wrong_projection_duplicate_placement_and_stable_id_collision_refuse ... ok
test allocation_drag::tests::mixed_p_x_y_refuses_semantic_and_arrange_instead_of_stretching_destination ... ok
test allocation_drag::tests::oa_communication_incompleteness_remains_advisory_without_collateral_loss ... ok
test allocation_drag::tests::oa_sa_incoming_between_outgoing_preserve_identity_source_history_and_other_views ... ok
test allocation_drag::tests::oa_sa_one_leaf_move_refuses_when_ancestor_regrouping_introduces_unrelated_overlap ... ok
test allocation_drag::tests::oa_sa_one_leaf_reassignment_and_outward_move_regroup_ancestors_without_moving_sibling ... ok
test allocation_drag::tests::oa_sa_populated_collapsed_target_accepts_room_and_refuses_collision_without_relocating_contents ... ok
test allocation_drag::tests::oa_sa_state_owned_action_and_availability_reject_reassignment_atomically ... ok
test allocation_drag::tests::oa_sa_unfolding_prior_hidden_overlap_refuses_even_when_insertion_does_not_collide ... ok
test allocation_drag::tests::own_deleted_allocation_routes_may_disappear_in_every_diagram_only ... ok
test allocation_drag::tests::role_only_same_effective_performer_is_semantic_noop_and_outgoing_refuses ... ok
test allocation_drag::tests::sa_port_and_deferred_exchange_allocation_cascade_refuses_and_retarget_is_invalid ... ok
test allocation_drag::tests::same_performer_readability_preserves_snapped_noop_and_allocation_identity ... ok
test allocation_drag::tests::scope_detects_first_child_allocation_and_role_transfer_and_finish_rejects_live_edits ... ok
test allocation_drag::tests::selected_header_visibility_allows_viewport_edge_but_refuses_clipping ... ok
test allocation_drag::tests::snapped_noop_returns_no_command_and_keeps_source_revision_and_redo ... ok
test allocation_drag::tests::source_budget_refusal_keeps_project_bundle_history_and_retry_identity_exact ... ok
test allocation_drag::tests::surviving_constraint_mutation_is_refused_even_when_core_candidate_is_valid ... ok
test allocation_drag::tests::target_presentation_requires_accepted_identity_and_selected_header_visibility ... ok
test allocation_drag::tests::toolbar_identity_allows_exact_incoming_placement_at_old_label_overlap ... ok
test allocation_drag::tests::uniform_folded_grandchild_and_unplaced_scope_moves_exactly_q_and_all_l_oa_sa ... ok
test allocation_drag::tests::uniform_role_only_and_mixed_direct_role_composites_same_target_do_not_allocate ... ok
test allocation_drag::tests::uniformly_unassigned_composite_creates_only_stable_leaf_allocations_including_unplaced ... ok
test allocation_drag::tests::unrequested_view_option_cleanup_is_not_whitelisted ... ok
test allocation_drag::tests::unresolved_role_leaf_can_arrange_or_accept_explicit_target_without_guessing ... ok
test app::allocation_drag::clearance::tests::corner_order_follows_boundary_crossing_and_is_deterministic ... ok
test app::allocation_drag::clearance::tests::descendant_footprint_controls_clearance_without_mutating_projects ... ok
test app::allocation_drag::clearance::tests::each_outgoing_edge_clears_the_source_and_passes_ordinary_placement ... ok
test app::allocation_drag::clearance::tests::independent_selected_roots_keep_one_rigid_group_translation ... ok
test app::allocation_drag::clearance::tests::no_crossing_no_overlap_no_source_and_nonfinite_requests_are_empty ... ok
test app::allocation_drag::clearance::tests::source_shrink_uses_candidate_enclosure_not_frozen_target ... ok
test app::allocation_drag::tests::actual_canvas_origin_change_cancels_held_work_before_any_legacy_release ... ok
test app::allocation_drag::tests::arrange_is_one_gesture_and_snapped_noop_preserves_redo_and_source ... ok
test app::allocation_drag::tests::candidate_semantics_are_cached_per_destination_with_stable_ids_and_own_index ... ok
test app::allocation_drag::tests::destination_identity_does_not_describe_blocked_or_outside_viewport_as_unallocation ... ok
test app::allocation_drag::tests::frozen_collapsed_target_uses_only_visible_header_and_port_edge_controls_occlude ... ok
test app::allocation_drag::tests::frozen_targets_use_half_open_semantic_priority_and_refuse_incomparable_overlap ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_dirty_description_retains_focus_and_middle_caret_for_next_key ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_dirty_name_retains_focus_and_middle_caret_for_next_key ... ok
test app::allocation_drag::tests::full_tree::actual_app_tree_exact_incoming_drag_keeps_destination_visible_and_canvas_stable ... ok
test app::allocation_drag::tests::full_tree::actual_keyboard_arrange_shortcut_consumes_once_escape_cancels_and_dirty_owner_refuses ... ok
test app::allocation_drag::tests::full_tree::actual_rendered_canvas_pixels_do_not_change_when_toolbar_feedback_text_changes ... ok
test app::allocation_drag::tests::full_tree::actual_toolbar_hover_inspects_last_full_name_without_authorizing_an_outside_drop ... ok
test app::allocation_drag::tests::full_tree::actual_tree_outgoing_boundary_motion_preview_release_and_cancel ... ok
test app::allocation_drag::tests::full_tree::control_focus::dirty_selected_pin_outer_ring_keeps_real_name_focus_and_caret ... ok
test app::allocation_drag::tests::group::allocation_bare_moves_cannot_bypass_armed_active_or_retired_lifetime ... ok
test app::allocation_drag::tests::group::completed_text_apply_rejects_old_allocation_packets_without_retiring_a_new_drag ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_after_cancel_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_context_mismatches_preserve_the_current_session ... ok
test app::allocation_drag::tests::group::connection_lifetime::captured_connection_current_restart_and_pair_commit_after_tool_boundary ... ok
test app::allocation_drag::tests::group::group_arrange_work_and_performer_anchors_preserve_every_responsibility ... ok
test app::allocation_drag::tests::group::group_assignment_split_rebuild_preserves_primary_and_commits_one_complete_candidate ... ok
test app::allocation_drag::tests::group::group_out_and_back_assigns_at_zero_delta_then_true_noop_preserves_redo ... ok
test app::allocation_drag::tests::group::group_selection_aba_and_old_press_cannot_retire_a_new_token ... ok
test app::allocation_drag::tests::group::group_source_refusal_retains_primary_source_and_both_history_paths ... ok
test app::allocation_drag::tests::group::idle_group_press_rejects_selection_generation_aba_with_unchanged_other_stamps ... ok
test app::allocation_drag::tests::group::ordinary_off_grid_performer_out_and_back_is_noop_with_redo ... ok
test app::allocation_drag::tests::group::route_lifetime::captured_route_context_fields_independently_reject_before_retirement ... ok
test app::allocation_drag::tests::group::route_lifetime::current_route_commits_without_session_preserve_exact_route_history ... ok
test app::allocation_drag::tests::group::route_lifetime::same_context_route_attachment_after_selection_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::same_context_route_commit_after_selection_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::stale_route_attachment_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::route_lifetime::stale_route_commit_preserves_arrange_arm_and_live_group ... ok
test app::allocation_drag::tests::group::unsupported_group_click_collapses_but_threshold_crossing_never_becomes_click ... ok
test app::allocation_drag::tests::modal_roundtrip_equal_fit_undo_resize_and_focus_retire_press_before_replay ... ok
test app::allocation_drag::tests::mounted_clean_stationary_selects_exact_work_without_revision_or_legacy_apply ... ok
test app::allocation_drag::tests::mounted_dirty_port_press_cannot_fall_through_to_applying_port_selection ... ok
test app::allocation_drag::tests::mounted_dirty_property_press_does_not_select_apply_or_destroy_draft ... ok
test app::allocation_drag::tests::mounted_oa_sa_ordered_incoming_between_outgoing_are_exact_single_history_steps ... ok
test app::allocation_drag::tests::mounted_role_only_outgoing_refusal_retains_placement_and_same_performer_creates_no_allocation ... ok
test app::allocation_drag::tests::mounted_uniform_parent_moves_hidden_placements_and_assigns_only_leaves ... ok
test app::allocation_drag::tests::navigation_union::old_chooser_envelopes_preserve_a_current_canvas_gesture ... ok
test app::allocation_drag::tests::navigation_union::stale_gesture_packets_preserve_navigation_and_a_new_live_cancel_still_works ... ok
test app::allocation_drag::tests::oa_sa_clipped_selected_header_refuses_preview_release_and_retries_without_partial_source_or_history ... ok
test app::allocation_drag::tests::oa_sa_toolbar_identity_accepts_exact_receiver_and_collapsed_header_drag ... ok
test app::allocation_drag::tests::outgoing_boundary_drop_clears_source_without_changing_other_placements ... ok
test app::allocation_drag::tests::outgoing_clearance_collision_refuses_release_without_source_or_history_mutation ... ok
test app::allocation_drag::tests::outgoing_clearance_preserves_source_enclosure_and_allocated_sibling ... ok
test app::allocation_drag::tests::outside_release_is_cancel_and_does_not_remove_an_assignment ... ok
test app::allocation_drag::tests::pending_behavior_draft_refuses_actual_work_press_and_equal_document_replacement_retires_packet ... ok
test app::allocation_drag::tests::refused_motion_retains_last_scene_but_release_never_commits_it ... ok
test app::allocation_drag::tests::release_uses_ordered_native_position_before_later_motion_in_same_batch ... ok
test app::allocation_drag::tests::same_snapped_position_on_opposite_shared_border_rebuilds_semantics_even_if_layout_refuses ... ok
test app::allocation_drag::tests::source_and_modal_admission_reject_prebuilt_clean_press_without_selecting ... ok
test app::allocation_drag::tests::source_refusal_is_atomic_and_a_new_gesture_can_retry_against_live_revision ... ok
test app::allocation_drag::tests::stale_packets_do_not_cancel_a_newer_token_and_each_release_is_consumed_once ... ok
test app::allocation_drag::tests::toolbar_destination_names_transformed_target_whose_header_is_clipped ... ok
test app::allocation_drag::tests::toolbar_status_leaves_transformed_top_edge_work_header_readable ... ok
test result: ok. 123 passed; 0 failed; 0 ignored; 0 measured; 1424 filtered out; finished in 54.86s
-87
View File
@@ -1,87 +0,0 @@
# Projection switching and canvas inspection
Branch contribution for [#42](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/42)
and [#43](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/43),
based on published preview `715036e132677dd2bc2fb37ed316d93dc9987aec`.
Owner: Codex-ytr83r, session 01a0d706. This is a candidate, not integrated
acceptance or a replacement release. Live status belongs to the linked issues.
## Decision and alternatives
String projections are presentation filters over one authored diagram. Preserve
opposite-layer placements, routes and visibility selections when switching away
from Traceability; ordinary projections render only their declared layer. This
extends the existing documented preservation of inapplicable element kinds.
Deleting incompatible placements loses authored arrangements; automatically
creating a second view fragments the user's work and makes repeated switching
ambiguous. Neither alternative satisfies reversible view switching as directly.
Missing identities and wrong reference kinds/families remain errors. StateMachine
and Scenario keep strict typed membership. Frozen versions 1–6 retain their old
layer admission before migration. The current version-7 correction adds no fields
or wire shapes; older version-7 readers may reject newly admitted latent records.
That compatibility limit must remain explicit until coordinated version adoption.
The explicit RelocateNode operation continues to require a compatible destination
layer or Traceability view; retaining latent records is distinct from moving a
placement into an incompatible destination.
Canvas inspection carries the originating route context and preserves view/layer.
Explicit model navigation continues to follow the target layer. Draft validation
and stale-context rejection apply before inspection. Existing production group
selection already retained the canvas; fallback edge/port selection and canvas
context actions require the correction. The published Windows baseline reproduces both reported failure states;
source diagnosis and those baseline results do not establish patched acceptance.
Contextual child/relationship creation must derive the semantic layer from the
selected object, while root creation continues to use the active perspective.
## Acceptance
- OA and SA switches through all ordinary projections preserve the complete model
except projection, source/JSON/bundle round trips, and one-step Undo/Redo.
- Returning to Traceability restores applicable placements; parent, port and edge
projection never leaks an opposite-layer record into an ordinary view.
- Invalid references and State/Scenario membership still reject; source and JSON
versions 3–6 retain their old layer checks and located diagnostic identities.
- Actual canvas clicks, context Properties/Hide and explicit navigation exercise
the intended selection distinction; stale packets and invalid drafts preserve
selection and source/history.
- Windows native selection, projection switching, Save, Undo/Redo and fresh reopen
are checked against predeclared full-model/source expectations. Compilation and
automated handler tests do not substitute for this acceptance.
Linux remains excluded by the existing user pause. Independent design critique
identified saved visibility selectors and frozen migration as additional admission
paths; both are included. At published candidate `603a59c1785dbcca324dae063ecc3405d9519a30`, 41 targeted core checks pass: legacy admission (2), projection switching (3), review regressions (15), source-6 view contract (8), and state diagrams (13). Tracked inputs were unchanged across the run. Whole-workspace formatting also passed at that commit. The first `0341bca` core attempt failed a generated-UUID test oracle; explicit fixture identities corrected the evaluator, without relaxing the admission assertion.
The desktop attempt at `603a59c` was deliberately interrupted before test execution after independent source review found canvas Properties redispatch and contextual relationship/child semantic-layer defects. Its source inputs remained unchanged; no desktop passing result is claimed. The Properties issue arose from fixing explicit navigation to an already-inspected opposite-layer object. Keep both regressions: contextual Properties stays in the view, explicit navigation follows the object's layer.
Published-preview executable SHA256 `2c03bd6cc3f1110c219e4f57ab94874a121590f83779239a93289b7170664399` reproduces edge selection changing SA to OA, and Architecture switching refused with `diagram_layer`. The isolated valid fixture remained byte-for-byte unchanged after the trial. An earlier fixture used reserved alias `capability` and was rejected; it was corrected before either reproduction. Initial native-dialog capture/input failures also remain separate from application acceptance. Independent evidence review confirmed the resulting screenshot states and persisted byte equality; screenshots alone do not capture the complete action sequence or transient state history.
The frozen full-workspace attempt at `3a7221b80cfa7924921b3b77f2dd35550247f595`
closed with unchanged tracked inputs and Cargo exit101: core/CLI groups passed616
with1 existing ignore; desktop passed1538, failed1 and retained7 existing ignores.
The sole failure was the new preferred-view test's setup, before child creation:
`Message::Projection` edits and selects the diagram, so the test's expectation
that the parent remained selected was false. An exact isolated rerun and source
review confirmed this. The correction initializes the projection in the fixture,
then uses explicit parent selection and the ordinary diagram picker to establish
independent semantic inspection. Production navigation is unchanged. All other
new canvas tests passed, including Properties, explicit navigation, relationship
Apply/history, child/root semantic layer, and projection/source/history checks.
The command remains a failed workspace run; server tests and doctests were not
reached. Its planned Clippy/build stages were consequently not launched.
The same source's formatting check found one multiline icon call requiring a
single line. The follow-up applies that formatting correction and adds in-app
help describing preserved cross-layer content and contextual inspection. Those
are the only production-file changes after the full suite; the remaining change
corrects the test setup. Follow-up canvas/server/doctest, formatting, strict
Clippy and native-build results must be recorded separately, with their exact
source pin. Reuse successful unchanged core/desktop evidence within these limits;
do not turn the failed workspace command into a pass.
Candidate Windows GUI save/history/reopen, HTTP regression, the corrected test
and final checks remain outstanding. Raw local evidence is not yet a
peer-consumable handoff; publish the consolidated evidence before integration.
Scope boundary: contextual relationship forms retain the canvas while opening; successful Apply retains the existing explicit post-review navigation. The generic child-creation handler is tested for containment and allocation, but the separate architecture palette/performer workflow still offers creation kinds for the diagram layer. Thus an OA performer displayed in an SA Traceability view has no Add activity menu entry; this inherited limitation is not claimed repaired here.