Skip to content

SK-2984 Add contract testing for v2 SDK#352

Open
saileshwar-skyflow wants to merge 3 commits into
SK-2967-java-sdk-add-flow-db-vault-api-support-using-modular-build-approachfrom
saileshwar/SK-2984-contract-testing
Open

SK-2984 Add contract testing for v2 SDK#352
saileshwar-skyflow wants to merge 3 commits into
SK-2967-java-sdk-add-flow-db-vault-api-support-using-modular-build-approachfrom
saileshwar/SK-2984-contract-testing

Conversation

@saileshwar-skyflow

Copy link
Copy Markdown
Collaborator

Summary

  • Adds japicmp-based public API contract testing for the v2 module, following the same committed-snapshot pattern skyflow-node uses (compare against a checked-in baseline, not a published version).
  • japicmp compares the current build against a committed baseline jar (v2/api-report/skyflow-java.baseline.jar) instead of pulling any published Maven Central version — common isn't independently published, and flowvault has no prior release to compare against yet, so no contract testing is added there in this PR.
  • A comparison-only shaded jar (v2 + common merged) is produced during the build so classes that physically live in common (Credentials, ErrorCode, BearerToken, etc.) aren't reported as false-positive removals against a self-contained baseline.
  • scripts/contract-snapshot-update.sh regenerates the committed baseline after an intentional public API change — run it and commit the updated jar alongside the code change.
  • SampleImportContractTest.java is a compile-time smoke test over the actual import statements used in samples/ and README.md, independent of japicmp's scope/excludes.
  • .github/workflows/contract-tests.yml runs the check on PRs targeting main/release/*, and posts a PR comment with the exact contract diff whenever the baseline jar itself is updated, so reviewers can see precisely what's being approved as the new contract.

Test plan

  • Clean mvn install -pl common,v2 -am passes against the current baseline (No changes.)
  • Simulated a real breaking change (renamed a public method) locally and confirmed japicmp fails the build with a clear diagnostic, then reverted
  • SampleImportContractTest compiles and passes
  • Rehearsed the base-vs-PR baseline diff + PR comment logic end-to-end in an isolated git worktree
  • Confirm the contract-tests.yml workflow runs correctly in real GitHub Actions (default GITHUB_TOKEN has pull-requests: write for the comment step)

Adds japicmp-based public API contract testing for the v2 module,
following the same committed-snapshot pattern skyflow-node uses:

- japicmp compares the current build against a committed baseline jar
  (v2/api-report/skyflow-java.baseline.jar) instead of a published
  Maven Central version, since common is not independently published
  and flowvault has no prior release to compare against.
- A comparison-only shaded jar (v2 + common merged) is produced so
  classes that live in common (Credentials, ErrorCode, BearerToken,
  etc.) aren't reported as false-positive removals.
- scripts/contract-snapshot-update.sh regenerates the committed
  baseline after an intentional API change.
- SampleImportContractTest.java is a compile-time smoke test over the
  actual import statements used in samples/ and README.md.
- .github/workflows/contract-tests.yml runs the check on PRs and posts
  a PR comment with the exact contract diff whenever the baseline jar
  itself is updated.
japicmp against the committed baseline snapshot is the load-bearing
check; this compile-time import smoke test was a supplementary layer
and not required.
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