-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve extension loading state and starting #554
Merged
Merged
Conversation
This file contains 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
luismiramirez
approved these changes
Jan 19, 2022
3 tasks
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
tombruijn
force-pushed
the
extension-loading
branch
from
January 19, 2022 09:56
24ac4f9
to
de7b0d4
Compare
Rebased on PR #558 because the failure scenario tests were not run. |
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
tombruijn
force-pushed
the
fix-ci-test-failures
branch
from
January 19, 2022 10:08
908d079
to
5a0eef9
Compare
tombruijn
force-pushed
the
extension-loading
branch
from
January 19, 2022 10:08
de7b0d4
to
8fdd435
Compare
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
tombruijn
force-pushed
the
fix-ci-test-failures
branch
from
January 19, 2022 10:15
5a0eef9
to
6e041c4
Compare
tombruijn
force-pushed
the
extension-loading
branch
from
January 19, 2022 10:16
8fdd435
to
0af3a90
Compare
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
luismiramirez
approved these changes
Jan 19, 2022
## The problem The `Extension`'s '`isLoaded` attribute was only set when the extension's `start` function was called. This made it difficult to determine if the extension was really loaded in the app or not, without starting the extension first. This made it necessary to start the extension in scenarios where we need to call extension functions without needing to starting it first, such as in the diagnose command. Calling `Extension`'s `start` doesn't change any state in the extension that needs to be set before any other function can be called. I think it was written this way as a way to communicate loading issues. A better name for this attribute would have been `isRunning`, but this is not something we have to track. ## Solution Update how the `isLoaded` is set, by checking if the extension was loaded into the app or not on load, not just when `start` is called. I've chosen to communicate this with an export from the extension wrapper, rather than if the start function returns an error or not. Since the value doesn't change at runtime it's now a static attribute of the class. I've removed the `isLoaded` return values from the extension's `start` and `stop` function, these are unused. ## About the error thrown by `start` I've left the `Extension`'s `start` function intact to print an error when called and the extension isn't loaded. In other integrations we print this on load of the extension. I suspect this was done on start, so that it wouldn't always be printed on unsupported Operating Systems. We may want to revisit this, or find another way to not print this all the time for those systems. ## Only start extension when its loaded and active Do not automatically start the extension when its initialized, but do this from the client like in all the other integrations. This also makes it easier to initialize the `Extension` class for other uses, like the diagnose without having to worry about the active state or not. Closes #551
tombruijn
force-pushed
the
extension-loading
branch
from
January 19, 2022 10:25
0af3a90
to
56fb794
Compare
tombruijn
added a commit
that referenced
this pull request
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
jeffkreeftmeijer
approved these changes
Jan 19, 2022
As reported in #556, when the extension is not installed or fails to load, calls to certain extension functions will fail. The issue mentions the `runningInContainer` broken being broken on the main branch. PR #554 also removes some safety checks that cause the same issue for the `diagnoseRaw` function. Those safety checks were removed because they did not what expected, tracking if the extension was running or not. For both functions I've implemented a no-operations function. This will fix any errors on calls to these functions. Other functions that call these functions need to handle receiving no return value. Part of #556, but doesn't fix it entirely. We should call more function calls. These ones were the most obvious ones. Based on PR #554.
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 problem
The
Extension
's 'isLoaded
attribute was only set when theextension's
start
function was called. This made it difficult todetermine if the extension was really loaded in the app or not, without
starting the extension first.
This made it necessary to start the extension in scenarios where we need
to call extension functions without needing to starting it first, such
as in the diagnose command.
Calling
Extension
'sstart
doesn't change any state in the extensionthat needs to be set before any other function can be called. I think it
was written this way as a way to communicate loading issues. A better
name for this attribute would have been
isRunning
, but this is notsomething we have to track.
Solution
Update how the
isLoaded
is set, by checking if the extension wasloaded into the app or not on load, not just when
start
is called.I've chosen to communicate this with an export from the extension
wrapper, rather than if the start function returns an error or not.
Since the value doesn't change at runtime it's now a static attribute of
the class.
I've removed the
isLoaded
return values from the extension'sstart
and
stop
function, these are unused.About the error thrown by
start
I've left the
Extension
'sstart
function intact to print an errorwhen called and the extension isn't loaded. In other integrations we
print this on load of the extension. I suspect this was done on start,
so that it wouldn't always be printed on unsupported Operating Systems.
We may want to revisit this, or find another way to not print this all
the time for those systems.
Only start extension when its loaded and active
Do not automatically start the extension when it's initialized, but do
this from the client like in all the other integrations. This also makes
it easier to initialize the
Extension
class for other uses, like thediagnose without having to worry about the active state or not.
Closes #551