Skip to content

fix(export_document): letterhead logo-only for composed reports (stag… - #902

Merged
venkat102 merged 1 commit into
developfrom
feat/rich-pdf-slice1.1
Aug 17, 2026
Merged

fix(export_document): letterhead logo-only for composed reports (stag…#902
venkat102 merged 1 commit into
developfrom
feat/rich-pdf-slice1.1

Conversation

@venkat102

Copy link
Copy Markdown
Contributor

…ing smoke)

The staging re-smoke showed the render approach (Slice 1.1) no longer leaked raw Jinja, but produced tenant "None"/partial junk ("g", "(Demo)", "None") in the header: a Letter Head is a document-BOUND template (company address/contact keyed off the printed doc) and a composed report has no such doc — an unwinnable render.

Pivot to LOGO-ONLY for composed reports: resolve_letterhead now extracts only the Letter Head's logo(s) (bounded first, then inlined to permission-checked base64 + the nh3 data-only gate) and DROPS the doc-bound Jinja/text block. No render, so no raw tags and no "None"/junk — deterministic and clean. A tenant that wants text branding on a report passes header=/footer= explicitly (the agent already supplies its own report title/footer). Removed _render_letterhead / _letterhead_context / _JINJA_RE (no longer rendering the letterhead).

Tests: replaced the render-template cases with _letterhead_logos (extract img, drop text+Jinja, size-cap) and updated the resolve tests (logo kept, text/Jinja dropped, remote img still stripped by the inline gate). 165 site-free tests + 151 subtests green; ruff clean.

⚠️ Still render-behavior — confirm on the staging re-smoke: header shows the logo (or nothing for a text-only letterhead), never raw template or "None" junk.

Summary

Pre-merge checklist

ℹ️ These repos are private on the GitHub Free plan, so branch protection is
not enforced — CI cannot hard-block a merge. Honoring this checklist is what keeps
broken changes out of UAT. See CONTRIBUTING.md.

  • CI is green — the tests check on this PR passes (never merge on ❌)
  • Branch is up to date with main (so it is tested against the latest code)
  • New/changed behavior has tests (the coverage gate still passes)
  • I self-reviewed the diff

…ing smoke)

The staging re-smoke showed the render approach (Slice 1.1) no longer leaked raw
Jinja, but produced tenant "None"/partial junk ("g", "(Demo)", "None") in the
header: a Letter Head is a document-BOUND template (company address/contact keyed
off the printed doc) and a composed report has no such doc — an unwinnable render.

Pivot to LOGO-ONLY for composed reports: resolve_letterhead now extracts only the
Letter Head's <img> logo(s) (bounded first, then inlined to permission-checked
base64 + the nh3 data-only gate) and DROPS the doc-bound Jinja/text block. No
render, so no raw tags and no "None"/junk — deterministic and clean. A tenant that
wants text branding on a report passes header=/footer= explicitly (the agent
already supplies its own report title/footer). Removed _render_letterhead /
_letterhead_context / _JINJA_RE (no longer rendering the letterhead).

Tests: replaced the render-template cases with _letterhead_logos (extract img,
drop text+Jinja, size-cap) and updated the resolve tests (logo kept, text/Jinja
dropped, remote img still stripped by the inline gate). 165 site-free tests + 151
subtests green; ruff clean.

⚠️ Still render-behavior — confirm on the staging re-smoke: header shows the logo
(or nothing for a text-only letterhead), never raw template or "None" junk.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@venkat102
venkat102 merged commit 8234c23 into develop Aug 17, 2026
8 checks passed
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