Repository navigation
fix(service-print)!: the record print downloads the PDF and stores no attachment - #39076
Conversation
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…rint Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 27 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 189 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 50f2cf2ebe427ac208088bd1930c7cf9b7b63ae3 && git checkout 50f2cf2ebe427ac208088bd1930c7cf9b7b63ae3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a294369cbc7032b85818b4e79ab999af9e7be230 3510e8a666f1249b078b59c568dffee19e06831d && git checkout -B drift-repro a294369cbc7032b85818b4e79ab999af9e7be230 && git merge --no-ff 3510e8a666f1249b078b59c568dffee19e06831d
node scripts/docs-audit/affected-docs.mjs --json a294369cbc7032b85818b4e79ab999af9e7be230
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head f184414 · 2026-12-02T08:03Z First contract review, on the dev's report 7338187928. CI is green at this head and the dogfood battery (opt-in) passed. |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Faces: the ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Findings Must-fix
Should-fix
Nits
Implemented-by: VERDICT: FAIL |
…int-download-only
…ut the action-door gap A request filename holding a lone UTF-16 surrogate is refused VALIDATION_ERROR / 400 before any render, and the download header builder is total (a lone surrogate becomes U+FFFD). The changeset, the print docs, the route ledgers, the plugin and route comments, the system-context table and the showcase's print action texts now state that a declared type:'api' print action is answered 502 by the REST and MCP action doors, and that the console's direct-fetch road reports success with no file. Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…int-download-only
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head 2125d13 · 2026-12-02T09:01Z Delta of record 7339311892 (FAIL), on the fix round reported in 7340216795. The seat patched the PR body with the dev's measured text ( |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Delta of record 7339311892 (FAIL at ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Findings Must-fix: none open. Both of the first record's are closed (changeset; PR body). Should-fix: none open. All three of the first record's are closed (lone surrogate; stale texts; showcase texts). Nits (no effect on correctness or the contract; accepted as they stand, carried by the seat)
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #39076 (#38894) · head 席位核对 · ACCEPTACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Delta of record 7339311892 (FAIL at ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Findings No must-fix, no should-fix. The first record's M1, M2 and S1–S3 are closed (changeset; PR body; lone surrogate; stale texts; showcase texts). Nits (no effect on correctness or the contract; accepted as they stand, carried by the seat)
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 维护者速读
Head-sha: |
…int-download-only
…'s PDF, and pin it end to end The action door now relays a non-JSON attachment answer and the console saves it, so a declared type:'api' print action downloads the PDF. The changeset, print-pages.mdx, both route-ledger notes, the plugin jsdoc and the showcase action's jsdoc now say so; MCP run_action still answers a file 502. The REST door conformance suite drives a declared print action through POST /api/v1/actions/... into the real print route and asserts the PDF arrives with the route's Content-Disposition: attachment. Claude-Session: https://claude.ai/code/session_01QSeKYnxn6m1nQaRrNvdiLw Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head 3510e8a · 2026-12-02T19:22Z Delta record after PASS 7340755868. The same reviewer reads it at |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Record written 2026-12-02T19:45Z. Delta of record 7340755868 (PASS at What moved since the reviewed head, on the first-parent line:
Code outside the diff, read and not reviewed: #39141's ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Findings No must-fix, no should-fix. The first record's M1, M2 and S1–S3 stay closed; this round reopens none. Nits (no effect on correctness or the contract; accepted as they stand, carried by the seat) Carried from record 7340755868, unchanged: nits 1, 3, 4, 5 and 6. Nit 2 is narrower but still open: the new pin forwards to the kernel's own New this round:
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #39076 (#38894, ruling 7344041246) · head Seat check · ACCEPTACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #39076 (#38894, ruling 7344041246) · head Re-posted from comment 7356776403 under the record heading the hand-off guard reads; no content changed. 席位核对ACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 维护者速读(更新 · 2026-12-02T19:51Z)
Head-sha: |
Part of #38894 — this PR is the service and route half of the ruling (a print writes no attachment and the route answers the PDF). The delivery half, the REST action door relaying a file and the console saving it (ruling A, record 7344041246), merged first in #39141 (
0fff9ae00b); this branch carries it through a merge oforigin/main.Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none — no published skill teaches the print service or its door (git grep over skills/ for print/records, printRecordToFile and service-print: zero hits; control: attachment has hits)
维护者速读
What changes
IPrintService.printRecordToFilebecomesprintRecordToPdfand returns the PDF itself (pdf,size,filename,contentType: 'application/pdf'). It no longer calls the files service, writes nosys_attachmentrow, and carries nosource/print_pagemarker.assertMayAttach) and theFILES_DISABLEDrefusal are gone, so a user who can read but not edit the record can print it.POST /api/v1/print/recordsand the print door member answer200with the PDF bytes:Content-Type: application/pdf,Content-Disposition: attachment; filename="ascii-fallback"; filename*=UTF-8''percent-encoded(RFC 6266 / RFC 5987),Cache-Control: no-store,X-Content-Type-Options: nosniff. Refusals keep the JSON error envelope.filenameis refusedVALIDATION_ERROR/ 400 before anything is rendered when it is over 255 characters (PRINT_FILENAME_MAX_CHARS) or holds a lone UTF-16 surrogate. The header builder is also total: a lone surrogate in any other name (a record's display value) is written as U+FFFD instead of throwing.@objectstack/service-storageis no longer a dependency of service-print (and the plugin no longer wires the attachments service).main, the REST action door relays a non-JSON2xxanswer that carriesContent-Disposition: attachmentbyte for byte and the console saves it, so a declaredtype: 'api'action that targets the route (showcaseGenerateInvoicePdfAction, HotCRM Print Quote) downloads the PDF under the print's file name. MCPrun_actionstill answers a file502. The changeset,content/docs/ui/print-pages.mdx, both route-ledger notes, the plugin jsdoc and the showcase action's jsdoc say so.successMessageand its zh-CN translation, and the comments on the invoice page and object no longer promise an attachment; the jsdoc says the console downloads the PDF through the REST action door. The action's wiring is unchanged.packages/spec/src/contracts/print-door-service.tsandpackages/runtime/src/domains/print.tsjsdoc now say "download". No type moves.quote_print_presentedbecomes an explicit "mark presented" action), and one ADR-0087 marker.Risk-first reading order:
packages/services/service-print/src/print-service.ts— the removed attach path andvalidateRequest; the read check and the session revoke infinallymust remain.packages/services/service-print/src/print-routes.ts—sendPdfandpdfContentDisposition(header quoting, encoding, the lone-surrogate replacement)..changeset/38894-print-downloads-no-attachment.md— what an upgrading app reads about a declared print action (REST door downloads, MCP502).Tests
print-routes.test.ts): the success case is a 200 PDF with the four headers. A non-ASCII name报价单 "Q1".pdfgivesfilename="___ _Q1_.pdf"plus a UTF-8filename*. A name holding a lone surrogate (\ud83d.pdf,a\udc00.pdf) isVALIDATION_ERROR/ 400 with nothing minted, read or rendered.pdfContentDispositionwrites a lone surrogate as%EF%BF%BDand keeps a paired one. The engine double traps every insert/update/delete/upsert (expectNothingWritten).print-door-member.test.ts): the door member answers the same PDF bytes as the mounted route.print-service.test.ts): "read access is the whole permission; nothing is stored"; a 255-character name prints and a 256-character one is refused; a paired surrogate prints (control) and a lone one is refused, both before anything starts; a display value holding a lone surrogate names the file with U+FFFD.print-service-archive):sys_attachmentrow is written;RECORD_NOT_FOUND/ 404.print-service-named-page/print-service-render: a render failure is forced by dropping the renderer's connections and asserts a status of 500 or above.action-door-attachment-38894.conformance.test.ts, both transports): the realPrintServicePluginmounts its route; a declared print action (recordIdParamplusbodyExtra, as the showcase declares it) sent toPOST /api/v1/actions/c38894_doc/print_pdfanswers200with the PDF bytes,Content-Type: application/pdf, the route's ownContent-Disposition: attachment; filename="__ INV-1.pdf"; filename*=UTF-8''%E5%8F%91%E7%A5%A8%20INV-1.pdf,no-storeandnosniff; the print service received exactly the assembled request, as the caller. Only the renderer (printRecordToPdf) is replaced, since no browser runs there.Acceptance notes
0fff9ae00b), somainnever had the502window. This branch mergedorigin/mainata0a9d699(K = 39; no conflict) and then restated every text that described the window (commit3510e8a6).print-service-plugin.tsand its two tests (the attachments wiring was removed);package.jsonandpnpm-lock.yaml(the dependency was dropped);packages/runtime/src/domains/print.ts(jsdoc) andpackages/runtime/src/route-ledger.ts(the print row's note);packages/services/service-print/src/print-route-ledger.ts(the row's note);content/docs/permissions/system-context.mdx(row 47d);packages/qa/dogfood/test/authz-conformance.matrix.ts(row text);packages/qa/http-conformance/src/action-door-attachment-38894.conformance.test.ts(one end-to-end pin added to feat(runtime): the REST action door delivers a target's attachment, and the console saves it as a download #39141's suite, as the dispatch ordered).packages/spec/src/contracts/print-door-service.tswas edited for jsdoc only. The result type lives in service-print, not spec.Content-Dispositionbuilder duplicates service-storage's, which is not exported. Sharing it is a possible follow-up, not done here.print-service-renderdogfood is SKIPPED locally because no console is built: NOT MEASURED locally, so CI is the reading.Verification
Two-minute check:
pnpm --filter @objectstack/service-print exec vitest run --maxWorkers=2 src/print-routes.test.ts— expect all tests to pass, including "a file name holding a lone UTF-16 surrogate: VALIDATION_ERROR / 400, before anything is minted or rendered".Readings at 3510e8a
os-regen-merge.sh: mergea0a9d699, no conflict, noos-regenpath taken frommain;@objectstack/spec check:generatedafter the build: all 14 generated artifacts up to date (no regeneration commit). The sibling's body is intact at the head (isRelayableAttachmentAnswer,saveAttachmentAnswer: same counts atorigin/mainand HEAD).@objectstack/service-printvitest run: 9 files / 143 tests passed.typecheck: exit 0.@objectstack/http-conformance:action-door-attachment-38894+hono-print-door: 2 files / 14 tests passed (2 new, one per transport).typecheck(tsc +check:test-typecheck): exit 0.@objectstack/runtime:route-ledger.conformance,own-door-bridge,api-action-forward: 3 files / 193 tests passed.test/invoice-generate-pdf-action.test.ts: 4 passed.dispatch-gates --ran: 115 of 139 derived families left to CI (declared narrowing).sendPdf, the edit gate, the lone-surrogate refusal and the header builder; the four print dogfood files) were taken at2125d13975and are in the contract review 7340628991; no print code changed since.🤖 Generated with Claude Code
https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2