Skip to content

MBTI-PDF-RESULT-RENDER-CLEANUP-03: clean result-page PDF print surface#1492

Merged
fermatmind merged 2 commits into
mainfrom
codex/mbti-pdf-result-render-cleanup-03
Jul 1, 2026
Merged

MBTI-PDF-RESULT-RENDER-CLEANUP-03: clean result-page PDF print surface#1492
fermatmind merged 2 commits into
mainfrom
codex/mbti-pdf-result-render-cleanup-03

Conversation

@fermatmind

Copy link
Copy Markdown
Owner

What changed

  • Added a clean MBTI result-page PDF shell for the private print route.
  • Blocks PDF readiness when placeholders or excluded runtime UI are present.
  • Hides header/footer/sidebar/tools/cookie and other non-PDF UI in print mode.
  • Adds contract coverage for the clean print surface and readiness behavior.

Why

The result-page PDF export should render the actual four core result modules without site chrome, tools, placeholders, or interactive UI contaminating the PDF body.

Validation

  • pnpm vitest run tests/contracts/result-gotenberg-print-route.contract.test.ts tests/contracts/result-client-view-state.contract.test.tsx
  • pnpm typecheck
  • git diff --check

Intentionally deferred

  • No deployment.
  • No backend, CMS, DB, queue, search, sitemap, llms, canonical, or JSON-LD changes.
  • No PDF visual pagination redesign beyond the clean print surface contract.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7078983480

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +77 to +78
'[data-site-header="true"]',
'[data-site-footer="true"]',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Limit PDF blocker scan to the printable surface

On localized result/print pages, SiteChrome still renders SiteHeader and SiteFooter around this client, and this checker scans the whole document with document.querySelector. Because these newly-added header/footer selectors are always present in the DOM even when CSS hides them for print, hasMbtiPdfReadySections() never becomes true, so the fermat-pdf-ready marker and window.__FERMAT_PDF_READY__ are never set for otherwise valid MBTI PDFs.

Useful? React with 👍 / 👎.

import ResultClient from "./ResultClient";

const RESULT_PAGE_PDF_SURFACE = "mbti.result_page_export.v1";
const RESULT_PAGE_PDF_SURFACE = "mbti.result_page_export.v2";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use one PDF surface version for token checks

This route now only enters PDF mode for surface=mbti.result_page_export.v2, but verifyResultPagePdfToken() still accepts only payloads whose surface is mbti.result_page_export.v1. Any signed v2 link reaches this branch and then 404s during verification, while old v1 links no longer enable pdfMode, so the result-page PDF entry point is effectively broken until the verifier/token issuer and route agree on the same surface value.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a5d86e3ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +54 to +57
const lines = cleanText(section.bodyMd)
.split(/\n+|(?:\s+-\s+)/)
.map((line) => cleanText(line))
.filter(Boolean);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Render payload-backed projection copy in the PDF

When mbti_public_projection_v1.sections use payload-backed renderers such as bullets, letters_intro, trait_dimension_grid, or preferred_role_list, the user-visible copy is in section.payload, not bodyMd (the existing MBTI projection fixture has many such sections). This helper only reads bodyMd, so those cards render as title-only blocks while the PDF is still marked ready, producing incomplete result-page PDFs for otherwise valid reports.

Useful? React with 👍 / 👎.

return [
{
key: "personality-traits",
title: "Personality Traits",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Localize the PDF section headings

For locale === "zh", this new PDF shell still uses English top-level headings because the section titles are hard-coded here while the component otherwise receives locale and localizes other copy. Chinese result-page PDF exports will therefore be mixed-language even when the projection content is localized.

Useful? React with 👍 / 👎.

@fermatmind fermatmind merged commit ac47e62 into main Jul 1, 2026
6 checks passed
@fermatmind fermatmind deleted the codex/mbti-pdf-result-render-cleanup-03 branch July 1, 2026 05:40
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