Skip to content

fix(ci): repair ktlint violations and the uphold unit-test org.json classpath - #1530

Merged
bfoss765 merged 1 commit into
feat/kotlin-sdk-phase1from
fix/phase1-ci
Jul 31, 2026
Merged

bfoss765 merged 1 commit into
feat/kotlin-sdk-phase1from
fix/phase1-ci

Conversation

@HashEngineering

Copy link
Copy Markdown
Collaborator

Makes feat/kotlin-sdk-phase1 pass CI. Both failures are pre-existing on phase1 — they only became visible now because the branch has never had a PR of its own, so #1525 is the first CI run over this code. Neither was introduced by that merge.

check — ktlintCheck: 23 violations in 3 modules

CI reported only crowdnode because the first failing task aborts the run; the rest were hidden behind it. Full list:

Module Violations
integrations/maya (main) 14 import-ordering + 1 unused import
integrations/maya (test) 2 missing final newline, 1 import-ordering, 1 max-line-length
integrations/crowdnode (test) 1 import-ordering
features/exploredash (main) 1 import-ordering

All applied with ktlintFormat except the over-length line, which the formatter can't fix: the Shelley test address in AddressParserTest is now split across two literals to fit 120 columns. I verified the concatenation is byte-identical to the original, so the assertion is unchanged. (The 125-char line inside the adjacent raw string is untouched — ktlint exempts raw-string content, and editing it would change the parser's test input.)

build — 8 of 11 uphold unit tests failed

java.lang.RuntimeException: Method getJSONObject in org.json.JSONObject not mocked.
  at ...uphold.data.UpholdApiException.getErrorsWithException(UpholdApiException.java:81)

android.jar ships a stub org.json whose methods throw under JVM unit tests. A real implementation had been reaching the test classpath transitively from org.dashj:dashj-core — its POM declares org.json:json:20231013 at runtime scope. Phase1 removed dashj from this module, and jjwt's own copy is deliberately excluded (it must not be packaged into the APK), so nothing supplied it any more.

Fix: testImplementation 'org.json:json:20231013' — test-scope only, so the APK is unaffected — and the stale //provided by Android natively comment now says why unit tests are the exception. Production code was never affected: a real device supplies org.json, which is why this only ever showed up in unit tests.

Verification

  • ./gradlew ktlintCheck — clean
  • ./gradlew testDebugUnitTest — 118 tests, 0 failures across common, exploredash, coinbase, crowdnode, maya, uphold (uphold now 11/11, previously 8 failing)

Both commands match what CI runs (ktlint.yml runs ktlintCheck; dashwallet.yml runs fastlane test → testDebugUnitTest).

Once this lands on phase1, re-merging or rebasing #1525 should turn it green.

🤖 Generated with Claude Code

…lasspath

The phase1 branch has never had a PR, so CI first ran over this code in the
master-merge PR (#1525) and surfaced two pre-existing failures.

check (ktlintCheck) — 23 violations across three modules, all invisible until now
because the first failing task aborted the run:
- import ordering in crowdnode/maya/exploredash (19 files)
- one unused import (MayaConversionPreviewViewModel)
- two files missing a trailing newline
- one over-length line in maya's AddressParserTest; the Shelley address literal is
  split in two to fit 120 columns (verified byte-identical to the original)
Everything except the long line was applied with ktlintFormat.

build (testDebugUnitTest) — 8 of 11 uphold tests failed with
"Method getJSONObject in org.json.JSONObject not mocked". android.jar ships a stub
org.json whose methods throw under JVM unit tests; a real implementation had been
arriving transitively from org.dashj:dashj-core, whose POM pulls org.json:json at
runtime scope. Removing dashj from the uphold module took it away, and jjwt's copy
is deliberately excluded so it stays out of the APK. Added org.json as an explicit
testImplementation and corrected the now-misleading "provided by Android natively"
comment. Production code is unaffected — a device supplies org.json.

Verified: ktlintCheck clean and 118 unit tests pass across all six modules.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a59fe96-f084-4f11-a2fe-78fd946feb82

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HashEngineering
HashEngineering requested a review from bfoss765 July 30, 2026 20:48

@bfoss765 bfoss765 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the full diff: 19 files are pure ktlint formatting (no logic changes — verified no non-import added lines). The two substantive changes are safe: (1) uphold/build.gradle adds org.json only at test scope with the APK exclude retained, restoring the real impl that dashj-core used to supply transitively; (2) the AddressParserTest Shelley address split is byte-identical to the original. No wallet-module changes, so no conflict with in-flight work. LGTM.

@bfoss765
bfoss765 merged commit 22f9ff5 into feat/kotlin-sdk-phase1 Jul 31, 2026
HashEngineering added a commit that referenced this pull request Jul 31, 2026
…t/merge-kotlin-sdk-master

Picks up phase1's CI repair (#1530) and the post-cutover completeness work
(11.10.36 / AAR v41int11), so this branch now builds against the SDK version
phase1 expects.

Conflicts (9 across 8 files), mostly import collisions from both sides being
ktlint-formatted independently. Two were substantive:

- NotificationItemPayment: phase1 reintroduced a `* 1000` on getDate() that
  master had deliberately removed. Every other NotificationItem returns true
  epoch millis (Contact -> usernameSearchResult.date, Stub ->
  currentTimeMillis, UserAlert -> createdAt), so the multiplier would push
  payment rows ~1000x into the future in the mixed-type sort and break
  relative-time rendering. Resolved by keeping phase1's new SDK-only support
  (the txId property deriving from correctedDisplay.rowId, so a post-cutover
  row works without a dashj Transaction) on master's millis scale, with a
  comment against reintroducing it.

- maya AddressParserTest: master replaced the fabricated Cardano address with
  a real CIP-19 mainnet vector and now asserts the old one is INVALID. #1530
  had merely reformatted that literal to fit 120 columns, so master's version
  supersedes it and was taken wholesale.

Also fixes two ktlint problems this branch's earlier merge (f73bf13)
introduced, which CI never reported because the crowdnode failure aborted
ktlintCheck before reaching these modules:

- PurchaseGiftCardFragmentV2: 4 indentation violations where phase1's neutral
  FiatValue lines kept master's old indentation.
- MayaAddressInputViewModel: the AddressNetwork.fromId(...) line exceeded 120
  columns; plus vendored-import ordering in four maya parsers.

Verified: ktlintCheck clean project-wide, maya + common unit tests pass, and
:wallet:compile_testNet3DebugKotlin builds against the freshly published
0.1.0-v41int11-SNAPSHOT (238 JNI exports, both ABIs).

Co-Authored-By: Claude Fable 5 <[email protected]>
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