---
id: w5/m4/t006
title: Simplify
worker: worker5
status: done
estimate: 30m
depends_on: [w5/m4/t005]
---

## Objective

Run `/simplify` over the code this milestone changed (services query wiring, list states, lifecycle actions) for reuse / simplification / efficiency, behavior-preserving.

## Context

- Files touched by m4: `src/routes/index.tsx`, `src/features/services/**`, `src/graphql/definitions.ts`.

## Steps

1. Run `/simplify` scoped to the m4 diff.
2. Apply behavior-preserving cleanups; re-run `yarn lint && yarn typecheck && yarn test`.

## Files

- Files changed in m4 (`src/features/services/**`, `src/routes/index.tsx`).

## Acceptance criteria

- [x] `/simplify` applied; no behavior change; checks green.

## Outcome (2026-07-08)

`/simplify` ran 4 parallel review agents (reuse / simplification / efficiency / altitude) over the m4 files. Applied, behavior-preserving:

- `lib/status.ts` — added `toServiceViews(nodes)` (list-level projection, mirrors logs' `toLogLines`).
- `hooks/use-services.ts` — both map sites now call `toServiceViews`, wrapped in `useMemo([data])` (stable identity; stops `computeStats` recompute on lifecycle-`pending` flips).
- `hooks/use-service-lifecycle.ts` — dropped the local `delay`, reuse shared `sleep` (`common/lib/utils/time`); `restart` convergence uses `deriveStatus(s).key === "running"` so the phase-casing rule stays sealed in `lib/status.ts`.
- `components/service-row-actions.tsx` — collapsed the `CONFIRMS`/`CONFIRM_TITLE`/`CONFIRM_BODY` triple (with dead `resume` placeholders) into one `CONFIRM: Partial<Record<…, {title, body}>>` — "no confirm" is expressed by absence.
- `routes/index.tsx` — `computeStats` wrapped in `useMemo([services])`.

Skipped (not behavior-preserving / out of scope): swapping the inline table empty-state for the shared `EmptyState` (it wraps its own Card → would nest a card in the table card); folding the per-verb tables into a cross-file verb descriptor (spans the lifecycle hook — larger design change than a simplify pass warrants).

`yarn lint && yarn typecheck && yarn test (373) && yarn build` green; services list + stats + row-action confirm dialog re-verified live via the local-bex stub.

## Out of scope

- New behavior.
