fix(permissions): clarify kept_state_names comment in get_stale_permissions
The variable was misleadingly named `tombstones` and commented as 'any name here is a tombstone', but kept_state_names() returns ALL agents with a state dir on disk — both live containers and soft-deleted tombstones. The logic was always correct (union with the live roster filters both), but the comment would mislead future readers. Rename the variable to `kept` and update comments to accurately describe the contents.
This commit is contained in:
parent
cffe645197
commit
75e49f7752
1 changed files with 8 additions and 5 deletions
|
|
@ -313,7 +313,7 @@ pub(super) async fn post_permissions(
|
|||
}
|
||||
|
||||
/// Agent names that have explicit capability/tool-group entries but are
|
||||
/// not in the live container roster AND not in the kept-state tombstone
|
||||
/// not in the live container roster AND not in the kept-state directory
|
||||
/// list (i.e. truly gone — renamed or destroyed agents whose JSON entries
|
||||
/// persisted). The client uses this to drive the "stale permission entries"
|
||||
/// sub-section in K3PT ST4T3 without having to fetch three separate
|
||||
|
|
@ -335,13 +335,16 @@ pub(super) async fn get_stale_permissions(
|
|||
.into_iter()
|
||||
.map(|c| c.name)
|
||||
.collect();
|
||||
// Kept-state directories — any name here is a tombstone, not a ghost.
|
||||
let tombstones: std::collections::HashSet<String> =
|
||||
// Kept-state directories: every agent that ever had a state dir on disk,
|
||||
// including both live containers (already in `live`) and soft-deleted
|
||||
// tombstones (destroyed but kept). A name present here is either live
|
||||
// or a properly-removed tombstone — neither is a ghost.
|
||||
let kept: std::collections::HashSet<String> =
|
||||
crate::coordinator::Coordinator::kept_state_names()
|
||||
.into_iter()
|
||||
.collect();
|
||||
// Known = live roster ∪ tombstones.
|
||||
let known: std::collections::HashSet<&String> = live.iter().chain(tombstones.iter()).collect();
|
||||
// Known = live roster ∪ kept-state names.
|
||||
let known: std::collections::HashSet<&String> = live.iter().chain(kept.iter()).collect();
|
||||
// Explicit entries in either JSON file.
|
||||
let caps = crate::capabilities::read();
|
||||
let tgs = crate::tool_groups::read();
|
||||
|
|
|
|||
Loading…
Reference in a new issue