# Root Migration Acceptance Checklist

This document is the durable acceptance checklist behind `scripts/pre-push-acceptance.sh`.
The script automates every item below. Run it before merging or pushing a migration branch:

```bash
bash scripts/pre-push-acceptance.sh
```

## Checks

### 1. PHP version

- PHP 8.2 or higher is available in the runtime path.

### 2. PHP syntax lint

- Every `.php` file under `src/`, `public/`, and `scripts/` passes `php -l` with no syntax errors.

### 3. Required files present

All of the following paths must exist relative to the repository root:

| Path | Purpose |
|---|---|
| `src/bootstrap.php` | Application bootstrap (autoloader, session, security headers) |
| `src/config.php` | Environment-driven configuration array |
| `src/env.php` | `.env` loader and `env()` helper |
| `src/routes.php` | Router registration for admin, API, and frontend |
| `database/schema.sql` | Canonical database schema |
| `.env.example` | Reference environment file shipped with the repo |
| `.htaccess` | Repository-root fallback rewrite + directory-index hardening for shared hosting |
| `public/index.php` | Web entry point (document root target) |
| `public/install.php` | Legacy installer redirect (`/install.php`) |
| `public/install/index.php` | Primary installer entry (`/install/`) |
| `public/.htaccess` | Apache mod_rewrite rules and folder-access restrictions |

### 4. Environment key coverage

Every key listed below must appear in `.env.example`:

- `DB_HOST`, `DB_PORT`, `DB_DATABASE`, `DB_USERNAME`, `DB_PASSWORD`
- `APP_URL`, `APP_NAME`, `APP_ENV`, `APP_DEBUG`, `APP_INSTALLED`
- `ADMIN_PATH`

### 5. Admin layout regression sweep

`scripts/admin-layout-regression-sweep.php` must exit 0. This sweep renders every admin view against fixture data (no database required) and asserts key HTML landmarks are present: nav active states, form action targets, table content, and role badges.

## What is NOT checked here

- Live database connectivity (covered by the browser installer).
- Frontend asset integrity (CSS/JS compilation is not part of this baseline).
- Full HTTP request flow (no web server is started).

## Shared-hosting fallback expectations

If a host is still pointed at the repository root instead of `public/`, the repository-root fallback must still:

- disable directory listing with `Options -Indexes`
- prefer `index.php` via `DirectoryIndex index.php`
- rewrite `/`, routes, and public asset aliases into `public/`

## Reproducing manually

If the script fails and you need to isolate the cause:

```bash
# Syntax lint only
find src public scripts -name '*.php' | xargs php -l

# Regression sweep only
php scripts/admin-layout-regression-sweep.php
```
