Files
Netcatty/infrastructure
Radwan Selo 5360385c41 fix(vault): normalize the vault_hosts_list group filter and explain empty group results (#4418)
* fix(vault): normalize the vault_hosts_list group filter and explain empty group results

The group filter only trimmed whitespace and trailing slashes, while saved
group paths are normalized (backslashes to "/", segments trimmed, empty
segments dropped). A filter like "/prod", "prod / web", "prod\web" or
"prod//db" silently returned no hosts.

- Normalize the filter with normalizeGroupTargetPath, the same rules used
  for saved groups. "/" still means no filter.
- When the group filter alone leaves the list empty, add a note so an
  agent can tell a mistyped group from an empty one: a case-only mismatch
  suggests the right name, an unknown group points to vault_groups_list,
  and a known group without hosts says so. Results with hosts, and empty
  results caused by the query, are unchanged.

* fix(vault): normalize stored host group paths in the vault_hosts_list group filter

Host Details saves a typed group verbatim apart from outer whitespace, so
hosts can carry noncanonical paths such as "prod / web" or "prod//db".
Normalizing only the filter made an exact match on such a value return no
hosts and report that the group exists but is empty. Normalize the stored
path the same way before comparing, so the exact stored value, its
canonical spelling, and parent filters all find the host.

* fix(vault): list known group names in the unknown-group note

vault_groups_list returns only saved groups, so pointing to it dead-ended
for groups that exist only through host paths. List the known group names
(saved groups and host paths, capped at 20) in the note instead.
2026-11-26 22:32:36 +08:00
..