Skip to content

fix(types): restore LLMProvider source compatibility for the 7-arg primitive shape#151

Merged
saurabhjain1592 merged 1 commit into
mainfrom
feature/llm-provider-source-compat
Apr 28, 2026
Merged

fix(types): restore LLMProvider source compatibility for the 7-arg primitive shape#151
saurabhjain1592 merged 1 commit into
mainfrom
feature/llm-provider-source-compat

Conversation

@saurabhjain1592

Copy link
Copy Markdown
Member

Summary

Code-review finding on PR #148: the new 13-arg boxed constructor replaced the public 7-arg primitive shape, and `getPriority()` / `getWeight()` changed from `int` to `Integer`. That's a real breaking change in a PR framed as additive — pre-existing callers either fail to compile (constructor) or now see nullable return values where they expected primitives (accessors).

This PR preserves source compatibility while keeping the boxed storage that the wire-shape contract needs.

What changed

Issue Fix
7-arg primitive constructor was removed Restored as a delegating overload, marked `@Deprecated` to nudge new callers toward the boxed form. Pre-existing call sites that construct `LLMProvider` directly continue to compile
`getPriority()` / `getWeight()` changed from `int` to `Integer` Reverted to primitive `int` (null-safe-unbox to 0). Boxed access available via new `getPriorityBoxed()` / `getWeightBoxed()`
`getEnabled()` from PR #148 returned `Boolean` (luring callers into `boolean e = p.getEnabled()` and an NPE on null) Renamed to `getEnabledBoxed()`. Pre-PR-#148 had no `getEnabled()`, so this rename has no consumers
Same naming concern for `getHasApiKey` Renamed to `getHasApiKeyBoxed` for symmetry. Primitive `boolean hasApiKey()` was already there pre-#148 and stays

Test plan

  • All 165 `AxonFlowTest` tests pass (163 existing + 2 new)
  • `mvn compile` clean
  • Wire-shape baseline refreshed (rename detected, no spec drift)
  • CHANGELOG entry under `[Unreleased]` documenting the source-compat restoration

New tests

  • `llmProviderLegacyConstructorPreservesSourceCompat` — exercises the 7-arg primitive constructor and confirms primitive accessors round-trip the values
  • `llmProviderPrimitiveAccessorsNullSafe` — confirms primitive accessors null-safe-unbox to 0/false when the underlying boxed field is null (which is what Jackson produces for omitted JSON fields)

Why this matters now

This lands BEFORE Java SDK v6.2.0 is tagged, so PR #148's source-incompat shape never reaches a published Maven Central release. Consumers upgrading from v6.1.0 → v6.2.0 won't see any breaking change.

…imitive shape

Code-review finding on PR #148: the new 13-arg boxed constructor
replaced the public 7-arg primitive shape, and getPriority() /
getWeight() changed from `int` to `Integer`. That's a real breaking
change in a PR framed as additive — pre-existing callers either
fail to compile (constructor) or now see nullable return values
where they expected primitives (accessors).

This PR preserves source compatibility while keeping the boxed
storage that the wire-shape contract needs:

  1. Add a 7-arg primitive constructor that delegates to the new
     13-arg one with nulls for the post-PR-#148 optional fields.
     Marked @deprecated to nudge new callers toward the boxed form.

  2. getPriority() and getWeight() return primitive `int` again
     (null-safe-unbox to 0). Boxed access is via the new
     getPriorityBoxed() / getWeightBoxed() methods.

  3. getEnabled() (which was BRAND NEW in PR #148, returning
     Boolean) is renamed to getEnabledBoxed() so the JavaBeans-style
     name doesn't lure callers into `boolean e = p.getEnabled()`
     and an NPE on null. Pre-PR-#148 had no getEnabled() so this
     rename has no consumers.

  4. Same Boxed-suffix pattern applied to getHasApiKey →
     getHasApiKeyBoxed for symmetry; primitive `boolean hasApiKey()`
     was already there from before #148.

Two new regression tests pin the source-compat shape:
  - llmProviderLegacyConstructorPreservesSourceCompat — exercises
    the 7-arg primitive constructor and confirms primitive-returning
    accessors round-trip correctly.
  - llmProviderPrimitiveAccessorsNullSafe — confirms primitive
    accessors null-safe-unbox to 0 / false when the boxed field is
    null (which is what Jackson produces when the JSON field is
    omitted).

Existing test that asserted on `p.getEnabled()` updated to
`p.getEnabledBoxed()` to match the new naming.

Wire-shape baseline refreshed — the renamed getter is not part of
the wire contract (Jackson reads via constructor), but the validator
records SDK class shape and noticed the rename. No spec drift.
@saurabhjain1592 saurabhjain1592 merged commit cbe13d2 into main Apr 28, 2026
15 checks passed
@saurabhjain1592 saurabhjain1592 deleted the feature/llm-provider-source-compat branch April 28, 2026 16:50
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