# DSH RC3 Staging Test Guide

RC3 is a staging-only release candidate. Do not deploy it over the production site until every gate below passes.

## 1. Before deployment

1. Export the current staging database.
2. Keep the current RC2 directory unchanged as the file rollback point.
3. Extract RC3 into a new `DSH_RC3` directory.
4. Copy or reuse the private database configuration outside the public web root.

## 2. Database migration

Select the staging database in phpMyAdmin, then import:

`install/migrations/003_subscription_release_schema.sql`

Run `database/preflight_rc3_read_only.sql` afterward. Expected results:

- `rc3_plan_rate_columns` = 3
- `rc3_payment_review_columns` = 1
- duplicate upgrade-request result = no rows
- duplicate commission result = no rows

## 3. Native release audit

From the RC3 project directory:

```bash
bash tools/release_audit.sh
```

Expected final line: `DSH RELEASE AUDIT: PASS`

## 4. Trial-first tenant flow

1. Submit a tenant application through an affiliate link.
2. Approve it in Superadmin > Applications.
3. Confirm the tenant dashboard displays `TRIAL`, not Starter.
4. Confirm the trial dates cover seven days.
5. Confirm the affiliate referral is visible but no commission is credited during the free trial.

## 5. Paid upgrade and commission flow

1. From the trial tenant, request Starter or Growth.
2. Approve the upgrade request as Superadmin and confirm an invoice is created.
3. Submit payment proof as Tenant Admin.
4. Approve the payment as Superadmin.
5. Confirm the invoice is paid and the tenant plan becomes active.
6. Confirm the affiliate commission log and wallet are updated exactly once.
7. Confirm rates:
   - Starter: 20% first paid cycle, 15% recurring
   - Growth: 20% first paid cycle, 10% recurring
   - Enterprise: 10% first paid cycle, 5% recurring
8. Refresh or repeat the approval request and confirm no duplicate credit is possible.

## 6. Enterprise workflow

1. Request Enterprise from the tenant account.
2. Confirm Superadmin shows `Review Strategy Booking` instead of automatic invoice approval.
3. Review or reschedule the strategy discussion.
4. Do not create a paid Enterprise invoice until a custom quote is agreed.

## 7. Admin UI coverage

Open every sidebar destination for both roles.

- Tenant Admin: verify the sidebar is visible and the content is aligned, especially Homepage Builder.
- Superadmin: verify the sidebar is visible and the active page is highlighted.
- On mobile width: verify sidebar and content stack without horizontal page overflow.

## 8. Mail and logs

1. Confirm SMTP host, username, password, and From email are configured.
2. Test approval, forgot-password, booking confirmation, and reschedule messages.
3. Review the staging PHP error log after all tests.
4. There must be no new `DSH MAIL CONFIGURATION ERROR`, SQL error, warning, or fatal error.

## 9. Go / No-Go

RC3 can proceed to the production gate only when the migration, release audit, functional tests, UI coverage, commission idempotency, mail tests, and clean-log check all pass.
