From 843831e78444dfa5dac195b8f3a6c8241afb16fc Mon Sep 17 00:00:00 2001 From: hyperpolymath <6759885+hyperpolymath@users.noreply.github.com> Date: Tue, 2 Jun 2026 12:03:52 +0100 Subject: [PATCH] ci(governance): allow Java in android/**/src/**/*.java (platform-required JVM shims) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Android instantiates Service / BroadcastReceiver / AppWidgetProvider / Activity subclasses by class name at platform boundaries. The JVM classloader demands bytecode implementing those superclasses — Rust / Zig cannot satisfy this contract directly. Consumers writing mobile apps via Gossamer (or any webview shell) need a minimal Java shim surface that delegates immediately to native (JNI / Zig-FFI) code. This carve-out exempts EXACTLY `android/**/src/**/*.java` paths (anchored: `(^|/)android/.*/src/.*\.java$`). Properties: * `.kt` / `.kts` remain fully banned (no Kotlin carve-out). * Random `Foo.java` at repo root still fails. * `not-android/.../src/.../Foo.java` still fails. * Matches the established Android source-tree shape used by Gossamer upstream (`gossamer/android/src/main/java/io/gossamer/...`) and by consumers like neurophone (`android/app/src/main/java/ai/neurophone/...`). Triggered by the neurophone Kotlin → Gossamer migration RFC (hyperpolymath/neurophone#97). Without this carve-out the migration cannot land cleanly because the four JVM-class-name boundaries above are unavoidable. Each Java shim added under this carve-out must be a minimal delegating wrapper (typically <10 LoC) that JNIs into Rust/Zig immediately. The shim contains no business logic. No SHA bump required for the 6 consumers pinning `@main` (incl. neurophone). 228 consumers pinning SHA `861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613` will need a SHA-bump fan-out post-merge — coordinate via the established R5b campaign script. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/governance-reusable.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/governance-reusable.yml b/.github/workflows/governance-reusable.yml index e0759782..24d88601 100644 --- a/.github/workflows/governance-reusable.yml +++ b/.github/workflows/governance-reusable.yml @@ -342,7 +342,16 @@ jobs: | grep -v venv | grep -v __pycache__ || true) MAKE_FILES=$(git ls-files 'Makefile' 'Makefile.*' '*.mk' \ | grep -v '\.github/' || true) - JAVA_FILES=$(git ls-files '*.java' '*.kt' '*.kts' || true) + # Platform-required JVM shims carve-out 2026-06-02: + # Java is permitted only in Android source trees + # (android/**/src/**/*.java) because Android instantiates + # Service/BroadcastReceiver/AppWidgetProvider/Activity classes by + # name at platform boundaries — Rust/Zig cannot provide JVM + # bytecode for these. Each Android Java shim must be a minimal + # delegating wrapper (typically <10 LoC) that JNIs into Rust/Zig + # immediately. Kotlin (*.kt, *.kts) remains banned outright. + JAVA_FILES=$(git ls-files '*.java' '*.kt' '*.kts' \ + | grep -vE '(^|/)android/.*/src/.*\.java$' || true) SWIFT_FILES=$(git ls-files '*.swift' || true) DART_FILES=$(git ls-files '*.dart' 'pubspec.yaml' || true) # V-lang detected by manifest (v.mod / vpkg.json); the .v extension