Skip to content

refactor(types): remove file id from drive types - #2346

Merged
apsantiso merged 6 commits into
masterfrom
refactor/remove-file-id-types
Nov 20, 2026
Merged

apsantiso merged 6 commits into
masterfrom
refactor/remove-file-id-types

Conversation

@apsantiso

@apsantiso apsantiso commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Description

Files are identified by uuid now, but DriveFileData still had the numeric id and Thumbnail still had file_id. Code could keep using the old identifier and the compiler wouldn't complain.

This PR removes both fields from the types and from the places that build file objects.

It also bumps @internxt/sdk to 1.27.0, which drops the same fields on its side and makes FetchTrashContentResponse generic, so the workspace trash response is now typed as files or folders.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

  • tsc --noEmit passes against SDK 1.27.0.
  • Affected unit tests pass.

Additional Notes

  • DriveItemData is DriveFileData & DriveFolderData, so item.id still compiles through the folder type. If file code still reads id from there, this PR won't catch it.

Summary by CodeRabbit

  • Updates
    • Drive file records and thumbnails no longer include legacy numeric identifiers. File previews and related operations continue to use the remaining file metadata.
    • Trash retrieval now returns more specific file and folder result types.
  • Maintenance
    • Updated test data to reflect the current file and thumbnail metadata. Existing checks for downloads, previews, and cached content remain in place.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 811c52a
Status: ✅  Deploy successful!
Preview URL: https://8ea2139b.drive-web.pages.dev
Branch Preview URL: https://refactor-remove-file-id-type.drive-web.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Files ignored due to path filters: 1

  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5f414be5-3387-4b82-9fc1-5027d80fdf91
Commits

Reviewing files that changed from the base of the PR and between 030cb56 and 811c52a.

Files ignored due to path filters: 1

  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock

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

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The SDK pin changes to 1.27.0, and getTrashItems uses an explicit trash response type. Drive file and thumbnail types, mappings, and test fixtures no longer include numeric identifier fields.

Changes: Trash response typing

Layer / File(s) Summary
SDK and trash response typing
package.json, src/services/workspace.service.ts
The pinned SDK version changes to 1.27.0. getTrashItems returns FetchTrashContentResponse<TrashedFile | TrashedFolder>.

Drive identifier removal

Layer / File(s) Summary
Drive data shapes and mappings
src/app/drive/types/index.ts, src/utils/driveThumbnail.utils.ts, src/views/Drive/DriveView.tsx, src/views/PublicShared/utils/mapSharedItemToPreviewFile.ts
DriveFileData no longer declares id, and Thumbnail no longer declares file_id. The thumbnail and preview-file mappings omit those fields.
Drive fixtures and tests
src/app/drive/components/FileViewer/..., src/app/drive/services/..., src/app/store/slices/storage/fileUtils/prepareFilesToUpload.test.ts, src/testUtils/fixtures/*, src/views/PublicShared/utils/mapSharedItemToPreviewFile.test.ts
Test fixtures no longer set id or file_id. Existing UUID-based download and cache assertions remain.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Refactor

Possibly related PRs

  • internxt/drive-web#2330: Changes the local file cache key and viewer file identity from numeric id to UUID, connecting to this PR’s removal of id from DriveFileData.

Suggested reviewers: xabg2, terrerox

Merge Risk: Minimal · previous review a773f

This change removes legacy numeric identifier fields from Drive file and thumbnail data and upgrades the SDK. No actionable merge-blocking risk was found. Normal CI should confirm the typecheck and tests.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "refactor(types): remove file id from drive types" matches the main change. The PR removes the numeric id from DriveFileData and file_id from Thumbnail, and it updates the code and t…
Description check Passed The description follows the repository template. It has a clear summary that explains the reason for removing id and file_id, and it lists the SDK bump and its effect on the workspace trash respon…
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.
Full details: Title check

Explanation

The title "refactor(types): remove file id from drive types" matches the main change. The PR removes the numeric id from DriveFileData and file_id from Thumbnail, and it updates the code and test fixtures that depended on them. The title is specific and concise. It does not mention the @internxt/sdk bump to 1.27.0 or the generic FetchTrashContentResponse change, but the title does not need to cover every detail.

Full details: Description check

Explanation

The description follows the repository template. It has a clear summary that explains the reason for removing id and file_id, and it lists the SDK bump and its effect on the workspace trash response. It links a related SDK PR and gives testing notes. Gaps: the Related Issues section is empty, most checklist items are unchecked, and the Testing Process section does not describe local manual testing. The Additional Notes section raises a useful limitation about item.id still compiling through DriveFolderData.

Resolution

Consider these improvements: (1) Add a linked issue under Related Issues, or write "None" if no issue exists. (2) Update the checklist items that the author completed, or explain why they remain unchecked. In particular, state whether local testing was done. (3) Add the test commands or steps that were run, not only the result summary. (4) Describe how the remaining item.id reads on file code will be found, for example with a lint rule or a follow-up task.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 57c3c8a0-0ea3-41e0-8938-9de68166b99e
Commits

Reviewing files that changed from the base of the PR and between 89b050d and a773f85.

Files selected for processing: 1

  • src/app/drive/services/downloadManager.service.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@apsantiso
apsantiso marked this pull request as ready for review November 19, 2026 16:49
@@ -338,7 +338,6 @@ describe('Thumbnail Service', () => {

const mockThumbnail: Thumbnail = {
id: 1,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shouldn't this id be removed too? 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope, we still return id for thumbnails, as they're not a "file" from the backend perspective, they're another table, etc.

@@ -71,7 +70,6 @@ export interface DriveFileData {

interface Thumbnail {
id: number;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here

larryrider
larryrider previously approved these changes Nov 19, 2026
@apsantiso

Copy link
Copy Markdown
Member Author

@larryrider @CandelR I'll check the type CI, let's review this tomorrow haha

@sonarqubecloud

Copy link
Copy Markdown

@apsantiso
apsantiso merged commit 5ecc593 into master Nov 20, 2026
12 checks passed
@apsantiso
apsantiso deleted the refactor/remove-file-id-types branch November 20, 2026 11:27
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