Skip to content

feat(xtest): support platform-embedded otdfctl for migration to monorepo#434

Open
dmihalcik-virtru wants to merge 1 commit intomainfrom
DSPX-2655-migrate-otdfctl
Open

feat(xtest): support platform-embedded otdfctl for migration to monorepo#434
dmihalcik-virtru wants to merge 1 commit intomainfrom
DSPX-2655-migrate-otdfctl

Conversation

@dmihalcik-virtru
Copy link
Copy Markdown
Member

otdfctl is moving from opentdf/otdfctl into opentdf/platform. This
updates the test infrastructure to auto-detect when the platform
checkout contains otdfctl/ and build from there instead of the
standalone repo.

Key changes:

  • xtest.yml: new otdfctl-source input (auto/standalone/platform) and
    detection step that checks for otdfctl/go.mod in the platform dir
  • setup-cli-tool: new platform-otdfctl-dir input; symlinks platform
    source into sdk/go/src/ for head builds instead of separate checkout
  • otdf-sdk-mgr: resolve.py supports go_source="platform" to resolve
    against the platform repo with otdfctl/ tag infix; installers write
    .module-path file for the new Go module path
  • cli.sh/otdfctl.sh: read .module-path to use the correct module path
    (github.com/opentdf/platform/otdfctl) for go run fallback

Backward compatible: old releases still resolve from the standalone
repo; .module-path absence defaults to the original module path.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

otdfctl is moving from opentdf/otdfctl into opentdf/platform. This
updates the test infrastructure to auto-detect when the platform
checkout contains otdfctl/ and build from there instead of the
standalone repo.

Key changes:
- xtest.yml: new otdfctl-source input (auto/standalone/platform) and
  detection step that checks for otdfctl/go.mod in the platform dir
- setup-cli-tool: new platform-otdfctl-dir input; symlinks platform
  source into sdk/go/src/ for head builds instead of separate checkout
- otdf-sdk-mgr: resolve.py supports go_source="platform" to resolve
  against the platform repo with otdfctl/ tag infix; installers write
  .module-path file for the new Go module path
- cli.sh/otdfctl.sh: read .module-path to use the correct module path
  (github.com/opentdf/platform/otdfctl) for go run fallback

Backward compatible: old releases still resolve from the standalone
repo; .module-path absence defaults to the original module path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dmihalcik-virtru dmihalcik-virtru requested review from a team as code owners April 15, 2026 20:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

Warning

Rate limit exceeded

@dmihalcik-virtru has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 42 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 14 minutes and 42 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 44e8e984-6184-48ac-b4bc-d7254fb1d392

📥 Commits

Reviewing files that changed from the base of the PR and between cf8debf and 3567fd3.

📒 Files selected for processing (8)
  • .github/workflows/xtest.yml
  • otdf-sdk-mgr/src/otdf_sdk_mgr/cli_versions.py
  • otdf-sdk-mgr/src/otdf_sdk_mgr/config.py
  • otdf-sdk-mgr/src/otdf_sdk_mgr/installers.py
  • otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py
  • xtest/sdk/go/cli.sh
  • xtest/sdk/go/otdfctl.sh
  • xtest/setup-cli-tool/action.yaml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DSPX-2655-migrate-otdfctl

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
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

Copy link
Copy Markdown
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 support for resolving and installing the Go otdfctl CLI from the platform monorepo in addition to the standalone repository. Key changes include adding a source parameter to resolution and installation logic, updating shell wrappers to support dynamic module paths, and modifying the GitHub Action to allow symlinking local platform-embedded source code. Feedback highlights a missing propagation of the source parameter during installation, a potential IndexError when resolving the main branch, and security risks associated with direct shell interpolation of JSON outputs in the GitHub Action.

Comment on lines +44 to +45
if source == "platform":
(dist_dir / ".module-path").write_text(f"{GO_MODULE_PATH_PLATFORM}\n")
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.

high

The source parameter is currently not being propagated from the CLI or the install_release function. Consequently, the .module-path file will never be created, causing the Go wrappers to use the incorrect module path for platform-embedded releases.

You can fix this by inferring the source from the version prefix if it is not explicitly provided.

Suggested change
if source == "platform":
(dist_dir / ".module-path").write_text(f"{GO_MODULE_PATH_PLATFORM}\n")
if source == "platform" or version.startswith("otdfctl/"):
(dist_dir / ".module-path").write_text(f"{GO_MODULE_PATH_PLATFORM}\n")

repo = Git()
if version == "main" or version == "refs/heads/main":
all_heads = [r.split("\t") for r in repo.ls_remote(sdk_url, heads=True).split("\n")]
sha, _ = [tag for tag in all_heads if "refs/heads/main" in tag][0]
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.

medium

This line will raise an IndexError if refs/heads/main is not found in the remote repository's heads. It is safer to use a more robust way to find the head or check if the list is non-empty.

Suggested change
sha, _ = [tag for tag in all_heads if "refs/heads/main" in tag][0]
sha, _ = next(tag for tag in all_heads if "refs/heads/main" in tag)

Comment on lines +158 to +161
a) version_json='${{ steps.resolve.outputs.version-a }}' ; needs_source='${{ steps.check-source.outputs.needs-source-a }}' ;;
b) version_json='${{ steps.resolve.outputs.version-b }}' ; needs_source='${{ steps.check-source.outputs.needs-source-b }}' ;;
c) version_json='${{ steps.resolve.outputs.version-c }}' ; needs_source='${{ steps.check-source.outputs.needs-source-c }}' ;;
d) version_json='${{ steps.resolve.outputs.version-d }}' ; needs_source='${{ steps.check-source.outputs.needs-source-d }}' ;;
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.

medium

Using direct interpolation of GitHub Action outputs (${{ steps.resolve.outputs.version-a }}) inside single quotes in a shell script is risky. If the JSON output contains a single quote (e.g., in a tag name or an error message), it will break the shell command syntax. It is safer to map these outputs to environment variables and use those in the script.

@github-actions
Copy link
Copy Markdown

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