Skip to content

ci(lint): lint library modules from the app's lintDebug - #1743

Merged
bmc08gt merged 3 commits into
code/cashfrom
ci/lint-library-modules
Oct 9, 2026
Merged

bmc08gt merged 3 commits into
code/cashfrom
ci/lint-library-modules

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #1741.

CI runs :apps:flipcash:app:lintDebug through the flipcash_tests lane, but checkDependencies defaults to false, so lint only checks the app module. That's how #1683's unguarded MediaStore.getPickImagesMaxLimit() call in chat-ui reached a release. Lint flags it as NewApi as soon as it looks at the module.

This turns on checkDependencies in the app's lint {} block. It surfaced four errors: the NewApi call #1741 fixes, plus three that already existed. Those three go in the baseline so the check only blocks new ones:

  • WrongConstant in AppSettingsMapper.kt:18
  • UnspecifiedRegisterReceiverFlag in SmsOtpAutofill.kt:104, on the pre-API 34 branch, where RECEIVER_EXPORTED isn't available
  • UnrememberedMutableState in Flippable.kt:57

The ~800 warnings it also reports don't fail the build and stay out of the baseline. Locally, lintDebug with checkDependencies took about 2 minutes on a warm build.

rememberChatPhotoPicker called getPickImagesMaxLimit() during composition
with no version check. The method exists only on API 33+, or on API 30-32
with SDK extension R 2+, so an Android 12 device without the MediaProvider
update threw NoSuchMethodError every time a chat opened (Bugsnag
6ac91865991833fd09984195, Samsung SM-N976V).

Only call it where the system picker provides it. Elsewhere androidx falls
back to a picker with no cap of its own, and the result callback already
trims the selection to the remaining slots.
Int.MAX_VALUE never reached the picker, since the clamp came out to
remaining anyway, but it read as no cap. Fall back to remaining directly.
CI runs :apps:flipcash:app:lintDebug, but checkDependencies defaults to
false, so lint only looked at the app module. The unguarded
MediaStore.getPickImagesMaxLimit() call in chat-ui (#1741) shipped
because no lint run ever saw it; with checkDependencies on, lint fails on
it with NewApi.

Turning it on surfaces three other existing errors, which go in the
baseline so the check gates new issues only: WrongConstant in
AppSettingsMapper, UnspecifiedRegisterReceiverFlag in SmsOtpAutofill (the
pre-34 branch, where the flag isn't available), and
UnrememberedMutableState in Flippable.
@bmc08gt bmc08gt self-assigned this Oct 9, 2026
@bmc08gt
bmc08gt changed the base branch from fix/chat-photo-picker-max-limit to code/cash October 9, 2026 17:27
@bmc08gt
bmc08gt merged commit 75afa44 into code/cash Oct 9, 2026
2 of 3 checks passed
bmc08gt added a commit that referenced this pull request Oct 9, 2026
* fix(chat): guard MediaStore.getPickImagesMaxLimit on older pickers

rememberChatPhotoPicker called getPickImagesMaxLimit() during composition
with no version check. The method exists only on API 33+, or on API 30-32
with SDK extension R 2+, so an Android 12 device without the MediaProvider
update threw NoSuchMethodError every time a chat opened (Bugsnag
6ac91865991833fd09984195, Samsung SM-N976V).

Only call it where the system picker provides it. Elsewhere androidx falls
back to a picker with no cap of its own, and the result callback already
trims the selection to the remaining slots.

* fix(chat): cap the fallback photo picker at the open slots

Int.MAX_VALUE never reached the picker, since the clamp came out to
remaining anyway, but it read as no cap. Fall back to remaining directly.

* ci(lint): lint library modules from the app's lintDebug

CI runs :apps:flipcash:app:lintDebug, but checkDependencies defaults to
false, so lint only looked at the app module. The unguarded
MediaStore.getPickImagesMaxLimit() call in chat-ui (#1741) shipped
because no lint run ever saw it; with checkDependencies on, lint fails on
it with NewApi.

Turning it on surfaces three other existing errors, which go in the
baseline so the check gates new issues only: WrongConstant in
AppSettingsMapper, UnspecifiedRegisterReceiverFlag in SmsOtpAutofill (the
pre-34 branch, where the flag isn't available), and
UnrememberedMutableState in Flippable.

* fix(lint): clear the three errors baselined in #1743

- WrongConstant: AppSettingMapper passed Biometrics.TEST_AUTH across a
  module boundary, where lint can't see it is a valid authenticator flag.
  The check now goes through Biometrics.authenticationState(), and
  TEST_AUTH is private.
- UnspecifiedRegisterReceiverFlag: SmsOtpAutofill only passed
  RECEIVER_EXPORTED on API 34+. ContextCompat.registerReceiver takes the
  flag on every version; the receiver stays exported, as SMS_RETRIEVED
  comes from Play services and SEND_PERMISSION still guards it.
- UnrememberedMutableState: FlippableCard built a new State object on
  each composition when animateFlip is false. It now uses
  rememberUpdatedState.

The three entries come out of the app's lint baseline.
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