Skip to content

feat(spacing/a11): live spacing-policy signal readout overlay (#26)#95

Closed
AsafMah wants to merge 4 commits into
devfrom
feat/spacing-a11-insight
Closed

feat(spacing/a11): live spacing-policy signal readout overlay (#26)#95
AsafMah wants to merge 4 commits into
devfrom
feat/spacing-a11-insight

Conversation

@AsafMah

@AsafMah AsafMah commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #93 (feat/spacing-signal-grace). Visual diagnostic only.

What

Adds SpacingInsightDrawingPreview, a small fixed-position HUD on the same drawing-preview surface as the gesture debug points overlay. It snapshots one line whenever combining mode arms:

spacing | c:Y  px:72%  g:380ms  [timer]
  • c — complete (Y/N): typed stem is a dictionary word
  • px — prefix-rich score (0–100%)
  • g — resolved graceMs after signal-driven adjustment
  • gate — currently timer for the single-timer model; exposes GATE_TIMER/GATE_NONE and accepts nullable strings so feat(spacing): tested two-gate Assisted decision model (#24) #94 / the gate branch can plug in INSTANT/PAUSE without coupling.

Gating

Co-gated behind the existing experimental Draw gesture debug points setting (PREF_GESTURE_DEBUG_DRAW_POINTS). No new setting.

Performance

The display string is built once per combining-mode arm, not per draw frame. drawPreview() is allocation-free. With the debug setting off, setSpacingInsight() returns immediately after the boolean check.

Verification

Subagent verified :app:compileStandardDebugJavaWithJavac — clean, no errors/warnings introduced.

On-device

Enable Settings → Experimental → Draw gesture debug points, then type/gesture with the grace timer on. The HUD appears at bottom-left of the keyboard area and should let us tune #93's Finished-word speed-up / Extendable-stem patience live.

AsafMah added 3 commits June 11, 2026 09:21
Phase 2 of the spacing-policy epic (#14). The combining grace-timer duration
now adapts to the #92 word-state signals instead of a fixed value:

  graceMs = clamp(base - completeBonus*complete + prefixPenalty*prefixRichScore,
                  100, 3000)

A finished dictionary word commits sooner; an extendable prefix-rich stem waits
longer. Wired into enterCombiningMode behind the default-off experimental flag
PREF_SPACING_SIGNAL_DRIVEN_GRACE; the formula is a pure static helper
(signalDrivenGraceMs) for testability.

Live tuning knobs (#26), all experimental on the Two-thumb screen:
- PREF_SPACING_SIGNAL_DRIVEN_GRACE (toggle, default off)
- PREF_SPACING_COMPLETE_BONUS_MS (slider, default 200)
- PREF_SPACING_PREFIX_PENALTY_MS (slider, default 400)
base = the existing PREF_COMBINING_GRACE_MS; min/max clamp hardcoded.

Verify: SpacingSignalsTest (+6 graceMs cases) / SettingsContainerTest /
InputLogicTest -> 128 completed, 3 failed (pre-existing baseline), 1 skipped;
0 new failures. Feel/tuning is on-device.
Add SpacingInsightDrawingPreview — a debug HUD drawn on the
DrawingPreviewPlacerView that shows the per-keystroke spacing-policy
signals at combining-mode arm time:

  spacing | c:Y  px:72%  g:380ms  [timer]

Fields:
  c    – complete (Y/N): typed stem is a dictionary word
  px   – prefix-rich score (0-100%): fraction of suggestions that are
         completions of the current stem
  g    – resolved graceMs after signal-driven adjustment
  gate – active commit gate; "timer" for the current single-timer model;
         reserved for the two-gate branch (see updateGate() integration hook)

Gating: co-gated behind PREF_GESTURE_DEBUG_DRAW_POINTS (the existing
gesture debug setting).  No new preference.

Integration points:
  DrawingProxy.setSpacingInsight(complete, prefixRichScore, graceMs, gate)
    – called from InputLogic.enterCombiningMode on each arm, and cleared
      on cancelCombiningMode / onCombiningGraceExpired.
  SpacingInsightDrawingPreview.updateGate(gate)
    – gate branch calls this once its gate decision is made to re-stamp
      the gate label without resetting the signal snapshot.

Hot-path: string is built once per keystroke commit (not per frame);
drawPreview() is allocation-free.  Enabled flag check short-circuits both
paths when the debug toggle is off.
The first spacing HUD exposed raw telemetry (c/px/g), which was hard to read
while typing and disappeared too quickly. Make it practical:
- decision-first labels: FAST / WAIT / TIMER / INSTANT
- detail line explains finished-word vs many-continuations
- linger briefly after commit/cancel so the user can read it
- inset/two-line box to avoid clipping

Add docs/SPACING_TEST_PLAN.md with concrete playtest scenarios for complete
words, extendable stems, Adapt on/off, shortcuts, corrections, and punctuation.

Verification: :app:compileStandardDebugJavaWithJavac -> BUILD SUCCESSFUL.
@AsafMah

AsafMah commented Jun 11, 2026

Copy link
Copy Markdown
Owner Author

Updated after on-device feedback: HUD is now decision-first (FAST/WAIT/TIMER/INSTANT), two-line/inset to avoid clipping, and lingers briefly after commit/cancel. Added docs/SPACING_TEST_PLAN.md with practical playtest scenarios.

The first playtest plan mixed input modality with timing behavior. Rewrite it
around the actual axes: auto-finish vs auto-space, tap-only vs swipe vs
tap-then-swipe, and which timing settings affect each path.

Adds timing presets, explicit path matrix, and practical tests for tap-only
safety, swiped complete words, swiped stems, tap-then-swipe extension,
Adapt on/off, corrections, and deferred punctuation.

Verification: :app:compileStandardDebugJavaWithJavac -> BUILD SUCCESSFUL.
@lurebat

lurebat commented Jun 11, 2026

Copy link
Copy Markdown

Updated again: it now explicitly separates tap-only / swipe / tap-then-swipe paths from auto-finish vs auto-space timing, with a settings matrix and clearer practical tests.

@AsafMah

AsafMah commented Jun 11, 2026

Copy link
Copy Markdown
Owner Author

Updated docs/SPACING_TEST_PLAN.md again: it now explicitly separates tap-only / swipe / tap-then-swipe paths from auto-finish vs auto-space timing, with a settings matrix and clearer practical tests.

@AsafMah

AsafMah commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

Parking the HUD code with #93/#94. The updated playtest doc is useful and will be split into its own docs-only PR, but the HUD is only valuable if we continue with signal/gate tuning. Without a concrete behavior to tune, it is debug noise.

Keeping the doc, dropping the visual overlay for now.

@AsafMah AsafMah closed this Jun 12, 2026
@AsafMah AsafMah deleted the feat/spacing-a11-insight branch June 12, 2026 16:37
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.

2 participants