MOB-98: mix mob.doctor detects the pre-fix component-event JNI mismatch - #45
Merged
Merged
Conversation
mob_new's template fix (JNI owner mismatch — nativeDeliverComponentEvent declared on MobNativeViewRegistry instead of MobBridge) only repairs newly-generated projects. This repo doesn't auto-patch hand-editable native source in existing generated apps (see enable.ex's detect_stale_pythonx_templates for the established precedent — detect + warn, never blind-overwrite), so an already-generated app stays broken until a human ports the fix or regenerates. mix mob.doctor's Build section now flags the pre-fix declaration shape in an existing MobBridge.kt, pointing at the same fix mob_new's template already carries — surfaced by `mix mob.doctor` instead of an UnsatisfiedLinkError on first real interaction with a tier-2 native component.
…g ADR From code review on PR #45: - __component_event_jni_mismatched__/1 used a plain String.contains? requiring "@JvmStatic external fun nativeDeliverComponentEvent" on one line. A dev hand-porting the fix with @JvmStatic on its own line above external fun — idiomatic Kotlin style — got permanently flagged as still broken, since mix mob.doctor only warns and never re-checks a fix it can't see was applied. Switched to a runtime- compiled regex tolerant of the annotation/declaration split across lines (Regex.compile!/1, not a ~r// literal — see mob's AGENTS.md rule #9). - The comment pointed at mob_dev/decisions/ for "why this repo doesn't auto-patch hand-editable native source" — no ADR there actually covered it; the only real precedent was an inline docstring in enable.ex. Wrote decisions/2026-08-25-detect-dont-autopatch-native-source.md documenting the decision properly (per this repo's own decision-log convention: record it the moment you make the call, not later) and pointed the comment at the real file.
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.
Summary
enable.ex'sdetect_stale_pythonx_templatesfor the established precedent: detect + warn, never blind-overwrite), so an existing app stays broken until a human ports the fix or regenerates.mix mob.doctor's Build section now flags the pre-fix declaration shape in an existingMobBridge.kt, pointing at the same fix mob_new's template already carries.Test plan
mix test— 2120 passed, 3 new tests for__component_event_jni_mismatched__/1mix format/mix credo --strict— cleanLinear: MOB-98 (companion PRs: mob fix/mob-98-native-component-events, mob_new fix/mob-98-native-component-events)
🤖 Generated with Claude Code