Skip to content

feat: DataSHIELD quotas API and command - #53

Merged
ymarcon merged 2 commits into
masterfrom
feat/datashield-quotas
Sep 9, 2026
Merged

ymarcon merged 2 commits into
masterfrom
feat/datashield-quotas

Conversation

@ymarcon

@ymarcon ymarcon commented Sep 9, 2026

Copy link
Copy Markdown
Member

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.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 DataSHIELDQuotaService with CRUD operations for quotas plus “usage” reads (current user and specified user).
  • Exposes a new datashield-quota command 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.

Comment thread tests/test_datashield.py Outdated
Comment thread obiba_opal/commands.py Outdated
Comment thread obiba_opal/datashield.py
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.
@ymarcon
ymarcon merged commit 92fd7eb into master Sep 9, 2026
8 checks passed
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