feat: DataSHIELD quotas API and command - #53
Merged
Merged
Conversation
Add DataSHIELDQuotaService, wrapping the /service/r/quotas and
/service/r/quota/{id} entry points with the DataSHIELD context: list,
get, add, update and delete a quota, and read the usage of a user or of
the current user.
Expose it as the datashield-quota command, in both the Typer and the
legacy consoles.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
It introduces at least one test that will unexpectedly trigger network-dependent setup in non-integration runs, and the CLI exposes a --fetch option that currently has no effect.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds first-class client + CLI support for managing Opal DataSHIELD R usage quotas via the /service/r/quotas and /service/r/quota/{id} endpoints, and introduces integration tests validating the new service behavior.
Changes:
- Introduces
DataSHIELDQuotaServicewith CRUD operations for quotas plus “usage” reads (current user and specified user). - Exposes a new
datashield-quotacommand in both the Typer console and the legacy argparse console. - Adds integration tests covering quota list/get/add/update/delete and usage endpoints.
File summaries
| File | Description |
|---|---|
| tests/test_datashield.py | Adds tests for the new quotas service (list/get/CRUD/usage + validation). |
| obiba_opal/datashield.py | Implements DataSHIELDQuotaService and legacy-console argument handling/dispatch. |
| obiba_opal/console.py | Registers the new Typer command datashield-quota. |
| obiba_opal/console_legacy.py | Registers the new legacy console subcommand datashield-quota. |
| obiba_opal/commands.py | Adds Typer command wrapper datashield_quota_command. |
| obiba_opal/init.py | Exports DataSHIELDQuotaService from the package top-level API. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Move the quota validation test out of the test class: the class setup builds a real client, which does network I/O, so an unmarked test in it made a "not integration" run depend on the test server. Validation happens before any request is sent, so the test needs no client at all. State in the help of --fetch that fetching is the default action.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add DataSHIELDQuotaService, wrapping the /service/r/quotas and /service/r/quota/{id} entry points with the DataSHIELD context: list, get, add, update and delete a quota, and read the usage of a user or of the current user.
Expose it as the datashield-quota command, in both the Typer and the legacy consoles.