fix(#947): include manager in agent-sockets.json
This commit is contained in:
parent
8b946a67c6
commit
4435666c00
1 changed files with 11 additions and 15 deletions
|
|
@ -38,7 +38,7 @@ pub const SOCKET_FILENAME: &str = "web.sock";
|
|||
/// sub-agent that hasn't flipped the option yet.
|
||||
///
|
||||
/// Renamed from `.bound` (legacy) to match the `hyperhive-` prefix
|
||||
/// convention for all harness-written state files. `build_map`
|
||||
/// convention for all harness-written state files (#838). `build_map`
|
||||
/// checks both names during the transition window so existing containers
|
||||
/// don't lose gateway routing before their next rebuild.
|
||||
pub const READY_MARKER: &str = "hyperhive-socket-bound";
|
||||
|
|
@ -67,12 +67,9 @@ pub fn socket_path_for(name: &str) -> PathBuf {
|
|||
}
|
||||
|
||||
/// Compute the agent-socket map for the given logical agent names.
|
||||
/// Sub-agents only — manager is filtered out at the call boundary
|
||||
/// for the same reason it's filtered from `agent_ports::build_map`
|
||||
/// (manager UI is routed via the c0re dashboard upstream, not via
|
||||
/// `/agent/<name>/`).
|
||||
///
|
||||
/// Also filters by `READY_MARKER` presence: only agents whose
|
||||
/// Includes manager and sub-agents — all managed containers that have
|
||||
/// bound a unix socket get an entry. Filters by `READY_MARKER` presence:
|
||||
/// only agents whose
|
||||
/// harness has actually bound the unix socket (and dropped the
|
||||
/// marker) appear in the map. Without this, the gateway would
|
||||
/// `proxy_pass` to a non-existent socket for every sub-agent that
|
||||
|
|
@ -105,7 +102,6 @@ where
|
|||
{
|
||||
names
|
||||
.iter()
|
||||
.filter(|n| n.as_str() != MANAGER_NAME)
|
||||
.filter(|n| is_ready(n))
|
||||
.map(|n| (n.clone(), socket_path_for(n)))
|
||||
.collect()
|
||||
|
|
@ -241,18 +237,18 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn build_map_filters_manager() {
|
||||
// Use `MANAGER_NAME` in the input so the assert actually
|
||||
// exercises the filter path — a literal `"hm1nd"` would pass
|
||||
// trivially if the constant ever changed and the filter
|
||||
// silently became a no-op. All-ready predicate bypasses the
|
||||
// marker check so we exercise the manager filter in isolation.
|
||||
fn build_map_includes_manager() {
|
||||
// Manager is now included in the gateway socket map so the
|
||||
// gateway can route `/agent/<manager-name>/` to its unix socket,
|
||||
// giving the operator access to the manager's per-agent web UI
|
||||
// (terminal, inbox, stats). All-ready predicate bypasses the
|
||||
// marker check so we exercise the manager inclusion in isolation.
|
||||
let names: Vec<String> = ["iris", MANAGER_NAME, "argus"]
|
||||
.iter()
|
||||
.map(|s| (*s).to_owned())
|
||||
.collect();
|
||||
let map = build_map_with(&names, |_| true);
|
||||
assert!(!map.contains_key(MANAGER_NAME));
|
||||
assert!(map.contains_key(MANAGER_NAME));
|
||||
assert!(map.contains_key("iris"));
|
||||
assert!(map.contains_key("argus"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue