Skip to content

feat: Share runs via Python SDK#667

Open
dima-aignostics wants to merge 15 commits into
mainfrom
feat/PYSDK-132-add-run-sharing-to-python-sdk
Open

feat: Share runs via Python SDK#667
dima-aignostics wants to merge 15 commits into
mainfrom
feat/PYSDK-132-add-run-sharing-to-python-sdk

Conversation

@dima-aignostics

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 4, 2026 11:10
@dima-aignostics dima-aignostics requested a review from a team as a code owner June 4, 2026 11:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to add “run sharing” capabilities to the Python SDK by introducing access-control resource wrappers (grants + share tokens), wiring them into the platform client, and exposing sharing workflows through the application service and CLI.

Changes:

  • Added new access-control resource layer (AccessGrant, ShareToken, ShareTokens) and new Run helpers (list_share_grants, grant_access).
  • Added new application service + CLI commands under run share ... to list/grant/revoke access and manage share tokens.
  • Regenerated codegen artifacts/docs for updated API parameters (e.g., grants relation filter, additional run filters, run organization_id field).

Reviewed changes

Copilot reviewed 8 out of 61 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
src/aignostics/platform/resources/access.py New access-control resource models and share-token listing/creation logic.
src/aignostics/platform/resources/runs.py Adds run-level grant listing/creation helpers with caching/retry integration.
src/aignostics/platform/_client.py Exposes a share_tokens resource on Client.
src/aignostics/application/_service.py Adds service methods for run sharing and token management.
src/aignostics/application/_cli.py Adds run share ... CLI command group.
tests/aignostics/platform/resources/access_test.py Unit tests for access resources.
tests/aignostics/platform/resources/run_sharing_test.py Unit tests for run-sharing workflows (currently mismatched with implementation).
codegen/in/openapi.json + codegen/out/** Codegen updates reflecting API spec changes.

Comment thread src/aignostics/platform/resources/access.py
Comment thread src/aignostics/platform/resources/access.py
Comment thread src/aignostics/platform/resources/access.py Outdated
Comment thread src/aignostics/platform/resources/runs.py
Comment thread src/aignostics/platform/resources/runs.py Outdated
Comment thread src/aignostics/platform/_client.py Outdated
Comment thread src/aignostics/platform/resources/access.py Outdated
Comment thread tests/aignostics/platform/resources/run_sharing_test.py
Comment thread tests/aignostics/platform/resources/access_test.py Outdated
Comment thread src/aignostics/platform/resources/runs.py
@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.16084% with 31 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/aignostics/application/_service.py 71.79% 22 Missing ⚠️
src/aignostics/platform/resources/access.py 88.33% 7 Missing ⚠️
src/aignostics/application/_cli.py 98.48% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/aignostics/platform/_client.py 93.18% <100.00%> (+0.15%) ⬆️
src/aignostics/platform/resources/runs.py 85.41% <100.00%> (+0.74%) ⬆️
src/aignostics/application/_cli.py 77.79% <98.48%> (+2.24%) ⬆️
src/aignostics/platform/resources/access.py 88.33% <88.33%> (ø)
src/aignostics/application/_service.py 62.12% <71.79%> (-2.88%) ⬇️

... and 6 files with indirect coverage changes

Copilot AI review requested due to automatic review settings June 4, 2026 14:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 61 changed files in this pull request and generated 20 comments.

Comment thread src/aignostics/platform/resources/access.py Outdated
Comment thread src/aignostics/platform/resources/access.py Outdated
Comment thread src/aignostics/platform/resources/runs.py Outdated
Comment thread src/aignostics/platform/resources/runs.py
Comment thread src/aignostics/platform/resources/runs.py Outdated
Comment thread src/aignostics/application/_cli.py
Comment thread tests/aignostics/platform/resources/access_test.py Outdated
Comment thread tests/aignostics/platform/resources/access_test.py Outdated
Comment thread tests/aignostics/platform/resources/access_test.py Outdated
Comment thread tests/aignostics/platform/resources/access_test.py Outdated
Copilot AI review requested due to automatic review settings June 4, 2026 18:45
dima-aignostics and others added 6 commits June 4, 2026 20:47
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Wraps the create_grant API call in a Retrying block with exponential
backoff and jitter, consistent with list_share_grants and other methods.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… grants

- Add --expires-at option to `application run share token create` CLI command;
  accepts ISO 8601 string, defaults to UTC if no timezone given
- Add expires_at parameter to Service.application_run_create_share_token()
- Promote organization_id from --option to positional [ORGANIZATION_ID] argument
  in both `share organization grant` and `share organization revoke` commands
- Add organization_id parameter to application_run_unshare_with_organization()
  so revoke filters grants by org (defaults to authenticated user's own org)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 61 changed files in this pull request and generated 9 comments.

Comment thread src/aignostics/platform/resources/access.py
Comment thread src/aignostics/platform/resources/runs.py
Comment thread src/aignostics/platform/resources/runs.py Outdated
Comment thread src/aignostics/platform/resources/runs.py Outdated
Comment thread src/aignostics/application/_service.py
Comment thread src/aignostics/application/_service.py
Comment thread src/aignostics/application/_service.py Outdated
Comment thread src/aignostics/application/_cli.py Outdated
Comment thread src/aignostics/platform/resources/access.py
@dima-aignostics dima-aignostics force-pushed the feat/PYSDK-132-add-run-sharing-to-python-sdk branch from 3bbec8d to 1131c91 Compare June 4, 2026 18:53
Copilot AI review requested due to automatic review settings June 4, 2026 18:55
@dima-aignostics dima-aignostics force-pushed the feat/PYSDK-132-add-run-sharing-to-python-sdk branch from 1131c91 to fa0f3b9 Compare June 4, 2026 18:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 63 changed files in this pull request and generated 7 comments.

Comment thread src/aignostics/platform/resources/access.py Outdated
Comment thread src/aignostics/platform/resources/runs.py
Comment thread src/aignostics/platform/resources/runs.py
Comment thread src/aignostics/application/_service.py Outdated
Comment thread src/aignostics/application/_service.py
Comment thread src/aignostics/application/_service.py Outdated
Comment thread src/aignostics/application/_cli.py
@dima-aignostics dima-aignostics force-pushed the feat/PYSDK-132-add-run-sharing-to-python-sdk branch from fa0f3b9 to c4e64be Compare June 4, 2026 19:26
Copilot AI review requested due to automatic review settings June 5, 2026 13:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 64 changed files in this pull request and generated 4 comments.

Comment thread src/aignostics/platform/resources/access.py
Comment thread src/aignostics/application/_cli.py
Comment thread src/aignostics/application/_service.py
Comment thread src/aignostics/application/_cli.py Outdated
- Add 34 integration tests covering all run share CLI subcommands
  (status, org list/grant/revoke, token list/create/revoke) including
  success, not-found, and error paths with both text and JSON output
- Add 15 unit tests for the 6 new service sharing methods
- Fix ShareTokens.list() cache key isolation bug: run_id was captured
  from closure scope and not included in the @cached_operation key,
  causing queries for different run IDs to share cache entries
- Fix --expires-at Z suffix parsing: remove unnecessary
  .replace("Z", "+00:00") workaround since Python ≥ 3.11 handles the
  Z UTC designator natively in datetime.fromisoformat()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 08:01
@dima-aignostics dima-aignostics force-pushed the feat/PYSDK-132-add-run-sharing-to-python-sdk branch from ffa17dc to ece8b91 Compare June 8, 2026 08:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 66 changed files in this pull request and generated 4 comments.

Comment thread src/aignostics/application/_cli.py
Comment thread src/aignostics/application/_cli.py Outdated
Comment thread src/aignostics/application/_service.py
Comment thread src/aignostics/application/_service.py Outdated
- Fix extra space before colon in share-with-organization error message
- Fix docstring for application_run_revoke_share_token: NotFoundException
  is raised when the share token is not found, not the run
- Fix run_share_token_revoke CLI handler to print the exception message
  instead of a hardcoded "Run ... not found" string, so users see the
  correct context (token ID not found vs run ID not found)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 08:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 66 changed files in this pull request and generated 4 comments.

Comment thread src/aignostics/application/_cli.py
Comment thread src/aignostics/platform/resources/access.py
Comment thread src/aignostics/platform/resources/access.py
Comment thread src/aignostics/application/_service.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 8, 2026 09:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 66 changed files in this pull request and generated 1 comment.

Comment thread src/aignostics/application/_cli.py
dima-aignostics and others added 3 commits June 8, 2026 11:23
application_run_revoke_share_token now finds the SHARE_TOKEN grant
on the specific run and revokes that grant, leaving the token itself
intact for any other runs it may be shared with.

Raises NotFoundException when no grant for the token exists on the run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GrantReadResponse carries these three fields but AccessGrant was
silently dropping them. Adding them lets callers (e.g. ShareToken.
list_share_grants()) inspect which resource a grant applies to and
who created it, without having to go back to the raw codegen model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 8, 2026 09:26
@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 66 changed files in this pull request and generated 3 comments.

Comment thread src/aignostics/platform/resources/access.py
Comment thread src/aignostics/platform/resources/access.py
Comment thread codegen/in/openapi.json
@arne-aignx

Copy link
Copy Markdown
Collaborator

Code changes LGTM considering the style of the codebase.

Some blockers:

  • Hard blocker: The required QMS artifacts outlined in the Change Request are missing
  • Soft blocker: We might want to pull the version bumps into another branch to avoid conflicts.

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.

3 participants