Skip to content

fix(bundle-update): avoid nested-comment trigger in KDoc body#50

Open
huhuanming wants to merge 8 commits intomainfrom
fix/bundle-update-kdoc-nested-comment
Open

fix(bundle-update): avoid nested-comment trigger in KDoc body#50
huhuanming wants to merge 8 commits intomainfrom
fix/bundle-update-kdoc-nested-comment

Conversation

@huhuanming
Copy link
Copy Markdown
Contributor

@huhuanming huhuanming commented Apr 24, 2026

Summary

  • KDoc at ReactNativeBundleUpdate.kt:992–998 contained bundleDir/web-embed/** in the comment body. Kotlin block comments nest (unlike Java/C), so the lexer treated the /* inside /web-embed/** as opening a new comment level. The outer */ only decremented depth from 2 to 1, so every definition after this comment — including fun validateWebEmbedSha256 and fun isDevSettingsEnabled — was silently absorbed into a comment that never closes.
  • This surfaced on Android release builds as four cascading errors from :onekeyfe_react-native-bundle-update:compileReleaseKotlin:
    • 990:6 Syntax error: Missing '}'
    • 2032:1 Syntax error: Unclosed comment
    • 849:83 Unresolved reference 'isDevSettingsEnabled'
    • 984:14 Unresolved reference 'validateWebEmbedSha256'
  • Rewrite the doc to prose ("Walks every file under bundleDir/web-embed/ recursively") so the ** glob is no longer in the comment body. No behavior change.

Repro / verification

Minimal repro (16-line Kotlin file with the same comment):

class Foo {
    /**
     * Walks bundleDir/web-embed/** and verifies every file's sha256 against
     */
    fun validateWebEmbedSha256(): Boolean = true
    fun isDevSettingsEnabled(): Boolean = false
}

kotlinc 2.3.21 output on the pre-fix file:

error: syntax error: Missing '}.
error: syntax error: Unclosed comment.

kotlinc on the post-fix file: no lex/parse errors (only expected unresolved reference entries for Android/Facebook framework imports that aren't on the standalone classpath).

Test plan

  • Bump @onekeyfe/react-native-bundle-update patch version and publish
  • Update apps/mobile/package.json in app-monorepo to the new version
  • Retrigger release-android on x and confirm :onekeyfe_react-native-bundle-update:compileReleaseKotlin passes
  • Smoke-test bundle hot update flow on Android release build (the touched function is used on the web-embed integrity path)

Open in Devin Review

Kotlin block comments nest, so a bare `**` inside a `/** ... */` KDoc
(as in `web-embed/**`) is lexed as a nested comment opener. The outer
closing `*/` then only decrements the depth to 1, causing the rest of
the file — including `fun validateWebEmbedSha256` and
`fun isDevSettingsEnabled` — to be swallowed as comment body until EOF.
This manifested as four cascading Android release errors:
`Missing '}'` at 990:6, `Unclosed comment` at file end, and two
`Unresolved reference` errors for the swallowed function names.

Rewrite the sentence to describe the traversal in prose instead of
using a glob, which removes the `**` from the comment body and makes
the file lex cleanly.
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Allows SplitBundleLoaderModule and other external modules to invoke the
three getCurrentBundle*JSBundle entry points via reflection with a null
receiver. Without @JvmStatic the Kotlin `object` members are instance
methods on the singleton, so Class.getMethod(...).invoke(null, ctx)
throws NPE and OTA segment lookup silently falls back to APK assets.
…c-nested-comment

# Conflicts:
#	CHANGELOG.md
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