feat(spacing): defer grace-mode space via PHANTOM, behind a flag (#23)#86
Merged
Conversation
Phase 1 of the spacing-policy epic (#14). Today the default gesture path defers its autospace via SpaceState.PHANTOM (materialized on next input, adapts to connectors/URLs/punctuation, backspace-reversible) but the two-thumb combining-grace path writes the space EAGERLY in onCombiningGraceExpired. This unifies them. New experimental, default-OFF pref PREF_SPACING_DEFER_GRACE_SPACE. When on, the grace commit arms PHANTOM instead of the eager insertAutomaticSpaceIfOptionsAndTextAllow + mAutospaceJustWritten + the mLastComposedWord separator patch; the existing PHANTOM consumers materialize/suppress the space on next input. The downstream cursor/undo accounting already handles autospaceInserted=false, so it's unchanged. Default-off keeps the ~8 existing eager grace tests valid (no contract rewrite needed); adds two deferred-path tests (materialize-on-next-input, backspace-reversible). Verify: InputLogicTest + SettingsContainerTest -> 115 completed, 3 failed (pre-existing baseline), 1 skipped; 0 new failures. Feel is on-device: gated behind the flag for playtesting per the roadmap's feel-driven rule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1 of the spacing-policy epic (#14) — see
docs/SPACING_POLICY.md(#85). Implements #23.What
Unifies the two space mechanisms. The default gesture path already defers its autospace via
SpaceState.PHANTOM(materialized on next input — adapts to connectors/URLs/punctuation, backspace-reversible). The two-thumb combining-grace path instead writes the space eagerly inonCombiningGraceExpired. This routes the grace commit through PHANTOM too.New experimental, default-OFF pref
PREF_SPACING_DEFER_GRACE_SPACE. When on:mSpaceState = PHANTOMinstead of the eagerinsertAutomaticSpaceIfOptionsAndTextAllow+mAutospaceJustWritten+ themLastComposedWordseparator patch;handleNonSeparatorEvent/handleSeparatorEvent) materialize/suppress the space on next input — so the gating (autospace-enabled, URL/email, punctuation) is applied at materialization, identical to the default path.The downstream cursor/undo accounting already handles
autospaceInserted = false, so it's unchanged.Why default-off (and no test rewrite)
The issue's scoping note assumed an unconditional change that breaks ~8 eager grace tests. Gating behind the flag keeps the eager path as default, so those tests stay valid unchanged; I add two deferred-path tests instead. This also satisfies the roadmap's "build it behind the experimental tuning so it can be felt" guidance.
Verification
InputLogicTest+SettingsContainerTest→ 115 completed, 3 failed (the AGENTS.md pre-existing baseline), 1 skipped — 0 new failures. New testsdeferredGraceSpaceMaterializesOnNextInputanddeferredGraceCommitIsBackspaceReversiblepass; existing eager grace tests preserved..dbgtestAPK; toggle Two-thumb settings → "Defer grace space (experimental)" on and feel the grace-commit spacing (it should match the default swipe-path feel, with the space appearing on your next input instead of immediately). Gated on your playtest before merge — feel-critical per the spec.Next phases: #26 (tuning panel + A11 insight) → #24 (signal-driven grace + two-gate Assisted) → #25 (adaptive cadence).