refactor(#962): replace children_of(MANAGER_NAME) with top_level_agents()

Add topology::top_level_agents_in(topo) and top_level_agents() which
find the topology root by structure (parent=None) rather than by name,
then return its children. Lifecycle.rs role logic now uses this instead
of children_of(MANAGER_NAME), removing the hardcoded manager-name
reference from the bind-mount logic.

Also adds two unit tests for top_level_agents_in.
This commit is contained in:
atlas 2026-06-01 18:54:37 +02:00 committed by mara
commit 828be8e2c8
2 changed files with 43 additions and 1 deletions

View file

@ -1156,7 +1156,7 @@ fn set_nspawn_flags(
agent_name,
crate::topology::ROLE_CAN_MANAGE_TOP_LEVEL_AGENTS,
) {
let top_level = crate::topology::children_of(MANAGER_NAME);
let top_level = crate::topology::top_level_agents();
for tl in &top_level {
if !direct_children.contains(tl) {
bind_child_agent_dirs(tl, &mut binds);