chore(backend): Organization takes precedence over personal account in organization sync options. #4320
+29
−23
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.
What changed?
This change makes organization URL patterns take precedence over personal account patterns in the new OrganizationSync handshake options.
Why now?
Initially, we didn't have a strong argument for which option should have precedence. Now, a use-case has become clear! If a fixed prefix is going to be present in a URL, we think it's more likely that it will be in org-indicating URLs and not personal-account-indicating URLs.
E.g. the following pattern:
/orgs/myorg/settings
<- Fixed prefix "orgs" implies "mygreatorg" is active/settings
<- Absence of prefix implies that the personal account is activeWill occur more often than:
/me/settings
<- Fixed prefix "me" indicates that the personal account is active/mygreatorg/settings
<- Absence of fixed prefix implies an organization is activeThis is relevant because it's easiest to have the activatible entity type (org or personal account) with a fixed prefix take presedence, so that the other can wildcard match all routes.
For example, for an app using the first pattern, they could use the following middleware options:
E.g. letting the personal account match everything that does not have the org prefix.
Is this a breaking change?
Technically yes, but this feature was introduced early this week, and has not yet been documented or formally announced, so I don't expect it to be in use yet, much less for anyone to be depending on this nuance yet.
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change