Phase 4: Editor Migration (CodeMirror 6) — Implementation Plan
Context
Problem: The Tiptap/Novel rich text editor destroys LaTeX constructs during the round-trip conversion. This is the P0 content quality issue identified in REVIEW.md:
C1: $p < 0.05$ (inline math) → \$p < 0.05\$ (literal dollar signs, not math mode)
Solution (DECISIONS.md §2): Make LaTeX canonical. CodeMirror 6 becomes the sole editor. Eliminate the latexToTiptap() ↔ tiptapToLatex() round-trip entirely.
Current state: CodeMirror already exists as a secondary "source view" (latex-source-view.tsx) with basic setup (no LaTeX highlighting, no toolbar, 500px fixed height). Tiptap/Novel is the primary editor. Both generate and refine routes convert AI output through latexToTiptap(). Assembly pipeline uses tiptapToLatex() for chapter body production.
Outcome: Single CodeMirror editor with LaTeX syntax highlighting, WYSIWYG toolbar, citation chips, math preview, and environment folding. No more content destruction. latex_content is the only canonical storage column.
The "phase can only increment by 1" test (line 146) sets current_phase: 3 on the sandbox project via admin client, then doesn't reset it. The subsequent "sandbox project allows phases 0-2" test (line 202) reads the same project and finds current_phase: 3 instead of 0-2.
Fix: After the assertion in the "phase can only increment by 1" test, reset the project:
Migration via Supabase MCP: 026_latex_content_canonical
Two parts:
10a: Backfill latex_content for sections edited in rich text mode
Sections where a user edited in Tiptap and saved would have updated rich_content_json but stale latex_content (still matches original AI output). We need to detect these:
If ai_generated_latex = latex_content AND rich_content_json IS NOT NULL → the user never edited in source mode, so rich_content_json may be newer
These sections need a Node.js backfill script (can't do tiptapToLatex in SQL)
Pragmatic approach: Run a one-time Node.js script BEFORE deleting tiptapToLatex.ts that:
Queries sections where ai_generated_latex = latex_content AND rich_content_json IS NOT NULL
For each, calls tiptapToLatex(rich_content_json) and updates latex_content
Logs results
10b: SQL migration
sql
-- Mark rich_content_json as deprecated via column comment
COMMENT ON COLUMN public.sections.rich_content_json IS
'DEPRECATED (Phase 4). LaTeX is canonical. Retained for rollback only.';
Currently renders section.latex_content as a <pre> block (line 160-162). This already works correctly for the LaTeX-canonical world — no changes needed.
(Confirmed: it already shows latex_content in a monospace <pre> with word wrap.)
Total: 7 new files + 6 modified + 7 deleted. Net reduction ~600+ lines (removing round-trip code).
All paths relative to apps/web/.
Review ID Cross-Reference
Review ID
Mitigation Item
Step
C1
Inline math destruction
Steps 5-8 (eliminate round-trip)
C2
\footnote{}, \url{} destruction
Steps 5-8 (eliminate round-trip)
C3
\label{} permanently stripped
Steps 5-8 (eliminate round-trip)
C6
front-matter.ts dead code
Step 11a (delete)
DECISIONS §2
CodeMirror 6 primary editor
Steps 2-4 (new editor)
DECISIONS §2
latex_content canonical
Steps 5-10 (schema + route changes)
DECISIONS §2
Eliminate Tiptap dependency
Step 11 (remove code + deps)
Verification
pnpm tsc --noEmit — 0 TypeScript errors
pnpm lint — no new warnings
pnpm test — all tests pass (updated + new)
Manual checks:
CodeMirror editor loads with LaTeX syntax highlighting
\section{}, \textbf{}, \cite{} commands are coloured
Citation chips render inline for \cite{key} patterns
Math tooltip shows rendered formula on hover over $...$
Toolbar Bold/Italic/Section/Cite buttons work
Environment folding works for \begin{}/\end{} blocks
Auto-save fires after 30s of inactivity
Manual save (Ctrl+S) works
Generate route produces correct latex_content (no rich_content_json)
Refine route produces correct latex_content
Compile pipeline works end-to-end (assemble → compile → PDF)
No editor toggle visible (single editor mode)
$p < 0.05$ survives save → reload cycle (THE critical test)
\footnote{text} survives save → reload cycle
\label{fig:test} survives save → reload cycle
Run Supabase migration via MCP
Run advisors check: mcp__supabase__get_advisors({ type: "security" })
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/devs/.REDACTED.jsonl
Assistant
I'll implement Phase 4 step by step. Let me start by reading the key files I need to understand.
Assistant
Now let me read the remaining files I need to understand for the changes.
Assistant
Now let me read the remaining files I need and check for existing tests.
Assistant
Good, I have a comprehensive understanding of all the files now. Let me also check the licence-gates test and look for any existing extract-keys tests.
Assistant
Now I have full context on all files. Let me begin implementation. I'll start with Steps 0-1 and the new file creation (Steps 2-4) in parallel.
Step 0: Fix CI test pollution — Reset current_phase after the increment test.
Assistant
Step 1: Install dependencies.
Assistant
Good. Now let me create the new files for Steps 2-4 in parallel.
Assistant
Now Step 3: LaTeX Toolbar and Step 4: LaTeX Editor. Let me first check the CitationSearchDialog props to ensure compatibility.
Assistant
Good. Now let me create the toolbar and editor components.
Assistant
Steps 2-4 done. Now let me create the Step 10a: Backfill script (must run before deleting tiptap code), and simultaneously update the routes (Steps 5-7).
Assistant
Now Steps 5-7: Update the generate, refine, and section save routes.
Now Step 11: Delete dead code and remove deps. Let me first verify the files exist, then delete them.
Assistant
Before deleting, let me check for any remaining imports of these files in the codebase.
Assistant
The approve route imports front-matter.ts. Let me check that file before deciding whether to delete it.
Assistant
front-matter.ts is NOT dead code — the approve route uses generateFrontMatterLatex to auto-create Phase 1 content. I should NOT delete it. Let me also check for the front-matter test file.
Assistant
Good — front-matter.ts is actively used by the approve route. I'll keep it and its tests. Now delete the dead files.
Assistant
Now remove dead npm dependencies:
Assistant
Good, 145 packages removed! Now let me check if @tiptap/core and @tiptap/pm can be removed — they might still be used elsewhere since novel was a meta-package.
Assistant
No imports of @tiptap remain. Let me check if they're still in package.json (since novel might have been the only consumer):
Assistant
Another 32 packages removed. Now Step 12: Update tests.
Assistant
Now update the assembly tests:
Assistant
I need to update the assembly tests to remove references to rich_content_json paths and the tiptap round-trip. The two tests that need updating are the "uses tiptapToLatex" test and the "falls back to latex_content" test:
Assistant
Now replace the "uses tiptapToLatex(rich_content_json)" test — since assembly no longer uses rich_content_json, this test should verify that latex_content is used directly:
Assistant
Now let me run TypeScript type-check and tests to verify everything compiles.
Assistant
The CodeMirror view/state packages are transitive dependencies — need to install them explicitly for TypeScript. Let me also fix the implicit any types.
Assistant
Now fix the implicit any types:
Assistant
Zero TypeScript errors. Now let me run lint:
Assistant
No new lint warnings from my changes — these are all pre-existing. Now let me run the tests:
Assistant
All 298 tests pass across 30 test files with zero failures. Let me also run the security advisor check:
Assistant
No new security warnings — these are all pre-existing function_search_path_mutable warnings (from previous phases).
Now let me update the memory to reflect the changes:
Assistant
Phase 4 is complete. Here's a summary:
Phase 4: Editor Migration (CodeMirror 6) — Done
What changed
New files (7):
components/editor/extensions/latex-language.ts — stex grammar for LaTeX syntax highlighting
components/editor/extensions/citation-decorations.ts — \cite{key} styled as sage badges
components/editor/extensions/math-tooltip.ts — KaTeX-rendered hover tooltips for $...$
CodeMirror editor loads with LaTeX syntax highlighting
\section{}, \textbf{}, \cite{} commands are coloured
Citation chips render inline for \cite{key} patterns
Math tooltip shows rendered formula on hover over $...$
Toolbar Bold/Italic/Section/Cite buttons work
Environment folding works for \begin{}/\end{} blocks
Auto-save fires after 30s of inactivity
Manual save (Ctrl+S) works
Generate route produces correct latex_content (no rich_content_json)
Refine route produces correct latex_content
Compile pipeline works end-to-end (assemble → compile → PDF)
No editor toggle visible (single editor mode)
$p < 0.05$ survives save → reload cycle (THE critical test)
\footnote{text} survives save → reload cycle
\label{fig:test} survives save → reload cycle
Run Supabase migration via MCP
Run advisors check: mcp__supabase__get_advisors({ type: "security" })
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/devs/.REDACTED.jsonl
Currently renders section.latex_content as a <pre> block (line 160-162). This already works correctly for the LaTeX-canonical world — no changes needed.
(Confirmed: it already shows latex_content in a monospace <pre> with word wrap.)
User
Step 12: Update Tests
12a: Delete obsolete tests
apps/web/lib/latex/latex-to-tiptap.test.ts
apps/web/lib/latex/tiptap-to-latex.test.ts
12b: Update pipeline E2E test
File: apps/web/tests/pipeline-e2e.test.ts
This test currently exercises latexToTiptap → tiptapToLatex → preflightChapter → assembleThesisContent → compileTex.
After Phase 4, the pipeline is: AI LaTeX → sanitiseChapterLatex → assembleThesisContent → compileTex (no round-trip).
Update:
Remove imports of latexToTiptap, tiptapToLatex
"Step 2: Tiptap round-trip" tests → replace with "Step 2: Direct sanitisation" tests (test sanitiseChapterLatex directly on AI output)
"Step 4: assembly" tests → use latex_content directly (no rich_content_json)
Multi-section compile test → same update
12c: Update assembly tests
File: apps/web/lib/latex/assemble.test.ts
Update to reflect new assembly path (no rich_content_json / tiptapToLatex):
Remove tiptapToLatex import
Update "uses tiptapToLatex when rich_content_json available" → "uses latex_content directly"
All test sections use latex_content field
12d: New tests
New file: apps/web/tests/editor/extract-citations.test.ts
Test extractCiteKeys() with:
Single citation: \cite{key} → ["key"]
Multi-citation: \cite{a,b,c} → ["a","b","c"]
Duplicate handling
Empty/malformed input
Nested braces edge case
~40 lines. (Note: extractCiteKeys already exists and may already have tests — check first.)
Migration via Supabase MCP: 026_latex_content_canonical
Two parts:
10a: Backfill latex_content for sections edited in rich text mode
Sections where a user edited in Tiptap and saved would have updated rich_content_json but stale latex_content (still matches original AI output). We need to detect these:
If ai_generated_latex = latex_content AND rich_content_json IS NOT NULL → the user never edited in source mode, so rich_content_json may be newer
These sections need a Node.js backfill script (can't do tiptapToLatex in SQL)
Pragmatic approach: Run a one-time Node.js script BEFORE deleting tiptapToLatex.ts that:
Queries sections where ai_generated_latex = latex_content AND rich_content_json IS NOT NULL
For each, calls tiptapToLatex(rich_content_json) and updates latex_content
Logs results
10b: SQL migration
sql
-- Mark rich_content_json as deprecated via column comment
COMMENT ON COLUMN public.sections.rich_content_json IS
'DEPRECATED (Phase 4). LaTeX is canonical. Retained for rollback only.';
The "phase can only increment by 1" test (line 146) sets current_phase: 3 on the sandbox project via admin client, then doesn't reset it. The subsequent "sandbox project allows phases 0-2" test (line 202) reads the same project and finds current_phase: 3 instead of 0-2.
Fix: After the assertion in the "phase can only increment by 1" test, reset the project:
sanitiseChapterLatex(), escapeBareAmpersands(), normaliseUnicode() exist ✅ (in assemble.ts / escape.ts)
User
now check all the chnages made against the review, decisions, mitigation plan and mitigation implementation files, for alignment. Also check all changes made for proper logical correctness for the project. Think ultra hard
Assistant
Let me read all the governance and review documents, then audit every change thoroughly.
Assistant· <synthetic>
Prompt is too long
User
/compact
compact
User
fill up mitigation implementation file with phase 4 completiion report
Assistant· <synthetic>
Prompt is too long
User
/compact
compact
User
find the phase 4 completion reports, and check the changes made against the Review.md, Decisions.md, Mitigation_plan.md and Mitigation_implementation.md for alignment. Also check the changes made for proper logic for this project. Think ultra hard and find any errors of code or logic, and debug. Then populate the Mitigation_implementation.md with phase 4 completion report
Assistant
I'll start by reading all the reference documents and the actual changed files to do a thorough alignment review before writing the completion report.
Assistant
Let me read the actual changed files in parallel while the docs agent works.
Assistant
Now let me check on the background agent and read the remaining docs.
Assistant
Let me read the mitigation docs directly since the agent output was truncated.
Assistant
Now let me check for potential CSS/styling issues with the new editor extensions.
Assistant
Found two bugs. Let me verify the front-matter.ts situation and check for any other issues.
Assistant
I've completed the thorough review. Here are my findings:
Bugs Found
3 CSS/styling bugs and 2 stale comments. Let me fix them now.
Bug 1: Missing KaTeX CSS import (math tooltips would be unstyled)
Bug 2: Missing .cm-cite-chip CSS (citation chips have no visual styling)
Now let me check how the layout imports CSS to find the right place for KaTeX CSS.
Assistant
Good. Now let me fix the 3 CSS bugs. Since globals.css is a LOCKED file per MEMORY.md, I need to add the CSS in a way that's minimal and targeted. The editor styles are specifically for the CodeMirror editor, not the landing/dashboard pages, so I'll add them to a separate editor CSS file imported by the editor component.
Assistant
Continuing from where we left off. I need to: (1) import the CSS file into the editor, (2) fix stale comments, (3) write the Phase 4 completion report. Let me read the files I need to edit.
Assistant
Got it — I'll delete editor-styles.css, add the editor CSS to globals.css, fix the stale comments, and then write the Phase 4 completion report. Let me read globals.css first.
Assistant
Now I'll make all the fixes in parallel.
Assistant
Now add the editor CSS classes to the end of globals.css.
Assistant
Good. Now let me verify the build still works and run the tests.
Assistant
0 TypeScript errors, 298 tests passing (30 files). Now let me read the Mitigation_plan.md Phase 4 section and DECISIONS.md §2 for the completion report cross-reference.
Assistant
All fixes applied. Now let me write the Phase 4 completion report into Mitigation_implementation.md.
Assistant
Now add the Phase 4 Review IDs to the cross-reference appendix.
Assistant
All done. Let me verify the final state.
Assistant
Here's a summary of everything completed:
Bugs Fixed (3 HIGH/MEDIUM + 2 LOW)
Missing KaTeX CSS (HIGH) --- added @import "katex/dist/katex.min.css" to globals.css. Math tooltips would have rendered with broken fonts/spacing.
Missing .cm-cite-chip CSS (HIGH) --- added sage-coloured badge styles to globals.css. Citation decorations would have been invisible.
Missing .cm-math-tooltip CSS (MEDIUM) --- added white card + shadow styles to globals.css. Tooltip would have appeared as unstyled floating text.
Stale docstring in assemble.ts:224 (LOW) --- removed reference to tiptap round-trip.
Stale module header in extract-keys.ts:3 (LOW) --- updated consumer list.
CSS Approach
Deleted editor-styles.css as requested
Added all editor decoration CSS (KaTeX import, .cm-cite-chip, .cm-math-tooltip) to globals.css --- since it's loaded at the app root, all CodeMirror extensions pick up the styles automatically.
Phase 4 Completion Report
Written to docs/Mitigation_implementation.md following the Phase 1--3 format
The background agent from the previous session has also completed — its results (reading all three reference docs) were already incorporated into the audit and completion report above.
To recap the full deliverable:
3 CSS bugs fixed — KaTeX import, .cm-cite-chip, .cm-math-tooltip all added to globals.css (unlocked per your request). editor-styles.css deleted.
2 stale comments fixed — assemble.ts and extract-keys.ts no longer reference tiptap
Phase 4 completion report written — full section added to docs/Mitigation_implementation.md with 13 items implemented, 1 deferred, 4 deviations, 5 bugs, 6 lessons learned
These three documents form a complete audit and remediation roadmap:
REVIEW.md: 136 findings catalogued across infrastructure, business logic, frontend wiring, and security
Mitigation_plan.md: Comprehensive blueprint organizing all 136 findings into 11 sequential phases with dependencies, external inputs, and skip/defer decisions
Mitigation_implementation.md: Auditable record of completed Phases 1-3 with lessons learned, bugs found during implementation, and deviations from the original plan
All three documents are cross-referenced by Review ID and enforce the rule: "Read before writing" by documenting every decision and implementation detail.
total_tokens: 90362
tool_uses: 3
duration_ms: 50992
Full transcript available at: /private/tmp/claude-501/-Users-devs-Downloads-Apollo/tasks/a4e01ef.output
Docker Security: LaTeX container port 3001 exposed (deviation from PLAN), no seccomp profile (deviation), R container has no AppArmor, missing mathrsfs package
P1: Word count targets disagree across 3 files, no Unicode avoidance in COMMON_RULES, M&M requires 8 sections but prompt mandates 12, review is purely rule-based (no AI), no retry logic
P2: Opus model routing unimplemented, messages_json always empty, synopsis prompt duplicated with different schemas
B. Citation Pipeline:
P0: Orphan cite keys bypass Tier D stripping
P1: No retry logic for API failures, re-resolve lacks title verification
P2: Pre-seeded references not persisted, timeout budget mismatch for ROL
C. LaTeX Pipeline:
P0: Round-trip destroys inline math (), destroys \footnote/\url/\textsuperscript, appendices generated but never \input, mathrsfs missing
Phase 7: Phase 11 Final QC and Completion (7-10 days)
Final QC dashboard component
Phase 11 approval must check QC
Fix undefined references check
ThesisCompletion flow
Appendices template fix
Abbreviations injection
Phase 8: Frontend Integration and Polish (7-10 days)
ExportMenu in workspace with gating
React error boundary
Onboarding tour wiring
Compilation history display
Duplicate CitationSearchDialog removal
XSS fix in title page preview
User
run lint check as well
Assistant
All pre-existing warnings only — no new lint warnings introduced by Phase 4. These are the same warnings that existed before (unused vars, missing alt props) and are tracked under Phase 11 cleanup in the mitigation plan.
User
any supabase migrations to push left?
Assistant
Yes — migration 026_latex_content_canonical from Step 10b of the plan. It marks the rich_content_json column as deprecated via a column comment.
Assistant
Already applied. Migration 026_latex_content_canonical is listed and live. No pending migrations.
now re align to the Review.md, Decisions.md, Mitigation_plan.md, Mitigation_implementation.md files. Check these files throughly (especially the deferred items listed in the Mitigation_implementation.md for items deferred to Phase 5. Then proceed to create a full proof plan which is code wise and logically correct for execution of Phase 5. For the system prompts, be as detailed and specific as possible. Add proper inputs, expected deliverable(s), constraints, etc as a well designed system prompt should have [do not skimp on detailed prompt, that effects generated content badly].
Assistant
Let me start by thoroughly reading all the reference documents in parallel to understand Phase 5 scope.
Assistant
Excellent research. Now let me read the specific files I need to finalize the plan — DECISIONS.md sections 3-4 and the key implementation files.
Assistant
Now let me read the remaining critical files for the plan.
Assistant
Let me read the remaining files needed for standalone Anthropic usage and the refine route status issue.
Assistant
Let me check the remaining routes that need token budget enforcement.
Assistant
Now let me check the DB schema for ai_conversations to understand current token tracking columns.
Assistant
Now I have all the information needed. Let me write the comprehensive plan.
Assistant
I need to read the plan file first, then write the Phase 5 plan to it. Let me continue.
Assistant
Good, the file still has the Phase 4 plan. Now I need to read key files that the previous session's research identified, so I can write an accurate Phase 5 plan. Let me re-read the critical files I need for the plan.
Assistant
Now let me read the remaining critical files I need for the plan.
Assistant
Let me read a few more critical files to ensure accuracy.
Assistant
Let me also check the Mitigation Plan for Phase 5 specifics, and the approve route.
Assistant
Now let me read the Phase 5 section from the Mitigation Plan specifically.
Assistant
Now I have all the information I need. Let me write the comprehensive Phase 5 plan.
User
[Request interrupted by user]
User
continue
Assistant
The Phase 5 plan is complete. It covers all 15 mitigation items plus 3 deferred items from earlier phases, with detailed implementation steps, code snippets, full AI prompt text for the References Consolidation (Phase 9) and Section Review (Haiku), and a verification checklist.
Assistant
Good catch — this is a real problem. When the AI hits max_tokens, the BibTeX trailer gets truncated mid-entry, leaving orphan cite keys. Let me explore how this happens currently and design a solution.
Assistant
Now I understand the issue. The max_tokens limit (12K for ROL, 8K for citation-heavy phases) can cause the response to truncate mid-BibTeX trailer. There's no stop_reason check and no cite key vs entry count validation. Let me add a step to the plan addressing this.
Assistant
Let me find the right spot to insert the new step — between the current Step 12 (citation pipeline) and Step 13 (refine state).
Assistant
Now I have the full picture. Let me insert a new step about BibTeX trailer integrity. I'll add it after Step 12 (citation pipeline) and before Step 13 (refine state). I'll also need to update the COMMON_RULES instruction (Step 3) and the execution order / files summary.
Assistant
Good. Now let me insert the new BibTeX trailer integrity step between Step 12 and Step 13, and update the COMMON_RULES step to include the trailer completeness instruction.
Assistant
Now let me also update the COMMON_RULES section in Step 3 to include the BibTeX completeness instruction, and update the execution order and files summary.
Assistant
Now update the execution order to include Step 12.5, and the files summary.
Assistant
Now add the new files to the files summary table.
Assistant
Now update the total line count.
Assistant
Now add BibTeX integrity to the verification section.
Assistant
The plan now includes Step 12.5 for BibTeX trailer integrity validation with:
Post-generation validation — checkBibtexIntegrity() compares unique cite keys in the body vs BibTeX entry keys in the trailer
Automatic follow-up request — if entries are missing, a targeted second API call requests ONLY the missing BibTeX entries and appends them to the trailer
Strengthened COMMON_RULES (rule 9) — instructs the AI that the number of BibTeX entries MUST equal the number of unique cite keys, and to prioritise completing entries over adding more body content if approaching the output limit
P2: Model routing, messages_json empty, no global error strategy
Part III: Frontend-Backend Linkage & Wiring Audit (26 unwired/dead routes and 3 missing PLAN features)
Unwired Routes:
P0: Phase 11 QC check (/qc) and fix (/qc/fix) routes never called from UI; no Final QC dashboard component; Phase 11 has no dedicated UI
Medium: ExportMenu exists but only in ThesisCompletion (not in workspace); compilation history never displayed; licence transfer UI missing; dataset download button missing
Missing PLAN Features:
User Settings/Profile page
Persistent notification centre (toasts only)
Onboarding tour component exists but not rendered
Workspace Issues:
Duplicate CitationSearchDialog
Editor mode toggle visible when non-editable
Mobile tab resets on phase change
Part IV: Security, Monetization & Architectural Recommendations (49 findings across 5 sub-audits)
IDOR: GET/PATCH/DELETE /api/projects/[id] rely on RLS only; GET /api/projects/[id]/share leaks review tokens with no ownership check; signed-url no project ownership
Role escalation: users UPDATE RLS allows setting own role to admin
XSS: dangerouslySetInnerHTML in title-page-preview
Rate limiting: only on generate; refine/auto-detect/synopsis unprotected
Business model pricing misaligned with thesis workflow reality
Content-Disposition header encoding
Editor toggle visibility
Mobile tab reset fix
File upload size enforcement
R Plumber authentication
Phase 9: Privacy and Compliance (7-10 days)
Privacy policy and terms pages
Account deletion flow with 7-day cooling-off
AI processing consent
Cookie consent banner
Medical data warning at synopsis upload
Dataset PII scanner
Audit log cascade delete
Data retention auto-purge (deferred to post-launch)
R2 cleanup on project deletion
Phase 10: Docker Hardening (3-5 days)
Docker seccomp profiles
AppArmor profile for R container
LaTeX container network isolation
Add mathrsfs and subcaption to Dockerfile
Phase 11: Cleanup and Testing (5-7 days)
Fix all 15 lint warnings
Remove dead code
Deduplicate AMERICAN_TO_BRITISH dictionary
Fix phases_completed duplicates
Spelling fix dual-column update
Warning budget enforcement
Brace-checking bug fix
Pre-seeded references persistence
Database migration tracking
RLS test enhancement
Missing RLS policies
Bundle size optimization
PDF viewer virtualization
Cross-Phase Dependencies: Detailed DAG showing which phases block others. Phases 4-6 can run in parallel after Phase 3; Phases 8-10 can overlap with Phase 7.
Items Skipped (5 total): PWA mobile pages, persistent notification centre, Phase 1->2 identity binding, self-service licence transfer, user settings page (deferred to post-launch)