Skip to content

chore: build java release CLIs against Maven Central - #652

Merged
dmihalcik-virtru merged 1 commit into
mainfrom
DSPX-5177-locobuf
Oct 15, 2026
Merged

dmihalcik-virtru merged 1 commit into
mainfrom
DSPX-5177-locobuf

Conversation

@dmihalcik-virtru

@dmihalcik-virtru dmihalcik-virtru commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

java-sdk releases don't attach cmdline.jar to their GitHub Releases, and cmdline isn't published to Maven Central. So every Java release that xtest uses has been built from source with a full mvn clean install. That build's sdk module runs buf generate against buf.build. With a dozen xtest jobs doing this at the same moment, BSR returns resource_exhausted: too many requests and fails the run (e.g. 38632037584 on #571). This is DSPX-5177.

Everything cmdline depends on (sdk-pom, sdk, sdk-pqc-bc, sdk-fips-bc) is on Maven Central. This PR builds just the CLI against those published jars.

Changes (otdf-sdk-mgr)

  • install_java_release: when the GitHub Release has no cmdline.jar, the installer checks Maven Central for io.opentdf.platform:sdk:<version>. If it's there, it shallow-clones the tag into a temp dir and runs mvn -pl .,cmdline package, so sdk* resolves from Central and no codegen or BSR calls happen.
    • The temp dir is outside src/ so the java Makefile doesn't rebuild it.
    • The build uses its own local repo, ~/.m2/otdf-sdk-mgr-releases. java-sdk main carries the last release's version (currently 0.19.1), so an sdk that a head build mvn installed into ~/.m2/repository would otherwise shadow the release. I hit this locally: the v0.19.1 cmdline failed to compile against main's sdk.
    • Any failure (not on Central, clone or build error) still raises InstallError, so setup-cli-tool falls back to today's full source build.
  • versions resolve java latest: no longer returns head: true when no release has a cmdline.jar asset. It's now an ordinary release row and takes the path above.
    • Behaviour change: in platform-head cells, latest is no longer rebuilt against the platform under test via PLATFORM_BRANCH. It's tested as published.
  • install stable java: drops the has_cli filter, which had made it skip Java entirely.

No workflow changes: JDK and Maven are already set up before setup-cli-tool in every job that installs Java.

Expected effect

In a run like 38632037584, each job's v0.19.1 build no longer calls BSR. Combined with opentdf/java-sdk#419 (which stops attach-sources from running codegen a second time), BSR traffic per run drops from about 96 to about 24 buf generate passes. Only real heads still build from source. Building each head once per run is a separate follow-up.

Testing

  • Maven Central has sdk for every release since 0.7.2 except 0.8.0 and 0.17.0. Those fall back to a source build.
  • mvn -pl .,cmdline package checked against an empty local repo:
    • v0.19.1 (latest): builds, zero buf calls.
    • v0.9.0 (LTS): builds, zero buf calls, with Maven 3.9.11 as on the runners. Maven 3.10 rejects that tag's sdk/pom.xml for a duplicate plugin declaration in the fuzz profile.
  • End to end: otdf-sdk-mgr install artifact --sdk java --version v0.19.1 --dist-name v0.19.1 takes the new path, and cmdline.jar --version reports {"version":"0.19.1","tdfSpecVersion":"4.3.0"}, which cli.sh supports gates on.
  • Added tests/test_installers.py and updated test_resolve.py. ruff check, ruff format, pyright and pytest (144 passed) are all clean.

Summary by CodeRabbit

  • New Features
    • Java installations now use the published command-line package when available. If it isn’t available, installation can build the CLI using the published SDK release.
    • Selecting the latest Java version now resolves to the newest stable release, whether or not it includes a prebuilt CLI package.
  • Bug Fixes
    • Installation reports an error when neither the published package nor the fallback build is available. CI can then fall back to a full source build.

@dmihalcik-virtru
dmihalcik-virtru requested review from a team as code owners October 15, 2026 17:18
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e650f67-ae46-4be2-a615-85a616fed4e0
📥 Commits

Reviewing files that changed from the base of the PR and between 7639a94 and e7dcb36.

📒 Files selected for processing: 7
  • .github/workflows/xtest.yml
  • otdf-sdk-mgr/README.md
  • otdf-sdk-mgr/src/otdf_sdk_mgr/installers.py
  • otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py
  • otdf-sdk-mgr/tests/test_installers.py
  • otdf-sdk-mgr/tests/test_resolve.py
  • xtest/setup-cli-tool/action.yaml

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 73543a76-c01c-497b-850c-0234518c8e5d
📥 Commits

Reviewing files that changed from the base of the PR and between b9f9652 and 7639a94.

📒 Files selected for processing: 5
  • otdf-sdk-mgr/README.md
  • otdf-sdk-mgr/src/otdf_sdk_mgr/installers.py
  • otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py
  • otdf-sdk-mgr/tests/test_installers.py
  • otdf-sdk-mgr/tests/test_resolve.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Java release resolution now selects the newest stable tag. Installation tries the GitHub CLI asset first, then builds the CLI from the tagged source against the published SDK artifact if needed.

Changes: Java release installation

Layer / File(s) Summary
Select the stable Java release
otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py, otdf-sdk-mgr/src/otdf_sdk_mgr/installers.py, otdf-sdk-mgr/tests/test_resolve.py
Java latest resolution and stable-version selection use the newest stable tag without requiring a GitHub CLI asset. The test expects the newest stable tag as a release, without a head marker.
Install the CLI from a release or Maven Central
otdf-sdk-mgr/src/otdf_sdk_mgr/installers.py, otdf-sdk-mgr/tests/test_installers.py, otdf-sdk-mgr/README.md
Installation tries the GitHub CLI asset first. If it is unavailable, the installer checks for the tagged SDK POM on Maven Central, clones the tag, and builds the CLI with a dedicated Maven repository. Tests cover asset download, Maven lookup, build failures, and cleanup. The README describes the fallback and the CI full-source-build fallback.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant GitHub_Releases
  participant Maven_Central
  participant Git
  participant Maven
  Installer->>GitHub_Releases: Check and download CLI asset
  GitHub_Releases-->>Installer: Asset available or installation error
  Installer->>Maven_Central: Check for tagged SDK POM
  Maven_Central-->>Installer: POM availability
  Installer->>Git: Clone Java SDK tag
  Git-->>Installer: Tagged source
  Installer->>Maven: Build parent and cmdline projects
  Maven-->>Installer: CLI wrapper and JAR
Loading

Suggested reviewers: abarabash-virtru

Merge Risk: ⚪ Minimal · up to 7639a

No actionable merge-blocking issue remains; the documented source-build fallback remains available if release installation fails.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 4 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: building Java release CLIs against Maven Central when needed.
Full details: Docstring Coverage

Explanation

Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 4 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checked the tag at dawn
Then fetched the CLI, neat and drawn
When GitHub’s jar was out of sight
Maven built the tool just right
The bunny hopped away with cheer

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

@dmihalcik-virtru dmihalcik-virtru changed the title fix(otdf-sdk-mgr): build java release CLIs against Maven Central chore: build java release CLIs against Maven Central Oct 15, 2026
java-sdk releases don't attach cmdline.jar to their GitHub Releases, so
every java release xtest used fell back to a full source build, whose
sdk module runs `buf generate` against buf.build. With a dozen xtest
jobs doing that at once, BSR rate limits fail the run.

When a release has no cmdline.jar asset, install_java_release now
checks Maven Central for io.opentdf.platform:sdk at that version and,
if present, builds only the parent pom and the cmdline module of the
tag (mvn -pl .,cmdline), resolving sdk* from Central. No codegen, no
BSR calls. It uses its own local Maven repo so a same-versioned head
installed into ~/.m2 can't shadow the release. Any failure still raises
InstallError, so setup-cli-tool falls back to the full source build.

java `latest` no longer resolves to head:true when no release has a
cmdline.jar asset; it is a normal release row, so it takes the path
above and is tested as published rather than rebuilt against the
platform under test.

setup-cli-tool gains a needs-build output (any head, or any release
whose artifact install failed), and the java make steps gate on it
instead of on heads. Previously a run whose only java versions were
releases checked out the fallback source but never built it.

DSPX-5177

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

X-Test Failure Report

@dmihalcik-virtru
dmihalcik-virtru merged commit e17816b into main Oct 15, 2026
31 checks passed
@dmihalcik-virtru
dmihalcik-virtru deleted the DSPX-5177-locobuf branch October 15, 2026 18:42
dmihalcik-virtru added a commit that referenced this pull request Oct 21, 2026
…plicitly (#663)

## What and why

[DSPX-3499](https://virtru.atlassian.net/browse/DSPX-3499) asks that the
PQC and hybrid PQ/T tests run whenever every component could support
them. An audit of the scheduled X-Test run (39383110889) found go and
java at main and latest already run and pass all six `test_pqc.py`
cells. js is the gap:

- **js "latest" was `@opentdf/ctl@0.4.0`.** `otdf-sdk-mgr` matched only
`sdk/vX.Y.Z` tags. web-sdk moved to `sdk-vX.Y.Z` at 0.4.1, so `latest`
has been pinned to 0.4.0 ever since. That build fails the
`key_management` gate, so it skipped every PQC cell and most of
`test_abac.py`.
- **The newest released CLI isn't on npm.** web-sdk's delivery job
failed on sdk 0.21.0 and 0.22.0 before it reached `@opentdf/ctl`
([DSPX-5277](https://virtru.atlassian.net/browse/DSPX-5277), filed
separately; this PR doesn't depend on it). npm `latest` for the CLI is
still 0.20.0, which has no ML-KEM.
- **The js shim had no `mechanism-secpmlkem` case.** The probe fell
through to `Unknown feature`. That answers "no", which is correct today
but only by accident.

web-sdk really does lack the hybrids at main and 0.22.0, so js@main
skipping X-Wing and secp+ML-KEM is correct. opentdf/web-sdk#1049 (open)
adds the secp hybrids. X-Wing isn't planned there.

## Changes

- **`otdf-sdk-mgr` resolve:** tag infixes match both `<infix>/` and
`<infix>-`, as a prefix rather than a substring. `release` is now the
tag as git names it (`sdk-v0.22.0`; `service/…` and `otdfctl/…` are
unchanged). `versions resolve js latest` → `sdk-v0.22.0`.
- **`install_js_release`:** installs `@opentdf/ctl` from npm when it's
there. Otherwise it shallow-clones the release tag and packs just `cli/`
against the `@opentdf/sdk` published to npm, the same way java release
CLIs build against Maven Central (#652). Failures raise `InstallError`,
so `setup-cli-tool` can still fall back to a full source build, and
never leave a partial dist dir. `install stable js` now follows the same
release tag instead of the newest CLI on npm.
- **`xtest.yml`:** the js `make` steps gate on `setup-cli-tool`'s
`needs-build`, as java's already do, instead of on "has a head". A js
release that falls back to source now gets built even when no js head is
in the run.
- **`xtest/sdk/js/cli.sh`:** explicit `mechanism-secpmlkem` probe, and
both hybrid probes key on the `hpqt:` names in `--encapKeyType`. When
#1049 merges, the secp cells turn on with no edit here.
- **`xtest/sdk/js/cli.sh`, no more `npx`** (SonarCloud): when a dist
dir's install is missing, `npx @opentdf/ctl` fetches and runs npm's
latest, so the cell reports on the wrong build. The shim now runs
`node_modules/.bin/opentdf` (the bin name in every `@opentdf/ctl` and
`@opentdf/cli` release) and fails loudly without it. `npx --no` doesn't
work as a substitute: it swallows the package name.
- **`spec/DSPX-3499.md`:** findings, plan, acceptance criteria.

## Expected CI differences

- The js release lane becomes `js@v0.22.0` instead of `js@v0.4.0`. It
should run both ML-KEM cells and every `key_management` cell in
`test_abac.py`. Its hybrid cells should skip on `mechanism-xwing` /
`mechanism-secpmlkem`.
- `bench (js)` compares against 0.22.0 rather than 0.4.0.
- New js@v0.22.0 cells may surface real interop failures that ctl 0.4.0
was skipping past.

## How it was tested

- `otdf-sdk-mgr`: `ruff check`, `ruff format --check`, `pyright`,
`pytest` (175 passed, including new resolver and js installer cases).
- Local end-to-end: `otdf-sdk-mgr install artifact --sdk js --version
sdk-v0.22.0 --dist-name v0.22.0` built `@opentdf/ctl@0.22.0` against
`@opentdf/sdk@0.22.0` in about a minute. Against that build, `cli.sh
supports` answers `key_management`, `mechanism-mlkem`, `ecwrap`,
`hexless` and `multikao` yes, and `mechanism-xwing` /
`mechanism-secpmlkem` no (exit 1, not 2).
- `shellcheck xtest/sdk/js/cli.sh`.
- Not run locally: the pytest suite against a live platform. This PR's
X-Test run is the end-to-end check.

## Out of scope

js also skips the extended-mechanism ABAC cells for reasons that aren't
PQ: `mechanism-rsa-4096` has no js shim case, and
`mechanism-ec-curves-384-521` is hard-coded `False` for js in `tdfs.py`.
Both are noted in the spec.


[DSPX-3499]:
https://virtru.atlassian.net/browse/DSPX-3499?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[DSPX-5277]:
https://virtru.atlassian.net/browse/DSPX-5277?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **New Features**
- JavaScript CLI installation now supports published packages and
fallback builds from matching SDK releases.
- Release detection supports both slash- and hyphen-formatted version
tags.
  - CLI checks now include X-Wing and secp256r1-ML-KEM capabilities.

- **Bug Fixes**
- Improved cleanup and error handling when JavaScript installation or
builds fail.
- Test workflows now correctly run required JavaScript builds for
applicable configurations.

- **Documentation**
- Updated installation guidance with fallback behavior, prerequisites,
version selection, and direct local CLI execution.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
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