# V19.7 — Institutional Deployment & Validation

## Choose the edition

- Instructor: local portal, course authoring, private assessment, local LMS, hardware gateway and verification runner. Never publish this directory as a public website.
- Student: local learning and hardware exercises, no private instructor resources.
- Cloudflare Student Static: upload the extracted static website only. Dr. Mohammad and free reviewed external-AI prompt handoff remain available; this is not an authenticated course service.
- Connected Worker: deploy only its `public/` assets through the configured Workers assets binding, with the Worker and D1 separately configured. The package is a deployment candidate, not an activated institutional service.

## Read-only preflight

On a clean extracted local edition, run `python preflight197.py`. On the connected edition use Python 3.11+ to parse TOML. From a separate location, use `python preflight197.py --root /path/to/static-edition` to audit a static extraction. The script checks the release manifest, curriculum and local links, public file names, dependency availability and connected configuration syntax. It does not install, connect, publish, invoke AI or inspect secret values. Exit 1 means a failed check; 2 means blocked prerequisites; 0 means no failed/blocked checks (pending live acceptance still applies). Run before configuring or installing dependencies: strict manifest verification will report expected modifications and newly installed files afterward. Keep a pristine release copy to compare. Never treat the manifest as an authenticated signature. The final manifests cover packaged files, not the correctness of their contents.

## Local installation and verification

Windows: extract the entire local ZIP, run `START_LOCAL_SERVER.cmd`, then use http://localhost:8760/ consistently (localhost and 127.0.0.1 are different browser storage origins). Python 3.10+ is required. The Linux/WSL verification runner is separate from the native Windows launcher. Under the extracted portal root in Linux or Kali WSL:

```bash
python3 verification/runner.py --profile consolidated --output /tmp/psut-v197-consolidated.json
python3 verification/runner.py --profile deployment-validation --output /tmp/psut-v197-deployment.json
```

Use fresh output paths. The runner runs approved packaged tests only; its temporary work directory is not an adversarial code sandbox. For firmware compilation, install PlatformIO/toolchains according to the existing project instructions, then use `--profile firmware --allow-build`; this may download dependencies. The default consolidated profile does not compile target firmware. See `RUN_VERIFICATION.md` and individual lab instructions.

## Optional integration dependencies

Kali/Debian Linux: use the OS package manager to install Mosquitto and Python venv support. Create a virtual environment outside the portal and install `paho-mqtt==2.1.0` from an approved package index. Install the Python packages identified by the preflight in the same environment. Do not use a public broker for private telemetry. Test the disposable MQTT loopback profile separately; this is not a TLS or physical hardware acceptance test.

For local Ethereum tests, use Node.js 20+ and install the exact versions from `blockchain/package.json` in the extracted `blockchain/` directory (`npm install`, inspect dependency audit and generated lockfile before institutional use). The package pins top-level versions; transitive dependencies are not locked in this release. Run `--profile evm` and `--profile advanced-blockchain`. These tests use a disposable local chain, not public Ethereum. No private wallet or real funds are needed. Package installation was unavailable in the build environment (Paho unavailable from configured index; npm registry DNS failure). No dependencies were silently substituted.

## Connected deployment acceptance (administrator)

Use the existing `README.md` and `CLOUD185_GUIDE.md` instructions. Before any public service is approved:

1. Verify the clean release hash inventory. Configure the actual D1 ID, Access issuer and audience, approved domain and institutional Access policy. Keep workers.dev and preview URLs disabled. Check that no alternate route bypasses the policy. AI stays disabled unless approved.
2. Deploy migrations against an authorized test D1 instance first. Provision only approved test student/instructor accounts. Test denied, disabled, expired and malformed identity cases. Test cross-account read/write, collaborator revocation and stale revisions. Verify private responses have no-store. Do not expose administrator credentials or production data during testing.
3. Review provider data handling and obtain institutional approval before setting API secrets. Configure provider budgets separately; request limits are not financial caps. Test one nonconfidential prompt per enabled provider and the daily quota. Test history opt-in and deletion; account removal, backup retention and provider retention require documented institutional procedures.
4. Document Access/D1 backup, restore and retention procedures for your actual account. Exercise recovery on a separate test database. The local SQLite backup utility is not a D1 backup tool. Never overwrite a live academic database during a restore exercise.
5. Test browser access, accessibility, response time and concurrent usage on the actual deployed domain; record results, operator and configuration. Approve only after institutional privacy/security review. No domain, identity provider, cloud account or provider credentials have been accessed in this release.

## Local academic service and recovery

Instructor only: `START_COURSE_SERVER.cmd` launches the local loopback course service on port 8761. It is not a public institutional LMS. Use `course-server/backup.py` with a fresh destination in a private directory outside the portal, then check the restored copy in an isolated test environment with a test identity. Do not distribute private assessment files, actual databases, backup files or private drafts to students. Official grades are not synchronized to Cloudflare workspaces. Use institutionally approved storage and retention.

## Physical hardware acceptance (supervised)

Follow `V19_6_GUIDE.md`. Use low-voltage LED circuits only for command testing. Verify board pin numbering, resistor, DHT22 pull-up and polarity with power off; use known-good hardware and calibrated reference measurements. Configure private MQTTs broker and device-specific ACLs, verify CA/hostname and deny wrong credentials, wrong topic, retained/duplicate packets. Record boot ID, sequence gaps, sensor receipt times and actual observation provenance. Confirm telemetry stale/disconnect gates. Only after these checks, enable the optional LED pulse and test its maximum duration, cooldown and expiry; verify actual LED output independently. The software watchdog is not a certified hardware interlock. Never connect mains, heaters or motors. Archive raw telemetry and record hardware/firmware versions; distinguish actual sensor data from browser models.

## Audit scope

All 102 lab HTML files retained from V19.6. New local portal filename checks reject common credential/backup names and percent-containing paths; same-origin framing header added. Worker malformed JWT JSON types rejected with 401 rather than generic 500. Existing Access, D1 and provider adapters are retained. Name-based public inventory checks are not complete secret scans or penetration tests. Release tests do not establish target electrical safety, real MQTTs, actual Ethereum deployment, cloud security, or measured performance. No automatic deployment or changes to existing user accounts were made.
