# verify — base readiness (one-time) + Definition of Done

> The automated **"it actually works"** gate. The pipeline produces **verified** code, not just code.
> **§A = base readiness** — a one-time check at the **base-repo level** (NOT part of START or a project run;
> a project run never enters a base-fix cycle). **§B = Definition of Done** — runs after each sprint/feature.
> Single source — `README.md`, `START.md`, and both workflows reference this file; they don't restate it.
>
> **Run every command NON-INTERACTIVELY.** Never open an interactive `php artisan tinker` (it hangs the agent); use
> `schema:check` / `migrate:status` / a test / `tinker --execute="…"` for probes. Add `--no-interaction`/`--force`
> where a prompt is possible. Give any potentially-blocking step a timeout and fail fast — never hang.

---

## A) Base readiness — ONE-TIME, at the base-repo level (NOT per project)

Keep the **base itself** green so every clone starts clean. Run this **in the base repo** when the base
changes — it is **not** part of START or the per-feature flow, and **a project run must never trigger a
base-fix cycle**. A project run assumes the base is ready.

```bash
php artisan migrate:fresh --seed     # completes with ZERO errors on a clean DB
php artisan test                     # base suite green
composer dump-autoload -o            # NO psr-4 warnings (catches namespace/path mismatches)
./vendor/bin/pint --test             # formatting clean
php artisan schema:check             # schema/*.json matches the real DB
```

If the base isn't green, **fix it once in the base repo and re-clone** — do not fix it from inside a project run.
(A project run only needs the environment ready: `.env`, DB reachable, `APP_KEY`.)

---

## B) Definition of Done — hard gate after each sprint / feature

A sprint (or feature) is **DONE only when ALL pass**:

1. **Migrations** — `php artisan migrate:fresh --seed` runs clean, including the new feature's
   migrations + seeders, with realistic Arabic data (no `lorem`/English placeholders for `ar`).
2. **Autoload / PSR-4** — `composer dump-autoload -o` with **no warnings** (catches namespace↔path mismatches).
3. **Format** — `./vendor/bin/pint` clean (PSR-12 / base style).
4. **Schema integrity** — `php artisan schema:check` clean: the feature's `database/schema/<feature>.json`
   matches the real tables/columns; no empty feature listed in `features.json`.
5. **Tests** — `php artisan test` green, **including the feature tests** from [`build-tests.md`](build-tests.md)
   (success + validation + auth + the response envelope, both locales).
6. **Smoke** — each new endpoint returns the standard envelope (`app/Traits/Response`) with `?lang=ar`
   **and** `?lang=en`, behind the correct guard (`auth:sanctum` / `auth:admin`).
7. **Conventions** — thin controller → Form Request → Service → Resource/response trait; no hardcoded
   strings; **Laravel-first** (events/jobs/notifications/policies/observers where they fit); no style drift.
8. **Dashboard i18n + sidebar** (for CRUD sprints) — every dashboard string (labels, headers, buttons,
   validation, **enum values**, statistics titles, flash) is in **both** `lang/ar` and `lang/en`; each CRUD has a
   **sidebar entry**; nothing hardcoded or half-localized.

**If any check fails → fix before moving on.** When all pass → **commit a checkpoint**
(see [`README.md`](README.md) → "Commit checkpoints").

> **Before committing, update the project docs:** `docs/project/CONTEXT.md` §B (state, + §C for any new
> reusable pattern) · a new section prepended to `docs/project/CHANGELOG.md` (what shipped + files +
> decisions + DoD result) · the affected parts of the root `README.md` (features / structure / API).

> **Live board:** as each plan is built, mark it on the `/kanban` board — `php artisan board:set --sprint=<n> --plan=<path> --status=done`; the sprint card auto-completes when all its plans are done (or `board:set --sprint=<n> --status=done`).

---

## Output
Append a short DoD result to the sprint file (`docs/project/sprints/<n>.md`): the commands run and
pass/fail for each of the 8 checks (check 8 applies to CRUD sprints). This makes "done" auditable, not assumed.

## References (single source — do not duplicate)
- Test generation → [`build-tests.md`](build-tests.md)
- Orchestration + commit checkpoints → [`README.md`](README.md)
- Schema drift command → `php artisan schema:check` (`app/Console/Commands/SchemaCheck.php`)
