# Learnitive 2.0 — Hotfix31 Autonomous Continuation Prompt

## Objective

Continue Learnitive 2.0 autonomously from the Hotfix31 source state. Do not redo completed implementation. The immediate task is authoritative staging acceptance of the corrected canonical Learn seed recovery.

## Protected boundaries

Deployment target only:

- `https://os.learnitive.com`
- `/var/www/os.learnitive.com`
- `/var/www/os.learnitive.com/public_html`
- `/etc/learnitive`

Do not modify production `learnitive.com` / `www.learnitive.com`, `texise.com` / `www.texise.com`, `/etc/texise/*`, TeXise vhosts or TeXise services.

Canonical staging ports: API 4210, collaboration 4211, Redis 7387, Console Gateway 9887, Universal Runner 9890.

## Latest authoritative staging result

Hotfix30 passed lock/runtime/R12, unified execution image, real runner/Docker bind preflights, production pnpm/Vite build, SaaS preflight, Apache syntax and all service health checks. It then validated the complete universal template library: 69/69 valid, failedBuiltins=0, published=69.

Hotfix30 SaaS preflight reported:

`schema=35; learnSchemaRepaired=false; learnSeedsRepaired=true; learnSeedMissing=9; migrationNameMismatches=3; ...`

Seeded Learn runtime validation then reported:

- `latex-fundamentals ... VALID`
- `Error: Missing seeded Learn course: python-fundamentals`

Do not remove the universal templates; they are proven healthy. The failure is canonical Learn seed persistence.

## Hotfix31 correction

Hotfix30 used `INSERT IGNORE` for missing course restoration and did not verify post-write canonical completeness. It also made migration 35 a one-shot repair, so the failed install can leave version 35 recorded while only part of the catalog exists.

Hotfix31 changes `server/saas-migrations.mjs` so:

- each missing canonical course is inserted strictly, not with `IGNORE`;
- each course is queried immediately after insertion and must exist;
- module/lesson replay remains idempotent and scoped only to courses absent before repair;
- surviving Admin-edited canonical courses are not generically rewritten;
- the final canonical slug set is queried and any remaining missing course fails preflight;
- canonical seed integrity runs on every SaaS startup even when migration 35 is already recorded, which directly repairs the current partial Hotfix30 DB state.

`server/saas-preflight.mjs` now emits:

- `learnSeedMissingBefore=<count>`
- `learnSeedMissingAfter=<count>`

For the observed current DB, the likely first Hotfix31 result is `learnSeedMissingBefore=8` and the required result is `learnSeedMissingAfter=0`.

If the live DB has a legacy constraint that prevented Hotfix30's ignored inserts, Hotfix31 will fail earlier and expose the affected course plus bounded MySQL error. Do not weaken the validator or delete healthy templates to bypass this.

## Verification completed

- supported server/static suite: 331/331 PASS;
- project-runtime suite: 10/10 PASS;
- frozen pnpm lock sync PASS: 69 importers / 1581 package records / 1583 snapshots / 1171 reachable snapshots;
- trusted runtime manifest PASS: 9 production imports;
- R12 namespace/static preview/full contract PASS;
- brand-reference audit: 0 violations;
- branding/provenance: 708 production-facing text files PASS;
- staging/root installer shell syntax PASS;
- changed server syntax PASS;
- Apache configtest: Syntax OK.

The new migration regression models version 35 already applied with only `latex-fundamentals` present and verifies the remaining eight courses are restored without applying a new numeric migration.

## Next staging acceptance sequence

1. Deploy Hotfix31 on `os.learnitive.com` only.
2. Confirm SaaS preflight reports `schema=35` and `learnSeedMissingAfter=0`.
3. Confirm 69/69 template validation remains green.
4. Confirm seeded Learn validation reaches all canonical courses, not just LaTeX.
5. Continue Node/Python/C++ queue smoke.
6. Continue LaTeX API -> Redis -> Universal Runner smoke and PDF/fallback behavior.
7. Verify React JS/TS, TypeScript/Vite, Vue and Svelte Web Preview and error overlay.
8. Verify Markdown visual/Bangle workflow.
9. Verify Learn uploaded/YouTube/Wistia media, captions/posters and Free/Pro entitlement boundaries.
10. Verify public HTTPS `/projects`, favicon, fonts and SNI routes.
11. If staging finds another defect, patch the smallest correct source change, add regression coverage, rerun supported tests/audits and package the next non-overwriting hotfix.

## Autonomous execution rule

Execute continuously using Execute -> Verify -> Diagnose -> Fix -> Verify again -> Continue. Do not ask for routine confirmation. Ask only when an external credential/permission is genuinely unavailable or an irreversible high-impact action cannot be inferred safely. Maintain the exact current state in durable docs before handoff.

Continue autonomously from this exact state. Do not restart completed phases. Do not ask for confirmation. Execute all remaining phases sequentially, verify each phase, fix problems, and continue until the project is complete. If this chat again approaches its context limit, generate another complete continuation prompt for the next chat before stopping.
