Integrate typed port authoring and reviewable exchange workflows

This commit is contained in:
2026-09-05 20:00:21 +03:00
parent 2dd17aa693
commit fa096cefd3
21 changed files with 6449 additions and 2154 deletions
+22 -1
View File
@@ -2245,8 +2245,29 @@ pub fn can_parent(p: &Project, child_kind: Kind, layer: Layer, parent: Option<Id
}),
}
}
/// Uses the same relation rules as committed edits, without cloning a project.
/// Sources for new interface roles; preserved legacy associations remain readable.
pub fn can_create_interface_role(p: &Project, source: Id) -> bool {
p.elements.get(&source).is_some_and(|e| {
e.kind().is_performer()
|| matches!(
crate::ports::port_contract(e),
Some(PortContract::Component { .. })
)
})
}
/// Feasibility of creating a relationship with the default authoring contract.
/// An FE builder creates its typed ports; validating an exact unbound FE here
/// would incorrectly hide every target. Exact records still require endpoints.
pub fn can_connect(p: &Project, kind: RelationKind, source: Id, target: Id) -> bool {
if kind == RelationKind::FunctionalExchange {
return source != target
&& [source, target].iter().all(|id| {
p.elements
.get(id)
.is_some_and(|e| e.layer() == Layer::Sa && e.kind() == Kind::Function)
});
}
if kind == RelationKind::Allocation
&& p.relations
.values()