SK-2984 Add contract testing for v2 SDK#352
Open
saileshwar-skyflow wants to merge 3 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v2module, following the same committed-snapshot pattern skyflow-node uses (compare against a checked-in baseline, not a published version).japicmpcompares the current build against a committed baseline jar (v2/api-report/skyflow-java.baseline.jar) instead of pulling any published Maven Central version —commonisn't independently published, andflowvaulthas no prior release to compare against yet, so no contract testing is added there in this PR.commonmerged) is produced during the build so classes that physically live incommon(Credentials,ErrorCode,BearerToken, etc.) aren't reported as false-positive removals against a self-contained baseline.scripts/contract-snapshot-update.shregenerates the committed baseline after an intentional public API change — run it and commit the updated jar alongside the code change.SampleImportContractTest.javais a compile-time smoke test over the actualimportstatements used insamples/andREADME.md, independent of japicmp's scope/excludes..github/workflows/contract-tests.ymlruns the check on PRs targetingmain/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
mvn install -pl common,v2 -ampasses against the current baseline (No changes.)SampleImportContractTestcompiles and passescontract-tests.ymlworkflow runs correctly in real GitHub Actions (defaultGITHUB_TOKENhaspull-requests: writefor the comment step)