Commit ed326a0
committed
M7 Phase 1: thread %field_vals as a per-call lexical
Turn do_form's `local %field_vals` into an explicit per-call lexical
`my $field_vals = {}` and pass it into the nested load_persistent() as a
parameter, replacing the dynamic-scope dependency. Six sites, all inside
do_form.
Design note carried forward to Phases 2-3: %field_vals is per-call
recursion state, so it becomes a per-call lexical, NOT a key on the single
startup $ctx -- a shared $ctx->{field_vals} reset per call would clobber a
parent screen when forms nest, whereas the lexical preserves the old
`local` save/restore exactly. The startup $ctx stays for genuinely shared
state (cfg/process); per-screen state lives in per-call containers.
load_persistent taking the map explicitly sidesteps the named-sub closure
trap (a named inner sub binds the first call's lexical, not each call's).
Inventory correction: only load_persistent read %field_vals, not
sync_fields_val/save_persistent as the plan assumed.
Coverage gap closed: the gate the plan named did not exist -- the pty
tests only navigate default/empty fields. Added t/19-form-init.t, which
drives a form whose `init { command:... }` pre-fills a field and asserts
the value renders, exercising the field_vals write/read sites this phase
changed. Full suite now 309 tests; all four CI checks pass locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c30e54e commit ed326a0
4 files changed
Lines changed: 96 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
209 | | - | |
210 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2651 | 2651 | | |
2652 | 2652 | | |
2653 | 2653 | | |
2654 | | - | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
2655 | 2659 | | |
2656 | 2660 | | |
2657 | 2661 | | |
| |||
2855 | 2859 | | |
2856 | 2860 | | |
2857 | 2861 | | |
| 2862 | + | |
2858 | 2863 | | |
2859 | 2864 | | |
2860 | 2865 | | |
| |||
2876 | 2881 | | |
2877 | 2882 | | |
2878 | 2883 | | |
2879 | | - | |
| 2884 | + | |
2880 | 2885 | | |
2881 | 2886 | | |
2882 | 2887 | | |
| |||
2916 | 2921 | | |
2917 | 2922 | | |
2918 | 2923 | | |
2919 | | - | |
| 2924 | + | |
2920 | 2925 | | |
2921 | 2926 | | |
2922 | 2927 | | |
| |||
2963 | 2968 | | |
2964 | 2969 | | |
2965 | 2970 | | |
2966 | | - | |
| 2971 | + | |
2967 | 2972 | | |
2968 | 2973 | | |
2969 | 2974 | | |
| |||
2979 | 2984 | | |
2980 | 2985 | | |
2981 | 2986 | | |
2982 | | - | |
| 2987 | + | |
2983 | 2988 | | |
2984 | 2989 | | |
2985 | 2990 | | |
| |||
3012 | 3017 | | |
3013 | 3018 | | |
3014 | 3019 | | |
3015 | | - | |
| 3020 | + | |
| 3021 | + | |
3016 | 3022 | | |
3017 | 3023 | | |
3018 | 3024 | | |
| |||
3026 | 3032 | | |
3027 | 3033 | | |
3028 | 3034 | | |
3029 | | - | |
| 3035 | + | |
3030 | 3036 | | |
3031 | 3037 | | |
3032 | 3038 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
0 commit comments