Skip to content

Reuse generated PDF downloads in existing object storage - #12

Merged
ottenhoff merged 3 commits into
mainfrom
codex-pdf-reuse
Oct 26, 2026
Merged

ottenhoff merged 3 commits into
mainfrom
codex-pdf-reuse

Conversation

@ottenhoff

@ottenhoff ottenhoff commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Public PDF downloads currently rebuild the document and fetch artwork on every request. Generate on first download and reuse the bytes in the existing R2/S3 storage while keeping current credential lookups and Cache-Control: no-store on both PDF routes.

The cache fingerprints all resolved PDF inputs plus a renderer version, so lifecycle, recipient, expiry, artwork URL, and public URL changes select a fresh render. One replaceable JSON/base64 object per assertion bounds retained versions; reuse expires after 24 hours so artwork at an unchanged external URL can refresh. Expected artwork that could not be embedded is never cached. Cache read/write failures still return a freshly rendered PDF.

No new infrastructure, database schema, challenge flow, or background jobs. Concurrent cache misses can render more than once; stored fingerprints prevent a different version from being reused.

CI fixes: update Zod to 4.6.6 and Undici to 7.30.1 / 6.29.1 for the production security audit, pin both CI jobs to Ubuntu 24.04, and surface browser errors from the production sign-in smoke test.

Validation:

  • pnpm audit:prod (no high or critical advisories)
  • pnpm format:check
  • pnpm test:scripts
  • pnpm check:node-runtime
  • Production Docker smoke: TLS, SMTP, browser sign-in, issuance, and revocation passed locally after dependency updates.
  • pnpm lint
  • pnpm typecheck
  • pnpm test: 265 files passed, 64 skipped; 1,915 tests passed, 256 skipped.
  • New real-renderer tests cover stored-byte reuse, recipient changes, lifecycle transitions, freshness, artwork failure recovery, tenant isolation, corrupt artifacts, and storage failures. Route tests cover both aliases, current-state headers, invalidation, and missing credentials after caching.

Related: Discussion #10 (internal PDF reuse only).

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedundici@​7.30.0 ⏵ 7.30.193100 +19100 +198100
Updatedzod@​4.6.5 ⏵ 4.6.6100100 +1610095 +1100

View full report

@ottenhoff
ottenhoff merged commit 5546e8c into main Oct 26, 2026
4 checks passed
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