Skip to content

chore(xtest): adds otdf-sdk-mgr tool for otdf client binary mgmt#410

Open
dmihalcik-virtru wants to merge 16 commits intoopentdf:mainfrom
dmihalcik-virtru:feat/otdf-sdk-mgr
Open

chore(xtest): adds otdf-sdk-mgr tool for otdf client binary mgmt#410
dmihalcik-virtru wants to merge 16 commits intoopentdf:mainfrom
dmihalcik-virtru:feat/otdf-sdk-mgr

Conversation

@dmihalcik-virtru
Copy link
Member

@dmihalcik-virtru dmihalcik-virtru commented Feb 13, 2026

Summary

  • Update setup-cli-tool/action.yaml with artifact installation support
    • Prefer using artifacts when available for a given tag
    • Fallback to build from source if artifact installation fails (e.g. package unavailable)
  • Add new otdf-sdk-mgr Python package for SDK version resolution, artifact installation, and checkout
  • Refactor shell scripts to thin wrappers delegating to otdf-sdk-mgr
  • Update CI workflows with step IDs, conditional if guards for SDK build steps, and otdf-sdk-mgr version resolution
  • Add "Lint otdf-sdk-mgr" step to CI check workflow
  • Add SDK Configuration section to AGENTS.md

Parent PRs

Test plan

  • cd otdf-sdk-mgr && uv sync && uv run ruff check . && uv run ruff format --check . && uv run pyright
  • shfmt -d . clean
  • CI YAML valid

🤖 Generated with Claude Code

Part of stacked PR series decomposing chore/the-claudiest-day-tmux

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dmihalcik-virtru, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant overhaul of the OpenTDF testing and SDK management infrastructure. It centralizes SDK version resolution and test environment control into two new Python-based command-line interfaces: otdf-sdk-mgr and otdf-local. These tools replace and refactor existing shell scripts, leading to more robust, maintainable, and efficient workflows for both local development and continuous integration. The changes also include updated documentation to guide users through the new setup and debugging procedures.

Highlights

  • New SDK Version Management CLI: Introduced the otdf-sdk-mgr Python package, a new command-line interface for streamlined SDK version resolution, artifact installation, and source checkout for Go, Java, and JavaScript SDKs.
  • New Test Environment Management CLI: Added the otdf-local Python package, a new CLI for managing the OpenTDF test environment, including starting/stopping services, viewing logs, and provisioning Keycloak and test fixtures.
  • Refactored Shell Scripts: Existing shell scripts for SDK management (checkout-all.sh, checkout-sdk-branch.sh, cleanup-all.sh, list-versions.py, post-checkout-java.sh, resolve-version.py) have been refactored into backward-compatible wrappers that now delegate their functionality to the new otdf-sdk-mgr Python CLI.
  • Updated CI Workflows: Modified the setup-cli-tool/action.yaml GitHub Action to leverage otdf-sdk-mgr for installing released SDK versions as artifacts and to conditionally perform source checkouts based on whether a version is a 'head' (source build) or a 'release' (artifact install).
  • Enhanced Agent Documentation: The AGENTS.md file has been significantly expanded and rewritten to provide a comprehensive guide for AI agents on working with OpenTDF tests and debugging, incorporating detailed instructions for using the new otdf-sdk-mgr and otdf-local tools.
  • Go SDK Version File Support: Updated Go SDK wrapper scripts (cli.sh, otdfctl.sh) to read a .version file, enabling the installation and use of specific Go CLI releases rather than always defaulting to latest.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added /xtest/logs/ to ignore generated log files.
  • .shfmt
    • Added a new configuration file for shell script formatting.
  • AGENTS.md
    • Rewrote the document to serve as an agent guide for OpenTDF tests, detailing test framework, SDK configuration, running tests, debugging, and best practices, with references to otdf-sdk-mgr and otdf-local.
  • otdf-local/CLAUDE.md
    • Added a new operational guide for the otdf-local test environment manager.
  • otdf-local/README.md
    • Added a new README detailing the otdf-local Python CLI for managing the OpenTDF test environment.
  • otdf-local/pyproject.toml
    • Added a new Python project configuration file for otdf-local.
  • otdf-local/src/otdf_local/init.py
    • Added package initialization for otdf-local.
  • otdf-local/src/otdf_local/main.py
    • Added main entry point for otdf-local.
  • otdf-local/src/otdf_local/cli.py
    • Added the main Typer CLI application for otdf-local, including commands for up, down, ls, status, logs, clean, provision, restart, and env.
  • otdf-local/src/otdf_local/config/init.py
    • Added configuration module for otdf-local.
  • otdf-local/src/otdf_local/config/features.py
    • Added module for detecting platform features based on version.
  • otdf-local/src/otdf_local/config/ports.py
    • Added port constants for various services.
  • otdf-local/src/otdf_local/config/settings.py
    • Added Pydantic settings management for otdf-local.
  • otdf-local/src/otdf_local/health/init.py
    • Added health check module for otdf-local.
  • otdf-local/src/otdf_local/health/checks.py
    • Added utilities for HTTP and port health checks.
  • otdf-local/src/otdf_local/health/waits.py
    • Added utilities for waiting on service conditions and health.
  • otdf-local/src/otdf_local/process/init.py
    • Added process management module for otdf-local.
  • otdf-local/src/otdf_local/process/logs.py
    • Added log file management and aggregation for otdf-local.
  • otdf-local/src/otdf_local/process/manager.py
    • Added subprocess lifecycle management for otdf-local.
  • otdf-local/src/otdf_local/services/init.py
    • Added service management module for otdf-local.
  • otdf-local/src/otdf_local/services/base.py
    • Added abstract base class for managed services in otdf-local.
  • otdf-local/src/otdf_local/services/docker.py
    • Added Docker compose service management for otdf-local.
  • otdf-local/src/otdf_local/services/kas.py
    • Added KAS instance management for otdf-local.
  • otdf-local/src/otdf_local/services/platform.py
    • Added platform service management for otdf-local.
  • otdf-local/src/otdf_local/services/provisioner.py
    • Added provisioning service for Keycloak and fixtures in otdf-local.
  • otdf-local/src/otdf_local/utils/init.py
    • Added utility module for otdf-local.
  • otdf-local/src/otdf_local/utils/console.py
    • Added Rich console helpers for formatted output in otdf-local.
  • otdf-local/src/otdf_local/utils/keys.py
    • Added cryptographic key generation utilities for otdf-local.
  • otdf-local/src/otdf_local/utils/yaml.py
    • Added YAML manipulation utilities for otdf-local.
  • otdf-local/tests/init.py
    • Added tests package for otdf-local.
  • otdf-local/tests/test_health.py
    • Added unit tests for health check utilities in otdf-local.
  • otdf-local/tests/test_integration.py
    • Added integration tests for the otdf-local CLI.
  • otdf-local/uv.lock
    • Added a new UV lock file for otdf-local dependencies.
  • otdf-sdk-mgr/README.md
    • Added a new README detailing the otdf-sdk-mgr Python CLI for SDK artifact management.
  • otdf-sdk-mgr/pyproject.toml
    • Added a new Python project configuration file for otdf-sdk-mgr.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/init.py
    • Added package initialization for otdf-sdk-mgr.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/main.py
    • Added main entry point for otdf-sdk-mgr.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/checkout.py
    • Added module for SDK source checkout using bare repos and worktrees.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/cli.py
    • Added the main Typer CLI application for otdf-sdk-mgr, including checkout, clean, and java-fixup commands.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/cli_install.py
    • Added install subcommand group for otdf-sdk-mgr.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/cli_versions.py
    • Added versions subcommand group for otdf-sdk-mgr.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/config.py
    • Added constants and path discovery for SDK management.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/installers.py
    • Added functions for installing SDK CLI artifacts.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/java_fixup.py
    • Added post-checkout fixups for Java SDK source trees.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/registry.py
    • Added registry queries for SDK version discovery.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py
    • Added version resolution logic for SDK tags/branches/SHAs.
  • otdf-sdk-mgr/src/otdf_sdk_mgr/semver.py
    • Added semantic version parsing and utilities.
  • otdf-sdk-mgr/uv.lock
    • Added a new UV lock file for otdf-sdk-mgr dependencies.
  • xtest/sdk/go/cli.sh
    • Updated to read .version file for Go CLI version.
  • xtest/sdk/go/otdfctl.sh
    • Updated to read .version file for Go CLI version.
  • xtest/sdk/java/cli.sh
    • Updated EC wrap version check logic.
  • xtest/sdk/js/cli.sh
    • Updated EC wrap version check logic.
  • xtest/sdk/scripts/checkout-all.sh
    • Refactored to be a backward-compatible wrapper for otdf-sdk-mgr checkout --all.
  • xtest/sdk/scripts/checkout-sdk-branch.sh
    • Refactored to be a backward-compatible wrapper for otdf-sdk-mgr checkout.
  • xtest/sdk/scripts/cleanup-all.sh
    • Refactored to be a backward-compatible wrapper for otdf-sdk-mgr clean.
  • xtest/sdk/scripts/list-versions.py
    • Refactored to be a backward-compatible wrapper for otdf-sdk-mgr versions list.
  • xtest/sdk/scripts/post-checkout-java.sh
    • Refactored to be a backward-compatible wrapper for otdf-sdk-mgr java-fixup.
  • xtest/sdk/scripts/requirements.txt
    • Updated with comments and removed GitPython as it's now managed by pyproject.toml.
  • xtest/sdk/scripts/resolve-version.py
    • Refactored to be a backward-compatible wrapper for otdf-sdk-mgr versions resolve.
  • xtest/setup-cli-tool/action.yaml
    • Modified to add a step for installing released versions as artifacts and updated checkout conditions to differentiate between head (source) and release (artifact) versions.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/check.yml
    • .github/workflows/xtest.yml
Activity
  • Pull request opened by dmihalcik-virtru.
  • Initial commit introducing otdf-sdk-mgr and otdf-local Python CLIs and refactoring existing scripts.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new Python packages, otdf-sdk-mgr and otdf-local, to manage SDK versions and the local test environment, which is a significant improvement over the previous shell scripts. The refactoring of existing scripts into wrappers for these new tools is well-executed. The code is well-structured, particularly with the use of typer and rich for the CLIs. I have identified a few inconsistencies in documentation paths and a minor bug in one of the CLI commands. Additionally, I've made a suggestion regarding the build configuration of one of the new packages. Overall, this is a solid contribution that will enhance the developer experience.

@dmihalcik-virtru dmihalcik-virtru changed the title feat(otdf-sdk-mgr): add SDK version management CLI and refactor scripts feat(xtest): add SDK version management CLI and refactor scripts Feb 18, 2026
@dmihalcik-virtru dmihalcik-virtru changed the title feat(xtest): add SDK version management CLI and refactor scripts chore(xtest): adds otdf-sdk-mgr tool for otdf client binary mgmt Feb 18, 2026
dmihalcik-virtru added a commit to dmihalcik-virtru/tests that referenced this pull request Feb 18, 2026
- config: make SDK_DIR discovery lazy via get_sdk_dir()/get_sdk_dirs();
  add OTDF_SDK_DIR env var override; no longer raises at import time
- installers: replace sys.exit() with InstallError exception; fix
  partial-write by downloading to tempfile before moving into dist_dir;
  replace deprecated urlretrieve with urlopen + copyfileobj
- resolve: guard LTS_VERSIONS lookup with explicit KeyError message
- checkout: fix worktree update to use 'git -C <worktree> pull' instead
  of broken --git-dir/--work-tree combination
- cli_install: make --sdk and --version truly required (typer.Option(...)
  with no default); catch InstallError in release/artifact commands
- registry: add GITHUB_TOKEN auth header support for GitHub API requests;
  warn with rate-limit reset time on 403/429 responses
- action.yaml: sanitize tag names for env var use (dots→underscores);
  add 'determine source checkout needs' step that checks both head==true
  and BUILD_FROM_SOURCE_<tag> fallback; update checkout step conditions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dmihalcik-virtru
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Python-based CLI tool, otdf-sdk-mgr, to centralize and simplify the management of SDK versions for testing. The new tool handles version resolution, artifact installation from registries, and source code checkouts. Existing shell scripts have been refactored to be thin wrappers around this new tool, and CI workflows are updated accordingly. The changes are well-structured and significantly improve the maintainability of the SDK management process. My feedback includes suggestions to improve error handling by using exceptions instead of sys.exit for better testability and reusability, correcting a documentation inconsistency, and making exception handling more specific.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new otdf-sdk-mgr Python CLI to manage SDK version resolution, artifact installs, and source checkouts; updates xtest tooling and CI workflows to use it instead of bespoke shell/Python scripts.

Changes:

  • Introduces otdf-sdk-mgr package (Typer CLI) for version discovery/resolution, installs, cleanup, and Java post-checkout fixups.
  • Refactors xtest scripts/docs and GitHub Action (setup-cli-tool) to prefer installing released artifacts and only checkout/build from source when needed.
  • Updates CI workflows to use uv + otdf-sdk-mgr and adds linting for the new package.

Reviewed changes

Copilot reviewed 27 out of 30 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
xtest/test_audit_logs_integration.py Updates run instructions to reflect new working directory.
xtest/setup-cli-tool/action.yaml Adds artifact install + conditional source checkout logic using otdf-sdk-mgr.
xtest/sdk/scripts/requirements.txt Removes GitPython requirement (migration to otdf-sdk-mgr).
xtest/sdk/scripts/post-checkout-java.sh Deletes Java fixup shell script (replaced by Python).
xtest/sdk/scripts/cleanup-all.sh Deletes cleanup shell script (replaced by CLI clean).
xtest/sdk/scripts/checkout-sdk-branch.sh Deletes checkout helper script (replaced by CLI checkout).
xtest/sdk/scripts/checkout-all.sh Deletes “checkout all” script (replaced by CLI checkout --all).
xtest/sdk/go/otdfctl.sh Reads .version to pin go run version when no local binary exists.
xtest/sdk/go/cli.sh Reads .version to pin go run version when no local binary exists.
xtest/README.md Updates instructions to use otdf-sdk-mgr commands.
otdf-sdk-mgr/src/otdf_sdk_mgr/semver.py Adds lightweight semver parsing/sorting utilities.
otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py Refactors version resolution into a module and adds Java “latest with CLI” logic.
otdf-sdk-mgr/src/otdf_sdk_mgr/registry.py Adds registry querying for Go tags, npm, Maven, and GitHub Releases.
otdf-sdk-mgr/src/otdf_sdk_mgr/java_fixup.py Reimplements Java post-checkout pom fixups in Python.
otdf-sdk-mgr/src/otdf_sdk_mgr/installers.py Adds installers for Go/JS/Java CLI artifacts and install subcommands.
otdf-sdk-mgr/src/otdf_sdk_mgr/config.py Centralizes constants and discovers xtest/sdk directory.
otdf-sdk-mgr/src/otdf_sdk_mgr/cli_versions.py Adds versions CLI commands (list/resolve).
otdf-sdk-mgr/src/otdf_sdk_mgr/cli_install.py Adds install CLI subcommands.
otdf-sdk-mgr/src/otdf_sdk_mgr/cli.py Adds top-level CLI and checkout/clean/java-fixup commands.
otdf-sdk-mgr/src/otdf_sdk_mgr/checkout.py Implements bare-repo + worktree checkout logic.
otdf-sdk-mgr/src/otdf_sdk_mgr/main.py Enables python -m otdf_sdk_mgr.
otdf-sdk-mgr/src/otdf_sdk_mgr/init.py Adds package metadata version.
otdf-sdk-mgr/pyproject.toml Defines new Python project + deps + ruff/pyright config.
otdf-sdk-mgr/README.md Documents CLI usage and install modes.
AGENTS.md Documents how to configure SDK artifacts via otdf-sdk-mgr.
.github/workflows/xtest.yml Uses uv + otdf-sdk-mgr for version resolution; adds conditional build steps.
.github/workflows/check.yml Adds lint/typecheck steps for otdf-sdk-mgr.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

dmihalcik-virtru added a commit to dmihalcik-virtru/tests that referenced this pull request Feb 18, 2026
- Fix SonarCloud security hotspot: replace execSync with spawnSync in
  xtest.yml to avoid command injection via template literal interpolation
- Use removeprefix("v") instead of lstrip("v") in java_fixup.py for
  correct single-prefix stripping semantics
- Wrap urlopen HEAD check in context manager to prevent resource leak;
  narrow broad except Exception to (URLError, OSError) in installers.py
- Replace sys.exit calls in checkout.py with proper exceptions
  (CalledProcessError, ValueError); handle them in CLI entry point
- Remove redundant --json flag from cli_versions.py list command
- Fix shell word-splitting in setup-cli-tool/action.yaml by piping
  through while read instead of for-in; improve tag_sanitized regex

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dmihalcik-virtru and others added 12 commits February 18, 2026 12:09
Add new SDK management package for version resolution, artifact
installation, and checkout. Refactor shell scripts to thin wrappers
delegating to otdf-sdk-mgr. Update CI workflows with step IDs,
conditional guards, and otdf-sdk-mgr version resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: David Mihalcik <dmihalcik@virtru.com>
- config: make SDK_DIR discovery lazy via get_sdk_dir()/get_sdk_dirs();
  add OTDF_SDK_DIR env var override; no longer raises at import time
- installers: replace sys.exit() with InstallError exception; fix
  partial-write by downloading to tempfile before moving into dist_dir;
  replace deprecated urlretrieve with urlopen + copyfileobj
- resolve: guard LTS_VERSIONS lookup with explicit KeyError message
- checkout: fix worktree update to use 'git -C <worktree> pull' instead
  of broken --git-dir/--work-tree combination
- cli_install: make --sdk and --version truly required (typer.Option(...)
  with no default); catch InstallError in release/artifact commands
- registry: add GITHUB_TOKEN auth header support for GitHub API requests;
  warn with rate-limit reset time on 403/429 responses
- action.yaml: sanitize tag names for env var use (dots→underscores);
  add 'determine source checkout needs' step that checks both head==true
  and BUILD_FROM_SOURCE_<tag> fallback; update checkout step conditions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix SonarCloud security hotspot: replace execSync with spawnSync in
  xtest.yml to avoid command injection via template literal interpolation
- Use removeprefix("v") instead of lstrip("v") in java_fixup.py for
  correct single-prefix stripping semantics
- Wrap urlopen HEAD check in context manager to prevent resource leak;
  narrow broad except Exception to (URLError, OSError) in installers.py
- Replace sys.exit calls in checkout.py with proper exceptions
  (CalledProcessError, ValueError); handle them in CLI entry point
- Remove redundant --json flag from cli_versions.py list command
- Fix shell word-splitting in setup-cli-tool/action.yaml by piping
  through while read instead of for-in; improve tag_sanitized regex

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dmihalcik-virtru and others added 4 commits February 18, 2026 12:11
spawnSync does not perform shell word-splitting, so passing "main latest"
as a single string only resolved one tag instead of both.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dmihalcik-virtru dmihalcik-virtru marked this pull request as ready for review February 18, 2026 18:05
@dmihalcik-virtru dmihalcik-virtru requested review from a team as code owners February 18, 2026 18:05
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

1 participant

Comments