---
id: w1/m2.5/t008
title: Simplify — /simplify over the refactored packages
worker: worker1
status: done
estimate: 20m
depends_on: [w1/m2.5/t007]
---

## Objective

Run `/simplify` over the code this milestone moved (the new feature packages + `core`/`authz` + composition root), applying behavior-preserving reuse / simplification / efficiency cleanups the extraction surfaced.

## Context

- Big mechanical moves tend to leave seams: duplicated error-mapping across feature `rest.go` fragments, a `core` base that accreted symbols that really belong to one feature, near-identical GraphQL resolver boilerplate (`gqlField[T]`), redundant re-fetches.
- Behavior-preserving only — no wire/verb changes; `/code-review` (not `/simplify`) owns bug hunting.

## Steps

1. `/simplify` scoped to `lego/backend/internal/{core,authz,apps,logs,metrics,apikeys,postgres,server}`.
2. Fold obvious duplication (shared error→HTTP mapping, resolver helpers) to the right home; push single-feature symbols out of `core`.
3. Re-run `go build ./... && go test ./...`.

## Files

- `lego/backend/internal/**` (refactored packages only)

## Acceptance criteria

- [ ] `go build ./... && go test ./...` green after cleanups.
- [ ] No new behavior; diff is reuse/simplification/efficiency only.
- [ ] `core` holds only genuinely cross-feature symbols (no single-feature leakage).

## Out of scope

- Bug fixing (that's `/code-review`); new features.
