Fix for Use of exit() or quit() - #20
Open
odaysec wants to merge 352 commits into
Open
Conversation
added 30 commits
October 29, 2021 18:46
* Store should re-assign its event-handling methods in its constructor so that they can be called in isolation without reference to self * Fix some warnings relating to keys not being found on the reconciler import. Reconciler is special, in that it returns a function that needs to be called with a HostConfig object. This is our runtime emulation of a bundle/compile-time injection that happens upstream. Talking with Paul, we need to make it so we can import data-only exports like ReactTypeOfMode, without the need for a host config. We'll figure it out next week, but we should be able to run store-test and some of the other self-contained unit tests in the meantime. * Adds Paul's BaseClasses logic, adds test file * LUAFDN-326, LUAFDN-316: Enable support for Profiler, which required fixing bugs (#112) * New test file ReactProfilerDevToolsIntegration. All tests pass, proving integration with a Profiler tool (either Studio for React DevTools) should be very straightforward. * Add DeveloperTools bridge to examples * Add DeveloperTools as a dev_dependency to devtools, so that it can be used in the examples RBXL project to demonstrate connecting to the Roact Inspector / Profiler * Re-fix small bugs in renderering for profiling which were lost due to missing github history * Fix a bug I introduced when making the code typecheck. Upstream doesn't filter out empty string keys, and I'd like to understand why we have that by default. * Since we can't get the generic types, use any? so that void/null scenarios don't require an argument and cause misalignments. * Move DeveloperTools setup into roact-alignment repo to use internal functionality
Problem: In certain games, the top bar was disappearing. https://jira.rbx.com/browse/LUAFDN-715 After a lot of debugging, I eventually found that this was caused by the EmotesMenu unmounting the top bar. It turned out that the top bar and the emotes menu both had the same root! Solution: The cause of this is that it is setmetatable(table, metatable), not setmetatable(metatable, table). Tables that wish to share behaviour but not be the same table need to share a metatable, not be the same table!
…cts being inserted (#248) This doesn't fix the production crash we saw in LUAFDN-692, but it will give us more information to track down the root cause. We get this crash in production: https://console.crashes.rbxinfra.com/p/UniversalApp/debug?fingerprint=a7b1edb8ef4d68db06604a4ec8bc8c16117e5b7f60b91f441ee4de889e15f91c&debug=(%22288330f%22,0,3) Tracing through that, an instance comes out of the map whose alternate's childLanes is nil. childLanes is initialized by default on every Fiber, and is only assigned to from other fiber.childLanes or from bit32.* calls. Lua Apps doesn't directly contain code that matches alternate = or \[.*alternate.*\].*=. This tells me that the alternate is probably not a fiber, but some other kind of table. I think the best bet is to catch when an invalid fiber or invalid fiber.alternate gets puts into the map. I suspect that we'll need to see what the inner component of the RoactRodux Connect component is to fully trace it into Lua Apps. As such, I've put up a draft PR to roact-rodux to try harder to get the inner component name and embed it in the Connect component name: Roblox/roact-rodux#59 If this proves successful in tracking down the bug, we can keep this check in but only in DEV, and submit a PR upstream.
Remove host objects from maps that associate them with other internals so that both the instances and the managers they're associated with can get cleaned up
Closes https://jira.rbx.com/browse/LUAFDN-717 Introduces an additional global to enable only prop type checking. I still need to add tests; I can add some around the checkProps logic itself, but unit testing that wouldn't make sure that it runs during actual element creation via ReactElementValidator.lua. Not sure how to cleanly add tests there.
Includes: * Clean up some unneeded allocations (LUAFDN-694: eliminate unnecessary allocations #241) * Disable non-actionable warnings (LUAFDN-706: Disable warnings and tighten up related behavioral tests #247) * Integrate developer tools injection point (RIDE-5276 Move developer tools setup into roact-alignment #236) * Fix the mysterious vanishing TopBar bug (LUAFDN-715 Fix Mysterious top bar disappearing bug #249) * Add some new error output to track down production issue (LUAFDN-692: Add assertions around the instance map to detect bad objects being inserted #248) * Remove probable memory leak from unreleased host objects (LUAFDN-698: Fix possible memory leak in RobloxComponentProps.lua #244) * A quick little fix for some new analysis errors that show up in the develop version of cli
* Yet another workaround for convert's totally deviant analysis that doesn't align with any shipping product * Workaround a few more analyze errors when all flags are off, just in case something else comes up.
* Switch back to proper semver dependency on jest, but patch the issue we hit in PR #238
Tried turning on DISABLE_ALL_WARNINGS_EXCEPT_PROP_VALIDATION for AvatarExperience tests and it wasn't catching property validation failures. The issue was that we don't use createElementWithValidation even with this true. Checklist before submitting: Added/updated relevant tests Added/updated documentation
Quick update to the statuses of these deviations. We've addressed them all at this point
…-throwing (#254) Closes LUAFDN-723. DUring out flag flip today, there are some very rare cases where an error from the Scheduler isn't getting serialized propery by the backtrace reporter. Manually massage it inline. We have no unit tests for the "real" Scheduler, so I turned on strict mode in the file to try and find bugs (which it did). I did modify some tests that hit the mock scheduler to capture the scenario, though.
More optimizations based on red flamegraph blocks in benchmarks and UIBlox Integration tests. Currently provides a solid 2-4fps uplift in Sierpinski Triangle using roblox-cli 0.5000.5010362 versus current master. (re-nice roblox-cli process, no other windows, took best score out of 10 runs on both master and branch). Tested as far back across the oldest CLI that allows our tests to pass and benchmarks to run (Yes, there are are other questions to ask Luau/systems team, but just focusing on the consistent uplift this branch offers versus master. Very cool to see we were consistently above 100fps from 0.486 to 0.491.) Commandline I used on MacOS: sudo nice -n -10 /tmp/roblox-cli_501/roblox-cli run --load.model tests.project.json --headlessRenderer 1 --run bin/run-sierpinski-triangle-benchmark.lua --fastFlags.allOn --lua.globals __NO_LOADMODULE__=true --lua.globals __YOLO__=true --lua.globals minSamples=1000
First draft of much of the core documentation
This helps us address some issues we encountered in the wild (https://jira.rbx.com/browse/SOCRTC-1885) that suggest that we might not want to inline act in all cases. Ideally we'd always mock the scheduler when we're in a testing context, but that hits some snags with some of our existing tests and is less trivial to address. For now, I want to split up the behavior so it's easier to opt into the parts of it that are needed.
Closes LUAFDN-257 and LUAFDN-728.
Addresses an issue in internal debug builds of the game engine. * Roll back the recursion limit * Bump version * Address a valid new analysis error
… (#265) Closes #264. The current inferred return type for `RoactTree.mount` does not match the param type accepted by `RoactTree.unmount`, leading to analyzer errors when strict mode is enabled. The issue boils down to the key param to mount being of type `string?`. It is later assigned a default string value if `nil` but Luau is not able to update the type of the existing local var from `string?` to `string`. We can work around this with an explicit cast. The return type of mount is also made explicit (reusing the existing `RoactHandle` type).
Remake of #263. Should fix the benchmarking inconsistencies we're seeing due to different GHA hardware getting picked up for different runs.
### Why are the changes being made? Just cleaning up flags that are completely unused in React today. They have no reference anywhere else in the code. ### What changes are being made? - Removes 13 unused feature flags from the `ReactFeatureFlags` module. - Cleans up related test files to eliminate obsolete feature flag references. - Improves maintainability by reducing dead code and configurations. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Adds documentation to the bulk of React's public API for a better editor experience. ### What changes are being made? - Adds detailed documentation comments to most React public APIs in `react-roblox`, covering functions, hooks, and components. - Enhances code readability and editor support with parameter descriptions, return values, and official React API reference links. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Adds documentation to the bulk of React's public API for a better editor experience. ### What changes are being made? - Adds detailed documentation comments to most React public APIs in `react-roblox`, covering functions, hooks, and components. - Enhances code readability and editor support with parameter descriptions, return values, and official React API reference links. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Closes [UIBLOX-3280](https://roblox.atlassian.net/browse/UIBLOX-3280). React stacktraces kinda suck right now. They can be huge and the vast majority of the frames in the stacktrace are from React internal modules. This gets worse the larger the tree is due to React's recursion. This PR: - Introduces a new feature flag for filtering stack frames - Implements a best-effort algorithm for determining if a stack frame is from inside React - Works out the path of known React packages in the datamodel and then checks if the frame is under one of those paths - Does not filter any stack frame if the first stack frame is from inside React (i.e the error originated internally) Before: ``` CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:316: CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:293: ------ Error caught by React ------ Something went very wrong! ------ Error caught by React ------ CorePackages._Workspace.ExampleApp.ExampleApp.someLibraryModule:4 function intentionallyFailingMethod CorePackages._Workspace.ExampleApp.ExampleApp.NameTag:25 function Name CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberHooks.new:3196 function renderWithHooks CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberBeginWork.new:209 function renderWithHooks CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberBeginWork.new:867 function updateFunctionComponent CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberBeginWork.new:3509 function beginWork CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:253 CorePackages._Workspace.Shared.Shared.invokeGuardedCallbackImpl:30 function invokeGuardedCallbackProd CorePackages._Workspace.Shared.Shared.ReactErrorUtils:49 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:3474 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:1972 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:1860 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:1809 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:942 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:858 CorePackages._Workspace.Scheduler.Scheduler.Scheduler:320 CorePackages._Workspace.Scheduler.Scheduler.Scheduler:268 CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:241 function doWork CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:277 function performWorkUntilDeadline ``` After: ``` CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:316: CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:293: ------ Error caught by React ------ Something went very wrong! ------ Error caught by React ------ CorePackages._Workspace.ExampleApp.ExampleApp.someLibraryModule:4 function intentionallyFailingMethod CorePackages._Workspace.ExampleApp.ExampleApp.NameTag:25 function Name ``` ### What changes are being made? - Adds `filterInternalStackFrames` feature flag to exclude React internal stack frames from error traces for improved readability. - Implements `buildStackString` function to construct filtered stack traces by identifying and omitting known React internal modules. - Updates `describeError` to apply stack frame filtering based on the new feature flag while preserving unfiltered errors from React internals. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Closes [UIBLOX-3280](https://roblox.atlassian.net/browse/UIBLOX-3280). React stacktraces kinda suck right now. They can be huge and the vast majority of the frames in the stacktrace are from React internal modules. This gets worse the larger the tree is due to React's recursion. This PR: - Introduces a new feature flag for filtering stack frames - Implements a best-effort algorithm for determining if a stack frame is from inside React - Works out the path of known React packages in the datamodel and then checks if the frame is under one of those paths - Does not filter any stack frame if the first stack frame is from inside React (i.e the error originated internally) Before: ``` CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:316: CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:293: ------ Error caught by React ------ Something went very wrong! ------ Error caught by React ------ CorePackages._Workspace.ExampleApp.ExampleApp.someLibraryModule:4 function intentionallyFailingMethod CorePackages._Workspace.ExampleApp.ExampleApp.NameTag:25 function Name CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberHooks.new:3196 function renderWithHooks CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberBeginWork.new:209 function renderWithHooks CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberBeginWork.new:867 function updateFunctionComponent CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberBeginWork.new:3509 function beginWork CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:253 CorePackages._Workspace.Shared.Shared.invokeGuardedCallbackImpl:30 function invokeGuardedCallbackProd CorePackages._Workspace.Shared.Shared.ReactErrorUtils:49 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:3474 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:1972 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:1860 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:1809 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:942 CorePackages._Workspace.ReactReconciler.ReactReconciler.ReactFiberWorkLoop.new:858 CorePackages._Workspace.Scheduler.Scheduler.Scheduler:320 CorePackages._Workspace.Scheduler.Scheduler.Scheduler:268 CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:241 function doWork CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:277 function performWorkUntilDeadline ``` After: ``` CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:316: CorePackages._Workspace.Scheduler.Scheduler.forks.SchedulerHostConfig.default:293: ------ Error caught by React ------ Something went very wrong! ------ Error caught by React ------ CorePackages._Workspace.ExampleApp.ExampleApp.someLibraryModule:4 function intentionallyFailingMethod CorePackages._Workspace.ExampleApp.ExampleApp.NameTag:25 function Name ``` ### What changes are being made? - Adds `filterInternalStackFrames` feature flag to exclude React internal stack frames from error traces for improved readability. - Implements `buildStackString` function to construct filtered stack traces by identifying and omitting known React internal modules. - Updates `describeError` to apply stack frame filtering based on the new feature flag while preserving unfiltered errors from React internals. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Closes [UIBLOX-3163](https://roblox.atlassian.net/browse/UIBLOX-3163). Updates DevTools to use the new user-space WebSocket API that's developer-accessible in Studio. This unblocks a couple of internal teams adopting DevTools, and will allow the wider community to use it as well. This change is flagged behind `ReactDevtoolsUseHttpWebStream` because I'd like to get it out sooner rather than later, but releasing it without waiting a few weeks will probably break some internal workflows (e.g. people on an outdated version of studio). Once the new API has been live for a month or so I'll come back and clean up the flag. ### What changes are being made? - Updates DevTools to use `HttpService:CreateWebStreamClient` and renders GUI in `Players.LocalPlayer.PlayerGui` with adjusted `App.lua` GUI properties for user-space compatibility. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Closes [UIBLOX-3163](https://roblox.atlassian.net/browse/UIBLOX-3163). Updates DevTools to use the new user-space WebSocket API that's developer-accessible in Studio. This unblocks a couple of internal teams adopting DevTools, and will allow the wider community to use it as well. This change is flagged behind `ReactDevtoolsUseHttpWebStream` because I'd like to get it out sooner rather than later, but releasing it without waiting a few weeks will probably break some internal workflows (e.g. people on an outdated version of studio). Once the new API has been live for a month or so I'll come back and clean up the flag. ### What changes are being made? - Updates DevTools to use `HttpService:CreateWebStreamClient` and renders GUI in `Players.LocalPlayer.PlayerGui` with adjusted `App.lua` GUI properties for user-space compatibility. --- - [x] AI-assisted summary reviewed and verified by author
As mentioned in #488 we noticed that the rotriever version used in the repo is so old that one of the bugs in it was causing non-publish packages to become published. This PR bumps the rotriever version to pull in any more modern bugfixes and features :)
As mentioned in #488 we noticed that the rotriever version used in the repo is so old that one of the bugs in it was causing non-publish packages to become published. This PR bumps the rotriever version to pull in any more modern bugfixes and features :)
While working on publishing this repo to the Creator Store, I noticed that some `publish = true` packages depend on the following `publish = false` packages: - `modules/react-noop-renderer` - `modules/scheduler` - `modules/shared` This breaks our Creator Store publishing workflow as we assume `publish = false` packages should not be included in the final build, but depending on them from a `publish = true` package conflicts with this. Furthermore, it turns out the rotriever version used in this repo is old enough that this setting isn't respected anyway, so all of the nonpublish packages are, in fact, published: https://rotriever.simulprod.com/package/Shared So this PR removes the `publish = false` declarations from the rotriever TOMLs since they aren't doing anything (except breaking our automation!) and don't seem to make sense anyway given they're publicly depended upon. It is better to have these TOMLs reflect their actual behaviour so that rotriever can be safely updated in the future without stopping updates from being pushed to the registry.
While working on publishing this repo to the Creator Store, I noticed that some `publish = true` packages depend on the following `publish = false` packages: - `modules/react-noop-renderer` - `modules/scheduler` - `modules/shared` This breaks our Creator Store publishing workflow as we assume `publish = false` packages should not be included in the final build, but depending on them from a `publish = true` package conflicts with this. Furthermore, it turns out the rotriever version used in this repo is old enough that this setting isn't respected anyway, so all of the nonpublish packages are, in fact, published: https://rotriever.simulprod.com/package/Shared So this PR removes the `publish = false` declarations from the rotriever TOMLs since they aren't doing anything (except breaking our automation!) and don't seem to make sense anyway given they're publicly depended upon. It is better to have these TOMLs reflect their actual behaviour so that rotriever can be safely updated in the future without stopping updates from being pushed to the registry.
### Why are the changes being made? Updates the documentation site to use the new `react-luau.dev` URL. ### What changes are being made? - Updates `mkdocs.yml` site metadata (site name, URL, repo) and fixes `nav` indentation for nested pages. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Updates the documentation site to use the new `react-luau.dev` URL. ### What changes are being made? - Updates `mkdocs.yml` site metadata (site name, URL, repo) and fixes `nav` indentation for nested pages. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Updates the error message when a component yields in DEV mode to more clearly explain the error and point the user towards the doc on yielding. ### What changes are being made? - Updates DEV no-yield error in `NoYield.lua` to multi-line; explains yields stall scheduler and links `go/react-yield-error` --- - [ ] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Updates the error message when a component yields in DEV mode to more clearly explain the error and point the user towards the doc on yielding. ### What changes are being made? - Updates DEV no-yield error in `NoYield.lua` to multi-line; explains yields stall scheduler and links `go/react-yield-error` --- - [ ] AI-assisted summary reviewed and verified by author
Implements react/react#21039 on our codebase. Creates a new deleted tree clean up level with three distinct levels. Facebook did an experiment and found level 3 to be the best, we should do the same and see whether the existing path, 1, 2, or 3 is the best.
Implements react/react#21039 on our codebase. Creates a new deleted tree clean up level with three distinct levels. Facebook did an experiment and found level 3 to be the best, we should do the same and see whether the existing path, 1, 2, or 3 is the best.
Rotriever requires readmes for publishing now. Added stubs.
Rotriever requires readmes for publishing now. Added stubs.
lute versions was too old, foreman couldn't even see it https://github.com/Roblox/roact-alignment/actions/runs/23354471638/job/67941642914 Checklist before submitting: * [ ] Added/updated relevant tests * [ ] Added/updated documentation
lute versions was too old, foreman couldn't even see it https://github.com/Roblox/roact-alignment/actions/runs/23354471638/job/67941642914 Checklist before submitting: * [ ] Added/updated relevant tests * [ ] Added/updated documentation
Adds a more comprehensive Wally exclude list and bumps the version number for the use of other packages.
## Summary - Add runtime scheduler config fields for desired and minimum frame rates. - Reset scheduler frame budget state when those frame-rate overrides change. - Bump the workspace Rotriever patch version for the Scheduler package change. ## Test plan - ReadLints on `modules/scheduler/src/forks/SchedulerHostConfig.default.lua` and `rotriever.toml`. Made with [Cursor](https://cursor.com) ---------
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
exitandquit"functions" are actuallysite.Quitterobjects and are loaded, at interpreter start up, from site. However, if the interpreter is started with the -S flag, or a custom site is used then exit and quit may not be present. In thisexit()is used and will fail if the interpreter is passed the -S option.Use
sys.exit(1)instead ofexit(1)in this script.sys.exitis always available after importingsys(already imported at line 17), and is the correct non-interactive termination API. Best fix in this snippet: update the three shown occurrences in argument parsing error branches (lines 63, 72, and 81) fromexit(1)tosys.exit(1).Checklist before submitting: