-
Notifications
You must be signed in to change notification settings - Fork 30.3k
feat: add TaskStorage derive macro and schema infrastructure #88338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Conversation
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
1 similar comment
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
caab350 to
5398e9b
Compare
a98f5fa to
00722c2
Compare
turbopack/crates/turbo-tasks-backend/src/backend/storage_schema.rs
Outdated
Show resolved
Hide resolved
Failing test suitesCommit: 8402228 | About building and testing Next.js
Expand output● runtime prefetching › should not cache runtime prefetch responses in the browser cache or server-side › private caches should return new results on each request |
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **431 kB** → **431 kB** ✅ -16 B82 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
|
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
102e146 to
f86b6c5
Compare
1c882f9 to
47d98d1
Compare
f86b6c5 to
dc32042
Compare
47d98d1 to
c82b781
Compare
dc32042 to
0d769e4
Compare
26fb1db to
9300306
Compare
0d769e4 to
f465836
Compare
Add the TaskStorage derive macro and storage schema as unused code scaffolding for the upcoming refactoring of InnerStorage. Changes: - Add turbo-tasks-macros/src/derive/task_storage_macro.rs (~2900 lines) - Supports inline/lazy storage modes - Generates typed accessors (get/set/take/ref/mut) - Generates encode_meta/encode_data/decode_meta/decode_data methods - Supports filter_transient attribute for skipping transient data - New `default` attribute for fields using Default::default() semantics - Add storage_schema.rs defining TaskStorage struct and schema - Defines all fields with storage attributes - Uses new `default` attribute for aggregation_number (12 bytes vs 16 with Option) - TaskStorage is 128 bytes (matches InnerStorage) - Includes comprehensive tests for accessors, encoding, and sizes - Add is_transient() methods to CellRef, CollectibleRef, CollectiblesRef, OutputValue - These are needed by the macro's filter_transient functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
9300306 to
d067b62
Compare
f465836 to
20e2a0d
Compare
20e2a0d to
ef39cbd
Compare

Add a new derive macro for
TaskStoragea replacement forInnerStorageandCachedDataItem, currently it is unused outside of tests.What
storage_schema.rsstorage_schema.rsdefines the layout of our new struct, for each field we specifyfilter_transientwhen encoding (not everything can contain transient data)CachedDataItemTaskFlagsa bitfield to hold some data items as well as 'meta' information like the 'snapshot' and 'restore' bits replacingInnerStorageStateLazyFieldenum, defines tall the fields that we dynamically allocateTaskStoragethe main storage struct, along with basic accessors for all the datatypes (which helps encapsualte storage strategy)TaskStorageAccessorsa trait with default implementations of every accessor which also handlecheck_accesstrack_mutationSerialization and encoding infrastructure
metaordatasubsetsSee https://gist.github.com/lukesandberg/ea35f0e92c1cdeddf80d0498f2978144 for a fully expanded version of the macro
Why
There are a few goals from this redesign of
InnerStoragederivemacro will be easier to maintain than the current mix ofmacro_rulesand derive macros we use forCacheDataItemmatchoperations onCachedDataItemVec<CachedDataItem>anymore and instead can either directly snapshot the storage or encode directly to a buffer. This should eliminate some temporary allocations and should enable a smaller serialization formatinvalidatorandimmutableare now stored as single inline bits reducing lookupcosts and memory for tasks that have these.How
Most of the code was written by Claude with obviously a ton of feedback, so please review carefully. For now all this code is unused but future PRs will integrate it into the backend