Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 30, 2025

Addresses #864 - upgrades base-x from v3 to v5.

Breaking Change

base-x v5 returns Uint8Array from decode() instead of Buffer. The Buffer.readUInt32BE() method doesn't exist on Uint8Array.

Changes

  • package.json: base-x ^3.0.11^5.0.0
  • app/common/UserUtil.ts: Use DataView to read the CRC32 value from decoded bytes
// Before (v3 - Buffer)
return crcBytes.readUInt32BE(0) === crc32(bytes);

// After (v5 - Uint8Array)
const dataView = new DataView(crcBytes.buffer, crcBytes.byteOffset, crcBytes.byteLength);
return dataView.getUint32(0, false) === crc32(bytes);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com//advisories
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

fix #864, upgrade base-x to v5


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@graphite-app
Copy link

graphite-app bot commented Nov 30, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • MQ - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 30, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


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

@socket-security
Copy link

socket-security bot commented Nov 30, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedbase-x@​3.0.11 ⏵ 5.0.1100 +110092 +386100

View full report

Copilot AI changed the title [WIP] Fix issue with upgrading base-x to v5 fix(deps): upgrade base-x to v5 Nov 30, 2025
Copilot AI requested a review from fengmk2 November 30, 2025 11:32
@codecov
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.25%. Comparing base (dc20401) to head (16b7ed1).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #897      +/-   ##
==========================================
- Coverage   95.37%   95.25%   -0.12%     
==========================================
  Files         197      197              
  Lines       22100    22102       +2     
  Branches     2444     2049     -395     
==========================================
- Hits        21077    21054      -23     
- Misses       1023     1048      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return crcBytes.readUInt32BE(0) === crc32(bytes);
// base-x v5 returns Uint8Array instead of Buffer, use DataView to read UInt32BE
const dataView = new DataView(crcBytes.buffer, crcBytes.byteOffset, crcBytes.byteLength);
return dataView.getUint32(0, false) === crc32(bytes);
Copy link
Member

Choose a reason for hiding this comment

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

@copilot 这样修改后性能会变差吗?能否加一个 benchmark 对比一下性能?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ran a benchmark comparing Buffer.from() + readUInt32BE() vs DataView:

Testing with 10000 tokens

Buffer.from + readUInt32BE: 32.44ms (308,222 ops/sec)
DataView:                   29.44ms (339,714 ops/sec)

Difference: -9.27% (DataView is FASTER)

The DataView approach is actually ~9% faster because it operates directly on the Uint8Array buffer without creating a new Buffer object (which involves memory allocation overhead).

@fengmk2 fengmk2 changed the title fix(deps): upgrade base-x to v5 chore(deps): upgrade base-x to v5 Dec 6, 2025
Copilot AI requested a review from fengmk2 December 6, 2025 13:16
@fengmk2 fengmk2 marked this pull request as ready for review December 6, 2025 13:16
@fengmk2 fengmk2 merged commit d3e4fae into master Dec 6, 2025
28 of 29 checks passed
@fengmk2 fengmk2 deleted the copilot/fix-upgrade-base-x-v5 branch December 6, 2025 13:20
fengmk2 pushed a commit that referenced this pull request Dec 6, 2025
[skip ci]

## <small>4.13.3 (2025-12-06)</small>

* fix: zero copy to create a new Buffer (#916) ([683ee1d](683ee1d)), closes [#916](#916) [hi#level](https://github.com/hi/issues/level)
* chore(deps): update mime-types to v3 (#899) ([0a5c90c](0a5c90c)), closes [#899](#899) [#865](#865)
* chore(deps): upgrade base-x to v5 (#897) ([d3e4fae](d3e4fae)), closes [#897](#897) [#864](#864)
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

🎉 This PR is included in version 4.13.3 🎉

The release is available on:

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