TASK22224: tidy pdf render compatibility

This commit is contained in:
2026-03-24 05:52:38 +00:00
parent 9b0365ffbd
commit c6205bbb39
4 changed files with 36 additions and 2 deletions
+33
View File
@@ -550,3 +550,36 @@ Validation:
Follow-ups:
- Optional final low-risk tidy sweep: remove dead imports/unused locals in legacy file handlers now that contract hardening stream is functionally complete.
---
### CL-014: TASK22224 pdf render compatibility tidy slice
date: 2026-03-24
author: Cline
scope: `pages/api/file/{generatepdf,generateappealpdf}.js`, `tests/phase21/file-handler-contract.test.cjs`
type: change
rationale: Apply a low-risk compatibility tidy so PDF render invocation remains stable across runtime and contract-test VM contexts.
impact: Keeps functional behavior unchanged while reducing test/runtime mismatch risk in render path setup.
status: completed
Summary:
- `pages/api/file/generatepdf.js`
- switched render call input from `React.createElement(MyDocument, ...)` to direct `MyDocument(...)` invocation in `ReactPDF.renderToStream(...)`
- `pages/api/file/generateappealpdf.js`
- switched render call input from `React.createElement(MyDocument, ...)` to direct `MyDocument(...)` invocation in `ReactPDF.renderToStream(...)`
- `tests/phase21/file-handler-contract.test.cjs`
- added `Buffer` injection for `generatepdf` catch-path test harness to align VM context expectations
Validation:
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
- helper: 4/4
- file-handler: 53/53
- email-handler: 12/12
- endpoint-handler: 152/152
Follow-ups:
- Optional: dead import cleanup (`Document/Page/Text/View/StyleSheet/PDFViewer`, `middleware`, `nextConnect`, `fs`, etc.) can be done in a dedicated non-behavioral hygiene PR.