docs: record approved PDF exporter design and implementation plan

This commit is contained in:
Codex committed 2026-10-09 19:53:38 +08:00
commit 10a87d2cee
4 files changed
+86

No files matched your search

@@ -0,0 +1,40 @@
# Mentor PDF Exporter Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox syntax for tracking.
**Goal:** Deliver a portable Windows test tool with simple UI and evidence-backed native PDF export.
**Architecture:** Isolated project copy -> deterministic native profile -> sequential sch2pdf subprocess -> PDF validation -> atomic output. Qt worker never modifies the UI directly.
**Tech Stack:** Python 3.12, PySide6 6.x, pypdf, pytest/pytest-qt, PyInstaller, local Mentor EE 7.9.5.
**Spec:** docs/superpowers/specs/2026-10-09-mentor-pdf-export-design.md
## Global Constraints
- No source Mentor project/config modification; export from copy only.
- Windows / Python 3.12 / PySide6 6.x / native Mentor EE 7.9.5.
- Git feature branch in fresh requested directory; no unrequested worktree.
- Runs, private source docs, source CAD projects, output PDFs and releases excluded from Git.
- No overwrite without explicit opt-in; no parallel Mentor export.
### Task 1: Native feasibility and safe core
Files: tests/test_scanner.py, tests/test_profiles.py, tests/test_workspace.py, src/mentor_pdf_export/{models,scanner,profiles,workspace,engine}.py, tools/live_smoke.py.
Interfaces: scan_projects(root, excluded_roots=()) -> list[ProjectInfo]; ExportOptions; prepare_workspace(project, run_dir, options) -> Path; build_command(engine, project, output, options) -> list[str].
- [ ] Write failing tests for recursive discovery/pruning, profile values and safe isolated workspace.
- [ ] Run pytest and confirm intended import/behavior failures.
- [ ] Implement core, rerun tests until passing.
- [ ] Export the local PON example ONLY from a copied workspace; retain logs and compare source hashes.
- [ ] Investigate config/ICT/font behavior and record actual evidence/limits.
### Task 2: Reliable export transaction
Files: tests/test_exporter.py, tests/test_engine.py, src/mentor_pdf_export/{exporter,validation}.py.
Interfaces: Exporter.export(ProjectInfo, output_root, ExportOptions, cancel_event, event_callback) -> ExportResult; discover_engine(explicit=None) -> Path.
- [ ] Write failing tests for valid/invalid PDF, old output preservation, source changes, timeout/cancel and duplicate names.
- [ ] Run red, implement, then run green.
- [ ] Include isolated output staging, JSON run report and retained stdout/stderr.
### Task 3: Simple UI and portable release
Files: tests/test_ui.py, src/mentor_pdf_export/{ui,__main__,cli}.py, packaging/mentor_pdf.spec, README.md, Start-MentorPDF.cmd.
Interfaces: MainWindow(root=None, output=None); CLI --self-check/--export/--ui-smoke.
- [ ] Write failing Qt tests: scan checkbox state, settings locking, background signals, cancel, result display.
- [ ] Implement minimal usable UI; run Qt tests and capture window PNG.
- [ ] Run real UI batch on sample copy, render native PDF and check pages/text/colors visually.
- [ ] Build PyInstaller onedir and ZIP; execute packaged --self-check and UI smoke.
- [ ] Run full tests, review diff and document release limitations/evidence.