pdf: split the generator into files by responsibility, no byte moves - #152
Conversation
pdf.go held the declaration, the settings, the object layout, the page text, the information dictionary, the padding and the minimum in 522 lines. Split by that list before new settings arrive, so each lands in the file that owns it instead of pushing one file past the shape gates. Blocks moved verbatim, cut by content. Compared against the previous binary on 300 requests (five paper sizes, 1, 2 and 24 pages, label on and off, two seeds, five sizes each from below the floor to 64 KB): 100 files with equal SHA-256, 200 refusals with the same exit code and wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (16)
🧰 Additional context used📓 Path-based instructions (9)Applies to text shown to the user (labels, buttons, tooltips, placeholders, dialogs, errors, status messages, empty states, translations).⚙️ CodeRabbit configuration file Files:
These are end-user desktop applications.⚙️ CodeRabbit configuration file Files:
Performance is a known weak spot of these projects.⚙️ CodeRabbit configuration file Files:
Applies only to code that builds or styles a GUI.⚙️ CodeRabbit configuration file Files:
Domain: test file generator (Go; `tfg` CLI and `tfg-gui` Fyne window over one engine).⚙️ CodeRabbit configuration file Files:
SECURITY, HIGH PRIORITY.⚙️ CodeRabbit configuration file Files:
These apps are QA/developer tools.⚙️ CodeRabbit configuration file Files:
Go code.⚙️ CodeRabbit configuration file Files:
All code in this repository is written by an AI coding agent (Claude Code).⚙️ CodeRabbit configuration file Files:
🔇 Additional comments (7)
📝 WalkthroughWalkthroughThe PDF implementation is split into new helpers for settings, page content, metadata, padding, minimum-size calculation, and document serialization. The previous implementation is removed from ChangesPDF generation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The PDF package builds after the split, with no identified issue requiring a fix before merge. 🚥 Pre-merge checks | ✅ 14✅ Passed checks (14 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The PDF generator is about to gain a dozen settings (metadata, dates, orientation, mixed paper sizes, page rotation, header version).
internal/format/pdf/pdf.goalready held seven responsibilities in 522 lines, so it is split first, on its own, where a byte change is easy to rule out.pdf.goPlan,Writesettings.godocument.gopage.goinfo.gopadding.gominimum.goBlocks moved verbatim, cut by content rather than line number. Nothing is reworded.
No byte moved. The golden values pin one PDF at default settings, which does not reach A5, several pages or an unlabelled file. So the previous and the new binary were compared on 300 requests: five paper sizes, 1, 2 and 24 pages, label on and off, two seeds, and five sizes each (below the floor, the floor, the one byte gap, two above, 64 KB). 100 files with equal SHA-256, 200 refusals with the same exit code and wording.
🤖 Generated with Claude Code
Summary by CodeRabbit