Anonymous - 2026-05-05

Originally posted by: kumaakh

Code Review — fleet-rev

Overall

The PR adds an optional category field to fleet members and uses it to group output in fleet_status, list_members, and the statusline. Approach is sound — a few issues worth addressing.


Correctness

1. Whitespace-only category silently stored (update-member.ts:123)

updates.category = input.category || undefined;

" " is truthy so it gets stored as-is, but the display side trims it → shows as (uncategorized) while the DB value is non-empty whitespace. Fix: trim before the falsy check:

updates.category = input.category.trim() || undefined;

2. Fragile index-based join in check-status.ts:219

const rowsWithCategory = rows.map((r, i) => ({ ...r, category: agents[i].category ?? null }));

Relies on rows and agents being the same length and order. Any future filtering on rows would silently miscategorize members. Attach category when the row is first built, not retroactively by index.

3. Multi-line statusline — new code joins category groups with \n. If Claude Code's status bar reads only the first line, all categories after the first are invisible. Needs verification.


Edge Cases

4. Category ordering is insertion-order (no sort). Users might expect alphabetical. Consider sorting Map keys, or at minimum putting (uncategorized) last.


Security

No issues. category is bounded (.max(64)), optional, display-only.


Tests

None added. Missing at minimum: whitespace-clearing behaviour on update, grouped output format in list_members/fleet_status, and category presence in JSON output.


Code Quality

5. Duplicated group-by-category logic across statusline.ts, check-status.ts, and list-members.ts. Extract a shared helper:

function groupByCategory<T>(items: T[], getCategory: (item: T) => string): Map<string, T[]>

6. Unrelated package-lock.json changes"peer": true added to several packages (express, hono, zod, vite, etc.). Looks like an npm version difference, not intentional. Should be explained or reverted.


Summary

Priority Item
Fix Trim whitespace on category before storage
Fix Verify multi-line statusline renders in Claude Code status bar
Should have Add unit tests (update, list, status)
Nice to have Extract shared groupByCategory helper
Cleanup Explain or revert unrelated package-lock.json peer changes