Skip to content

feat(spacing): per-keystroke spacing-policy signals (#24 foundation)#92

Merged
AsafMah merged 1 commit into
devfrom
feat/spacing-signals
Jun 11, 2026
Merged

feat(spacing): per-keystroke spacing-policy signals (#24 foundation)#92
AsafMah merged 1 commit into
devfrom
feat/spacing-signals

Conversation

@AsafMah

@AsafMah AsafMah commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Phase 2 foundation of the spacing-policy epic (#14), per docs/SPACING_POLICY.md. Start of #24.

What

Computes the two free per-keystroke signals from the existing mSuggestedWords (zero extra native calls), in a pure static helper so it's unit-testable without a live InputLogic:

  • complete = the typed word is a real dictionary word (mTypedWordValid and source != user_typed)
  • prefixRichScore = fraction of candidates that are KIND_COMPLETION, in [0..1] (high = lots left to extend to → keep open; low = little left → safe to commit)

computeSpacingSignals(SuggestedWords) → SpacingSignals, wired into setSuggestedWords to store mSpacingComplete / mSpacingPrefixRichScore.

No behavior change yet

This just lays the signal layer. The signal-driven graceMs + the two-gate Assisted tier + the A11 insight readout consume mSpacingComplete/mSpacingPrefixRichScore in the next increments (still all behind the experimental flag / default-off). The two fields are intentionally write-only for now.

Verification

New SpacingSignalsTest — 6 cases (complete for real-dict, not for user-typed, not for invalid; the prefix-rich fraction; empty input). All green. No other behavior touched.

Phase 2 of the spacing-policy epic (#14), per docs/SPACING_POLICY.md. Computes
the two free signals from the existing suggestion results every keystroke (zero
extra native calls), in a pure static helper for testability:

- complete       = typed word is a real dictionary word (mTypedWordValid AND
                   source != user_typed)
- prefixRichScore = fraction of candidates that are KIND_COMPLETION, [0..1]

computeSpacingSignals(SuggestedWords) -> SpacingSignals; wired into
setSuggestedWords to store mSpacingComplete / mSpacingPrefixRichScore. No
behavior change yet — the signal-driven graceMs + two-gate Assisted tier (and
the A11 insight readout) consume these next.

SpacingSignalsTest: 6 cases (complete for real-dict / not for user-typed /
not for invalid; prefix-rich fraction; empty). All green.
@AsafMah AsafMah merged commit 1d82631 into dev Jun 11, 2026
1 check passed
@AsafMah AsafMah deleted the feat/spacing-signals branch June 11, 2026 06:02
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