Skip to content

Conversation

@parameja1
Copy link
Contributor

Problem

With updating Toolkit version to latest in SMUS CodeEditor Spaces, observing Toolkit throws an error as attached in screenshot below with error message

Attempted to get compute region without initializing
image

Solution

  • Get Compute Region seems to be invoked first before Initializing compute region is called

  • hence solution is to start the async operation of initialize compute region in the background and set a default value, immediately to prevent future calls from throwing error in order to not fail the toolkit extension activation

  • Tested with a local debug artifact in SMUS CodeEditor space, toolkit activation completed and working

  • image

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.

  • Your code changes must meet the guidelines in CONTRIBUTING.md.

  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@parameja1 parameja1 requested a review from a team as a code owner June 18, 2025 23:28
@github-actions
Copy link

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.


export function getComputeRegion(): string | undefined {
if (computeRegion === notInitialized) {
throw new Error('Attempted to get compute region without initializing.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By removing this, you are hiding a problem.

The error exists to ensure that order-of-operations is correct. After your change, that guarantee will no longer be possible.

It seems convenient now, but is a short-term solution with long-term consequences.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the question, though the Error is removed in terms of order-of-operations the above implementation ensures initializeComputeRegion is being called within getComputeRegion to handle case where user may not set it correctly. Also default region being set follows same logic from initializeComputeRegion

  • curious why not handle initialize region within get call above?

@parameja1 parameja1 closed this Jul 2, 2025
@parameja1
Copy link
Contributor Author

CR closed to address the issue with a different approach as suggested in the comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants