Skip to content

fix(policies): include all statuses in download-all PDF bundle#2402

Merged
tofikwest merged 1 commit intomainfrom
fix/policies-download-all-include-all-statuses
Mar 30, 2026
Merged

fix(policies): include all statuses in download-all PDF bundle#2402
tofikwest merged 1 commit intomainfrom
fix/policies-download-all-include-all-statuses

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

Summary

  • Previously, "Download All" only included published policies — users with no published policies got "Failed to generate PDF" error
  • Now includes all non-archived policies, sorted by status priority: publishedneeds_reviewdraft
  • Content resolution uses the same cascade as single policy download: currentVersionpolicy level data

Changes

  • Removed status: 'published' filter from the query
  • Added status-priority sorting so published policies appear first in the bundle
  • No changes to PDF merging, headers, page numbers, or S3 upload logic

Test plan

  • Org with only draft policies → should generate PDF bundle successfully
  • Org with mixed statuses → published policies appear first, then needs_review, then draft
  • Org with only published policies → same behavior as before
  • Org with no policies at all → still returns 404
  • Policy with uploaded PDF (any status) → embedded correctly in bundle

🤖 Generated with Claude Code

Previously, the download-all endpoint only included published policies,
causing "Failed to generate PDF" errors when no published policies existed.
Now includes all non-archived policies (published > needs_review > draft)
using the same content resolution logic as single policy download.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comp-framework-editor Ready Ready Preview, Comment Mar 30, 2026 10:46pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app Skipped Skipped Mar 30, 2026 10:46pm
portal Skipped Skipped Mar 30, 2026 10:46pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 30, 2026

PR Summary

Medium Risk
Expands downloadAllPoliciesPdf to include draft/needs_review content, changing what data is bundled and potentially exposing non-published policies to anyone with access to the endpoint.

Overview
The “Download All Policies” PDF bundle now includes all non-archived policies instead of only published ones, and returns 404 only when there are no policies at all.

Bundled policies are additionally sorted by status priority (publishedneeds_reviewdraft), and the content/PDF source resolution is aligned with single-policy download by preferring currentVersion content/PDF URL before falling back to policy-level fields.

Written by Cursor Bugbot for commit 908879f. This will update automatically on new commits. Configure here.

@tofikwest tofikwest merged commit b518e1e into main Mar 30, 2026
10 checks passed
@tofikwest tofikwest deleted the fix/policies-download-all-include-all-statuses branch March 30, 2026 22:47
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.13.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants