fix(tree): make bookkeeping rows searchable

This commit is contained in:
can1357
2026-08-07 13:20:58 +02:00
parent 93f3c5c51c
commit 4beb58a39b
2 changed files with 41 additions and 0 deletions
@@ -398,6 +398,34 @@ class TreeList implements Component {
case "label":
parts.push("label", entry.label ?? "");
break;
case "service_tier_change":
parts.push("service tier");
if (entry.serviceTier) {
const serviceTier = entry.serviceTier;
for (const family in serviceTier) {
const tier = serviceTier[family as keyof typeof serviceTier];
if (tier) parts.push(family, tier);
}
}
break;
case "title_change":
parts.push("title", entry.title);
break;
case "mode_change":
parts.push("mode", entry.mode);
break;
case "credential_pin":
parts.push("credential pin", entry.provider);
break;
case "ttsr_injection":
parts.push("ttsr injection", ...entry.injectedRules);
break;
case "reset_boundary":
parts.push("reset boundary");
break;
case "session_init":
parts.push("session init");
break;
}
return parts.join(" ");
@@ -96,6 +96,19 @@ describe("tree selector entry labels", () => {
expect(rows).toContain("[session init]");
});
it("searches bookkeeping entries by their rendered content", () => {
for (const [query, expected] of [
["fork", "[title: fork cleanup]"],
["anthropic", "[credential pin: anthropic]"],
["priority", "[service tier: claude:priority]"],
]) {
const selector = selectorFor([userEntry, ...bookkeeping]);
selector.handleInput(ALT_A);
selector.handleInput(query);
expect(visibleRows(selector).join("\n")).toContain(expected);
}
});
it("hides bookkeeping entries in the default view", () => {
const selector = selectorFor([userEntry, ...bookkeeping]);
const rows = visibleRows(selector).join("\n");