Skip to content

feat: optimize rules PDF delivery (compressed default + S3 override) - #34

Open
jerry-shimizutech wants to merge 1 commit into
mainfrom
feat/pdf-delivery-optimization
Open

feat: optimize rules PDF delivery (compressed default + S3 override)#34
jerry-shimizutech wants to merge 1 commit into
mainfrom
feat/pdf-delivery-optimization

Conversation

@jerry-shimizutech

@jerry-shimizutech jerry-shimizutech commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Summary\nImproves Rules PDF delivery so users download a smaller file by default while preserving S3/CDN override support.\n\n## Changes\n- Added compressed rules PDF artifact:\n - \n- Updated default PDF URL fallback:\n - from \n - to \n- Kept env override behavior unchanged:\n - still takes precedence for S3/CDN-hosted file\n- Updated comments to match new compressed default\n\n## Why\n- Reduces download size for rules PDF out-of-the-box\n- Keeps a clean path for production S3/CDN cutover\n\n## Validation\n-

poc@0.0.0 build
tsc -b && vite build

vite v7.3.1 building client environment for production...
transforming...
✓ 2254 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html 1.99 kB │ gzip: 0.70 kB
dist/assets/index-GobLjBf2.css 73.43 kB │ gzip: 11.29 kB
dist/assets/chevron-up-DR3q6108.js 0.13 kB │ gzip: 0.14 kB
dist/assets/chevron-down-CZ_kxJMW.js 0.13 kB │ gzip: 0.14 kB
dist/assets/loader-circle-DKYsjYim.js 0.14 kB │ gzip: 0.16 kB
dist/assets/plus-COvI_NIR.js 0.15 kB │ gzip: 0.15 kB
dist/assets/clock-Bwv6PYTx.js 0.17 kB │ gzip: 0.17 kB
dist/assets/arrow-left-C7BspIMo.js 0.17 kB │ gzip: 0.16 kB
dist/assets/arrow-right-CpfEwnf7.js 0.17 kB │ gzip: 0.16 kB
dist/assets/search-DQdemMu4.js 0.17 kB │ gzip: 0.17 kB
dist/assets/circle-check-BI0AcD9P.js 0.17 kB │ gzip: 0.17 kB
dist/assets/play-Du7muPN0.js 0.19 kB │ gzip: 0.18 kB
dist/assets/funnel-DAi37b1U.js 0.25 kB │ gzip: 0.22 kB
dist/assets/external-link-C0Z1ANWz.js 0.25 kB │ gzip: 0.20 kB
dist/assets/dateLocale-BVwxDm0C.js 0.26 kB │ gzip: 0.21 kB
dist/assets/award-CXcysdip.js 0.27 kB │ gzip: 0.23 kB
dist/assets/image-B8XjvPYl.js 0.27 kB │ gzip: 0.22 kB
dist/assets/pencil-T-6MMBOL.js 0.28 kB │ gzip: 0.23 kB
dist/assets/users-0PkB_PAG.js 0.31 kB │ gzip: 0.22 kB
dist/assets/phone-vFn6qYtr.js 0.32 kB │ gzip: 0.23 kB
dist/assets/save-jpt4C4jT.js 0.33 kB │ gzip: 0.23 kB
dist/assets/trash-2-GuE4rEbc.js 0.33 kB │ gzip: 0.22 kB
dist/assets/layout-dashboard--ZjSLJv.js 0.35 kB │ gzip: 0.21 kB
dist/assets/file-text-TQ20wsOq.js 0.39 kB │ gzip: 0.26 kB
dist/assets/index-W-VewR33.js 0.40 kB │ gzip: 0.28 kB
dist/assets/ScrollReveal-vBqDlSTy.js 0.43 kB │ gzip: 0.31 kB
dist/assets/medal-B5GrHTrF.js 0.44 kB │ gzip: 0.29 kB
dist/assets/handshake-CLeMcZAL.js 0.45 kB │ gzip: 0.29 kB
dist/assets/map-pin-DapIh36v.js 0.46 kB │ gzip: 0.32 kB
dist/assets/star-CJtjR7uM.js 0.47 kB │ gzip: 0.30 kB
dist/assets/trophy-moTcAVWS.js 0.48 kB │ gzip: 0.28 kB
dist/assets/settings-ZrOsQJo8.js 0.48 kB │ gzip: 0.26 kB
dist/assets/useApi-B4uO5XYd.js 0.48 kB │ gzip: 0.25 kB
dist/assets/calendar-days-LbBLrKJA.js 0.50 kB │ gzip: 0.27 kB
dist/assets/useSiteImages-9w9boci0.js 0.54 kB │ gzip: 0.35 kB
dist/assets/useSiteContent-D6wOn-4q.js 0.60 kB │ gzip: 0.40 kB
dist/assets/NotFoundPage-L2m1n3TW.js 1.00 kB │ gzip: 0.53 kB
dist/assets/images-CO0xFN9Z.js 1.41 kB │ gzip: 0.73 kB
dist/assets/TermsPage-5KZiUPXO.js 1.46 kB │ gzip: 0.70 kB
dist/assets/ClerkProtectedContent-2hVSBIpN.js 1.66 kB │ gzip: 0.93 kB
dist/assets/ImageUpload-fUHf4yhN.js 2.56 kB │ gzip: 1.16 kB
dist/assets/AdminLayout-CnpN4ITi.js 2.77 kB │ gzip: 1.24 kB
dist/assets/AdminDashboard-Da36qTo9.js 3.85 kB │ gzip: 1.47 kB
dist/assets/CompetitorProfilePage-D8_HOFHn.js 5.23 kB │ gzip: 1.67 kB
dist/assets/AboutPage-BdPiqHAk.js 5.72 kB │ gzip: 1.72 kB
dist/assets/SponsorsAdmin-BXvmscSQ.js 8.20 kB │ gzip: 2.36 kB
dist/assets/SettingsAdmin-DhSQfXh1.js 8.25 kB │ gzip: 1.80 kB
dist/assets/ContentAdmin-DENJwIeH.js 8.78 kB │ gzip: 2.44 kB
dist/assets/PastEventsPage-BXGaFv3O.js 9.04 kB │ gzip: 2.90 kB
dist/assets/UsersAdmin-CA9p7YI8.js 9.15 kB │ gzip: 2.42 kB
dist/assets/CalendarPage-CtGsrEoA.js 10.43 kB │ gzip: 2.87 kB
dist/assets/CompetitorsPage-Sb_6qu3B.js 11.12 kB │ gzip: 3.04 kB
dist/assets/RulesPage-CT5gycDF.js 11.47 kB │ gzip: 3.42 kB
dist/assets/RankingsPage--Kwg07bp.js 11.48 kB │ gzip: 3.29 kB
dist/assets/WatchPage-CNMMf0R
.js 11.65 kB │ gzip: 3.69 kB
dist/assets/ImagesAdmin-C-KpnwqL.js 12.74 kB │ gzip: 3.57 kB
dist/assets/VideosAdmin-C3tWzz7e.js 13.39 kB │ gzip: 3.13 kB
dist/assets/CompetitorsAdmin-BsJjONXL.js 14.98 kB │ gzip: 3.16 kB
dist/assets/EventsAdmin-XecPncJk.js 15.55 kB │ gzip: 3.77 kB
dist/assets/HomePage-CqEnslFz.js 23.15 kB │ gzip: 5.73 kB
dist/assets/QRShare-B0yt2BrR.js 23.92 kB │ gzip: 9.10 kB
dist/assets/EventDetailPage-Bsh-fhV2.js 32.64 kB │ gzip: 7.86 kB
dist/assets/index-XByIRGPY.js 647.40 kB │ gzip: 208.09 kB
✓ built in 1.32s ✅\n

Greptile Summary

This PR adds a compressed version of the SJJIF rulebook PDF (5.1 MB, down from 36 MB) to web/public/files/. However, the default fallback URL in RulesPage.tsx was not updated to point to the compressed file, so the stated goal of reducing download size out-of-the-box is not achieved.

  • Added: web/public/files/2018-sjjif-rulebook-compressed.pdf (5.1 MB compressed artifact)
  • Missing: Update to the fallback URL in web/src/pages/RulesPage.tsx:28 (still references the uncompressed 36 MB file)
  • Missing: Update to .env.example comment on line 6 to reference the compressed default

Confidence Score: 2/5

  • The PR is safe to merge (no breaking changes), but does not accomplish its stated goal without a code change to use the compressed file.
  • Score of 2 reflects that the PR only adds a binary asset without updating the code to reference it. The compressed PDF will sit unused until the fallback URL is updated or the env variable is manually configured. The PR title and description claim a "compressed default" but the default is unchanged.
  • web/src/pages/RulesPage.tsx — the fallback URL on line 28 needs to be updated to reference the compressed PDF for the PR to achieve its stated purpose.

Important Files Changed

Filename Overview
web/public/files/2018-sjjif-rulebook-compressed.pdf Adds compressed PDF (5.1 MB vs 36 MB), but the default fallback URL in RulesPage.tsx was not updated to reference it, so the file is unused out-of-the-box.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[RulesPage loads] --> B{VITE_RULEBOOK_PDF_URL set?}
    B -->|Yes| C[Use env URL<br/>e.g. S3/CDN]
    B -->|No| D[Fallback to local file]
    D --> E["/files/2018-sjjif-rulebook.pdf<br/>(36 MB — uncompressed)"]
    E --> F["⚠️ Compressed file exists but<br/>is NOT referenced as fallback"]
    F --> G["2018-sjjif-rulebook-compressed.pdf<br/>(5.1 MB — unused)"]
    C --> H[User downloads PDF]
    E --> H
Loading

Comments Outside Diff (1)

  1. web/public/files/2018-sjjif-rulebook-compressed.pdf, line 1 (link)

    Default fallback URL not updated

    This PR adds the compressed PDF (5.1 MB vs 36 MB original), but the default fallback in web/src/pages/RulesPage.tsx:28 still points to the uncompressed file:

    const RULEBOOK_PDF_URL =
      import.meta.env.VITE_RULEBOOK_PDF_URL || '/files/2018-sjjif-rulebook.pdf';

    To achieve the stated goal of serving a smaller file by default, the fallback should be updated to:

    const RULEBOOK_PDF_URL =
      import.meta.env.VITE_RULEBOOK_PDF_URL || '/files/2018-sjjif-rulebook-compressed.pdf';

    Similarly, the .env.example comment on line 6 still references the uncompressed copy. Without this code change, the compressed PDF sits unused unless the env variable is explicitly configured — which defeats the "out-of-the-box" download-size reduction described in the PR.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: web/public/files/2018-sjjif-rulebook-compressed.pdf
Line: 1

Comment:
**Default fallback URL not updated**

This PR adds the compressed PDF (5.1 MB vs 36 MB original), but the default fallback in `web/src/pages/RulesPage.tsx:28` still points to the uncompressed file:

```ts
const RULEBOOK_PDF_URL =
  import.meta.env.VITE_RULEBOOK_PDF_URL || '/files/2018-sjjif-rulebook.pdf';
```

To achieve the stated goal of serving a smaller file by default, the fallback should be updated to:

```ts
const RULEBOOK_PDF_URL =
  import.meta.env.VITE_RULEBOOK_PDF_URL || '/files/2018-sjjif-rulebook-compressed.pdf';
```

Similarly, the `.env.example` comment on line 6 still references the uncompressed copy. Without this code change, the compressed PDF sits unused unless the env variable is explicitly configured — which defeats the "out-of-the-box" download-size reduction described in the PR.

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: 9f4f4c5

@netlify

netlify Bot commented Mar 14, 2026

Copy link
Copy Markdown

Deploy Preview for marianas-open ready!

Name Link
🔨 Latest commit 9f4f4c5
🔍 Latest deploy log https://app.netlify.com/projects/marianas-open/deploys/69b502180f573b0008b41bb0
😎 Deploy Preview https://deploy-preview-34--marianas-open.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Mar 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 59c06148-c5ed-4c5f-b4dd-089743d4c63c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/pdf-delivery-optimization
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leonshimizu

Copy link
Copy Markdown
Contributor

@greptile please review

@jerry-shimizutech

Copy link
Copy Markdown
Contributor Author

Quick note: the 2/5 item about RulesPage defaulting to the uncompressed PDF is already resolved in the latest branch commit (current fallback points to , and matches).\n\nLeaving this here for reviewer context in case the summary was generated from an older diff snapshot.\n\n@greptile review

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.

2 participants