Skip to content

Add production Memory Editor search engine - #113

Closed
H3nb wants to merge 2 commits into
alphafrom
codex/memory-editor-engine
Closed

Add production Memory Editor search engine#113
H3nb wants to merge 2 commits into
alphafrom
codex/memory-editor-engine

Conversation

@H3nb

@H3nb H3nb commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

First of two PRs for the production Memory Editor described in H3nb/JL-Mod-Plus#108.

  • add one authoritative :memory_engine service and one remote read-only native scan core;
  • keep target-local /proc/self/maps + mincore() collection in a thin non-exported :midlet bridge;
  • scope every command to a process-local runtime generation token and clear state immediately when that generation ends;
  • verify real process_vm_readv() access with an 8-byte target-owned capability probe before reporting support;
  • support known searches (=, !=, >, <, >=, <=, Between), Unknown snapshots, all requested primitive types including Auto, relative/delta predicates, previous-vs-initial comparison, bounded history/Undo, cancellation, pagination, and engine-owned CandidateIds;
  • keep operations transactional: truncated ranges, partial reads, cancellation, OOM, and candidate/snapshot budget overflow never publish a partial result.

The implementation is intentionally direct: primitive AIDL buffers, a single worker, flat native stores, and immutable committed states. It adds no DI framework, database, shared-memory layer, local scanner fallback, or product UI.

Safety and containment

  • both services are non-exported;
  • no arbitrary PID API and no write path in this PR;
  • PID alone is never accepted as identity;
  • dynamic target page size and checked uintptr_t arithmetic are used;
  • incomplete resident-run collection fails closed;
  • valid zero-match refinements commit an empty result;
  • queued and in-flight cancellation preserve the last committed state;
  • Java integer delta magnitude is overflow-safe through the full 64-bit domain, including Long.MIN_VALUE to Long.MAX_VALUE;
  • native state lives outside the MIDlet ART heap and is cleared on target death/generation end.

Validation

Passed locally:

  • cppcheck --enable=warning,performance,portability --std=c++17 ... app/src/main/cpp/memory
  • :app:lintEmulatorDebug
  • :app:testEmulatorDebugUnitTest
  • :dexlib:testDebugUnitTest
  • :app:assembleEmulatorDebug
  • :app:assembleEmulatorDebugAndroidTest
  • :app:assembleEmulatorRelease
  • release NDK compilation for arm64-v8a, armeabi-v7a, x86, and x86_64
  • R8 mapping verification that both JNI class names survive shrinking
  • universal release APK verification that libjlmem.so and libjlmem_target.so are packaged for all four ABIs

The Android instrumentation probe is compiled but not executed yet because no ADB device is connected. Physical Android 16 validation with Green Farm, Bounce, and additional corpus samples remains a merge/stable gate.

Deliberately deferred to PR 2

  • translucent runtime overlay and Back-menu entry;
  • grouped Auto aliases, live visible refresh, selection/remove/keep/copy flows;
  • identity context and bounded relocation recovery;
  • guarded single/bounded multi-edit with readback;
  • Watch and safe Freeze state machines;
  • Advanced Group Search;
  • Phosphor vectors/attribution, English/Indonesian strings, responsive/accessibility work;
  • physical-device benchmarks and acceptance documentation.

Audit recommendations for PR 2

  1. Benchmark the provisional 1,000,000-candidate, 96 MiB Unknown snapshot, and 192 MiB history budgets before making them public defaults.
  2. Add deterministic native value-codec/predicate boundary coverage without carrying production self-test plumbing.
  3. Keep visible live refresh conservative and measured before introducing shared memory; primitive Binder pages are sufficient until profiling proves otherwise.
  4. Harden the existing immediate EventQueue path so a future overlay callback can never run guest work on Android's main thread.
  5. Treat relocation as context-aware recovery only; never promote a fresh exact-search pool into the result set by itself.

@H3nb H3nb closed this Aug 29, 2026
@H3nb
H3nb deleted the codex/memory-editor-engine branch August 29, 2026 22:57
@H3nb

H3nb commented Aug 29, 2026

Copy link
Copy Markdown
Owner Author

Superseded by PR 115 after the requested branch rename to feature/memory-editor-engine.

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