fix(experiments): provide required_scope
for experiments API
#23385
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.
Problem
This user: https://posthoghelp.zendesk.com/agent/tickets/14932 had an issue where they weren't able to call one of our Public API endpoints. Turns out, we never enabled the appropriate
required_scope
for that endpoint, so it kept failing. I don't know of any reason why we shouldn't allow users to hit this endpoint, so I went with the approach of just enabling the experiments:*required_scope
, but if we don't support these endpoints, I feel like we should call that out in our docs/not make them available. IMO this was just an oversight on our part when enabling our API token scopes.In draft mode for now while I confirm that this is the correct approach. I should probably add some tests for this behavior as well, but I'm also not exactly sure where to put tests that encode this type of knowledge (i.e. which scopes should be enabled for which endpoint).
How did you test this code?
Manually tested all of these endpoints locally and they all worked as expected.