Skip to content

fix(android): getJurisdiction/getRegion prefer locally-set values#130

Merged
ethanpschoen merged 2 commits into
justin/feat/cross-activity-lifecyclefrom
ethan/fix/local-first-headless-getters
Jul 20, 2026
Merged

fix(android): getJurisdiction/getRegion prefer locally-set values#130
ethanpschoen merged 2 commits into
justin/feat/cross-activity-lifecyclefrom
ethan/fix/local-first-headless-getters

Conversation

@ethanpschoen

@ethanpschoen ethanpschoen commented Jul 20, 2026

Copy link
Copy Markdown

Description of this change

getJurisdiction()/getRegion() on the Ketch instance always fetched from the server, ignoring any value already set via setJurisdiction()/setRegion() on the same instance. Both getters now check the local field first and only fall back to the server-resolved value when nothing has been set locally — matching ketch-tag's getter/setter model, where an explicit override short-circuits resolution before any fetch.

Why is this change being made?

  • Chore (non-functional changes)
  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How was this tested? How can the reviewer verify your testing?

Added two live-CDN instrumented tests to KetchHeadlessIntegrationTest (testGetJurisdictionPrefersLocallySetValue, testGetRegionPrefersLocallySetValue) — confirmed red before this change, green after, on a real Android emulator against the production CDN (ketch_samples/android). No regressions in the rest of the headless suite or the ketchsdk unit tests.

./gradlew :integration-tests:connectedAndroidTest \
  -Pandroid.testInstrumentationRunnerArguments.class=com.ketch.android.integration.tests.KetchHeadlessIntegrationTest

Related issues

Reported by a customer blocked on Android headless testing; no tracked GitHub issue.

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have evaluated the security impact of this change, and OWASP Secure Coding Practices have been observed.
  • I have informed stakeholders of my changes.

…s first

getJurisdiction()/getRegion() always fetched from the server, ignoring
any value already set via setJurisdiction()/setRegion() on the same
instance. Check the local field first and only fall back to the
server-resolved value when nothing has been set locally, matching
ketch-tag's override-before-fetch getter/setter model.

Verified with a live-CDN instrumented test (KetchLocalFirstIntegrationTest):
red before this change, green after, no regressions in the existing
headless test suite.
…ationTest

Per integration-tests/README.md's own contribution convention, headless
CDN tests belong in KetchHeadlessIntegrationTest rather than a new file.
Also drops the two redundant fallback-to-server assertions, which
duplicated existing testGetJurisdictionReturnsJurisdictionCode/
testGetRegionReturnsRegionCode coverage without exercising anything the
prior commit changed.
@ethanpschoen
ethanpschoen requested a review from jboileau99 July 20, 2026 18:47
@ethanpschoen
ethanpschoen merged commit 7df66de into justin/feat/cross-activity-lifecycle Jul 20, 2026
4 checks passed
@ethanpschoen
ethanpschoen deleted the ethan/fix/local-first-headless-getters branch July 20, 2026 19:27
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