---
id: w6/m4/t005
title: Wire purgers into the composition root
worker: worker6
status: done
estimate: 20m
depends_on: [w6/m4/t003, w6/m4/t004]
---

## Objective

Populate `ServerDeps.WorkspacePurgers` in `cmd/api/main.go` with the three concrete purgers (secrets, postgres, keyvalue) so `DeleteWorkspace` actually invokes them instead of looping over an empty slice.

## Context

- `lego/backend/internal/api/server.go:133` — `ServerDeps.WorkspacePurgers []workspaces.WorkspacePurger`, passed to the `workspaces.Service` at line 179.
- `lego/backend/cmd/api/main.go` — never sets `WorkspacePurgers` today (confirmed via grep — the field is absent from the composition root entirely).

## Steps

1. In `cmd/api/main.go`, after constructing the `secrets`, `postgres`, and `keyvalue` services, construct their `WorkspacePurger` instances (from t003/t004) and populate `ServerDeps.WorkspacePurgers` with all three.
2. Confirm ordering doesn't matter (each purger only touches its own resource type) or document if it does.

## Files

- `lego/backend/cmd/api/main.go`

## Acceptance criteria

- [ ] `ServerDeps.WorkspacePurgers` is populated with all three purgers at binary startup
- [ ] `go build ./...` succeeds

## Out of scope

- The purger implementations themselves (t003, t004).
