Skip to content

Conversation

@rrama
Copy link
Contributor

@rrama rrama commented Jan 12, 2026

So we don't need to make API calls every time someone sets the org to "", e.g. on a cloned configuration.

Required for snyk/snyk-ls#1115

So we don't need to make API calls every time someone sets the org to "", e.g. on a cloned configuration.
@snyk-io
Copy link

snyk-io bot commented Jan 12, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-io
Copy link

snyk-io bot commented Jan 12, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@rrama rrama marked this pull request as ready for review January 12, 2026 13:10
@rrama rrama requested review from a team as code owners January 12, 2026 13:10
ORGANIZATION_SLUG string = "internal_org_slug" // ORGANIZATION_SLUG (string) returns the slug of the organization and correlates to the ORGANIZATION ID.
ORGANIZATION string = "org" // ORGANIZATION (string) sets/returns the Organization ID
ORGANIZATION_SLUG string = "internal_org_slug" // ORGANIZATION_SLUG (string) returns the slug of the organization and correlates to the ORGANIZATION ID.
DEFAULT_ORGANIZATION string = "default_org" // DEFAULT_ORGANIZATION (string) returns the default Organization ID, as specified for the user in the web UI.
Copy link
Contributor

@PeterSchafer PeterSchafer Jan 12, 2026

Choose a reason for hiding this comment

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

Question: Is it really globally relevant to access this value? Otherwise if this is required for some sub functionality, I would recommend to register it close to the functionality. The reason I'm asking is that I'm worried users get confused between ORGANIZATION and DEFAULT_ORGANIZATION. So far DEFAULT_ORGANIZATION was not required by any extension or other GAF consumer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We would also want it in LS so we can replace this awful code I wrote while under a time crunch: https://github.com/snyk/snyk-ls/blob/main/domain/ide/command/folder_handler.go#L166
I realised we only need to compare the org Id and now slug, so if I can just query the default org and compare OR have a function in GAF I can call to check if an org Id is the default org Id, then that would be great.

Copy link
Contributor

Choose a reason for hiding this comment

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

have a function in GAF I can call to check if an org Id is the default org Id

This sounds like great a small impact byproduct of the logic that is already available. So if we can reduce the amount of code we add and even reduce the possibility for incorrect usage, I would say it is a win for everyone.

Comment on lines +100 to +105
callback := func(_ configuration.Configuration, existingValue interface{}) (interface{}, error) {
// TODO - This function uses the outer (global) config and network access, so will not respect values set in the closures' (potentially cloned) configs.
existingString, ok := existingValue.(string)
if existingValue != nil && ok && len(existingString) > 0 {
return existingString, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

curious when do we invalidate ?
I think we should invalidate cache on token change and api endpoint

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.

4 participants