# Dead File Cleanup — 2026-08-07 (Phase 3)

Per the Single Source of Truth refactor's Phase 3 instructions: identify genuinely unreferenced files, confirm via grep before touching anything, relocate (never delete) to `dead-files/` at the TraderAlign parent directory. The `dead-files/` folder did not already exist at `c:\xampp\htdocs\dead-files` as described — it was created fresh this pass, since that is the unambiguous "parent directory of `traderalign/`, not inside it" location.

## Files moved, with the specific check that confirmed each was unreferenced

| File | Confirmed via | Reason |
|---|---|---|
| `applications.html` (5,660 lines) | Fixed-string grep across every `.php`/`.html` file in the repo for the literal string `applications.html`; zero matches. Not routed in `index.php`. | Stale June-dated snapshot/backup file, already flagged as such in CLAUDE.md's own history — confirmed still true. |
| `strategy-source (backup).html` (598 lines) | Same fixed-string grep sweep for `strategy-source (backup)`; zero matches anywhere. | Explicitly named as a backup. Note: `index.php` *does* have a live route for `/strategy-source.html` (no "(backup)" suffix) — see the separate finding below; this file is not that route's target. |
| `traderalign-landing (1).html` (770 lines) | Same fixed-string grep sweep; zero matches. Untracked in git (`??`), unlike the other two. | Stale duplicate of the live `landing.html` (confirmed both files share the identical `<title>`/head structure — a copy, not a distinct page) — `landing.html` is the one actually routed at `/` in `index.php`. |
| `public/debug.php` | Grepped `index.php` for any route referencing `debug.php` — zero matches. Grepped the whole codebase for any `require`/`include` of it — zero matches. | Throwaway diagnostic scaffolding (dumps raw account/trade query output for manual inspection), not part of any real page flow. |
| `public/mt5-test.php` | Same two checks — zero route, zero include, anywhere. | One-line file (`echo "MT5 test works";`) — a connectivity smoke-test stub, not a real feature. |
| `public/test.php` | Same two checks — zero route, zero include, anywhere. | One-line file (`error_log("FOUND_ME_..."); echo "Done. Check logs.";`) — a debug-logging trigger stub, not a real feature. |
| `api/analytics/test2.php` | Found during the audit's §20 research pass (Trading Center/remaining-API sweep), confirmed via the same two checks — zero route in `index.php`, zero reference anywhere in the codebase. | One-line file (`<?php echo "HELLO";`) — pure debris, no real content at all. |

All seven are confirmed unreferenced by any route in `index.php` and by any `require`/`include` anywhere in `public/`, `api/`, or `src/`. `index.php` itself re-lints clean (`php -l`) after the moves, and every other route in the app is unaffected — none of these seven files were `require`d from a live code path, only reachable (if at all) by someone directly typing their exact file path, since Apache serves any real on-disk file directly per this app's `.htaccess` rewrite rule (`RewriteCond %{REQUEST_FILENAME} !-f`).

Six of the seven were git-tracked; moving them outside the repository boundary makes them show as `D` (deleted) in `git status` for the `traderalign` repo — this is expected, not data loss. The files themselves are fully intact at `c:\xampp\htdocs\dead-files\`. Nothing has been committed; the deletions are sitting in the working tree for review.

## Separate finding, NOT a dead-file action — a live but broken route

While confirming `strategy-source (backup).html` was unreferenced, found that `index.php` has a genuinely live, routed case:

```php
case $method === 'GET' && $uri === '/strategy-source.html':
    readfile(__DIR__ . '/strategy-source.html');
    break;
```

**`strategy-source.html` (no "(backup)" suffix) does not exist anywhere on disk.** This route would currently throw a PHP warning/empty response if hit. It is not linked from anywhere in the live app (grepped `public/`, `src/`, `api/` for the string `strategy-source.html` — zero references), so it is not causing a visible symptom today, but it is a real, broken, reachable route. This is flagged for a decision, not fixed here — options are: remove the dead route entirely (if `strategy-source.html` was meant to be retired along with its backup), or restore/rename the intended live file if one was supposed to exist separately from the backup copy. Left untouched pending that decision.

## Categories explicitly investigated but not actioned this pass

- **Unreferenced/unreachable API endpoints** (`api/analytics/career.php`, `api/analytics/portfolio.php`, `api/analytics/account.php` — which also contains a second, previously-undocumented orphaned scorer, `calculateRiskGrade()` — `api/analytics/behavior.php`, `api/analytics/test.php`, and `api/accounts/eligible-for-promotion.php` — this last one *is* routed in `index.php` but confirmed to have zero JS/fetch callers anywhere in the app) — confirmed via the audit's research passes to have zero frontend callers, but these are **not** treated as dead files in the same sense as the seven moved above. They read as intentional, if currently unused, endpoint stubs (some contain real, if independently-computed and now-audited-as-wrong, logic — see the audit doc's §1k/§1l/§9/§20), and this codebase has an established, repeated, deliberate convention (documented throughout CLAUDE.md) of leaving orphaned-but-potentially-future-relevant code in place rather than removing it. Moving these wholesale would contradict that established convention and risks discarding something intentionally built ahead of a not-yet-wired-up feature. Flagged in the audit document instead, left in place — a decision for Kevin, not assumed.
- **Large commented-out code blocks** — attempted an automated sweep (looking for long runs of comment-only lines, then refined to filter for actual code-like syntax inside the comments rather than documentation prose). The refined sweep found zero genuine disabled-code blocks of meaningful size; every long comment run detected was legitimate, dense documentation prose (this codebase's own well-established style, as CLAUDE.md itself demonstrates). No candidates found worth flagging.
- **Unused functions inside otherwise-live files** — the audit's research passes surfaced a small number of these as a side effect of tracing computations (e.g. `journal.php`'s `rnAccountLifecycleBadge()`, confirmed dead with zero call sites — see the audit doc §17). These are documented in the audit doc rather than acted on here, since removing a function from inside a large, live, heavily-verified file (`journal.php` in that example) is a different, more surgical kind of edit than relocating a whole orphan file, and carries real regression risk if a reference was missed — better handled deliberately during the Phase 4 migration than as a drive-by deletion in this sweep.

## Verification performed

- `php -l index.php` — clean after the moves.
- Every remaining route in `index.php` re-checked against the current `public/` file listing — no other route currently points at a missing file (the `strategy-source.html` case above was the only one found).
- `ls` confirmed all six files present and intact at `c:\xampp\htdocs\dead-files\`, absent from their original locations in `traderalign/`.
