---
name: verify
description: Project definition-of-done runner for the EDR platform. Use before calling any code change finished, before committing, and whenever asked "is it done / does it work". Runs the targeted checks that actually catch this repo's failure modes - type-check with turbo filters, @edr/types dist rebuild, raw-SQL EXPLAIN validation, migration safety, and honest test reporting.
---

# Verify a change (EDR definition of done)

Run these in order. Report which you ran and what each said — never call
unverified work done.

## 1. Type-check exactly what you touched

```bash
pnpm turbo type-check --filter=@edr/freight-api --filter=@edr/freight-backoffice --filter=@edr/freight-portal
```

Drop filters you didn't touch; whole-repo runs waste minutes. **If you edited
`packages/types`, rebuild it FIRST** — consumers read its `dist/`, not `src/`:

```bash
pnpm turbo build --filter=@edr/types
```

## 2. Validate every raw SQL statement

Each new/edited `dataSource.query` / `manager.query` string must pass:

```bash
node .claude/skills/edr-db/query.cjs explain "<the statement with dummy params>"
```

## 3. Migration checklist (if you added one)

- Timestamp unique in `src/migrations/` **and** greater than
  `node .claude/skills/edr-db/query.cjs "SELECT max(timestamp) FROM public.migrations"`.
- DDL idempotent (`IF NOT EXISTS`, guarded backfills).
- Watch-mode reload does NOT run migrations — apply the SQL to the dev DB
  yourself or fully restart the API, then confirm with
  `query.cjs columns <table>`.

## 4. Tests — honest bar

`pnpm test` for `@edr/freight-api` is currently red on `dev`, so a green suite
is not the bar. The bar: run the specs nearest what you touched and introduce
**no new failure**. If you touched a service constructor, update its `.spec.ts`
mocks (constructor-arity breaks are this repo's most common test regression).

## 5. Observe the behaviour

Compiling is not working. Hit the endpoint, drive the UI flow, or query the
resulting rows. If you genuinely could not observe it, say so explicitly in the
summary — do not imply it was seen working.

## 6. Before commit

- Conventional message (`fix(warehouses): …`). Git hooks do NOT run in this
  repo (husky shims exist but no user hooks) — nothing will catch it for you.
- Lint the files you touched if in doubt: `pnpm turbo lint --filter=<pkg>`.
- Do not commit or push unless the user asked.
