Skip to content

fix: validate cached binary version matches requested version (#146) - #169

Merged
xhyrom merged 2 commits into
oven-sh:mainfrom
wyMinLwin:fix/validate-cached-bun-version
Mar 4, 2026
Merged

xhyrom merged 2 commits into
oven-sh:mainfrom
wyMinLwin:fix/validate-cached-bun-version

Conversation

@wyMinLwin

Copy link
Copy Markdown
Contributor

I pull the expected version from the download URL, compare it with the binary that was restored, and if they don’t match, I just download it again.
No more silently using an outdated cached version.

for #146

@coderabbitai

coderabbitai Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between af3f129 and 37a513a.

⛔ Files ignored due to path filters (1)
  • dist/setup/index.js is excluded by !**/dist/**
📒 Files selected for processing (1)
  • src/action.ts

Walkthrough

Adds a new utility to extract Bun version strings from download URLs and integrates it into cache validation: expected version is derived from the URL and compared to the cached revision, logging warnings and forcing re-download on parse failure or mismatch.

Changes

Cohort / File(s) Summary
Version Extraction Utility
src/utils.ts, tests/utils.spec.ts
Added `extractVersionFromUrl(url: string): string
Cache Validation Enhancement
src/action.ts
Imported and used extractVersionFromUrl to derive expectedVersion from the download URL; compares it to the cached revision's version (pre-+), logs warnings and invalidates cache when parsing fails or versions mismatch; retains existing cache-hit behavior on match.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: validating that cached binary versions match the requested version, which aligns with the core functionality added across the modified files.
Description check ✅ Passed The description is directly related to the changeset, explaining the approach of extracting the expected version from the download URL and redownloading if versions don't match, preventing silent use of outdated caches.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/action.ts`:
- Around line 98-108: The code currently accepts a cached binary when
extractVersionFromUrl(url) returns undefined; change the logic in the revision
validation block (using extractVersionFromUrl, expectedVersion, actualVersion,
revision, cacheHit, warning, info) to "fail closed": if expectedVersion is
falsy, treat it as a mismatch by setting revision = undefined, do not set
cacheHit true, and emit a warning/error explaining that the expected version
could not be parsed from the URL so the cache will be ignored; keep the existing
path that accepts the cache only when expectedVersion is defined and
actualVersion === expectedVersion.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4c32875 and af3f129.

⛔ Files ignored due to path filters (1)
  • dist/setup/index.js is excluded by !**/dist/**
📒 Files selected for processing (3)
  • src/action.ts
  • src/utils.ts
  • tests/utils.spec.ts

Comment thread src/action.ts
@xhyrom
xhyrom merged commit 95edc15 into oven-sh:main Mar 4, 2026
256 of 259 checks passed
@xhyrom

xhyrom commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

ty!

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