Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions internal/cli/plugin_agents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,41 @@ func TestApply_AgentsFlagKeepsSiblingSharedSkill(t *testing.T) {
// Codex owns it in state. No --agents pi surface may offer it as an orphan:
// status would report a deletion, the dry run would preview one, and
// reconcile would prompt to remove a file Codex still depends on.
for _, args := range [][]string{
{"status", "--agents", "pi"},
{"apply", "--dry-run", "--agents", "pi"},
{"reconcile", "--auto-safe", "--agents", "pi"},
//
// The dry run never prints orphan paths, only the removal counts, so
// checking it for the skill name alone could never fail. Its removal line
// is pinned exactly instead: pi's own MCP cleanup is the one expected
// removal ("Removals: 1 key(s) (…)"), and a leaked skill delete turns it
// into "1 key(s), 1 file(s)". Pinning the whole line, rather than only the
// absence of "file(s)", keeps this row from going vacuous again if the
// label is ever reworded.
for _, tc := range []struct {
args []string
leaks []string // must not appear
wants []string // must appear
}{
{args: []string{"status", "--agents", "pi"}, leaks: []string{"toolkit-audit"}},
{
args: []string{"apply", "--dry-run", "--agents", "pi"},
leaks: []string{"toolkit-audit", "file(s)"},
wants: []string{"Removals: 1 key(s) (the real apply will remove these)"},
},
{args: []string{"reconcile", "--auto-safe", "--agents", "pi"}, leaks: []string{"toolkit-audit"}},
} {
out, err := runCLI(t, env, args...)
cmd := strings.Join(tc.args, " ")
out, err := runCLI(t, env, tc.args...)
if err != nil {
t.Fatalf("%s: %v\n%s", strings.Join(args, " "), err, out)
t.Fatalf("%s: %v\n%s", cmd, err, out)
}
for _, leak := range tc.leaks {
if strings.Contains(out, leak) {
t.Errorf("%s offered the skill Codex still owns (found %q):\n%s", cmd, leak, out)
}
}
if strings.Contains(out, "toolkit-audit") {
t.Errorf("%s offered the skill Codex still owns:\n%s", strings.Join(args, " "), out)
for _, want := range tc.wants {
if !strings.Contains(out, want) {
t.Errorf("%s: want %q in output:\n%s", cmd, want, out)
}
}
}
if out, err := runCLI(t, env, "apply", "--agents", "pi"); err != nil {
Expand Down
Loading