# Regression Checklist

Run this checklist after completing refactor sections 1–4, before releasing a new version.

## Plugin Lifecycle

| Check | Command / Action | Expected |
|-------|------------------|----------|
| Activate | Activate plugin in WP Admin | No errors, success message |
| Deactivate | Deactivate plugin | No PHP errors in debug.log |
| Uninstall | Delete plugin via WP Admin | All options/tables/transients removed |

**Verify:** `grep -i error debug.log` returns nothing related to this plugin.

---

## Debug Log

| Check | Command / Action | Expected |
|-------|------------------|----------|
| No notices | `grep -i notice debug.log` | No notices related to plugin |
| No warnings | `grep -i warning debug.log` | No warnings related to plugin |
| No deprecated | `grep -i deprecated debug.log` | No deprecated warnings |

**Verify:** Enable `SCRIPT_DEBUG` in wp-config.php, trigger a few AI requests, then check logs.

---

## REST API Health

Test each endpoint with `curl` or REST API tester (authenticated):

```bash
# Authenticate
COOKIES="cookies.txt"
wp auth generate-cookie

# List all registered routes
curl -s -H "Cookie: wordpress_logged_in_xxx=xxx" \
  http://localhost/wp-json/wp-agentic-writer/v1/ai-capabilities | jq .

# Test endpoints (authenticated)
curl -s -H "Cookie: wordpress_logged_in_xxx=xxx" \
  http://localhost/wp-json/wp-agentic-writer/v1/chat-history/1 | jq .

curl -s -H "Cookie: wordpress_logged_in_xxx=xxx" \
  http://localhost/wp-json/wp-agentic-writer/v1/seo-audit/1 | jq .
```

| Endpoint | Method | Expected |
|----------|--------|----------|
| `/ai-capabilities` | GET | 200 + model registry data |
| `/chat-history/{post_id}` | GET | 200 + conversation history |
| `/seo-audit/{post_id}` | GET | 200 + audit data |
| `/suggest-keywords` | POST | 200 + keyword suggestions |
| `/refine-multi-pass` | POST | 200 + refined content |
| `/generate-meta` | POST | 200 + meta description |

---

## Database

| Check | Command / Action | Expected |
|-------|------------------|----------|
| Conversations table exists | `SHOW TABLES LIKE 'wpaw_conversations'` | Table found |
| Cost entries persist | `SELECT COUNT(*) FROM wpaw_cost_log` | > 0 after AI use |
| Image records persist | `SELECT COUNT(*) FROM wpaw_generated_images` | Records exist after image generation |
| Plugin update preserves data | Update plugin, re-check above | Same record counts |

---

## Settings Page

Access: **WP Admin → Settings → Agentic Writer**

| Tab | Check | Expected |
|-----|-------|----------|
| General | Page loads, no JS errors | No console errors |
| Models | Dropdowns populate | All model options visible |
| MEMANTO | URL field saves | URL persists after reload |
| Costs | Log table renders | Entries display |
| All 7 tabs | Switch between tabs | No errors, smooth transitions |

**Verify:** Open browser DevTools Console (`Cmd+Option+J`), switch tabs, check for red errors.

---

## Gutenberg Editor

| Check | Action | Expected |
|-------|--------|----------|
| Sidebar loads | Open post in Gutenberg | Sidebar panel visible |
| No JS errors | Check console after load | No red errors |
| All tabs work | Switch sidebar tabs | Chat, Plan, SEO tabs functional |
| Block operations | Add/refine blocks | Works without errors |

**Verify:** Open browser DevTools Console, trigger a chat message, verify streaming works.

---

## Assets

| Check | Command / Action | Expected |
|-------|------------------|----------|
| CSS loads | View source, check `<link>` tags | agentic-sidebar.css loaded |
| JS loads | View source, check `<script>` tags | sidebar.js loaded |
| No 404s | Check Network tab | All resources return 200 |
| Fonts load | Check for font-related 404s | All font files accessible |

---

## Cron Jobs

| Check | Command | Expected |
|-------|---------|----------|
| Cron registered | `wp cron event list` | `wpaw_cleanup_temp_images` appears |
| Cron fires | `wp cron event run wpaw_cleanup_temp_images` | No errors |
| Schedule exists | `wp cron schedule list` | Plugin schedules available |

---

## Quick Smoke Test (5 minutes)

Run these manually after any significant change:

1. **Activate** → No errors
2. **Open post** → Gutenberg loads with sidebar
3. **Send chat** → Streaming response works
4. **Run SEO audit** → Report displays
5. **Generate image** → Image uploads to Media Library
6. **Check settings** → All tabs render
7. **Deactivate** → Clean, no errors

---

## Pre-Release Checklist

- [ ] All items above pass
- [ ] `debug.log` is clean
- [ ] Plugin tested on fresh WP install
- [ ] Tested with WP_DEBUG enabled
- [ ] All 7 settings tabs verified
- [ ] REST endpoints return expected data
- [ ] No console errors in Gutenberg
- [ ] Unit tests pass (`./vendor/bin/phpunit`)
