# MT4 Build Validation

## 2026-08-27 market, 404 and email-theme regression checks

| Check | Result |
|---|---:|
| Individual Finantics market routes | 6/6 HTTP 200 |
| Market detail pages with populated risk/content sections | 6/6 |
| Public missing route | Theme-native HTTP 404 |
| Administrator/client/JSON 404 separation | Passed |
| Active-theme email palettes | 6/6 |
| Themed HTML email views rendered | 7/7 |
| Project PHP files linted | 432 |
| Blade templates compiled and linted | 348/348 |
| Laravel routes | 429 |
| Named routes | 421 |
| Duplicate route names | 0 |

Validation performed on 2026-08-14 against the complete release source, all six supplied website themes, and the supplied MT4 Postman collection.

## Final validation matrix

| Check | Result |
|---|---:|
| Postman requests mapped in `Mt4Service` | 29/29 |
| MT4 list response shapes exercised | 4 |
| Closed-order compatibility fallback | Passed |
| Symbols route callback regression | Passed |
| Human date/time conversion | Passed |
| WebTerminal Base64 auto-login format | Passed |
| Registered Laravel routes | 416 |
| Named routes | 408 |
| Duplicate named routes | 0 |
| Controller actions resolved | 409/409 |
| Client order-mutation routes | 0 |
| Project-owned PHP files linted | 405 |
| PHP syntax failures | 0 |
| Blade templates compiled and linted | 313/313 |
| Compiled Blade syntax failures | 0 |
| Client-dashboard JavaScript syntax | Passed |
| Supplied theme packages | 6 |
| Supplied theme pages audited | 115 |
| Unexpected supplied-layout changes | 0 |
| Protected per-theme default menus | 6 |
| Theme palette override harness | Passed |
| Matching theme-auth variant harness | Passed |
| Theme AI banner/auth media | 24 WebP files |
| Chat AI staff portraits | 11 WebP files |
| Inline JavaScript bundles syntax-checked | 5/5 |
| Final archive integrity | Verified after packaging |

## MT4 response regression coverage

The direct Laravel HTTP-fake harness exercises:

- bare arrays of trade/symbol rows;
- wrapped `data` responses;
- nested response wrappers;
- single associative row responses;
- value-only array filtering, preventing Laravel from passing a collection key as a second argument to `is_array`;
- human chart/trade timestamps in `DD-MM-YYYY HH:mm:ss` format;
- `trade_type=close_order` followed by a single `trade_type=all` compatibility request when the first provider response is empty or malformed;
- exclusion of open positions, pending orders, deposits, withdrawals, balance entries, and credit entries from derived closed orders.

The exact two reported failure paths were covered:

```text
/client/mt4/symbols?limit=500
/client/mt4/accounts/{account}/trades?trade_type=all&sort_by=OpenTime&sort_order=DESC&page=1&limit=200
```

## Client portal checks

- The selected account is persisted in `sessionStorage`.
- Duplicate account rows are collapsed by numeric local account ID.
- Selecting another account aborts obsolete requests and increments a generation guard.
- A late response from a previously selected account cannot overwrite the current account.
- Local balance/equity/margin snapshots render immediately; account-scoped provider synchronization follows in the background.
- The client portal has no open, modify, close, delete, or reopen order route or UI action.
- The selected account’s Open WebTrader button calls an authenticated,
  account-owned redirect route. Laravel decrypts the stored
  `trading_account_pass`, generates `Base64(login|password)`, and appends
  `autologin=1&one=...` without rendering a plaintext password into the page.
- Client account creation loads only active administrator-managed database groups.
- Clients submit only Deposit and Withdrawal requests. Deposit settlement as balance or account credit is selected by an administrator; bonus and credit-out operations remain administrator-only.
- Recent Requests exposes account login, method, settlement, provider ticket, status, note, decline reason, creation time, and processing time.

## Supplied-theme preservation

The release uses the five exact packages supplied in `themes.zip`—ForTradex, Fxzone, ConsultPlus, Fina, and Finantics—plus the separately supplied Chat Laravel theme as the sixth protected theme.

A normalized file comparison was run across all 55 production theme pages. After removing only:

```blade
@include('themes.includes.runtime-customization')
@include('themes.includes.runtime-body-end')
```

and the whitespace introduced immediately before the closing `head` and `body` tags, every page matched the prior supplied-template integration. No section order, template layout, typography, CSS/JavaScript package, component structure, responsive behavior, or animation was replaced.

The runtime layer was separately checked for:

- selected-theme activation;
- per-theme primary/secondary/accent overrides;
- administrator logo, light-logo, and favicon resolution;
- matching authentication composition;
- raw custom CSS, head code, and body code support.

## Environment limitations

No production MT4 affiliate API credentials were supplied. Validation therefore did not create, fund, trade, modify, close, delete, or reopen a real remote account. A staging acceptance test with dedicated demo credentials and a non-production MT4 group remains required before enabling live financial operations.

The build container does not provide PDO database drivers, DOM/XML extensions, or `mbstring`, so the full database-backed PHPUnit feature suite cannot run here. Equivalent MT4 transport behavior was exercised through Laravel HTTP fakes; all project-owned PHP files and compiled Blade output were syntax-checked independently. The existing Composer vendor autoloader successfully booted the Laravel application and all direct harnesses.

## Deployment acceptance test

1. Preserve the production `.env`, `storage/app/public`, and database backup.
2. Deploy the complete release and run the pending migrations.
3. Configure a dedicated demo MT4 API account and one or more active local MT4 groups.
4. Create two MT4 accounts for one client and repeatedly switch between them before and after refreshing the page.
5. Verify immediate local statistics and subsequent provider synchronization for each selected account.
6. Verify symbols, chart history, all trades, open orders, and closed orders.
7. Select each account and confirm that Open WebTrader redirects to the
   configured terminal with the correct account-specific auto-login token.
8. Submit Deposit and Withdrawal requests and approve a Deposit once as balance and once as account credit.
9. Inspect all six supplied public themes and their matching login, registration, reset, and confirmation views on desktop and mobile.
10. Change each theme’s administrator-controlled colors, logo, and favicon and confirm that its original layout remains unchanged.
11. Run `php artisan optimize:clear`, followed by production cache commands in the target PHP environment.

## 2026-08-14 client and theme-menu regression checks

- Client-specific MT4 limits were verified for null/legacy, zero-disabled, and positive-limit values; no CMS-global account-count fallback remains.
- Both administrator MT4 account-creation paths reject creation beyond the selected client’s limit.
- The created-account modal exposes selectable read-only credentials plus individual and combined copy actions.
- Fix Balance performs repeated `GetAccount` reconciliation and the administrator page reloads every live MT4 card and related order/transaction table.
- MT4 comment normalization strips IPv4, IPv4-with-port, and IPv6 data while retaining the human operation note.
- Client dashboard JavaScript passed Node syntax validation after Blade values were substituted; chart symbol and interval persistence, KYC, Account Settings, and revised funding/request placement were inspected.
- Six distinct protected theme-menu definitions were generated; the Chat page catalogue includes every manifest route, including staff, legal, account-type, promotion, platform, and instrument pages.
- All changed Blade templates compiled to valid PHP. Runtime navigation JavaScript, the CMS menu builder, administrator client JavaScript, client account JavaScript, and the MT4 dashboard JavaScript passed syntax checks.
- Twenty-four theme AI WebP images and eleven Chat AI staff portraits were verified at their packaged paths.

## 2026-08-21 CMS/offcanvas/account-plan regression checks

- Affiliator creation and client MT4-account creation use Bootstrap offcanvas components; the old create-modal identifiers are absent.
- Guarded close handlers remove stale modal/offcanvas backdrops only when no other overlay is open.
- CMS Settings, Header/Footer, Themes, Pages, Menus, and Trading Accounts are available under one administrator tab workspace.
- Header/footer settings persist independently, including a separate footer/light logo and theme-scoped footer-menu location.
- All six public themes include the common account-plan dataset on their account-type page and retain independent theme-native plan styling.
- Trading-account plan validation enforces five plans maximum and one fixed feature catalogue with per-plan enable/disable state.
- Registered Laravel routes: 419; named routes: 411; duplicate named routes: 0; controller actions resolved: 418; closure routes: 1.
- Project-owned PHP/Blade source files linted: 750 with zero syntax errors.
- Blade templates compiled and generated PHP linted: 331 with zero errors.
- Inline JavaScript syntax checks passed for the affiliations offcanvas, client MT4 dashboard, unified CMS hub, and runtime public-theme customization.

## 2026-08-24 CMS, overlay and leverage validation

The latest update was validated against the supplied MT4 operation definitions, including CreateAccount `leverage`, `uname`, `lname`, `trading_account_pass`, and `change_leverage`/GetAccount reconciliation.

- Laravel routes registered: 419.
- Named routes: 411; duplicate names: 0.
- Controller actions resolved: 412; missing classes/methods: 0.
- Canonical leverage values: `1,2,3,5,10,15,20,25,33,50,66,100,200,300,400,500`.
- Direct HTTP-fake CreateAccount harness: passed.
- CreateAccount field separation (`uname`, `lname`, `pwd`, `trading_account_pass`, API `name`, API `pass`): passed.
- Create response with `Leverage=0` followed by `change_leverage` and GetAccount: passed.
- Full Balance/Equity/Credit/Margin/FreeMargin snapshot reconciliation: passed.
- Stale GetAccount reads preserve an accepted leverage and return a reconciliation warning: passed.
- Client and administrator leverage inputs are selects sourced from the same configuration catalogue.
- Client live refresh pauses while the MT4 settings, account-creation, deposit or withdrawal form is active.
- CMS Settings editor actions and non-sticky tab spacing: inspected and Blade-compiled.
- Shared overlay JavaScript passed Node syntax validation.
- Shared overlay and client-terminal CSS parsed without errors.
- Calendar and Affiliator form surfaces are moved to `body`, use static backdrops and invoke the shared overlay manager.
- No active `Collection::filter('is_array')` regression remains.
