Skip to content

Run 2: Multi-Template Printing

Implement composite response type, PdfRenderService.renderGroups() with parallel rendering and batch splitting, simplify calling services, and update frontend to handle multiple PDF URLs.

Specification: Phase 2 Specification Requirements: Phase 2 Requirements Verification: Phase 2 Verification

#CriterionVerification CommandExpected Output
1Run 1 exit gate passesbash .../run-1-bug-fixes/validate-exit.shALL CHECKS PASSED
2Run 1 changes committed to all worktreesgit -C .../operations log --oneline -1Contains Run 1 commit
3Operations builds cleanmake -C .../operations buildBUILD SUCCESSFUL
ArtifactPathFormatDescription
CompositeRenderResultoperations/src/.../pdfrender/business/RenderResult.ktKotlinNew composite response types
PdfRenderService.renderGroups()operations/src/.../pdfrender/service/PdfRenderService.ktKotlinMulti-group rendering with batching and parallelism
Printing configoperations/src/main/resources/shop-access/pdf-render/application.confHOCONmaxItemsPerDocumintRequest, maxParallelRenders
Per-request configoperations/src/main/resources/reference/item/application.confHOCONmaxItemsPerRequest
Simplified ItemPrintingServiceoperations/src/.../item/service/ItemPrintingService.ktKotlinGroups and delegates to renderGroups()
Simplified PrintLifecycleImploperations/src/.../kanban/service/PrintLifecycleImpl.ktKotlinGroups, delegates, scoped status updates
Updated endpointsoperations/src/.../item/api/rest/ItemEndpoint.ktKotlinResponse type changed to CompositeRenderResult
Frontend handlersarda-frontend-app/src/app/items/page.tsxTSXHandles results array, opens multiple tabs
Updated PDF Render Module docdocumentation/src/.../shop-access/pdf-render-module.mdMarkdownrenderGroups(), composite types, sequence diagram
Updated Item Module docdocumentation/src/.../reference-data/item/index.mdMarkdownSimplified printing sequence diagram
CHANGELOG entriesoperations/CHANGELOG.md, arda-frontend-app/CHANGELOG.mdMarkdownVersion entries for multi-template feature
#TaskPersonaDepends OnStatusAcceptance Criteria
2.1Define CompositeRenderResult + GroupRenderResult in pdfRender moduleback-end-engineerPendingTypes compile. T-P2-006, T-P2-007.
2.2Add printing config to pdfRender and item/kanban modulesback-end-engineerPendingConfig loads with defaults. T-P2-013.
2.3Implement PdfRenderService.renderGroups()back-end-engineer2.1, 2.2PendingGrouping, batch splitting, Semaphore-limited parallelism. T-P2-001 through T-P2-005, T-P2-009 through T-P2-012.
2.4Simplify ItemPrintingServiceback-end-engineer2.3PendingGroups by template, delegates to renderGroups(). Single-template enforcement removed. T-P2-001, T-P2-002, T-P2-011, T-P2-012.
2.5Simplify PrintLifecycleImpl for cardsback-end-engineer2.3PendingGroups, delegates, scoped print status updates. T-P2-003, T-P2-016.
2.6Update API endpoint response typesback-end-engineer2.4, 2.5PendingAll print endpoints return CompositeRenderResult. T-P2-008.
2.7Frontend composite response handlingfront-end-engineer2.1 (response shape)PendingOpens multiple tabs, shows per-group errors. Remove card grouping logic. T-P2-014, T-P2-015.
2.8Update design documentationback-end-engineer2.3, 2.4, 2.5PendingPDF Render Module + Item Module docs updated. T-P2-019, T-P2-020.
2.9Regression tests and CHANGELOGback-end-engineer2.1-2.8PendingAll builds pass. CHANGELOG entries with [X.Y.Z-jmpicnic-0408] format. T-P2-017, T-P2-018.
2.1 (types) ──┬──→ 2.3 (renderGroups) ──┬──→ 2.4 (ItemPrintingService) ──┐
2.2 (config) ─┘ └──→ 2.5 (PrintLifecycleImpl) ───┤
├──→ 2.6 (endpoints) ──→ 2.8 (docs) ──→ 2.9 (regression)
2.1 (types) ──────────────────────────────→ 2.7 (frontend) ──────────────┘

Tasks 2.1 and 2.2 can run in parallel. Task 2.3 is the critical path. Tasks 2.4 and 2.5 can run in parallel after 2.3. Task 2.7 (frontend) can start as soon as 2.1 defines the response shape.

Agent assignment: A single back-end-engineer handles 2.1-2.6, 2.8-2.9 (sequential dependency chain). A front-end-engineer handles 2.7 (can work in parallel once response shape is defined).

#CriterionVerification CommandExpected Output
1Operations builds with all tests passingmake -C .../operations buildBUILD SUCCESSFUL
2Frontend buildscd .../arda-frontend-app && npm run buildExit 0
3Frontend Jest tests passcd .../arda-frontend-app && npx jest ...All pass
4Documentation buildscd .../documentation && make buildComplete!
5CHANGELOG updated in operationshead -20 .../operations/CHANGELOG.mdContains jmpicnic version entry
6All worktrees cleangit -C .../operations status --shortClean

PR creation and deployment to dev are gated on explicit user prompt. The dev environment is a shared resource. Do not push, create PRs, or deploy without user authorization.

You are implementing multi-template printing in the operations repository at /Users/jmp/code/arda/projects/multi-pdf-print-and-bugs-worktrees/operations.

Read the specification at .../../phase-2-multi-template/specification.md and implement Tasks 2.1 through 2.6, 2.8, 2.9. Use mode: "bypassPermissions".

Key architecture decision: PdfRenderService owns column packing, batch splitting, parallel execution, and result composition. Calling services (ItemPrintingService, PrintLifecycleImpl) only transform domain types to JsonElement, group by template, validate per-request limit, and delegate to renderGroups().

Config field names: maxItemsPerDocumintRequest, maxItemsPerRequest, maxParallelRenders. CHANGELOG format: [X.Y.Z-jmpicnic-0408].

You are implementing composite print response handling in arda-frontend-app at /Users/jmp/code/arda/projects/multi-pdf-print-and-bugs-worktrees/arda-frontend-app.

Read the specification at .../../phase-2-multi-template/specification.md and implement Task 2.7.

Key decisions:

  • All print responses use composite shape (even single-item)
  • Parse data.data.results array; window.open() per successful URL; toast.error() per failed group
  • Remove frontend card grouping logic (cardsByTemplate map)
  • Remove label/breadcrumb same-template error check
ArtifactSource RunPath
Fixed notes mappingRun 1operations/src/.../kanban/business/KanbanCardPrinter.kt
UNMARK event (stable print status)Run 1operations/src/.../kanban/business/KanbanCard.kt
ArtifactConsumer RunPath
CompositeRenderResult typeRun 3, Run 4operations/src/.../pdfrender/business/RenderResult.kt
PdfRenderService.renderGroups()Run 3operations/src/.../pdfrender/service/PdfRenderService.kt
Printing config patternRun 3operations/src/main/resources/.../application.conf
CHANGELOG entryRun 3 (appends)operations/CHANGELOG.md

Copyright: (c) Arda Systems 2025-2026, All rights reserved