Skip to content

GET request for multiple score sets#683

Open
jstone-dev wants to merge 2 commits intorelease-2026.1.2from
score-set-batch-request
Open

GET request for multiple score sets#683
jstone-dev wants to merge 2 commits intorelease-2026.1.2from
score-set-batch-request

Conversation

@jstone-dev
Copy link
Collaborator

This pull request introduces a new API endpoint for fetching multiple score sets by a comma-separated list of URNs, along with comprehensive tests to verify its behavior. The changes enhance the flexibility of the score set retrieval functionality and improve validation and error handling.

New API endpoint for batch score set retrieval:

  • Added show_score_sets endpoint to score_sets.py that allows fetching multiple score sets via a comma-separated urns query parameter. The endpoint validates input, enriches experiment data, and returns a list of score sets.

Testing enhancements for new functionality:

  • Added tests to verify successful retrieval of multiple score sets by URN, input validation requiring at least one URN, and correct handling of mixed valid and invalid URNs (returns 404 for missing URNs).
  • Included tests to ensure whitespace around URNs is handled correctly and does not affect validation or error reporting.

@jstone-dev jstone-dev requested a review from bencap March 18, 2026 17:44
Copy link
Collaborator

@bencap bencap left a comment

Choose a reason for hiding this comment

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

Thanks @jstone-dev, looks good. Although I know it's covered by existing tests for fetch_score_set_by_urn, I think guaranteeing permission checks are working at the level of each endpoint is important enough to warrant the duplication. Could you please be able to add a few auth tests?

  • anonymous users can fetch public score sets
  • anonymous users cannot fetch private score sets
  • authenticated users can fetch private score sets
  • mixed private/public requests fail w/ 404

Just don't want us to refactor the endpoint away from the auth safety of fetch_score_set_by_urn at some point and not have the tests in place to catch it.

@jstone-dev
Copy link
Collaborator Author

Thanks; I added five new API-level authorization unit tests.

Copy link
Collaborator

@bencap bencap left a comment

Choose a reason for hiding this comment

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

Looks great, save one test that was probably copy/pasted. We can merge this in once we either remove it or alter the logic to test the contributor logic of this endpoint.

assert f"score set with URN '{private_score_set['urn']}' not found" in response.json()["detail"]


def test_can_add_contributor_in_both_experiment_and_score_set(session, client, setup_router_db):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one looks like it wasn't updated from the original test it was pulled from.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is actually a previously-existing test; I reordered the tests a little because the existing "get score set" tests were interrupted by these contributor tests, and I wanted to group them together in order to have a good place for the new tests. I think moving the contributor tests made the diff look more confusing than it actually is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh ok, sorry I didn't realize! Looks good in that case.

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