refactor(utils): migrate uploads and uploadsSHA1Worker from Flow to T… - #4846
bonchevskyi wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. WalkthroughThe PR adds upload utilities for input normalization, transfer-item handling, identifiers, and capability checks. It also adds a SHA-1 web worker and updates upload ID tests to pass root folder IDs as strings. ChangesUpload handling
Priority: ⬇️ Low Estimated code review effort: 4 (Complex) | ~45 minutes Change: Refactor Sequence Diagram(s)sequenceDiagram
participant MainThread
participant createWorker
participant Worker
participant Rusha
MainThread->>createWorker: createWorker()
createWorker->>Worker: Instantiate worker from Blob ObjectURL
MainThread->>Worker: Send ordered file part
Worker->>Rusha: Append part contents
Rusha-->>Worker: Update SHA-1 state
Worker-->>MainThread: partDone with transferred contents
Worker-->>MainThread: done with final SHA-1
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The migrated upload worker resolves correctly in the configured build and test environments, and no concrete current-head regression remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. A rabbit reads each line, Comment |
greg-in-a-box
left a comment
There was a problem hiding this comment.
Review
Straightforward Flow → TypeScript migration of uploads and uploadsSHA1Worker, consistent with the other utils migration batches.
What looks good
- Export surface matches master; runtime logic is preserved (Flow casts → TS assertions, docs trimmed).
.js.flowstubs via rename match the established migration pattern for remaining Flow importers.uploadsSHA1Workercorrectly keeps the Rusha/asm worker under@ts-nocheck/ eslint-disable with no behavioral change.- Test updates for
getFileId(file, '0')androotFolderId: '0'align the tests with the existingstringcontract (production callers already passrootFolderId). isMultiputSupportedreturn is explicitly boolean (!!); same truthiness for callers.
Nits (non-blocking)
- CI (
lint_test_build) was still in progress at review time — worth confirming green before merge.
Verdict: Approve.
Summary
This PR migrates upload-related utilities in
src/utilsfrom Flow (.js) to TypeScript (.ts), disjoint from other utils migration PRs.Migrated utilities
uploadsuploadsSHA1WorkerComponents / API modules touched (consumers)
src/api/uploads/MultiputUpload.js— importsuploadsSHA1Worker(import path unchanged; bundler resolves.ts)Changes
uploadsanduploadsSHA1Workerto.tsand added matching.js.flowstubs for remaining Flow importersuploadsSHA1Worker.tswith existing@ts-nocheck/ eslint disable (behavior unchanged)Contract
.jssources)Related
Browser,Cache,LocalStore,TokenServicewebcrypto,error,file,function,flatten,fuzzySearch,domPolyfill,getFileSize,validatorsbase64,comparator,download,env,hex,keys,parseCSV,parseEmails,performance,relativeTime,sleep,storybook,urlcreateTheme,dom,iframe,sorterSummary by CodeRabbit