-
Notifications
You must be signed in to change notification settings - Fork 547
Make failProxy fail on unrecognized properties #24460
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: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in the failProxy implementation by throwing an error on unrecognized property accesses rather than returning a truthy object. It also updates test data in several test files to include properties (e.g. disposed and setConnectionState) needed to trigger intended behavior for boolean properties.
- Updated the failProxy and failSometimeProxy implementations to throw an error.
- Modified test fixtures in BlobManager, blobHandles, and loader tests to include new properties.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/runtime/container-runtime/src/test/blobManager.stashed.spec.ts | Changed failProxy behavior from recursion to throwing an error. |
packages/runtime/container-runtime/src/test/blobHandles.spec.ts | Similar update to failProxy to throw an error. |
packages/loader/container-loader/src/test/loaderLayerCompatValidation.spec.ts | Added disposed and setConnectionState properties to test setup. |
packages/loader/container-loader/src/test/loader.spec.ts | Added disposed and setConnectionState properties to test setup. |
packages/loader/container-loader/src/test/failProxy.ts | Updated failProxy to throw an error instead of recurring. |
Comments suppressed due to low confidence (5)
packages/loader/container-loader/src/test/loaderLayerCompatValidation.spec.ts:242
- Verify that the added 'disposed' flag and 'setConnectionState' function in the test setup are properly covered in assertions, ensuring they align with the expected behavior in updated tests.
disposed: false,
packages/loader/container-loader/src/test/loader.spec.ts:65
- Ensure the new properties 'disposed' and 'setConnectionState' in the loader test expectations are validated against the actual runtime behavior.
disposed: false,
packages/runtime/container-runtime/src/test/blobManager.stashed.spec.ts:31
- Replacing the recursive call with a thrown error prevents misinterpretation of unrecognized boolean properties; please confirm that all related tests are updated to expect an exception.
throw new Error(`${p.toString()} not implemented`);
packages/runtime/container-runtime/src/test/blobHandles.spec.ts:28
- Ensure that throwing an error for unrecognized properties in the proxy is intentionally consistent with the new failProxy behavior across tests.
throw new Error(`${p.toString()} not implemented`);
packages/loader/container-loader/src/test/failProxy.ts:27
- Confirm that the updated error throwing in failProxy is the intended fallback and that any callers expecting a proxy object are updated accordingly.
throw new Error(`${p.toString()} not implemented`);
Guessing this was the original intent and just a bug. Otherwise it returns an object on unrecognized properties, which is particularly bad for boolean properties since it looks truthy. E.g. notably it was sending loader.spec.ts down the
disposed == true
paths which probably wasn't intended.