fix(core): cached Lazys use the Box API internally#37889
Conversation
|
👋 It looks like your PR description follows the template but is missing a valid issue number in the first section. PRs without a linked issue will receive lower priority for review and merging. Please update the description to include a reference like |
Lazy now uses the Box API internally
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Lazy now uses the Box API internallyLazys now use the Box API internally
Lazys now use the Box API internallyLazys use the Box API internally
8565bff to
7d83d36
Compare
Refactor LazyBase to extend State from the Box API, making all Lazy tokens pass Box.isBox(). This enables PropertyAssignmentMetadataWriter to detect Lazy tokens and allows Lazy values to participate in the Box derive/combine ecosystem. Export State and BaseReadableBox from box.ts. Add Box.empty() factory. Add tests verifying Lazy tokens are boxes with correct resolve, derive, and caching behavior.
7d83d36 to
96ba2cd
Compare
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status
This pull request spent 1 hour 21 minutes 24 seconds in the queue, including 39 minutes 30 seconds running CI. Required conditions to merge
|
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
N/A
Reason for this change
We don't want multiple deferred value APIs that behave differently. With this change,
Lazyacts as a backwards-compatible user-facing front, but internally it's all Box API. One resolution mechanism, one set of behaviors.Description of changes
Introduces
LazyBox, aReadonlyStatewrapper that makes cached Lazy tokens participate in the Box ecosystem. Cached Lazy methods (Lazy.string(),Lazy.number(),Lazy.list(),Lazy.any()) now return aLazyBoxthat passesBox.isBox()and supportsderive()andgetStackTraces().Uncached Lazy methods remain unchanged — they depend on resolution context and cannot be boxes (at least for now).
Splits
ReadonlyStateout ofStateinbox.tsto provide an immutable base forLazyBox.Describe any new or updated permissions being added
N/A
Description of how you validated changes
Added tests in
boxes.test.tsverifying that cached Lazy variants are boxes and uncached variants are not. Tests coverBox.isBox(),resolve(),derive(), and caching semantics. All existing tests (including nested-stack) continue to pass.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license