Skip to content

feat(content-uploader): pass version_number to modernized uploader items list#4623

Open
olehrybak wants to merge 2 commits into
box:masterfrom
olehrybak:modernized-items-list-version-number
Open

feat(content-uploader): pass version_number to modernized uploader items list#4623
olehrybak wants to merge 2 commits into
box:masterfrom
olehrybak:modernized-items-list-version-number

Conversation

@olehrybak

@olehrybak olehrybak commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Passed version_number to the modernized upload items list
  • Extracted the logic that appends version_number query param to the upload url outside of if (!uploadUrl) so that it can be called when we receive a url from preflight request

Summary by CodeRabbit

  • Chores

    • Updated upload manager dependency to a newer version.
  • Bug Fixes

    • Fixed upload URL query parameter handling to ensure fields are consistently applied across all upload scenarios.
  • Features

    • Added version number tracking to uploaded items.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR upgrades @box/uploads-manager from ^1.15.0 to ^1.17.2 and integrates two new features: consistent field parameter handling in upload URLs and version number extraction in upload item mappings, with corresponding test coverage for both changes.

Changes

Upload Manager Integration Improvements

Layer / File(s) Summary
Dependency Version Upgrade
package.json
@box/uploads-manager version updated to ^1.17.2 in both devDependencies and peerDependencies.
Fields Query Parameter Support in Upload Handler
src/api/uploads/PlainUpload.js, src/api/uploads/__tests__/PlainUpload.test.js
PlainUpload.preflightSuccessHandler now applies the fields query parameter to all upload URL paths, not only when constructing the URL internally. New test verifies the encoded fields query parameter is present in the upload URL.
Version Number Field in Upload Item Mapping
src/elements/content-uploader/utils/mapToModernizedUploadItem.ts, src/elements/content-uploader/utils/__tests__/mapToModernizedUploadItem.test.ts
mapToModernizedUploadItem now extracts versionNumber from boxFile.version_number. Test assertions updated and new cases added to verify field presence and value propagation from legacy file objects.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • box/box-ui-elements#4592: Adds/adjusts support for the optional fields array in PlainUpload.preflightSuccessHandler upload URL construction.
  • box/box-ui-elements#4573: Introduces the mapToModernizedUploadItem mapping logic that this PR extends with versionNumber field extraction.
  • box/box-ui-elements#4563: Modifies @box/uploads-manager dependency declarations in package.json.

Suggested labels

ready-to-merge

Suggested reviewers

  • jpan-box
  • reneshen0328

Poem

🐰 A little bump, a gentle shift,
Two features hop into the gift—
Fields align, version numbers gleam,
Upload manager makes the dream,
One more small stone in the beam! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main feature change: passing version_number to modernized uploader items, which aligns with the primary objective of the changeset.
Description check ✅ Passed The description concisely summarizes the two main changes but lacks detail about specific files modified, testing coverage, and dependency updates included in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Biome (2.4.16)
src/api/uploads/PlainUpload.js

File contains syntax errors that prevent linting: Line 12: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 17: return types can only be used in TypeScript files; Line 19: return types can only be used in TypeScript files; Line 27: Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 27: return type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 28: type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 45: Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 45: return type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 63: Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove th

... [truncated 1145 characters] ...

instead found <; Line 151: Expected a parameter but instead found '}'.; Line 151: Expected a statement but instead found '): void'.; Line 153: Illegal return statement outside of a function; Line 177: Expected a semicolon or an implicit semicolon after a statement, but found none; Line 179: Illegal return statement outside of a function; Line 192: Expected a semicolon or an implicit semicolon after a statement, but found none; Line 192: expected , but instead found :; Line 192: Expected a semicolon or an implicit semicolon after a statement, but found none; Line 199: type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 206: Illegal return statement outside of a function; Line 208: Expected a statement but instead found '}'.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed due to a network error.


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.

@socket-security

Copy link
Copy Markdown

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​box/​uploads-manager@​1.15.0 ⏵ 1.17.277 +1100100 +199 +250

View full report

@olehrybak olehrybak marked this pull request as ready for review June 12, 2026 08:55
@olehrybak olehrybak requested review from a team as code owners June 12, 2026 08:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/api/uploads/__tests__/PlainUpload.test.js (1)

177-196: ⚡ Quick win

Consider adding a test for fields with preflight-provided upload_url.

The new test correctly verifies that fields are appended when the upload URL is constructed internally. However, the PR objective states that fields should be appended "regardless of whether the upload URL is provided initially or returned by preflight." Consider adding a complementary test case where data.upload_url is provided to ensure complete coverage of both code paths.

🧪 Suggested additional test case
+    test('should append fields query parameter when upload URL is provided by preflight', () => {
+        const preflightUploadUrl = 'https://upload.box.com/api/2.0/files/content';
+        upload.isDestroyed = jest.fn().mockReturnValueOnce(false);
+        upload.computeSHA1 = jest.fn().mockReturnValueOnce(Promise.resolve('somehash'));
+        upload.file = {
+            name: 'warlock',
+        };
+        upload.folderId = '123';
+        upload.fields = ['content_created_at', 'version_number'];
+        upload.xhr = {
+            uploadFile: jest.fn(),
+        };
+
+        return upload.preflightSuccessHandler({ data: { upload_url: preflightUploadUrl } }).then(() => {
+            expect(upload.xhr.uploadFile).toHaveBeenCalledWith(
+                expect.objectContaining({
+                    url: `${preflightUploadUrl}?fields=content_created_at%2Cversion_number`,
+                }),
+            );
+        });
+    });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/api/uploads/__tests__/PlainUpload.test.js` around lines 177 - 196, Add a
complementary unit test to verify that when preflight returns an upload_url the
upload.fields are still appended to that URL; specifically, create a test that
sets upload.fields (e.g., ['content_created_at','version_number']), mocks
upload.isDestroyed and computeSHA1, sets upload.file/folderId and
upload.xhr.uploadFile, calls upload.preflightSuccessHandler({ data: {
upload_url: 'https://host/some/path' } }) and asserts upload.xhr.uploadFile was
called with an object whose url equals the provided upload_url plus the query
parameter ?fields=content_created_at%2Cversion_number; this ensures both code
paths (constructed URL and preflight-provided upload_url) handle upload.fields
correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Line 150: Verify that bumping `@box/uploads-manager` to 1.17.2 doesn’t introduce
breaking API/type changes by auditing uses of UploadItemStatus, UploadItem, and
UploadsManager in the repo: search for references to those symbols, update any
call sites or type annotations to match the new package typings if they changed,
and run the content-uploader test suite (unit and integration) to catch
runtime/type regressions; if tests fail, pin the dependency back or apply
necessary code changes to adapt to the new API.

---

Nitpick comments:
In `@src/api/uploads/__tests__/PlainUpload.test.js`:
- Around line 177-196: Add a complementary unit test to verify that when
preflight returns an upload_url the upload.fields are still appended to that
URL; specifically, create a test that sets upload.fields (e.g.,
['content_created_at','version_number']), mocks upload.isDestroyed and
computeSHA1, sets upload.file/folderId and upload.xhr.uploadFile, calls
upload.preflightSuccessHandler({ data: { upload_url: 'https://host/some/path' }
}) and asserts upload.xhr.uploadFile was called with an object whose url equals
the provided upload_url plus the query parameter
?fields=content_created_at%2Cversion_number; this ensures both code paths
(constructed URL and preflight-provided upload_url) handle upload.fields
correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aee7135a-79ca-41b0-87ab-fe599be9ee22

📥 Commits

Reviewing files that changed from the base of the PR and between d4605b9 and abd1679.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • package.json
  • src/api/uploads/PlainUpload.js
  • src/api/uploads/__tests__/PlainUpload.test.js
  • src/elements/content-uploader/utils/__tests__/mapToModernizedUploadItem.test.ts
  • src/elements/content-uploader/utils/mapToModernizedUploadItem.ts

Comment thread package.json
"@box/unified-share-modal": "^2.15.16",
"@box/user-selector": "^1.77.13",
"@box/uploads-manager": "^1.15.0",
"@box/uploads-manager": "^1.17.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check the validity of `@box/uploads-manager` version and look for breaking changes

echo "Fetching available versions of `@box/uploads-manager` from npm..."
npm view `@box/uploads-manager` versions --json | jq -r '.[]' | grep -E '^1\.(15|16|17)\.' | tail -20

echo -e "\nChecking if version 1.17.2 exists..."
npm view `@box/uploads-manager`@1.17.2 version 2>/dev/null && echo "✓ Version 1.17.2 exists" || echo "✗ Version 1.17.2 not found"

echo -e "\nFetching recent changelog/release notes..."
npm view `@box/uploads-manager`@1.17.2 --json | jq -r '.description, .homepage'

Repository: box/box-ui-elements

Length of output: 149


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Check whether 1.17.2 exists (lightweight npm view)..."
npm view `@box/uploads-manager`@1.17.2 version || true

echo
echo "2) Fetch minimal metadata for 1.17.2 (homepage/repository if available)..."
npm view `@box/uploads-manager`@1.17.2 --json | head -c 4000 || true

echo
echo "3) Look for resolved versions in lockfiles..."
ls -1 package-lock.json yarn.lock pnpm-lock.yaml 2>/dev/null || true
rg -n "\"`@box/uploads-manager`\"" package-lock.json yarn.lock pnpm-lock.yaml 2>/dev/null || true
rg -n "`@box/uploads-manager`@1\.(15|16|17)\." package-lock.json yarn.lock pnpm-lock.yaml 2>/dev/null || true

Repository: box/box-ui-elements

Length of output: 149


🌐 Web query:

@box/uploads-manager 1.17.2 release notes changelog migration

💡 Result:

There is no publicly available release version 1.17.2 for the package @box/uploads-manager as of June 12, 2026. Official Box documentation and repositories, such as the box/box-ui-elements repository, do not contain release notes or a changelog for this specific version. The @box/uploads-manager package is primarily a component used within Box UI Elements [1]. If you are looking for information regarding Box SDK migrations, Box has transitioned its primary development efforts toward generated SDKs (sdk-gen) [2]. Migration guides for Box SDKs, such as moving from the legacy box-node-sdk to the generated sdk-gen module, are available in the official box-node-sdk repository [3][2]. For specific updates related to your project's dependencies, it is recommended to: 1. Check the official npm registry page for @box/uploads-manager to verify the latest published version. 2. Review the box/box-ui-elements GitHub repository for any unreleased changes or open pull requests that might match your version number. 3. Consult the official Box Developer documentation at https://developer.box.com/ for the most current integration and migration guidance.

Citations:


🌐 Web query:

site:github.com "@box/uploads-manager" releases 1.17.2

💡 Result:

There is no publicly available npm package named @box/uploads-manager, nor is there a record of a release version 1.17.2 associated with such a package [1][2]. The UploadsManager is a component internal to the Box UI Elements library, which is maintained in the box/box-ui-elements repository on GitHub [1][3]. This component is used within the Content Uploader UI element [1][4], but it is not distributed as a standalone npm package [2]. If you are looking for specific versions of Box-related tools, you may be referring to a different package, as versioning schemes vary across Box's various SDKs and UI libraries (e.g., box-ui-elements or box-node-sdk) [5][6].

Citations:


🌐 Web query:

"uploads-manager" "CHANGELOG" "1.17"

💡 Result:

The term "uploads-manager" (or similar variations) appears in multiple software projects, but version 1.17 is specifically associated with the Uploadcare File Uploader project [1][2]. According to the official CHANGELOG.md for the uploadcare/file-uploader repository, version 1.17.0 was released on June 16, 2025, followed by versions 1.17.1 and 1.17.2 on June 18, 2025 [1][2]. These releases primarily focused on various bug fixes [1][2]. While the term "uploads-manager" or "upload manager" is used in other contexts—such as within the source code of the Perplexica project [3], Elementor (where an uploads-manager.php file exists) [4], and various other software systems [5][6][7][8]—there is no widely recognized or standardized project strictly named "uploads-manager" that maintains a unified changelog for version 1.17 outside of the specific context of the Uploadcare File Uploader or project-specific internal components [1][2]. If you are looking for information regarding a different specific software product, please provide the name of the organization or repository.

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Lockfiles present:"
ls -1 package-lock.json yarn.lock pnpm-lock.yaml pnpm-lock.yml 2>/dev/null || true

echo
echo "Searching for `@box/uploads-manager` in lockfiles..."
rg -n "`@box/uploads-manager`" package-lock.json yarn.lock pnpm-lock.yaml pnpm-lock.yml 2>/dev/null || true

echo
echo "Searching for a resolved version number for `@box/uploads-manager`..."
rg -n "`@box/uploads-manager`@|\"`@box/uploads-manager`\":\\s*\\{\"|\"`@box/uploads-manager`\"\\s*:\\s*\\{" package-lock.json yarn.lock pnpm-lock.yaml pnpm-lock.yml 2>/dev/null || true

echo
echo "Searching for scope registry config (.npmrc) for `@box`..."
ls -1 .npmrc 2>/dev/null || true
[ -f .npmrc ] && sed -n '1,200p' .npmrc || true

echo
echo "Repo-wide search for `@box/uploads-manager`..."
rg -n "`@box/uploads-manager`" . 2>/dev/null | head -n 50 || true

Repository: box/box-ui-elements

Length of output: 2034


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Get the exact resolved tarball URL from yarn.lock
url="$(awk '
  $0 ~ /^"`@box`\/uploads-manager@\^1\.17\.2":/ {inblk=1; next}
  inblk && $0 ~ /^\s*resolved "/ {
    sub(/^[[:space:]]*resolved "/,""); sub(/"$/,""); print; exit
  }
' yarn.lock)"

echo "Resolved tarball URL from yarn.lock:"
echo "$url"

echo
echo "Downloading tarball to /tmp..."
rm -f /tmp/uploads-manager-1.17.2.tgz
curl -L --fail --silent --show-error -o /tmp/uploads-manager-1.17.2.tgz "$url"

echo "Inspecting tarball contents (top level)..."
mkdir -p /tmp/uploads-manager-1.17.2
rm -rf /tmp/uploads-manager-1.17.2/*
tar -xzf /tmp/uploads-manager-1.17.2.tgz -C /tmp/uploads-manager-1.17.2 --strip-components=1 --wildcards 'package.json' 'README*' 'CHANGELOG*' 'changelog*' 'MIGRATION*' 'migration*' 2>/dev/null || true

echo
echo "Top docs present:"
ls -la /tmp/uploads-manager-1.17.2 || true

echo
echo "package.json:"
cat /tmp/uploads-manager-1.17.2/package.json || true

echo
echo "Any changelog/migration text (first 200 lines each):"
for f in /tmp/uploads-manager-1.17.2/CHANGELOG* /tmp/uploads-manager-1.17.2/changelog* /tmp/uploads-manager-1.17.2/MIGRATION* /tmp/uploads-manager-1.17.2/migration*; do
  [ -e "$f" ] || continue
  echo "---- $f ----"
  sed -n '1,200p' "$f" || true
done

Repository: box/box-ui-elements

Length of output: 583


🏁 Script executed:

#!/bin/bash
set -euo pipefail

tgz="/tmp/uploads-manager-1.17.2.tgz"

echo "tgz file stats:"
ls -la "$tgz" || true
echo
echo "tgz file type:"
file "$tgz" || true
echo
echo "First bytes (to detect HTML/errors):"
head -c 200 "$tgz" | xxd -p || true
echo
echo "Archive listing (first 50 entries):"
tar -tzf "$tgz" | head -n 50 || true

Repository: box/box-ui-elements

Length of output: 2225


🏁 Script executed:

#!/bin/bash
set -euo pipefail

tgz="/tmp/uploads-manager-1.17.2.tgz"
out="/tmp/uploads-manager-1.17.2"

rm -rf "$out"
mkdir -p "$out"

echo "Extracting without stripping to inspect paths..."
tar -xzf "$tgz" -C "$out" || true

echo
echo "Top-level extracted dirs/files:"
ls -la "$out" || true

echo
echo "Searching for package.json in extracted tree..."
find "$out" -maxdepth 4 -name package.json -print || true

echo
echo "Searching for CHANGELOG/MIGRATION in extracted tree (maxdepth 6)..."
find "$out" -maxdepth 6 -iname "change*log*" -o -iname "migration*" -print || true

Repository: box/box-ui-elements

Length of output: 477


🏁 Script executed:

#!/bin/bash
set -euo pipefail

out="/tmp/uploads-manager-1.17.2"

echo "package/package.json (first 120 lines):"
sed -n '1,120p' "$out/package/package.json"

echo
echo "Package version field(s):"
node -e "const p=require('$out/package/package.json'); console.log({version:p.version, name:p.name});" 2>/dev/null || true

echo
echo "Search for changelog/migration files in tarball contents:"
find "$out" -maxdepth 6 -iname "change*log*" -o -iname "*migration*" -print || true

echo
echo "Search for 'breaking' notes in common doc files (best-effort):"
find "$out" -maxdepth 6 -type f \( -iname "*readme*" -o -iname "*changelog*" -o -iname "*migration*" -o -iname "*.md" \) -print | head -n 50 || true

for f in $(find "$out" -maxdepth 6 -type f \( -iname "*readme*" -o -iname "*changelog*" -o -iname "*migration*" -o -iname "*.md" \) -print 2>/dev/null | head -n 20); do
  echo "---- $f (breaking snippets) ----"
  rg -n -i "breaking|migrat|upgrade|deprecat" "$f" | head -n 20 || true
done

Repository: box/box-ui-elements

Length of output: 1844


🏁 Script executed:

#!/bin/bash
set -euo pipefail

out="/tmp/uploads-manager-1.17.2/package"

echo "README.md (first 200 lines):"
sed -n '1,200p' "$out/README.md" || true

echo
echo "README.md (lines matching breaking/migrat/upgrade/deprecat):"
rg -n -i "breaking|migrat|upgrade|deprecat" "$out/README.md" || true

echo
echo "Any markdown/text docs besides README.md (up to depth 6):"
find "$out" -maxdepth 6 -type f \( -iname "*.md" -o -iname "*readme*" \) -print || true

echo
echo "Search all extracted files for breaking/migrat/upgrade/deprecat (best-effort):"
rg -n -i "breaking|migrat|upgrade|deprecat" "$out" || true

Repository: box/box-ui-elements

Length of output: 9104


Check @box/uploads-manager 1.17.2 bump risk

  • @box/uploads-manager is already resolved to 1.17.2 in yarn.lock, and the downloaded 1.17.2 tarball’s package/package.json reports version: "1.17.2".
  • The 1.17.2 package ships no CHANGELOG/MIGRATION files (README documents the API only), so breaking/migration guidance isn’t available from release notes.
  • Validate breaking API/type changes in this repo’s usage of UploadItemStatus, UploadItem, and UploadsManager and run the relevant content-uploader tests before merging.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 150, Verify that bumping `@box/uploads-manager` to 1.17.2
doesn’t introduce breaking API/type changes by auditing uses of
UploadItemStatus, UploadItem, and UploadsManager in the repo: search for
references to those symbols, update any call sites or type annotations to match
the new package typings if they changed, and run the content-uploader test suite
(unit and integration) to catch runtime/type regressions; if tests fail, pin the
dependency back or apply necessary code changes to adapt to the new API.

@Omfalos Omfalos 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.

lgtm

Comment thread package.json
"@box/unified-share-modal": "^2.15.16",
"@box/user-selector": "^1.77.13",
"@box/uploads-manager": "^1.15.0",
"@box/uploads-manager": "^1.17.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe you also have to update the peerDependencies of @box/uploads-manager package, ex. blueprint-web, blueprint-web-assets, and item-icon

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.

4 participants