Skip to content

fix: cover letters show the date, the employer and the role - #20

Merged
coderback merged 1 commit into
mainfrom
fix/cover-letter-header
Oct 15, 2026
Merged

coderback merged 1 commit into
mainfrom
fix/cover-letter-header

Conversation

@coderback

Copy link
Copy Markdown
Owner

Summary

The cover-letter builder passed the date, company, company location and job title to the template, but the template never showed them.

Letter

  • A block between the contact details and the salutation now shows:
    • the date;
    • the employer and its location;
    • a bold Re: line.
      If none of these are set, the block is left out.
  • The fpdf2 fallback carries the same lines, and no longer prints the name twice: its header prints it, and so did the text.
  • The letter editor (DocEditor.tsx) gains Date, Role (Re: line), Company and Company location fields, and LetterDoc gains company_location.

Page fit

The new lines pushed a 380-word letter, the top of the prompt's 300–380 range, onto a second page. Letters now get the CV's measured fit from #19, layout only: tighter spacing, then 10pt type (_LETTER_FIT_STEPS). Paragraphs are never trimmed. _fitted_cv_html becomes _fitted_html, which handles both document types.

Letter Pages Layout
320 words 1 as written
380 words 1 tighter spacing
480 words 2, with a warning logged tighter spacing and 10pt type

Fix

When the job had no location, the employer's location fell back to the candidate's country. Now that the location is printed, that would be wrong, so it's left blank and can be filled in from the editor.

Testing

  • New tests check:
    • the order of the block (contact → date → company → location → Re: → salutation);
    • that no block appears when its fields are empty;
    • the location not falling back to the candidate's country;
    • a long letter tightening while keeping every paragraph;
    • the fallback PDF's lines.
      The full-length letter test now includes the block and fits on one page.
  • The API suite passes (650), as do the 43 document tests in the API image, the frontend type check and the 6 smoke tests.
  • A real letter from Azure for my profile and a Cambridge Consultants role has the block "15 October 2026 / Cambridge Consultants / United Kingdom / Re: Graduate AI Engineer (2027 start)". It runs to 360 words on one page, as written.

The letter builder passed the date, company, location and job title, but
the template never showed them. Under the candidate's contact block the
letter now has the date, the employer and its location, and a bold
"Re: <role>" line before the salutation; the fpdf2 fallback carries the
same lines (and no longer prints the name twice). The letter editor gains
Date, Role, Company and Company location fields.

The extra lines pushed a 380-word letter (the top of the prompt's range)
onto a second page, so letters get the CV's measured fit, layout only:
tighter spacing, then 10pt type; paragraphs are never trimmed.

The employer's location no longer falls back to the candidate's country
when the job has none.
@coderback
coderback merged commit 93822a2 into main Oct 15, 2026
4 checks passed
@coderback
coderback deleted the fix/cover-letter-header branch October 15, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant