Skip to content

chore(deps): update rand_distr requirement from 0.4 to 0.5 - #3

Merged
hyperpolymath merged 2 commits into
mainfrom
dependabot/cargo/rand_distr-0.5
Dec 16, 2025
Merged

hyperpolymath merged 2 commits into
mainfrom
dependabot/cargo/rand_distr-0.5

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Dec 16, 2025 •

Copy link
Copy Markdown
Contributor

Updates the requirements on rand_distr to permit the latest version.

Release notes

Sourced from rand_distr's releases.

0.5.1

What's Changed

New Contributors

Full Changelog: rust-random/rand_distr@0.5.0...0.5.1

Changelog

Sourced from rand_distr's changelog.

[0.5.1]

Testing

  • Added building the crate to CI

Fixes

  • Fix missing import for no_std builds

[0.5.0] - 2025-01-27

Dependencies and features

  • Bump the MSRV to 1.61.0 (#1207, #1246, #1269, #1341, #1416); note that 1.60.0 may work for dependents when using --ignore-rust-version
  • Update to rand v0.9.0 (#1558)
  • Rename feature serde1 to serde (#1477)

API changes

  • Make distributions comparable with PartialEq (#1218)
  • Dirichlet now uses const generics, which means that its size is required at compile time (#1292)
  • The Dirichlet::new_with_size constructor was removed (#1292)
  • Add WeightedIndexTree (#1372, #1444)
  • Add PertBuilder to allow specification of mean or mode (#1452)
  • Rename Zeta's parameter a to s (#1466)
  • Mark WeightError, PoissonError, BinomialError as #[non_exhaustive] (#1480)
  • Remove support for usage of isize as a WeightedAliasIndex weight (#1487)
  • Change parameter type of Zipf::new: n is now floating-point (#1518)

API changes: renames

  • Move Slice -> slice::Choose, EmptySlice -> slice::Empty (#1548)
  • Rename trait DistString -> SampleString (#1548)
  • Rename DistIter -> Iter, DistMap -> Map (#1548)
  • Move {Weight, WeightError, WeightedIndex} -> weighted::{Weight, Error, WeightedIndex} (#1548)
  • Move weighted_alias::{AliasableWeight, WeightedAliasIndex} -> weighted::{..} (#1548)
  • Move weighted_tree::WeightedTreeIndex -> weighted::WeightedTreeIndex (#1548)

Testing

Fixes

  • Fix Knuth's method so Poisson doesn't return -1.0 for small lambda (#1284)
  • Fix Poisson distribution instantiation so it return an error if lambda is infinite (#1291)
  • Fix Dirichlet sample for small alpha values to avoid NaN samples (#1209)
  • Fix infinite loop in Binomial distribution (#1325)
  • Fix Pert distribution where mode is close to (min + max) / 2 (#1452)
  • Fix panic in Binomial (#1484)
  • Limit the maximal acceptable lambda for Poisson to solve (#1312) (#1498)
  • Fix bug in Hypergeometric, this is a Value-breaking change (#1510)

Other changes

  • Remove unused fields from Gamma, NormalInverseGaussian and Zipf distributions (#1184) This breaks serialization compatibility with older versions.

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file rust Pull requests that update rust code labels Dec 16, 2025
@hyperpolymath
hyperpolymath merged commit e321587 into main Dec 16, 2025
@hyperpolymath
hyperpolymath deleted the dependabot/cargo/rand_distr-0.5 branch December 16, 2025 13:50
hyperpolymath added a commit that referenced this pull request Jun 2, 2026
Maps every external fun in NativeLib.kt to (a) the Rust JNI export
we'll write in crates/neurophone-android/src/lib.rs and (b) the
underlying neurophone-core API it composes. Surfaces 5 gaps:

1. No start/stop/is_running lifecycle on NeuroSymbolicSystem
   → keep as JNI-layer concept (bool in static state holder).
2. Sensor-type int→string mapping currently in Kotlin
   → move into Rust JNI layer as const lookup.
3. query() uses heuristic prefer_local; Kotlin queryLocal/queryClaude
   expect hard routing → introduce QueryRoute enum on core.
4. No get_neural_context() on core → add method composing from get_state().
5. No reset() on core → JNI layer replaces held instance.

Estimated sub-PR #4 size: ~250 LoC new Rust + ~10 LoC core change +
JNI roundtrip tests. Shovel-ready when sub-PRs #2 (CI exemption) +
#3 (Gossamer scaffolding) land.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
hyperpolymath added a commit that referenced this pull request Jun 2, 2026
Q1: estate-wide CI exemption (standards#341).
Q2: self-answered.
Q3: drop widget-configure activity.
Q4: Groovy *.gradle.
Q5: emulator+Termux for dev, Oppo Reno 13 for final close-out.
Q6: contribute upstream — `gossamer-android-services` companion in
    hyperpolymath/gossamer with four shim base classes (Service,
    BroadcastReceiver, AppWidgetProvider, Activity-with-bridge).

Q6 changes the sub-PR sequence: a new #2b — Gossamer companion PR —
blocks the original #3 (neurophone Gossamer scaffolding). Revised
9-step sequence captured in the new "Sequencing implications of Q6"
section.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
hyperpolymath added a commit that referenced this pull request Jun 4, 2026
## Sub-PR #3 of the Android Kotlin→Rust/Gossamer migration epic

Part of epic **#83**, RFC PR **#97**, tracking sub-issue **#109**. Scope
of #3 is **scaffolding only** — stand up the minimal Gossamer Android
shell so sub-PRs #4–#7 can port the actual components. No behaviour
change to existing crates.

### Files added / changed
| File | Change |
|------|--------|
| `android/gossamer.conf.json` | **NEW** — Gossamer app config
(analogous to the former `tauri.conf.json`). Schema
`https://gossamer.dev/schemas/config/v1`, modelled on
`hyperpolymath/panll` + `hyperpolymath/gossamer`. Includes a
`bundle.mobile.android` block (`minSdk 26` / `targetSdk 34`, mirroring
the legacy `AndroidManifest.xml`). |
|
`android/app/src/main/java/ai/neurophone/gossamer/NeurophoneMainActivity.java`
| **NEW** — Java shim extending `io.gossamer.GossamerActivity`;
overrides `getInitialHtml()` to load placeholder HTML in the Gossamer
webview. |
| `crates/neurophone-android/Cargo.toml` | Commented-out `gossamer-rs`
placeholder + TODO (unpublished; see below). |
| `android/app/build.gradle.kts` | Commented-out Gossamer Android
library dependency + TODO. |
| `android/app/src/main/AndroidManifest.xml` | Commented-out
registration of `NeurophoneMainActivity` + TODO (legacy `.MainActivity`
stays LAUNCHER for now). |

Every new file carries `SPDX-License-Identifier: MPL-2.0`.

### `gossamer-rs` resolvability outcome
**Not resolvable in this workspace — left as a commented placeholder, by
design.** Estate precedent (`hyperpolymath/panll`) consumes it only as a
**path dependency to a sibling checkout**: `gossamer-rs = { path =
"../gossamer/bindings/rust" }`. The crate (`gossamer-rs` v0.1.0) is
**not published to crates.io**, and there is no sibling `gossamer`
checkout in neurophone CI. Adding it as a hard dependency would break
`cargo build --workspace`, so per the hard constraint it is commented
out with a TODO(#83 sub-PR #5) documenting the git/path/registry
options. Likewise the **Gossamer Android library**
(`io.gossamer.GossamerActivity`/`GossamerBridge`) ships upstream as a
raw Java source tree + prebuilt `libgossamer.so`, **not** a Maven/AAR
artifact, so the Gradle dependency and the manifest activity
registration are also commented placeholders.

### What I verified
- `cargo metadata --no-deps` → **OK** (all workspace manifests,
including my Cargo.toml edit, parse).
- `cargo build --workspace` → **fails, but with a PRE-EXISTING failure
unrelated to this PR.** The `esn` and `lsm` crates do not compile on
`main` (commit `0a88e45`) due to a `rand` 0.10 / `ndarray-rand` 0.16 API
incompatibility (`no method named random`/`sample`, `RngExt`/`DerefMut`
bounds). This PR touches **zero** compiling Rust: the diff in
`crates/esn`, `crates/lsm`, `crates/neurophone-core` is empty, and the
only Rust change is a **commented** block in
`crates/neurophone-android/Cargo.toml`. **Build/test error delta
introduced by this PR: 0.** `cargo test --workspace` is blocked by the
same pre-existing compile failure, not by anything here.
- No new `gossamer-rs` hard dependency added → CI green-ness is not
regressed by this PR.

> ⚠️ The pre-existing `esn`/`lsm` `rand` breakage on `main` is out of
scope for this scaffolding sub-PR and should be fixed separately.

### `GossamerActivity` API assumptions
Read directly from `hyperpolymath/gossamer`
`android/src/main/java/io/gossamer/GossamerActivity.java`:
- Package `io.gossamer`; subclass and override `getInitialHtml()`
(non-null ⇒ `webView.loadData`) **or** `getInitialUrl()` (used when HTML
is null).
- Parent loads `libgossamer.so` via `System.loadLibrary("gossamer")` in
a static block and registers the `GossamerBridge` JS interface
(`window.GossamerBridge.postMessage(json)`) for native IPC.
- Assumed `gossamer.conf.json` v1 schema is the correct mobile config
surface and that `bundle.mobile.android` is the right place for
SDK/permission config (matches the gossamer reference config; not
independently validated against a live gossamer mobile build, since
Gossamer Android is webview-only today).

### TODOs / risks for sub-PRs #4–#8
- **#4**: replace placeholder HTML with the real bundled web UI
(`getInitialUrl()` / `build.frontendDist`); enable the manifest activity
+ move LAUNCHER intent-filter; retire `.MainActivity`.
- **#5**: enable `gossamer-rs` (vendor / git dep / registry) once
resolvable; port the 11 `NativeLib` JNI methods
(init/start/stop/processSensor/queryLocal/queryClaude/query/getNeuralContext/getState/reset/isRunning)
onto the Gossamer IPC bridge, backed by `crates/neurophone-android` +
`crates/neurophone-core`.
- **#6**: port the sensor pipeline (accel/gyro/mag/light/proximity →
LSM→ESN loop).
- **#7**: port `NeurophoneService` (foreground service), `BootReceiver`,
and the home-screen widgets; re-add
`BODY_SENSORS`/`FOREGROUND_SERVICE`/`RECEIVE_BOOT_COMPLETED`/`WAKE_LOCK`
to `gossamer.conf.json`.
- **#8**: remove the legacy `android/` Kotlin tree and drop the
`.hypatia-baseline.json` carve-out once migration lands.
- **Risk**: gossamer Android library distribution mechanism (Maven coord
vs vendored source vs prebuilt `.so` path) is unconfirmed — sub-PR #4/#5
must pick one. Mobile `gossamer.conf.json` fields beyond the desktop
reference are assumed, not validated against a live mobile build.

https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw)_

Co-authored-by: Claude <[email protected]>
hyperpolymath added a commit that referenced this pull request Jun 6, 2026
**Sub-PR #3** of the Android Kotlin→Rust/Gossamer migration epic (#83,
RFC PR #97, tracking sub-issue #109). **Scaffolding only.** No behaviour
change to existing crates; the legacy Kotlin `android/app/` tree is
untouched.

## Files added (all under `android/gossamer/`, all
`SPDX-License-Identifier: MPL-2.0`)

| File | Purpose |
|---|---|
| `gossamer.conf.json` | Gossamer app config (analogous to
`tauri.conf.json`). Schema mirrored from `hyperpolymath/gossamer` and
`hyperpolymath/panll`. Carries identity `ai.neurophone`, the
`bundle.mobile.android` block (minSdk 26 / targetSdk 34 + the permission
set from the legacy `AndroidManifest.xml`), dev/build runner config. |
| `app/src/main/java/ai/neurophone/NeurophoneMainActivity.java` | Java
shim extending `io.gossamer.GossamerActivity`; overrides
`getInitialHtml()` to load placeholder HTML in the Gossamer WebView. |
| `Cargo.toml` | Standalone (non-workspace) scaffold manifest for the
future `neurophone-gossamer` cdylib. `gossamer-rs` dep commented out
(see below). |
| `src/lib.rs` | Inert placeholder lib so the standalone crate compiles;
documents wiring TODOs. |
| `README.adoc` | Documents resolvability, `GossamerActivity` API
assumptions, TODOs/risks for #4–#8. |
| `Cargo.lock` | Lock for the standalone scaffold crate (pins
serde/serde_json placeholder deps). |

The `android/**` subtree is exempt from the banned-language CI gate via
`.hypatia-baseline.json` on `main`, so the hand-written Java shim is
acceptable here.

## `gossamer-rs` resolvability outcome

**`gossamer-rs` v0.1.0 is NOT published to crates.io.** In the estate it
is consumed as a **path dependency** from the sibling
`hyperpolymath/gossamer` repo at `bindings/rust` — precedent from
`hyperpolymath/panll`:
```toml
gossamer-rs = { path = "../gossamer/bindings/rust" }
```
That sibling checkout doesn't exist in a neurophone clone, so wiring it
as a hard dependency would break the build. Per the hard constraint (CI
green > "complete" dep), it is **left commented out** with `TODO(#83
sub-PR #8)`. The scaffold manifest is also kept **out of the root
workspace `members`** and carries an empty `[workspace]` table, so
neither `cargo build --workspace` nor `cargo test --workspace` ever
touches it.

## What I verified (build/test)

- `cargo metadata --no-deps` for the root workspace → the 8 existing
crates only; `neurophone-gossamer` is **not** a member. My additions are
inert to the workspace.
- Standalone scaffold: `cargo test --manifest-path
android/gossamer/Cargo.toml` → **compiles + 1 test passes**.
- `cargo build --workspace` / `cargo test --workspace` fail **only** in
`crates/esn` and `crates/lsm` (`ndarray-rand` 0.16 vs `rand` 0.10 API
skew: `random`/`sample`/`random_using`). **This failure pre-exists on
`main`** — reproduced in a pristine `main` worktree (`cargo build -p
esn` exits 101 on `0a88e45`). My PR neither introduces nor worsens it.
⚠️ Pre-existing red workspace flagged below.

## `GossamerActivity` API assumptions (read from
`hyperpolymath/gossamer` `android/src/main/java/io/gossamer/`)

- `io.gossamer.GossamerActivity extends android.app.Activity`.
- Loads `libgossamer.so` via `System.loadLibrary("gossamer")` in a
static block.
- `onCreate()` builds a full-screen `WebView`, enables JS + DOM storage,
**disables** `file://`/content access, registers the `GossamerBridge` JS
interface (`window.GossamerBridge.postMessage(json)`), and calls native
`nativeInit(activity, webview)`.
- Content via overriding **`getInitialHtml()`** (HTML `String`) or
**`getInitialUrl()`** (URL `String`); `getInitialHtml()` takes
precedence — we override it.
- Gossamer on Android is **webview-only today**.
- Assumed: the gossamer Android sources + `libgossamer.so` are
vendored/linked into the app module at build time (sub-PR #8), so
`io.gossamer.GossamerActivity` is on the classpath. The shim is
therefore not part of any CI build step yet.

## TODOs / risks for sub-PRs #4–#8

- **#4** — Port `NativeLib`: map the 11 JNI methods
(init/start/stop/processSensor/queryLocal/queryClaude/query/getNeuralContext/getState/reset/isRunning)
to Gossamer IPC command handlers calling the Rust core
(`crates/neurophone-core`, `crates/neurophone-android`). IPC
name/payload contract is **undefined**.
- **#5** — Port `NeurophoneService` foreground sensor loop.
- **#6** — Port `BootReceiver`.
- **#7** — Port the home-screen widgets.
- **#8** — Real frontend bundle (`frontendDist`) + full IPC wiring;
**enable `gossamer-rs`** (resolve the sibling-checkout/build-integration
question); decide `gossamer` CLI vs Gradle for the APK build; then
remove the legacy Kotlin `android/app/` tree.
- **Licensing risk**: `gossamer-rs` is `AGPL-3.0-or-later`; everything
added here is `MPL-2.0`. Whether the cdylib linking `gossamer-rs` can
stay MPL-2.0 or must adopt a compatible license is an **open question**
to resolve before #8.

Refs #83, #97, #109.

https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw)_

Co-authored-by: Claude <[email protected]>
hyperpolymath added a commit that referenced this pull request Jun 6, 2026
## neurophone sub-PR #6 — port BootReceiver

Part of the Android Kotlin→Rust/Gossamer migration (epic #83, RFC PR
#97, sub-issue #112).

### What this does
Replaces the Kotlin `BootReceiver` with a **thin, hand-written Java**
`BroadcastReceiver` shim. On `BOOT_COMPLETED` / `LOCKED_BOOT_COMPLETED`
it starts the neurophone foreground `NeurophoneService` (the service
from sub-PR #5) via `startForegroundService`. The receiver carries **no
business logic** — any runtime policy (e.g. "was it running before
reboot?") and all inference live behind the Rust JNI
(`crates/neurophone-android`), reached through the service start path,
not here.

### Files changed
- **Added** `android/app/src/main/java/ai/neurophone/BootReceiver.java`
— Java shim, `SPDX-License-Identifier: MPL-2.0`.
- **Deleted** `android/app/src/main/java/ai/neurophone/BootReceiver.kt`.
- **Modified** `android/app/src/main/AndroidManifest.xml` — receiver
registration is class-name based (`.BootReceiver`) and therefore
migration-transparent; only updated the surrounding comment + a
`TODO(#83 rebase)` marker.

### Constraints honoured
- Hand-written Java lives **only** under `android/`, covered by the
existing `.hypatia-baseline.json` exemption (`android/**`, tracking
#97). No baseline edit needed.
- New file carries `SPDX-License-Identifier: MPL-2.0`.
- Change set is **Java + manifest only**; touches **zero** Rust files.
`android/` is not a cargo workspace member, so the Rust workspace is
unaffected.

### Verified
- No stale references: only the manifest references `.BootReceiver`
(correct, class-name based); no Kotlin/Gradle references to the removed
class remain.
- `android/` confirmed absent from the cargo `[workspace] members` list
— the migration changes cannot affect the Rust build.
- Ran `cargo build --workspace`: **pre-existing** failures in
`esn`/`lsm` (a `rand` / `ndarray-rand` trait-bound mismatch: `no method
named random/sample found for &mut impl Rng`). These reproduce on
**pristine `main` with zero changes** and are unrelated to this PR.
`cargo test --workspace` is blocked by the same pre-existing compile
failure. This PR does not introduce or worsen them.

### TODOs / risks
- `TODO(#83 rebase)` — depends on sub-PRs #3 (scaffolding), #4
(NativeLib→Rust), #5 (Service shim), none yet merged. The
`NeurophoneService` reference and package layout are assumed from
current `main`; re-point if #4/#5 rename or relocate the service
entrypoint.
- `TODO(#83)` — once the Rust JNI boot-policy entrypoint exists,
delegate the "should we restart?" decision to
`crates/neurophone-android` instead of unconditionally starting the
service.
- Risk: pre-existing `esn`/`lsm` workspace build break is environmental
(dependency drift) and should be tracked separately; it is **not**
caused by this PR.

https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw)_

Co-authored-by: Claude <[email protected]>
hyperpolymath added a commit that referenced this pull request Jun 6, 2026
#127)

## Sub-PR #8 — AffineScript UI in the Gossamer webview

Part of the Android Kotlin→Rust/Gossamer migration (epic #83, RFC PR
#97, sub-issue #114).

Reimplements the UI currently in
`android/app/src/main/java/ai/neurophone/MainActivity.kt` +
`res/layout/activity_main.xml` as the **AffineScript** webview UI that
the Gossamer Android shell loads. The Kotlin sources are left in place;
their removal happens at migration cutover.

### Dependency note
Needs **#3** (Gossamer scaffolding / webview host) and **#4**
(NativeLib→Rust JNI) — both in parallel and **not merged**. Based off
`main`; their structure is assumed and every assumption is marked
`TODO(#83 rebase)` / `TODO(#83)`.

### Files added
All new files carry `SPDX-License-Identifier: MPL-2.0`. Under
`android/app/src/main/assets/gossamer-ui/`:

| File | Purpose |
|------|---------|
| `src/bridge.affine` | Typed bridge to the native Rust core (was
`NativeLib` JNI): `init`, `start`, `stop`, `process_sensor`, `query`,
`query_local`, `query_claude`, `get_neural_context`, `get_state`,
`reset`, `is_running`. Config ported verbatim from
`MainActivity.createConfig()`. |
| `src/ui.affine` | View/controller logic ported 1:1 from
`MainActivity`: init-on-load, Start/Stop toggle, 500 ms neural-context
poll, query + "Prefer Local" routing. |
| `index.html` | Webview entry; element ids match `ui.affine` queries. |
| `styles.css` | Visual parity with `activity_main.xml` (16dp padding,
centred header, monospace neural-context panel, spinner, etc.). |
| `deno.json` | Deno build/check/fmt tasks (no npm/Node). |
| `build.sh` | AffineScript → Deno-ESM build wiring. |
| `dist/ui.mjs` | Committed compiler-output **stub** (see below). |
| `README.adoc` | Documents bridge assumptions + TODOs. |

Plus a scoped `.gitignore` negation so the committed `dist/ui.mjs` stub
is tracked while the general `dist/` ignore stays.

### AffineScript build wiring + assumptions
- AffineScript (`.affine`) compiles to Deno-ESM via the estate
`affinescript` toolchain (OCaml/Dune CLI: `check` / `fmt` / `compile
--target deno-esm`), driven through Deno tasks: `deno task check:ui` /
`build:ui` / `fmt:ui`. `build.sh` is the single CI-ready entry point.
- **The `affinescript` compiler is not yet vendored** in this repo/CI.
So `dist/ui.mjs` is a hand-written **generated-output stub** faithfully
mirroring `src/ui.affine` + `src/bridge.affine`, keeping the webview
loadable/reviewable today. `build.sh` falls back to the committed stub
when the compiler is absent (and says so loudly). `TODO(#83)`:
vendor/pin the toolchain, flip `USE_STUB=0`, regenerate, delete the
stub, wire `deno task build:ui` into CI.
- **Bridge contract assumed** (owned by #3/#4): Gossamer injects
`globalThis.gossamer` with `invoke(cmd, args): Promise<string>`; command
names are snake_case forms of the old `NativeLib` methods; host serves
`index.html` as the webview root. All marked `TODO(#83 rebase)`.
- Sensor *acquisition* intentionally not in this UI — the foreground
Rust service (#4) registers sensors natively; `bridge.process_sensor`
stays exposed for parity.

### Verification
- `build.sh` runs clean with the stub fallback (exit 0).
- All 8 new files carry the MPL-2.0 SPDX header; `deno.json` is valid
JSON.
- **Cargo workspace:** no Rust/Cargo files touched (web assets +
`.gitignore` only). `cargo build --workspace` currently fails on `main`
in the `lsm`/`esn` crates due to a pre-existing `rand` 0.10 API drift
(`.random()`/`.sample()`), present on `origin/main` before this branch
and unaffected by these changes.

### TODOs / risks
- `TODO(#83 rebase)`: reconcile the bridge object name/call convention
and DOM-host bindings against #3/#4 once merged.
- `TODO(#83)`: vendor the AffineScript toolchain and replace the
`dist/ui.mjs` stub with real compiled output; wire into CI.
- Pre-existing `lsm`/`esn` `rand` API build failure on `main` is out of
scope for this UI PR.

### Language policy
AffineScript (primary app language) + HTML/CSS + a Deno-run Bash build
script. No TypeScript, Node, or npm. The single `.mjs` is a
compiler-output stub, not hand-authored application logic.

https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw)_

Signed-off-by: Jonathan D.A. Jewell <[email protected]>
Co-authored-by: Claude <[email protected]>
hyperpolymath added a commit that referenced this pull request Jun 6, 2026
## Sub-PR #5 — Port `NeurophoneService` (Kotlin → Java JNI shim)

Part of the Android Kotlin→Rust/Gossamer migration: epic #83, RFC PR
#97, sub-issue #111.

> **Draft / depends on unmerged work.** Sub-PR #3 (Gossamer scaffolding)
and #4 (NativeLib→Rust JNI in `crates/neurophone-android`) are being
built in parallel and are **not merged**. This PR bases off `main`,
assumes their structure, and marks integration seams `TODO(#83 rebase)`.

### What changed
- **Removed**
`android/app/src/main/java/ai/neurophone/NeurophoneService.kt` (Kotlin
foreground service that carried business logic + synthetic salience +
widget publishing).
- **Added**
`android/app/src/main/java/ai/neurophone/NeurophoneService.java` — a
minimal hand-written **Java** `Service` shim. Same class name
(`ai.neurophone.NeurophoneService`), so the existing `BootReceiver.kt`,
`widget/NeurophoneAppWidget.kt`, and the `AndroidManifest.xml`
`.NeurophoneService` entry resolve to it unchanged.

### JNI calls used (`NativeLib`, Kotlin `object` → `NativeLib.INSTANCE`)
- `onCreate()` → `NativeLib.init(null)` then `NativeLib.start()`
- `onDestroy()` → `NativeLib.stop()`
- `onSensorChanged()` → `NativeLib.processSensor(typeId, values,
timestampNs, accuracy)`

All JNI calls are wrapped in `try/catch (Throwable)` so dev hardware
without the native lib still runs (matches prior Kotlin behaviour).

### Convenience mapping replicated
Sensor type → compact id (mirrors the old `NativeLib.pushSensorEvent`
table):

| sensor | id |
|---|---|
| accelerometer | 1 |
| magnetometer | 2 |
| gyroscope | 4 |
| light | 5 |
| proximity | 8 |
| (else) | 0 |

Timestamp converted **ms → ns** (`System.currentTimeMillis() *
1_000_000L`). Accuracy defaults to `3` (`SENSOR_STATUS_ACCURACY_HIGH`).

### Kept thin (in scope)
Business logic stays in Rust. The shim keeps only the Android-owned
concerns: foreground notification + channel, partial wake lock, and
sensor registration (accelerometer only for now). Widgets / boot
receiver / UI **not** ported.

### Verification
- Diff touches **only** files under `android/` (one Java add, one Kotlin
delete). No Rust or `Cargo.*` files changed → cargo behaviour is
identical to `main`.
- `cargo build --workspace` and `cargo test --workspace` **fail on
`main` already**, in `crates/lsm` and `crates/esn` only (pre-existing
rand 0.10 API drift: `random()`/`sample()` no longer resolve). This is
unrelated to this PR and unaffected by it. The `neurophone-android`
crate is an untouched stub and compiles.

### TODOs / risks
- `TODO(#83 rebase)`: `NativeLib` JNI signatures depend on sub-PR #4
landing the Rust exports (`init`/`start`/`stop`/`processSensor`).
- `TODO(#83)`: widen sensor registration beyond accelerometer once the
Rust core consumes the full set (the id mapping already covers them).
- `TODO(#83)`: foreground notification / wake lock should migrate behind
Gossamer/Rust, shrinking or removing this shim with the rest of
`android/`.
- Risk: Java↔Kotlin-`object` interop uses `NativeLib.INSTANCE`; if #4
reimplements `NativeLib` as a Java class or changes the singleton shape,
the call sites need a trivial rebase (flagged).

https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw)_

Co-authored-by: Claude <[email protected]>
hyperpolymath added a commit that referenced this pull request Jun 6, 2026
…gacy android/ tree (#124)

## ⚠️ BLOCKED — DO NOT MERGE (gated draft)

**This is the TERMINAL, GATED step of the Android Kotlin→Rust/Gossamer
migration** (epic #83, RFC PR #97, sub-issue #115).

It is **gated on sub-PRs #3–#8** (scaffolding + all component ports),
which are **NOT done**. Deleting `android/` now removes the **only
working Android frontend**, so this PR **MUST NOT be merged until #3–#8
have landed**.

- Status: **DRAFT / BLOCKED**
- Merge only after: **#3, #4, #5, #6, #7, #8** are all merged
- After those land, **rebase this branch on `main`** so the diff removes
only what is truly legacy (the Kotlin/Gradle files), leaving the Java
shims + Rust + AffineScript UI delivered by #3–#8 in place.

> Because #3–#8 are not merged into this branch, the diff here simply
deletes the **current** `android/` tree. That is expected for this
staging draft.

---

## What was removed

The legacy Kotlin/Gradle `android/` app — **20 files**:

- **7 `*.kt`**: `BootReceiver.kt`, `MainActivity.kt`, `NativeLib.kt`,
`NeurophoneService.kt`, `widget/NeurophoneAppWidget.kt`,
`widget/NeurophoneWidgetActions.kt`,
`widget/NeurophoneWidgetConfigureActivity.kt`
- **3 `*.gradle.kts`**: `android/build.gradle.kts`,
`android/settings.gradle.kts`, `android/app/build.gradle.kts`
- Plus `gradle.properties`, `AndroidManifest.xml`, and the `res/` XML
(drawables, layouts, values, widget info).

After migration these are replaced by the Java shims under `android/` +
Rust (`crates/`) + AffineScript UI from #3–#8.

## Carve-out removal (now stale)

The `android/**` banned-language carve-out existed in **three mirrored
locations**, all justified only while banned Kotlin lived in `android/`.
With the tree gone they are stale and a stale-baseline detector would
otherwise warn, so all three are removed:

1. **`.hypatia-baseline.json`** — the glob `file_pattern: "android/**"`
entry removed; file is now an empty array `[]` (it was the only entry).
*(A pure-JSON array schema cannot carry an SPDX comment without breaking
the schema the detector reads; the original file had no SPDX header
either.)*
2. **`.hypatia-ignore`** — the per-file
`cicd_rules/banned_language_file:android/...` lines removed (these
mirrored the canonical glob).
3. **`.github/workflows/language-policy.yml`** — the `android/` prune in
the *Check for Java/Kotlin files* step removed; the check is now an
unconditional scan.

## Expected end state

With the legacy tree gone and no carve-out:

- ✅ **`Check for Banned Languages`** — green, no exemption needed.
- ✅ **`governance / Language / package anti-pattern policy`** — green,
no exemption needed.

## Verification

- **Rust workspace unaffected.** The `android/` Gradle tree is **not** a
cargo member — `cargo metadata` resolves cleanly and references the
`android/` tree **0 times**. The Rust JNI crate
`crates/neurophone-android` is a separate workspace member and is
**untouched**.
- **Pre-existing build failure (NOT caused by this PR).** `cargo build
--workspace` / `cargo test --workspace` currently fail to compile in
`crates/esn` and `crates/lsm` due to a `rand`-crate API breakage
(`.random()` / `.sample()` no longer resolve under the locked `rand`
version). This failure reproduces on **pristine `main` with `android/`
still present** (verified by building `-p esn` on `origin/main`), so it
is **entirely independent** of this deletion. This PR neither introduces
nor fixes that failure and does not touch `Cargo.lock`.

## Out of scope (noted)

Narrative docs (`EXPLAINME.adoc`, `TESTING-REPORT.adoc`,
`docs/BT-PRESENCE-PLAN.adoc`) still mention the old `android/app/...`
Kotlin paths. They are non-build prose describing the legacy app and are
intentionally left for the migration-docs update accompanying #3–#8;
nothing in the build/CI consumes them.

---

PART OF: epic #83 · RFC PR #97 · sub-issue #115

https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw)_

Co-authored-by: Claude <[email protected]>
hyperpolymath added a commit that referenced this pull request Jun 7, 2026
…activity (#83) (#128)

## Sub-PR #7 — port the widget triple

Part of the Android Kotlin→Rust/Gossamer migration (epic #83, RFC PR
#97, sub-issue #113).

Replaces the home-screen widget Kotlin with thin hand-written **Java**
shims that JNI into the Rust core (`crates/neurophone-android`) via
`NativeLib.getState()` / `NativeLib.query(...)`. The widget is now
**stateless**: every render reads live `salience` / `description`
straight from the Rust core instead of caching in SharedPreferences.

### Files changed
**Ported (Kotlin → Java):**
- `NeurophoneAppWidget.kt` → `NeurophoneAppWidget.java` —
`AppWidgetProvider` shim. Reads core state via `NativeLib.getState()`
(JSON, parsed defensively) and `isRunning()`; toggle/refresh/ask actions
preserved. Adds `public static requestRefresh(Context)` for non-widget
callers.
- `NeurophoneWidgetActions.kt` → `NeurophoneWidgetActions.java` —
`BroadcastReceiver` shim. The old `PUBLISH_STATE` (extras +
SharedPreferences) path is gone; receiver now does `FORCE_REFRESH`
(re-render from core) and `ACTION_QUERY` (one-shot
`NativeLib.query(...)` then refresh).

**Dropped (owner decision):**
- `NeurophoneWidgetConfigureActivity.kt` — **deleted, not ported.** It
had **no manifest `<activity>` entry**; its only registration was
`android:configure=...` in `res/xml/neurophone_widget_info.xml`, now
removed along with
`android:widgetFeatures="reconfigurable|configuration_optional"` and the
`widget_configure_*` strings. **The widget works with no configure
step.**

**Knock-on edits (Kotlin callers of the removed widget API, kept
compiling):**
- `NeurophoneService.kt` — `publishState(...)` call sites →
`requestRefresh(...)` (core is now source of truth).
- `BootReceiver.kt` — dropped the removed
`NeurophoneAppWidget.prefs/KEY_RUNNING` read (a core concern now);
conservatively no-ops on boot pending a core-persisted autostart flag.
- `AndroidManifest.xml`, `neurophone_widget_info.xml`, `strings.xml` —
configure-activity removal + explanatory comments.

### Dropped configure-activity note
`NeurophoneWidgetConfigureActivity` is intentionally **not** ported per
owner decision. No manifest registration existed to remove; the
`android:configure` hook in the widget-info XML was the sole binding and
has been removed. The single optional question it asked (`local_only`)
is left for the core/UI to own post-migration.

### What I verified
- All new Java files carry `SPDX-License-Identifier: MPL-2.0`;
hand-written Java is permitted **only under `android/`** via the
existing `.hypatia-baseline.json` `android/**` carve-out.
- No live code references any removed symbol (`publishState`, `prefs`,
`KEY_RUNNING`, `NeurophoneWidgetConfigureActivity`, `KEY_LOCAL_ONLY`) —
remaining hits are comments/docstrings only.
- All referenced widget layout IDs (`widget_state`, `widget_salience`,
`widget_salience_value`, `widget_toggle`, `widget_refresh`,
`widget_query`) exist in `widget_neurophone.xml`.
- XML well-formedness checked for the manifest, widget-info, and
strings.
- **Rust workspace:** `cargo build --workspace` / `cargo test
--workspace` currently **fail on a pre-existing breakage in `esn` and
`lsm`** (a `rand` / `ndarray-rand` API mismatch: `no method named
random/sample`, `impl Rng: ndarray_rand::rand::Rng` unsatisfied).
**Reproduced on a clean `origin/main` with all PR changes stashed**, so
it is not introduced here. This PR touches **no Rust** (android-only
diff) and does not regress the workspace. `neurophone-android` itself
only fails transitively through `esn`/`lsm`.

### TODOs / risks
- `TODO(#83 rebase)` markers flag the seams that depend on parallel
sub-PRs **#3/#4/#5** (not yet merged):
- `NativeLib` is still the pre-migration Kotlin `object`, so the Java
shims use `NativeLib.INSTANCE.…`; drop `.INSTANCE` if #3/#4/#5 republish
it as a Java facade.
- The `getState()` JSON schema (`salience`, `description` keys) is the
agreed contract but should be confirmed/tightened on rebase. JNI calls
are wrapped in `try { } catch (Throwable)` so the widget never crashes
the launcher against the current stub crate (`UnsatisfiedLinkError`).
- `BootReceiver` autostart and the service's per-tick salience push need
the core-side persisted run/state APIs from #3/#4/#5.

### Open questions
- Should the dropped configure activity's `local_only` preference be
re-surfaced somewhere (settings screen / core config), or is it gone for
good?
- Confirm the final `NativeLib` shape (Kotlin `object` vs Java facade)
so the `.INSTANCE` interop can be cleaned up on rebase.

> Marked **DRAFT**: depends on parallel sub-PRs #3/#4/#5 (base off
`main`, structure assumed, `TODO(#83 rebase)` markers).

https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw)_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant