Virtual-LPU / docs /PHASE1_AUDIT /PHASE1_SOURCE_AUDIT.md
karimshahi's picture
Upload 35 files
a93cf7a verified
|
Raw History Blame
4.49 kB
# PHASE 1 — SOURCE AUDIT (LPU V7 tree, the user's actual project)
Audit date: 2026-11-18 · Subject: the LPU AI Accelerator V7 tree (run_lpu.py /
desktop_app.py / server/ / lpu/ / frontend/) at 7.1.1, audited file-by-file.
All findings verified by executing code in the audit environment; file:line
references included.
## 1. Project structure (the real tree, verified)
```
LPU root (V7 line, e.g. C:\ipara\LPU\<folder>\LPU)
├── run_lpu.py single entry: server / --desktop / --check (95 lines)
├── run_lpu_desktop.py PyInstaller desktop entry (13 lines, imports desktop_app)
├── desktop_app.py native-window app: 3 modes, port-scan, honest fallback
├── server/app.py FastAPI control plane: / (dashboard), /api/status
├── lpu/version.py version identity (7.1.1 -> 7.2.0 after this update)
├── lpu/accelerator/, lpu/runtime/ empty placeholder packages (__init__ 0 bytes)
├── frontend/dashboard.html served at / (was a 96-byte stub — see D2)
├── LPU_Desktop.cmd / LPU_Server.cmd / LPU_Check.cmd python.exe-explicit launchers
├── tests/conftest.py + test_08_desktop.py 13 tests (12 pass + 1 display-gated skip)
└── configs/ DID NOT EXIST (see D4)
```
Note: this tree has no V010_*.py trainer files — the V6/V010 training line
is a separate archive. Any patch referencing V010_LPU_V003.py does not apply
here (this corrects the previous 7.2 draft, which targeted the wrong tree).
## 2. Verified capabilities (executed here)
- **Server lifecycle**: ServerThread boots uvicorn in a daemon thread,
readiness-polled, clean stop (desktop_app.py:114-140). Verified by the
test_08 suite: 12 passed.
- **Attach detection**: `is_lpu_server_running()` checks /api/status for
`runtime_version` starting "7." (desktop_app.py:87-90); foreign ports are
skipped, never hijacked (desktop_app.py:93-111).
- **Honest fallback chain**: no pywebview OR window-creation failure →
browser fallback with the reason printed; never a silent exit; the loop
unwinds via request_shutdown() (desktop_app.py:186-220). Pinned by tests.
- **.cmd launchers**: call python.exe explicitly (bypasses the broken .py
association that caused the Electron/Chromium incident) — verified by
test_cmd_launchers_call_python_explicitly.
- **Baseline suite on 7.1.1**: 12 passed, 1 skipped (native window needs
display), 0 failed — the 7.1.1 desktop fix itself is sound.
## 3. Defects found by this audit (each fixed by the 7.2 update)
| ID | Defect | Location | Evidence |
|---|---|---|---|
| D1 | `--check` is dead code: imports `lpu.cli.self_check`, which never existed → ModuleNotFoundError on every machine | run_lpu.py:60 | executed: `No module named 'lpu.cli'` |
| D2 | Dashboard served at `/` is a 96-byte stub (`<span>Runtime —</span>`), not a dashboard | frontend/dashboard.html | file content; served page verified over HTTP |
| D4 | run_lpu.py's documented default config `configs/lpu_config_v7.yaml` does not exist → every launch silently runs with `{}` | run_lpu.py:48-53 | `ls configs` → missing |
| D5 | `server.open_browser` (documented, default true) is never read anywhere → `python run_lpu.py` never opens the dashboard | run_lpu.py:87-91 (no consumer of the key) | grep: zero readers |
D3 (token-auth for exposed binds) is NOT implemented anywhere (grep: only
comments). It stays documented as a rule: loopback-only binds need no token;
any `--host 0.0.0.0` use is the user's explicit decision. Enforcing auth is
PHASE 3 work (roadmap), not silently claimed as present.
## 4. Reachability / dead-code map (this tree)
Active: run_lpu.py, desktop_app.py, server/app.py, lpu/version.py,
frontend/dashboard.html, tests/, .cmd launchers.
Empty placeholders (future wiring points, keep): lpu/accelerator/__init__.py
(0 bytes), lpu/runtime/__init__.py (0 bytes).
Dead import (fixed by D1): lpu.cli.self_check was imported but absent — now
real. The `lpu` package contains no training logic in this line and the docs
never claim it does.
## 5. Test coverage (real numbers, this environment)
- 7.1.1 baseline: tests/test_08_desktop.py — 12 passed, 1 skipped (native
window = display-gated), 0 failed.
- 7.2 patched tree: test_08_desktop.py 12 passed + test_09_v72_fixes.py
7 passed → **19 passed, 1 skipped** total.
- Not covered (needs rig): native WebView2 window, real dual-GPU behavior,
long-duration stability (PHASE 7/8 of the roadmap).