Skip to content

A3d: Native gesture-recognition replay harness + run native tests in CI #78

Description

@AsafMah

Part of #13. The gap #22 does not cover.

Problem

All automated tests are JVM/Robolectric and tap-based. The real swipe→word recognition runs in the native C++ engine (app/src/main/jni/), which JVM/Robolectric tests cannot exercise. So gesture recognition has zero automated coverage — only on-device manual testing catches a recognition regression (e.g. a scoring/geometry change that makes swiping produce the wrong word). This is the long-standing coverage gap noted in AGENTS.md / IMPROVEMENT_PLAN.md.

What already exists (so this is tractable)

  • A native C++ gtest harness is already in the repo, just not run in CI: app/src/main/jni/tests/** (dictionary / suggest-core / dicnode / geometry tests), run-tests.sh, HostUnitTests.mk (host build — runs in CI with no device/emulator), TargetUnitTests.mk. None of the existing tests cover gesture recognition.
  • TraceRecorder (A3a: Pointer-trace recorder & capture format #20) already captures replay-ready golden fixtures. Per trace: pointers = flattened InputPointers (xCoordinates / yCoordinates / pointerIds / times), keyboard = {width=mOccupiedWidth, height=mOccupiedHeight, layout, locale}, committedWord = the recognized word. i.e. the swipe + its expected output.

Deliverables

  • Run the existing native host unit suite in CI. Wire run-tests.sh / HostUnitTests.mk (host build) into a CI job. Instant coverage of the dictionary/suggest/geometry engine the JVM can't reach. (Low effort, high value — the tests already exist and pass.)
  • Native gesture-replay test. A new C++ test (under app/src/main/jni/tests/suggest/) that: loads recorded trace fixtures (a small committed corpus of TraceRecorder JSON), reconstructs the proximity/keyboard geometry, feeds the InputPointers through the gesture/glide scorer, and asserts the top suggestion == recorded committedWord (or within top-N). Deterministic, no device.
  • Commit a seed fixture corpus — a handful of recorded traces for common words across the default layout (recorded via the A3a: Pointer-trace recorder & capture format #20 recorder on-device, sanitized), as test resources.

Acceptance

  • CI runs the native host test suite and fails on a real native regression.
  • The gesture-replay test catches a deliberate recognizer break (sanity: perturb scoring → test goes red).
  • Adding a new golden trace is a drop-in (copy a recorder JSON into the fixtures dir).

Notes / open questions

  • Confirm the gesture scorer is reachable from a host build (some native paths are target/NDK-only). If the host build can't link the gesture path, fall back to a TargetUnitTests.mk (emulator) job for the replay test only, keeping the rest host-side.
  • Keep the fixture corpus small + curated; this is a regression net, not a benchmark.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions