Skip to content

feat(loader): add S3 fast-path cache probe to versioned loader endpoint#161

Open
jameswillis99 wants to merge 1 commit intoplasmicapp:masterfrom
jameswillis99:feat/s3-fast-path-cache
Open

feat(loader): add S3 fast-path cache probe to versioned loader endpoint#161
jameswillis99 wants to merge 1 commit intoplasmicapp:masterfrom
jameswillis99:feat/s3-fast-path-cache

Conversation

@jameswillis99
Copy link
Copy Markdown

@jameswillis99 jameswillis99 commented Apr 22, 2026

Summary

Probes S3 for a pre-built bundle before resolving project dependencies or doing any DB work. On a warm cache hit the full codegen and dep-resolution pipeline is skipped entirely, significantly reducing latency for versioned loader requests.

  • Add tryGetS3CacheEntry<T> to s3-util — read-only probe returning T | null, never computes or stores
  • Add getS3Client() singleton to avoid re-instantiating the S3 client on every cache call
  • Extract makeExportOpts helper in gen-code-bundle to deduplicate export opts construction shared between the fast-path key and the full path
  • Add tryGetCachedPublishedBundle fast-path at the top of genPublishedLoaderCodeBundle
  • Export _testonly.resetS3Client for test isolation

Test plan

  • s3-util.spec.ts — 8 new tests covering cache hit, cache miss, TimeoutError rethrow, singleton reset (all passing)
  • gen-code-bundle.spec.ts — 5 new tests for makeExportOpts covering version flags, i18n, and defaults consistency (requires yarn gen:models to run)
  • Manual: hit /api/v1/loader/code/versioned with a warm S3 cache and confirm response is served without DB round-trips

Probe S3 for a pre-built bundle before resolving project dependencies or
doing any DB work. On a warm cache hit the full codegen and dep-resolution
pipeline is skipped entirely.

- Add tryGetS3CacheEntry<T> to s3-util: read-only probe returning T|null
- Add getS3Client singleton to avoid re-instantiating S3 on every call
- Extract makeExportOpts helper in gen-code-bundle to deduplicate export
  opts construction shared between fast-path key and full path
- Add tryGetCachedPublishedBundle fast-path at top of genPublishedLoaderCodeBundle
- Add _testonly.resetS3Client for test isolation
- Add s3-util.spec.ts with 8 tests covering hit/miss/timeout/singleton reset
- Add makeExportOpts tests to gen-code-bundle.spec.ts
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

@jwillis24 is attempting to deploy a commit to the Plasmic Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

Thank you for your submission, we really appreciate it! ❤️

Like many open-source projects, we ask that you sign our Individual Contributor License Agreement before we can accept your contribution. If you are contributing on behalf of a company, please contact us at help@plasmic.app to sign a Corporate Contributor License Agreement.

You can sign the individual CLA by posting a comment with the below text.


I have read, agree to, and hereby sign Plasmic's Individual Contributor License Agreement


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@jaslong
Copy link
Copy Markdown
Member

jaslong commented Apr 29, 2026

Hey James, thanks for the contribution! We'll be merging this in soon. Do you mind accepting the CLA?

@jameswillis99
Copy link
Copy Markdown
Author

jameswillis99 commented Apr 29, 2026

Thank you @jaslong ! As I'm contributing on behalf of a company it's currently in the hands of our legal department, I'm hoping this shouldn't take too long.

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.

3 participants