File size: 3,747 Bytes
8ca929f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95abc1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8ca929f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Apply Recommendations Implementation Note

## What was implemented
Pulse CV now includes a post-analysis **Apply recommendations** workflow that appears only after a completed analysis and only when an original CV source file is available.

The workflow includes:
- `Apply recommendations` action in the Analyzer results screen
- edit-plan preview before file generation
- updated CV generation in the same input format
- downloadable change report / redline summary
- DOCX-first surgical editing path
- transparent PDF fallback path

## Files added
- `server/cvApply/types.ts`
- `server/cvApply/editPlan.ts`
- `server/cvApply/storage.ts`
- `server/cvApply/pythonWorker.ts`
- `scripts/cv_apply_worker.py`
- `requirements-doc-worker.txt`

## Files updated
- `server.ts`
- `src/App.tsx`
- `Dockerfile`

## Chosen libraries
### DOCX editing
- `python-docx`

Why:
- strongest practical choice in the current stack for paragraph-aware DOCX editing
- allows targeted paragraph replacement / insertion
- preserves much more styling and section structure than full regeneration

### PDF generation fallback
- `reportlab`

Why:
- reliable recruiter-safe regenerated PDF output
- honest fallback when exact layout-preserving PDF editing is not realistic

## Why DOCX and PDF paths differ
DOCX is structurally editable and supports a true surgical patch path.
PDF is not a reliable semantic editing format for exact high-fidelity rewriting across arbitrary source files.

Therefore:
- DOCX input -> DOCX output with high-fidelity targeted edits
- PDF input -> PDF output in recruiter-safe fallback mode when exact layout preservation cannot be guaranteed

## Fidelity guarantees
### DOCX
Reasonable guarantees:
- preserve paragraph order
- preserve headings and section flow
- preserve most paragraph styling where possible
- preserve contact details and chronology
- patch only targeted sections when possible

### PDF
Honest guarantee:
- preserve content intent and same output format
- generate recruiter-readable / ATS-readable PDF
- do not guarantee exact original visual layout for arbitrary PDFs

## Safety rules enforced
- no invented tools, degrees, titles, achievements, or experience
- dates and chronology are preserved unless intentionally edited
- recommendations are applied only through Pulse CV analysis output
- AI is not used as the source of truth for scoring or fit logic
- only `FinalCvPatch.replacementText` may enter DOCX generation
- `DisplayRecommendation.message` is UI-only and can never be written into the CV
- multilingual meta-language validation runs before patch creation and again inside the DOCX worker
- if a generated patch contains advice, conditional wording, UI labels, or language mismatch, the download is blocked

## Multilingual repair architecture
Pulse CV now separates:
- `DisplayRecommendation`
- `InternalEditInstruction`
- `FinalCvPatch`

The core product rule is:

```text
Analyze in any language.
Recommend in the UI layer.
Patch only in the CV language.
Patch only with evidence.
Never write advice into the CV.
```

## Implemented API
- `POST /api/cv/apply-recommendations/plan`
- `POST /api/cv/apply-recommendations/generate`
- `GET /api/cv/generation/:jobId/status`
- `GET /api/cv/generation/:jobId/download`
- `GET /api/cv/generation/:jobId/redline`

## Validation completed
- local lint passed
- local build passed
- Python worker compilation passed
- DOCX end-to-end generation passed
- PDF end-to-end fallback generation passed

## Current limitations
- DOCX is the happy path and the strongest implementation today
- PDF output is intentionally transparent fallback, not fake exact-layout editing
- server orchestration still lives partly in `server.ts` and can be modularized further later