The live IT compiles against a client generated from either contract - #25
Merged
Merged
Conversation
… so a node-side spec change cannot block its own release The Java live IT is hand-written against the GENERATED client, and two lanes generate that client from two different specs: this repository's CI from the vendored `openapi.json`, opendpp-node's "SDK regen" gate from its live contract. They can sit a contract apart, so any hand-written reference to a generated signature or getter compiles in one lane and breaks the other. That is what happened. Contract 1.16.0 added the `representation` query parameter to both public resolvers and moved the passport body out of a `metadata` object onto the document root. This file kept compiling here, against the vendored 1.15.0, and stopped compiling in node's gate — four call sites on argument count, one on a getter that no longer exists. Since that gate feeds the required rollup on `release/train-*`, a contract change was blocked by a test in another repository that could not have been green in both places. So the two things that differ by contract are no longer named at compile time: - `resolve(api, name, key)` finds the resolver by NAME and passes `null` for every parameter after the key. Those are all optional on the wire — a grant token, and since 1.16.0 the representation flag — so the request is the same one the two-argument form made: anonymous tier, default compressed document. It unwraps `InvocationTargetException` so the 404 case still asserts on a typed `ApiException` rather than a reflection wrapper. - The old `getMetadata()` assertion is split. What it was really testing — that untyped JSON survives Jackson — is now asserted through `@context`, which both contracts declare as a relaxed Object, by requiring a structured value rather than a flattened string. The map check itself is kept opportunistically through `optionalMap`, so contracts up to 1.15.0 still prove the body is non-empty; on 1.16.0 the property is gone and the body's elements are root members with no generated getter, so there is nothing there to read. Everything asserted unconditionally is now true of both contracts, and the file header says so, so the next contract change does not rediscover this. Verified both directions with node's own gate script (`scripts/sdk-regen-verify.ts … --only=java`), which is what CI runs: against a client generated from the live 1.16.0 contract it failed on exactly the five reported errors before this change and passes after, regenerating, building and testing at 1.16.0. Against the vendored 1.15.0 in this tree, `./gradlew build` passes unchanged. Only the test file is touched — no regenerated client and no version bump, which stay the mirror sync's to write.
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.
What
Makes
OpenDppLiveITcompile against a generated client from either contract, by not naming the twothings that differ by contract at compile time.
resolve(api, name, key)finds a resolver by NAME and passesnullfor every parameter after the key.Those are all optional on the wire — a grant token, and since contract 1.16.0 the
representationflag— so the request is exactly the one the two-argument form made: anonymous tier, default compressed
document.
InvocationTargetExceptionis unwrapped, so the 404 case still asserts on a typedApiExceptionrather than a reflection wrapper.getMetadata()assertion is split. What it actually tested — untyped JSON surviving Jackson — isnow asserted through
@context, which every contract declares as a relaxed Object, by requiring astructured value rather than a flattened string. The non-empty map check is kept opportunistically via
optionalMap, so contracts up to 1.15.0 still prove the body is non-empty; from 1.16.0 the property isgone and the body's elements are root members with no generated getter, so there is nothing to read.
Test-only. No regenerated client, no version bump, no vendored spec change — those stay the mirror sync's
to write.
Why
This file is hand-written against the generated client, and two lanes generate that client from two
different specs: this repo's CI from the vendored
openapi.json, and opendpp-node'sSDK regengate fromits live contract. They can sit a contract apart, so any hand-written reference to a generated signature
or getter compiles in one lane and breaks the other.
Contract 1.16.0 did exactly that. It added
representationto both public resolvers and moved thepassport body out of a
metadataobject onto the document root. This file kept compiling here againstthe vendored 1.15.0 and stopped compiling in node's gate: four call sites on argument count, one on the
missing getter. That gate feeds the required rollup on node's
release/train-*, so a contract change wasblocked by a test in another repository that could not have been green in both places at once.
The header now states the constraint, so the next contract change does not rediscover it: anything
asserted unconditionally has to be true of both contracts.
Verification
Both directions, using node's own gate script (
scripts/sdk-regen-verify.ts <checkout> --only=java),which is what its CI runs:
errors before this change; after it, regenerates, builds and tests clean at 1.16.0.
./gradlew buildpasses, unchanged.The live IT itself stays opt-in behind
OPENDPP_LIVE_TEST=1, so neither run executed it against thehosted node.
Note for the merge
node's
SDK regenjob checks this repository out atref: main, so the gate only clears once this is onmain.