Commit d8c4f3b
committed
fix(websocket): three-level fallback for keystroke_timings extraction
Iter 58 — the user reported the dashboard's 'Typing rhythm' tile
still reading 0 ms after iter 41 + restart, even though composition
cadence (1.29 s avg) was being recorded correctly on the same turn.
Root cause: the iter 41 fix correctly routed JS-format ``iki_ms``
into the keystroke_buffer, but the buffer's first sampled keystroke
event always has ``iki_ms = 0`` (no preceding keystroke). When a
short message produced exactly ONE keystroke event (every 3rd
keystroke is sampled — so a 3-key message lands on event #3 with
keyTimings.length=2 → iki_ms is the gap between #2 and #3, OK; but
when the very first sampled event is the only one, the buffer has
[0]). The pre-fix server passed ``[0]`` straight to
``Pipeline._iki_stats``, which filtered the zero out and returned
mean=0 — even though composition_metrics.keystroke_timings had real
data right there.
Three-level fallback:
1. server-side keystroke_buffer (filter to non-zero entries)
2. composition_metrics.keystroke_timings array
3. composition_metrics.mean_iki scalar (last resort: synthesize a
single timing from the JS-precomputed mean)
The dashboard's 'Typing rhythm' tile now never reads 0 ms when the
JS client has any meaningful inter-key data — even on edge-case
messages where the per-event sampler captured only zero-IKI entries.1 parent f98c2db commit d8c4f3b
1 file changed
Lines changed: 37 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
808 | 844 | | |
809 | 845 | | |
810 | 846 | | |
| |||
813 | 849 | | |
814 | 850 | | |
815 | 851 | | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
| 852 | + | |
835 | 853 | | |
836 | 854 | | |
837 | 855 | | |
| |||
0 commit comments