Skip to content

test(native): host-constructible ProximityInfo for replay harness (#78)#104

Merged
AsafMah merged 1 commit into
devfrom
feat/native-replay-proof
Jun 13, 2026
Merged

test(native): host-constructible ProximityInfo for replay harness (#78)#104
AsafMah merged 1 commit into
devfrom
feat/native-replay-proof

Conversation

@AsafMah

@AsafMah AsafMah commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Follow-up proof spike after #96.

What

Adds a non-JNI ProximityInfo constructor that accepts the same keyboard geometry as raw int/float arrays, so native host tests can build keyboard geometry without a live JVM/JNIEnv.

Adds GestureReplayHostSeamTest.BuildsProximityInfoWithoutJNI: constructs a minimal QWERTY ProximityInfo and verifies key lookup for the hello trace (h/e/l/o present, # absent). This removes the earlier JNI blocker from the replay path.

What the spike proved

Real remaining blocker

I attempted to enable GestureReplayTest.ReplayHelloQwerty with a tiny in-memory dictionary. ASAN showed the crash is not the dictionary asset anymore — it's more fundamental:

Dictionary::getSuggestions(..., IS_GESTURE) constructs Suggest with GestureSuggestPolicyFactory::getGestureSuggestPolicy(), but this repo contains only gesture_suggest_policy_factory.cpp (a nullable hook) and no gesture suggest policy implementation. In host builds the factory returns nullptr, so Suggest::getSuggestions crashes at TRAVERSAL->getMaxSpatialDistance().

That means a real replay assertion requires an open/host-buildable GestureSuggestPolicy implementation (e.g. the future NLnet recognizer) or a test policy with the same interface. No fake green added; the replay assertion remains disabled and the code documents the blocker.

Verification

WSL / ubuntu-like native host run:
ctest --test-dir /tmp/lt-replay-proof --output-on-failure -E 'FormatUtilsTest\\.TestDetectFormatVersion'

Result: 77/77 enabled tests pass, 1 disabled (GestureReplayTest.ReplayHelloQwerty).

#78)

Follow-up proof spike after #96. Add a non-JNI ProximityInfo constructor that
accepts the same keyboard geometry as raw int/float arrays, so native host tests
can build a keyboard geometry object without a live JVM/JNIEnv.

Adds GestureReplayHostSeamTest.BuildsProximityInfoWithoutJNI: constructs a
minimal QWERTY ProximityInfo and verifies key lookup for the 'hello' trace.

Attempted to enable the full replay assertion with an in-memory dict; ASAN showed
the next blocker is more fundamental than a dict asset: the open-source tree has
no GestureSuggestPolicy implementation, only GestureSuggestPolicyFactory, whose
factory method is null in host builds. Dictionary::getSuggestions(...,
IS_GESTURE) therefore crashes at TRAVERSAL->getMaxSpatialDistance(). The disabled
replay scaffold now documents that real blocker.

Verification (WSL / ubuntu-like): native host ctest excluding the known
FormatUtils quarantine -> 77/77 enabled tests pass, 1 disabled replay assertion.
@AsafMah AsafMah merged commit 8e7621e into dev Jun 13, 2026
2 checks passed
@AsafMah AsafMah deleted the feat/native-replay-proof branch June 13, 2026 14:48
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