chore: check smali descriptors and toggle keys against the extension at build time #116

Merged
midas merged 1 commit from review/78-contract-check into dev 2026-10-17 16:42:29 +02:00
Owner

Part of #105, fixes #78.

buildAndroid now depends on :patches:test, which runs ExtensionContractTest (patches/src/test/kotlin/.../contract/):

  • every Lnl/midasvo/extension/...; class, ->method(desc) and ->field:Type in the Kotlin patches (with same-file const vals, $CONST templates and string joins resolved) must exist in the compiled extension, public, and static for invoke-static/sget/sput;
  • every toggle key (MidasToggle(key = ...), toggleKey = ...) must be registered in MidasSettings.java and vice versa; explicit allow-list with reasons, stale entries fail.

Failures name the Kotlin file:line. Because CI, the release and the app update check all run buildAndroid, no workflow change is needed.

Proof (temporary mutations, reverted): a changed descriptor in HideReviewPromptsPatch.kt and a misspelt hide_surveys both failed the build with file:line messages. Clean tree: all green, no allow-list entries needed.

Limitations: checks the javac classes, not the final dex; only same-file const vals are resolved.

🤖 Generated with Claude Code

Part of #105, fixes #78. `buildAndroid` now depends on `:patches:test`, which runs `ExtensionContractTest` (patches/src/test/kotlin/.../contract/): - every `Lnl/midasvo/extension/...;` class, `->method(desc)` and `->field:Type` in the Kotlin patches (with same-file `const val`s, `$CONST` templates and string joins resolved) must exist in the compiled extension, public, and static for `invoke-static`/`sget`/`sput`; - every toggle key (`MidasToggle(key = ...)`, `toggleKey = ...`) must be registered in `MidasSettings.java` and vice versa; explicit allow-list with reasons, stale entries fail. Failures name the Kotlin file:line. Because CI, the release and the app update check all run `buildAndroid`, no workflow change is needed. Proof (temporary mutations, reverted): a changed descriptor in HideReviewPromptsPatch.kt and a misspelt `hide_surveys` both failed the build with file:line messages. Clean tree: all green, no allow-list entries needed. Limitations: checks the javac classes, not the final dex; only same-file `const val`s are resolved. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chore: check smali descriptors and toggle keys against the extension at build time
All checks were successful
CI / Build (pull_request) Successful in 1m36s
46cc2bc5dd
buildAndroid now runs :patches:test first (extension contract check). It resolves the
Lnl/midasvo/extension/... class, method and field references in the Kotlin patches (const val
strings, $CONST templates, joined strings) and compares them with the javac output of the
extension: class, name, descriptor, public and static. It also checks that every toggle key in
MidasToggle/toggleKey is registered in MidasSettings.java and every registered key is used,
with an allow-list. Failures name the Kotlin file:line of the call site.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.